Skip to content

Commit

Permalink
md: don't check 'mddev->pers' from suspend_hi_store()
Browse files Browse the repository at this point in the history
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: Yu Kuai <[email protected]>
Signed-off-by: Song Liu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
  • Loading branch information
YuKuai-huawei authored and liu-song-6 committed Sep 22, 2023
1 parent 158d32a commit a2a9f16
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -5226,18 +5226,13 @@ suspend_hi_store(struct mddev *mddev, const char *buf, size_t len)
err = mddev_lock(mddev);
if (err)
return err;
err = -EINVAL;
if (mddev->pers == NULL)
goto unlock;

mddev_suspend(mddev);
mddev->suspend_hi = new;
mddev_resume(mddev);

err = 0;
unlock:
mddev_unlock(mddev);
return err ?: len;
return len;
}
static struct md_sysfs_entry md_suspend_hi =
__ATTR(suspend_hi, S_IRUGO|S_IWUSR, suspend_hi_show, suspend_hi_store);
Expand Down

0 comments on commit a2a9f16

Please sign in to comment.