Skip to content

Commit

Permalink
md: fix small irregularity with start_ro module parameter
Browse files Browse the repository at this point in the history
The start_ro modules parameter can be used to force arrays to be
started in 'auto-readonly' in which they are read-only until the first
write.  This ensures that no resync/recovery happens until something
else writes to the device.  This is important for resume-from-disk
off an md array.

However if an array is started 'readonly' (by writing 'readonly' to
the 'array_state' sysfs attribute) we want it to be really 'readonly',
not 'auto-readonly'.

So strengthen the condition to only set auto-readonly if the
array is not already read-only.

Signed-off-by: NeilBrown <neilb@suse.de>
  • Loading branch information
NeilBrown committed Dec 30, 2009
1 parent cbd1998 commit 0f9552b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -4357,7 +4357,7 @@ static int do_md_run(mddev_t * mddev)
mddev->barriers_work = 1;
mddev->ok_start_degraded = start_dirty_degraded;

if (start_readonly)
if (start_readonly && mddev->ro == 0)
mddev->ro = 2; /* read-only, but switch on first write */

err = mddev->pers->run(mddev);
Expand Down

0 comments on commit 0f9552b

Please sign in to comment.