Skip to content

Commit

Permalink
md: Don't try to set an array to 'read-auto' if it is already in that…
Browse files Browse the repository at this point in the history
… state.

'read-auto' is a variant of 'readonly' which will switch to writable
on the first write attempt.

Calling do_md_stop to set the array readonly when it is already readonly
returns an error.  So make sure not to do that.

Signed-off-by: NeilBrown <neilb@suse.de>
  • Loading branch information
NeilBrown committed Oct 13, 2008
1 parent ea43ddd commit 80268ee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -2725,9 +2725,9 @@ array_state_store(mddev_t *mddev, const char *buf, size_t len)
break;
case read_auto:
if (mddev->pers) {
if (mddev->ro != 1)
if (mddev->ro == 0)
err = do_md_stop(mddev, 1, 0);
else
else if (mddev->ro == 1)
err = restart_array(mddev);
if (err == 0) {
mddev->ro = 2;
Expand Down

0 comments on commit 80268ee

Please sign in to comment.