Commit a2a9f168 authored by Yu Kuai's avatar Yu Kuai Committed by Song Liu

md: don't check 'mddev->pers' from suspend_hi_store()

Now that mddev_suspend() doean't rely on 'mddev->pers' to be set, it's
safe to remove such checking.

This will also allow the array to be suspended even before the array
is ran.
Signed-off-by: default avatarYu Kuai <yukuai3@huawei.com>
Signed-off-by: default avatarSong Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20230825030956.1527023-7-yukuai1@huaweicloud.com
parent 158d32af
...@@ -5226,18 +5226,13 @@ suspend_hi_store(struct mddev *mddev, const char *buf, size_t len) ...@@ -5226,18 +5226,13 @@ suspend_hi_store(struct mddev *mddev, const char *buf, size_t len)
err = mddev_lock(mddev); err = mddev_lock(mddev);
if (err) if (err)
return err; return err;
err = -EINVAL;
if (mddev->pers == NULL)
goto unlock;
mddev_suspend(mddev); mddev_suspend(mddev);
mddev->suspend_hi = new; mddev->suspend_hi = new;
mddev_resume(mddev); mddev_resume(mddev);
err = 0;
unlock:
mddev_unlock(mddev); mddev_unlock(mddev);
return err ?: len; return len;
} }
static struct md_sysfs_entry md_suspend_hi = static struct md_sysfs_entry md_suspend_hi =
__ATTR(suspend_hi, S_IRUGO|S_IWUSR, suspend_hi_show, suspend_hi_store); __ATTR(suspend_hi, S_IRUGO|S_IWUSR, suspend_hi_show, suspend_hi_store);
......
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