summaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2014-09-30 07:24:25 +0200
committerNeilBrown <neilb@suse.de>2014-10-14 04:08:29 +0200
commite1960f8c5cd1420dd2ecf0754a136956246365e7 (patch)
tree9ea3e40fedadd37cdd429128eb00068ed57fce25 /drivers/md/md.c
parentmd: remove unwanted white space from md.c (diff)
downloadlinux-e1960f8c5cd1420dd2ecf0754a136956246365e7.tar.xz
linux-e1960f8c5cd1420dd2ecf0754a136956246365e7.zip
md: don't allow "-sync" to be set for device in an active array.
If an array is active, devices can be marked 'faulty', but simply removing the 'sync' flag is wrong. That only makes sense for an array which is not active (and is probably only useful for testing anyway). Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 3ca611fabfaf..9939122ca00c 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2642,10 +2642,12 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len)
set_bit(In_sync, &rdev->flags);
err = 0;
} else if (cmd_match(buf, "-insync") && rdev->raid_disk >= 0) {
- clear_bit(In_sync, &rdev->flags);
- rdev->saved_raid_disk = rdev->raid_disk;
- rdev->raid_disk = -1;
- err = 0;
+ if (rdev->mddev->pers == NULL) {
+ clear_bit(In_sync, &rdev->flags);
+ rdev->saved_raid_disk = rdev->raid_disk;
+ rdev->raid_disk = -1;
+ err = 0;
+ }
} else if (cmd_match(buf, "write_error")) {
set_bit(WriteErrorSeen, &rdev->flags);
err = 0;