mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-18 19:21:26 +00:00
Avoid that a warning like the one below is triggered when adding
a nullio, fileio or blockio device with a name that already exists: WARNING: at fs/sysfs/dir.c:481 sysfs_add_one+0x95/0xd0() sysfs: cannot create duplicate filename '/kernel/scst_tgt/devices/disk09' Call Trace: warn_slowpath_common+0x72/0xa0 ? sysfs_add_one+0x95/0xd0 ? sysfs_add_one+0x95/0xd0 warn_slowpath_fmt+0x33/0x40 sysfs_add_one+0x95/0xd0 create_dir+0x61/0xa0 sysfs_create_dir+0x71/0xb0 kobject_add_internal+0x9b/0x250 ? kvasprintf+0x41/0x50 kobject_init_and_add+0x39/0x60 scst_dev_sysfs_create+0x6e/0x250 [scst] scst_register_virtual_device+0x1f4/0x3e0 [scst] vdev_nullio_add_device+0x14f/0x1c0 [scst_vdisk] ? vdisk_add_nullio_device+0x5a/0x110 [scst_vdisk] vdisk_add_nullio_device+0xf1/0x110 [scst_vdisk] ? scst_check_grab_devt_ptr.clone.0+0xa8/0x170 [scst] scst_process_devt_mgmt_store+0xa9/0x2a0 [scst] ? spin_unlock.clone.11+0x12/0x20 [scst] scst_devt_mgmt_store_work_fn+0x13/0x20 [scst] scst_process_sysfs_works+0x7f/0x170 [scst] ? spin_lock.clone.10+0x12/0x20 [scst] sysfs_work_thread_fn+0x103/0x270 [scst] ? wake_up_bit+0x30/0x30 ? prepare_to_wait_exclusive_head.clone.16+0x60/0x60 [scst] kthread+0x84/0x90 ? __init_kthread_worker+0x60/0x60 kernel_thread_helper+0x6/0x10 Signed-off-by: Bart Van Assche <bvanassche@acm.org> git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3938 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -3493,10 +3493,14 @@ out:
|
||||
static int vdev_create(struct scst_dev_type *devt,
|
||||
const char *name, struct scst_vdisk_dev **res_virt_dev)
|
||||
{
|
||||
int res = 0;
|
||||
int res;
|
||||
struct scst_vdisk_dev *virt_dev;
|
||||
uint64_t dev_id_num;
|
||||
|
||||
res = -EEXIST;
|
||||
if (vdev_find(name))
|
||||
goto out;
|
||||
|
||||
virt_dev = kzalloc(sizeof(*virt_dev), GFP_KERNEL);
|
||||
if (virt_dev == NULL) {
|
||||
PRINT_ERROR("Allocation of virtual device %s failed",
|
||||
@@ -3534,6 +3538,7 @@ static int vdev_create(struct scst_dev_type *devt,
|
||||
TRACE_DBG("usn %s", virt_dev->usn);
|
||||
|
||||
*res_virt_dev = virt_dev;
|
||||
res = 0;
|
||||
|
||||
out:
|
||||
return res;
|
||||
@@ -4861,13 +4866,6 @@ static int vdisk_write_proc(char *buffer, char **start, off_t offset,
|
||||
|
||||
if (action == 1) {
|
||||
/* open */
|
||||
if (vdev_find(name)) {
|
||||
PRINT_ERROR("Virtual device with name "
|
||||
"%s already exist", name);
|
||||
res = -EINVAL;
|
||||
goto out_up;
|
||||
}
|
||||
|
||||
while (isspace(*p) && *p != '\0')
|
||||
p++;
|
||||
filename = p;
|
||||
@@ -5106,14 +5104,6 @@ static int vcdrom_open(char *p, char *name)
|
||||
int res = 0;
|
||||
int cdrom_empty;
|
||||
|
||||
virt_dev = vdev_find(name);
|
||||
if (virt_dev) {
|
||||
PRINT_ERROR("Virtual device with name "
|
||||
"%s already exist", name);
|
||||
res = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
while (isspace(*p) && *p != '\0')
|
||||
p++;
|
||||
filename = p;
|
||||
|
||||
Reference in New Issue
Block a user