[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240206085511.2841555-5-linan666@huaweicloud.com>
Date: Tue, 6 Feb 2024 16:55:06 +0800
From: linan666@...weicloud.com
To: song@...nel.org,
mariusz.tkaczyk@...ux.intel.com,
shli@...com,
neilb@...e.com
Cc: linux-raid@...r.kernel.org,
linux-kernel@...r.kernel.org,
linan666@...weicloud.com,
yukuai3@...wei.com,
yi.zhang@...wei.com,
houtao1@...wei.com,
yangerkun@...wei.com
Subject: [PATCH v6 4/9] md: return directly before setting did_set_md_closing
From: Li Nan <linan122@...wei.com>
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: Li Nan <linan122@...wei.com>
---
drivers/md/md.c | 25 ++++++++-----------------
1 file changed, 8 insertions(+), 17 deletions(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index fb4e80a0aa9a..02d6197dc944 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -7649,26 +7649,19 @@ static int md_ioctl(struct block_device *bdev, blk_mode_t mode,
switch (cmd) {
case GET_ARRAY_INFO:
if (!mddev->raid_disks && !mddev->external)
- err = -ENODEV;
- else
- err = get_array_info(mddev, argp);
- goto out;
+ return -ENODEV;
+ return get_array_info(mddev, argp);
case GET_DISK_INFO:
if (!mddev->raid_disks && !mddev->external)
- err = -ENODEV;
- else
- err = get_disk_info(mddev, argp);
- goto out;
+ return -ENODEV;
+ return get_disk_info(mddev, argp);
case SET_DISK_FAULTY:
- err = set_disk_faulty(mddev, new_decode_dev(arg));
- goto out;
+ return set_disk_faulty(mddev, new_decode_dev(arg));
case GET_BITMAP_FILE:
- err = get_bitmap_file(mddev, argp);
- goto out;
-
+ return get_bitmap_file(mddev, argp);
}
if (cmd == HOT_REMOVE_DISK)
@@ -7684,13 +7677,11 @@ static int md_ioctl(struct block_device *bdev, blk_mode_t mode,
mutex_lock(&mddev->open_mutex);
if (mddev->pers && atomic_read(&mddev->openers) > 1) {
mutex_unlock(&mddev->open_mutex);
- err = -EBUSY;
- goto out;
+ return -EBUSY;
}
if (test_and_set_bit(MD_CLOSING, &mddev->flags)) {
mutex_unlock(&mddev->open_mutex);
- err = -EBUSY;
- goto out;
+ return -EBUSY;
}
did_set_md_closing = true;
mutex_unlock(&mddev->open_mutex);
--
2.39.2
Powered by blists - more mailing lists