Commit d2da626d authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'md-3.4-fixes' of git://neil.brown.name/md

Pull a few more md bug fixes from NeilBrown:
 "2 are tagged for -stable, one being for a fairly serious bug that can
  corrupt metadata and make it hard to recovery an array.  The other is
  for a more recent regression since 3.3"

* tag 'md-3.4-fixes' of git://neil.brown.name/md:
  md: fix possible corruption of array metadata on shutdown.
  md: don't call ->add_disk unless there is good reason.
  DM RAID: Use safe version of rdev_for_each
parents 721b024b 30b8aa91
...@@ -859,7 +859,7 @@ static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs) ...@@ -859,7 +859,7 @@ static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs)
int ret; int ret;
unsigned redundancy = 0; unsigned redundancy = 0;
struct raid_dev *dev; struct raid_dev *dev;
struct md_rdev *rdev, *freshest; struct md_rdev *rdev, *tmp, *freshest;
struct mddev *mddev = &rs->md; struct mddev *mddev = &rs->md;
switch (rs->raid_type->level) { switch (rs->raid_type->level) {
...@@ -877,7 +877,7 @@ static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs) ...@@ -877,7 +877,7 @@ static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs)
} }
freshest = NULL; freshest = NULL;
rdev_for_each(rdev, mddev) { rdev_for_each_safe(rdev, tmp, mddev) {
if (!rdev->meta_bdev) if (!rdev->meta_bdev)
continue; continue;
......
...@@ -7560,14 +7560,14 @@ void md_check_recovery(struct mddev *mddev) ...@@ -7560,14 +7560,14 @@ void md_check_recovery(struct mddev *mddev)
* any transients in the value of "sync_action". * any transients in the value of "sync_action".
*/ */
set_bit(MD_RECOVERY_RUNNING, &mddev->recovery); set_bit(MD_RECOVERY_RUNNING, &mddev->recovery);
clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
/* Clear some bits that don't mean anything, but /* Clear some bits that don't mean anything, but
* might be left set * might be left set
*/ */
clear_bit(MD_RECOVERY_INTR, &mddev->recovery); clear_bit(MD_RECOVERY_INTR, &mddev->recovery);
clear_bit(MD_RECOVERY_DONE, &mddev->recovery); clear_bit(MD_RECOVERY_DONE, &mddev->recovery);
if (test_bit(MD_RECOVERY_FROZEN, &mddev->recovery)) if (!test_and_clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery) ||
test_bit(MD_RECOVERY_FROZEN, &mddev->recovery))
goto unlock; goto unlock;
/* no recovery is running. /* no recovery is running.
* remove any failed drives, then * remove any failed drives, then
...@@ -8140,7 +8140,8 @@ static int md_notify_reboot(struct notifier_block *this, ...@@ -8140,7 +8140,8 @@ static int md_notify_reboot(struct notifier_block *this,
for_each_mddev(mddev, tmp) { for_each_mddev(mddev, tmp) {
if (mddev_trylock(mddev)) { if (mddev_trylock(mddev)) {
__md_stop_writes(mddev); if (mddev->pers)
__md_stop_writes(mddev);
mddev->safemode = 2; mddev->safemode = 2;
mddev_unlock(mddev); mddev_unlock(mddev);
} }
......
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