mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
Revert "um: ubd: Set device serial attribute from cmdline"
This reverts commit ef3ba87cb7.
kernel_test build is broken by this change:
<5>Kernel command line: mem=512M ubdar=/home/paullawrence/code/kernels/common/kernel/tests/net/test/net_test.rootfs.20150203 con=null,fd:1 ro panic=1 init=/sbin/net_test.sh net_test_args="" net_test_mode=builder random.trust_cpu=on entropy=sPiFf7S2QnyBKuFrKmhuG9T441Gxu0E6taYRZ6cz0dNVup/2u7RHlr0BhlH+zn60 net_test=/host/home/paullawrence/code/kernels/common/kernel/tests/net/test/all_tests.sh net_test_exitcode=/proc/exitcode root=98:0
<4>
<4>Modules linked in:
<6>Pid: 0, comm: swapper Not tainted 5.11.0-rc4-02525-g902943e0329c
<6>RIP: 0033:[<0000000060032853>]
<6>RSP: 00000000605f3db0 EFLAGS: 00010246
<6>RAX: 0000000000000000 RBX: 0000000000000000 RCX: 000000006054efd3
<6>RDX: 0000000000000000 RSI: 000000006054efd0 RDI: 00000000605f3dd8
<6>RBP: 00000000605f3e10 R08: 0000000000000000 R09: 000000000000002c
<6>R10: 0000000081756c64 R11: 0000000000000000 R12: 0000000000000000
<6>R13: 00000000605e0981 R14: 00000000605f3e20 R15: 00000000605fbab8
<0>Kernel panic - not syncing: Segfault with no mm
<4>CPU: 0 PID: 0 Comm: swapper Not tainted 5.11.0-rc4-02525-g902943e0329c #1
<4>Stack:
<4> 00000000 00000000 00000000 605fba90
<4> 81756c0f 00000000 60618d78 81756c0c
<4> 81756c0c 605e09d8 600601e4 81756c09
<4>Call Trace:
<4> [<600601e4>] ? parameqn+0x0/0x41
<4> [<60031e98>] ubd_setup+0x1b/0x4c
<4> [<60031e7d>] ? ubd_setup+0x0/0x4c
<4> [<60001dda>] obsolete_checksetup+0x82/0xc2
<4> [<60001d58>] ? obsolete_checksetup+0x0/0xc2
<4> [<60001888>] ? unknown_bootoption+0x0/0x168
<4> [<600018cc>] unknown_bootoption+0x44/0x168
<4> [<60001888>] ? unknown_bootoption+0x0/0x168
<4> [<60060225>] ? parameq+0x0/0x66
<4> [<60060382>] parse_args+0xf7/0x2af
<4> [<6006028b>] ? parse_args+0x0/0x2af
<4> [<6007d60e>] ? printk+0x0/0x7f
<4> [<60039e20>] ? block_signals+0x0/0x13
<4> [<60001459>] start_kernel+0x182/0x4de
<4> [<60001888>] ? unknown_bootoption+0x0/0x168
<4> [<60003aae>] start_kernel_proc+0x49/0x51
<4> [<60025a3d>] new_thread_handler+0x81/0xae
<4> [<60028981>] uml_finishsetup+0x54/0x59
/home/paullawrence/code/kernels/common/build/../kernel/tests/net/test/run_net_test.sh: line 431: 1137943 Aborted $KERNEL_BINARY umid=net_test mem=512M $blockdevice=$ROOTFS $netconfig $consolemode $cmdline 1>&2
Returning exit code 134.
Bug: 177651696
Test: Local build of kernel_test fails with the original change,
succeeds when the change is reverted
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I15b274ee83b3bf8c53a3ff79e73f0864014e8034
This commit is contained in:
@@ -155,7 +155,6 @@ struct ubd {
|
||||
/* name (and fd, below) of the file opened for writing, either the
|
||||
* backing or the cow file. */
|
||||
char *file;
|
||||
char *serial;
|
||||
int count;
|
||||
int fd;
|
||||
__u64 size;
|
||||
@@ -181,7 +180,6 @@ struct ubd {
|
||||
|
||||
#define DEFAULT_UBD { \
|
||||
.file = NULL, \
|
||||
.serial = NULL, \
|
||||
.count = 0, \
|
||||
.fd = -1, \
|
||||
.size = -1, \
|
||||
@@ -274,7 +272,7 @@ static int ubd_setup_common(char *str, int *index_out, char **error_out)
|
||||
{
|
||||
struct ubd *ubd_dev;
|
||||
struct openflags flags = global_openflags;
|
||||
char *file, *backing_file, *serial;
|
||||
char *backing_file;
|
||||
int n, err = 0, i;
|
||||
|
||||
if(index_out) *index_out = -1;
|
||||
@@ -370,27 +368,24 @@ static int ubd_setup_common(char *str, int *index_out, char **error_out)
|
||||
goto out;
|
||||
|
||||
break_loop:
|
||||
file = strsep(&str, ",:");
|
||||
if (*file == '\0')
|
||||
file = NULL;
|
||||
backing_file = strchr(str, ',');
|
||||
|
||||
backing_file = strsep(&str, ",:");
|
||||
if (*backing_file == '\0')
|
||||
backing_file = NULL;
|
||||
if (backing_file == NULL)
|
||||
backing_file = strchr(str, ':');
|
||||
|
||||
serial = strsep(&str, ",:");
|
||||
if (*serial == '\0')
|
||||
serial = NULL;
|
||||
|
||||
if (backing_file && ubd_dev->no_cow) {
|
||||
*error_out = "Can't specify both 'd' and a cow file";
|
||||
goto out;
|
||||
if(backing_file != NULL){
|
||||
if(ubd_dev->no_cow){
|
||||
*error_out = "Can't specify both 'd' and a cow file";
|
||||
goto out;
|
||||
}
|
||||
else {
|
||||
*backing_file = '\0';
|
||||
backing_file++;
|
||||
}
|
||||
}
|
||||
|
||||
err = 0;
|
||||
ubd_dev->file = file;
|
||||
ubd_dev->file = str;
|
||||
ubd_dev->cow.file = backing_file;
|
||||
ubd_dev->serial = serial;
|
||||
ubd_dev->boot_openflags = flags;
|
||||
out:
|
||||
mutex_unlock(&ubd_lock);
|
||||
@@ -411,7 +406,7 @@ static int ubd_setup(char *str)
|
||||
|
||||
__setup("ubd", ubd_setup);
|
||||
__uml_help(ubd_setup,
|
||||
"ubd<n><flags>=<filename>[(:|,)<filename2>][(:|,)<serial>]\n"
|
||||
"ubd<n><flags>=<filename>[(:|,)<filename2>]\n"
|
||||
" This is used to associate a device with a file in the underlying\n"
|
||||
" filesystem. When specifying two filenames, the first one is the\n"
|
||||
" COW name and the second is the backing file name. As separator you can\n"
|
||||
@@ -434,12 +429,6 @@ __uml_help(ubd_setup,
|
||||
" UMLs and file locking will be turned off - this is appropriate for a\n"
|
||||
" cluster filesystem and inappropriate at almost all other times.\n\n"
|
||||
" 't' will disable trim/discard support on the device (enabled by default).\n\n"
|
||||
" An optional device serial number can be exposed using the serial parameter\n"
|
||||
" on the cmdline which is exposed as a sysfs entry. This is particularly\n"
|
||||
" useful when a unique number should be given to the device. Note when\n"
|
||||
" specifying a label, the filename2 must be also presented. It can be\n"
|
||||
" an empty string, in which case the backing file is not used:\n"
|
||||
" ubd0=File,,Serial\n"
|
||||
);
|
||||
|
||||
static int udb_setup(char *str)
|
||||
@@ -879,41 +868,6 @@ static void ubd_device_release(struct device *dev)
|
||||
*ubd_dev = ((struct ubd) DEFAULT_UBD);
|
||||
}
|
||||
|
||||
static ssize_t serial_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct gendisk *disk = dev_to_disk(dev);
|
||||
struct ubd *ubd_dev = disk->private_data;
|
||||
|
||||
if (!ubd_dev)
|
||||
return 0;
|
||||
|
||||
return sprintf(buf, "%s", ubd_dev->serial);
|
||||
}
|
||||
|
||||
static DEVICE_ATTR_RO(serial);
|
||||
|
||||
static struct attribute *ubd_attrs[] = {
|
||||
&dev_attr_serial.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static umode_t ubd_attrs_are_visible(struct kobject *kobj,
|
||||
struct attribute *a, int n)
|
||||
{
|
||||
return a->mode;
|
||||
}
|
||||
|
||||
static const struct attribute_group ubd_attr_group = {
|
||||
.attrs = ubd_attrs,
|
||||
.is_visible = ubd_attrs_are_visible,
|
||||
};
|
||||
|
||||
static const struct attribute_group *ubd_attr_groups[] = {
|
||||
&ubd_attr_group,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static int ubd_disk_register(int major, u64 size, int unit,
|
||||
struct gendisk **disk_out)
|
||||
{
|
||||
@@ -945,7 +899,7 @@ static int ubd_disk_register(int major, u64 size, int unit,
|
||||
|
||||
disk->private_data = &ubd_devs[unit];
|
||||
disk->queue = ubd_devs[unit].queue;
|
||||
device_add_disk(parent, disk, ubd_attr_groups);
|
||||
device_add_disk(parent, disk, NULL);
|
||||
|
||||
*disk_out = disk;
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user