Skip to content

Commit 2befeea

Browse files
neilbrowngregkh
authored andcommitted
md: fix calculation of stacking limits on level change.
commit 02e5f5c upstream. The various ->run routines of md personalities assume that the 'queue' has been initialised by the blk_set_stacking_limits() call in md_alloc(). However when the level is changed (by level_store()) the ->run routine for the new level is called for an array which has already had the stacking limits modified. This can result in incorrect final settings. So call blk_set_stacking_limits() before ->run in level_store(). A specific consequence of this bug is that it causes discard_granularity to be set incorrectly when reshaping a RAID4 to a RAID0. This is suitable for any -stable kernel since 3.3 in which blk_set_stacking_limits() was introduced. Reported-and-tested-by: "Baldysiak, Pawel" <[email protected]> Signed-off-by: NeilBrown <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 0524a6b commit 2befeea

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
@@ -3620,6 +3620,7 @@ level_store(struct mddev *mddev, const char *buf, size_t len)
36203620
mddev->in_sync = 1;
36213621
del_timer_sync(&mddev->safemode_timer);
36223622
}
3623+
blk_set_stacking_limits(&mddev->queue->limits);
36233624
pers->run(mddev);
36243625
set_bit(MD_CHANGE_DEVS, &mddev->flags);
36253626
mddev_resume(mddev);

0 commit comments

Comments
 (0)