Skip to content

Commit

Permalink
Merge tag 'md-3.4-fixes' of git://neil.brown.name/md
Browse files Browse the repository at this point in the history
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
  • Loading branch information
torvalds committed Apr 24, 2012
2 parents 721b024 + 30b8aa9 commit d2da626
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions drivers/md/dm-raid.c
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs)
int ret;
unsigned redundancy = 0;
struct raid_dev *dev;
struct md_rdev *rdev, *freshest;
struct md_rdev *rdev, *tmp, *freshest;
struct mddev *mddev = &rs->md;

switch (rs->raid_type->level) {
Expand All @@ -877,7 +877,7 @@ static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs)
}

freshest = NULL;
rdev_for_each(rdev, mddev) {
rdev_for_each_safe(rdev, tmp, mddev) {
if (!rdev->meta_bdev)
continue;

Expand Down
7 changes: 4 additions & 3 deletions drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -7560,14 +7560,14 @@ void md_check_recovery(struct mddev *mddev)
* any transients in the value of "sync_action".
*/
set_bit(MD_RECOVERY_RUNNING, &mddev->recovery);
clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
/* Clear some bits that don't mean anything, but
* might be left set
*/
clear_bit(MD_RECOVERY_INTR, &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;
/* no recovery is running.
* remove any failed drives, then
Expand Down Expand Up @@ -8140,7 +8140,8 @@ static int md_notify_reboot(struct notifier_block *this,

for_each_mddev(mddev, tmp) {
if (mddev_trylock(mddev)) {
__md_stop_writes(mddev);
if (mddev->pers)
__md_stop_writes(mddev);
mddev->safemode = 2;
mddev_unlock(mddev);
}
Expand Down

0 comments on commit d2da626

Please sign in to comment.