Commit 5bf29597 authored by NeilBrown's avatar NeilBrown

md: remove ability to explicit set an inactive array to 'clean'.

Being able to write 'clean' to an 'array_state' of an inactive array
to activate it in 'clean' mode is both unnecessary and inconvenient.

It is unnecessary because the same can be achieved by writing
'active'.  This activates and array, but it still remains 'clean'
until the first write.

It is inconvenient because writing 'clean' is more often used to
cause an 'active' array to revert to 'clean' mode (thus blocking
any writes until a 'write-pending' is promoted to 'active').

Allowing 'clean' to both activate an array and mark an active array as
clean can lead to races:  One program writes 'clean' to mark the
active array as clean at the same time as another program writes
'inactive' to deactivate (stop) and active array.  Depending on which
writes first, the array could be deactivated and immediately
reactivated which isn't what was desired.

So just disable the use of 'clean' to activate an array.

This avoids a race that can be triggered with mdadm-3.0 and external
metadata, so it suitable for -stable.
Reported-by: default avatarRafal Marszewski <rafal.marszewski@intel.com>
Acked-by: default avatarDan Williams <dan.j.williams@intel.com>
Cc: <stable@kernel.org>
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent 110518bc
...@@ -3066,11 +3066,8 @@ array_state_store(mddev_t *mddev, const char *buf, size_t len) ...@@ -3066,11 +3066,8 @@ array_state_store(mddev_t *mddev, const char *buf, size_t len)
} else } else
err = -EBUSY; err = -EBUSY;
spin_unlock_irq(&mddev->write_lock); spin_unlock_irq(&mddev->write_lock);
} else { } else
mddev->ro = 0; err = -EINVAL;
mddev->recovery_cp = MaxSector;
err = do_md_run(mddev);
}
break; break;
case active: case active:
if (mddev->pers) { if (mddev->pers) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment