diff options
author | NeilBrown <neilb@suse.de> | 2013-04-23 21:42:40 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2013-04-23 21:42:40 -0400 |
commit | d87f064f5874ba60814c6ccac67104761be5b26c (patch) | |
tree | bbc599fc78742a23dc62e3414e00db649a1d697e | |
parent | 824282ca7d250bd7c301f221c3cd902ce906d731 (diff) |
md: never update metadata when array is read-only.
Normally we don't even try to update the metadata if
the array is read-only. However future patches
will increase the number of things that can happen on a read-only
array, so it is safest to explicitly disable this.
Every time that mddev->ro is set to 0, either
- md_update_sb will be called again (at least if MD_CHANGE_DEVS
is set) or
- the mddev->thread is scheduled, which will also run
md_update_sb if needed.
So this is safe: if the array ever become read-write the
metadata will be updated.
Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r-- | drivers/md/md.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index aeceedfc530b..c6e44a836a53 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -2411,6 +2411,11 @@ static void md_update_sb(struct mddev * mddev, int force_change) | |||
2411 | int nospares = 0; | 2411 | int nospares = 0; |
2412 | int any_badblocks_changed = 0; | 2412 | int any_badblocks_changed = 0; |
2413 | 2413 | ||
2414 | if (mddev->ro) { | ||
2415 | if (force_change) | ||
2416 | set_bit(MD_CHANGE_DEVS, &mddev->flags); | ||
2417 | return; | ||
2418 | } | ||
2414 | repeat: | 2419 | repeat: |
2415 | /* First make sure individual recovery_offsets are correct */ | 2420 | /* First make sure individual recovery_offsets are correct */ |
2416 | rdev_for_each(rdev, mddev) { | 2421 | rdev_for_each(rdev, mddev) { |