Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

md: don't check 'mddev->pers' and 'pers->quiesce' from suspend_lo_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: Yu Kuai <yukuai3@huawei.com>
Signed-off-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20230825030956.1527023-8-yukuai1@huaweicloud.com

authored by

Yu Kuai and committed by
Song Liu
54d21eb6 a2a9f168

+2 -7
+2 -7
drivers/md/md.c
··· 5189 5189 err = mddev_lock(mddev); 5190 5190 if (err) 5191 5191 return err; 5192 - err = -EINVAL; 5193 - if (mddev->pers == NULL || 5194 - mddev->pers->quiesce == NULL) 5195 - goto unlock; 5192 + 5196 5193 mddev_suspend(mddev); 5197 5194 mddev->suspend_lo = new; 5198 5195 mddev_resume(mddev); 5199 5196 5200 - err = 0; 5201 - unlock: 5202 5197 mddev_unlock(mddev); 5203 - return err ?: len; 5198 + return len; 5204 5199 } 5205 5200 static struct md_sysfs_entry md_suspend_lo = 5206 5201 __ATTR(suspend_lo, S_IRUGO|S_IWUSR, suspend_lo_show, suspend_lo_store);