Skip to content

Commit 4d484a4

Browse files
committed
md: allow upper limit for resync/reshape to be set when array is read-only
Normally we only allow the upper limit for a reshape to be decreased when the array not performing a sync/recovery/reshape, otherwise there could be races. But if an array is part-way through a reshape when it is assembled the reshape is started immediately leaving no window to set an upper bound. If the array is started read-only, the reshape will be suspended until the array becomes writable, so that provides a window during which it is perfectly safe to reduce the upper limit of a reshape. So: allow the upper limit (sync_max) to be reduced even if the reshape thread is running, as long as the array is still read-only. Signed-off-by: NeilBrown <[email protected]>
1 parent 1a67dde commit 4d484a4

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/md/md.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3599,6 +3599,7 @@ max_sync_store(mddev_t *mddev, const char *buf, size_t len)
35993599
if (max < mddev->resync_min)
36003600
return -EINVAL;
36013601
if (max < mddev->resync_max &&
3602+
mddev->ro == 0 &&
36023603
test_bit(MD_RECOVERY_RUNNING, &mddev->recovery))
36033604
return -EBUSY;
36043605

0 commit comments

Comments
 (0)