Commit 91b26a39 authored by Li Nan's avatar Li Nan Committed by Song Liu

md: return directly before setting did_set_md_closing

There is nothing to do at 'out' before setting 'did_set_md_closing'
in md_ioctl(). Return directly, and it will help us to remove
'did_set_md_closing' later.
Signed-off-by: default avatarLi Nan <linan122@huawei.com>
Signed-off-by: default avatarSong Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20240226031444.3606764-5-linan666@huaweicloud.com
parent 9dd8702e
...@@ -7626,26 +7626,19 @@ static int md_ioctl(struct block_device *bdev, blk_mode_t mode, ...@@ -7626,26 +7626,19 @@ static int md_ioctl(struct block_device *bdev, blk_mode_t mode,
switch (cmd) { switch (cmd) {
case GET_ARRAY_INFO: case GET_ARRAY_INFO:
if (!mddev->raid_disks && !mddev->external) if (!mddev->raid_disks && !mddev->external)
err = -ENODEV; return -ENODEV;
else return get_array_info(mddev, argp);
err = get_array_info(mddev, argp);
goto out;
case GET_DISK_INFO: case GET_DISK_INFO:
if (!mddev->raid_disks && !mddev->external) if (!mddev->raid_disks && !mddev->external)
err = -ENODEV; return -ENODEV;
else return get_disk_info(mddev, argp);
err = get_disk_info(mddev, argp);
goto out;
case SET_DISK_FAULTY: case SET_DISK_FAULTY:
err = set_disk_faulty(mddev, new_decode_dev(arg)); return set_disk_faulty(mddev, new_decode_dev(arg));
goto out;
case GET_BITMAP_FILE: case GET_BITMAP_FILE:
err = get_bitmap_file(mddev, argp); return get_bitmap_file(mddev, argp);
goto out;
} }
if (cmd == HOT_REMOVE_DISK) if (cmd == HOT_REMOVE_DISK)
...@@ -7661,13 +7654,11 @@ static int md_ioctl(struct block_device *bdev, blk_mode_t mode, ...@@ -7661,13 +7654,11 @@ static int md_ioctl(struct block_device *bdev, blk_mode_t mode,
mutex_lock(&mddev->open_mutex); mutex_lock(&mddev->open_mutex);
if (mddev->pers && atomic_read(&mddev->openers) > 1) { if (mddev->pers && atomic_read(&mddev->openers) > 1) {
mutex_unlock(&mddev->open_mutex); mutex_unlock(&mddev->open_mutex);
err = -EBUSY; return -EBUSY;
goto out;
} }
if (test_and_set_bit(MD_CLOSING, &mddev->flags)) { if (test_and_set_bit(MD_CLOSING, &mddev->flags)) {
mutex_unlock(&mddev->open_mutex); mutex_unlock(&mddev->open_mutex);
err = -EBUSY; return -EBUSY;
goto out;
} }
did_set_md_closing = true; did_set_md_closing = true;
mutex_unlock(&mddev->open_mutex); mutex_unlock(&mddev->open_mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment