Commit d890fa2b0586b6177b119643ff66932127d58afa

Authored by NeilBrown
1 parent 355840e7a7

md: Fix some bugs in recovery_disabled handling.

In 3.0 we changed the way recovery_disabled was handle so that instead
of testing against zero, we test an mddev-> value against a conf->
value.
Two problems:
  1/ one place in raid1 was missed and still sets to '1'.
  2/ We didn't explicitly set the conf-> value at array creation
     time.
     It defaulted to '0' just like the mddev value does so they
     could appear equal and thus disable recovery.
     This did not affect normal 'md' as it calls bind_rdev_to_array
     which changes the mddev value.  However the dmraid interface
     doesn't call this and so doesn't change ->recovery_disabled; so at
     array start all recovery is incorrectly disabled.

So initialise the 'conf' value to one less that the mddev value, so
the will only be the same when explicitly set that way.

Reported-by: Jonathan Brassow <jbrassow@redhat.com>
Signed-off-by: NeilBrown  <neilb@suse.de>

Showing 3 changed files with 6 additions and 1 deletions Side-by-side Diff

... ... @@ -1519,7 +1519,8 @@
1519 1519 abort = 1;
1520 1520 }
1521 1521 if (abort) {
1522   - mddev->recovery_disabled = 1;
  1522 + conf->recovery_disabled =
  1523 + mddev->recovery_disabled;
1523 1524 set_bit(MD_RECOVERY_INTR, &mddev->recovery);
1524 1525 md_done_sync(mddev, r1_bio->sectors, 0);
1525 1526 put_buf(r1_bio);
... ... @@ -2436,6 +2437,7 @@
2436 2437  
2437 2438 bio_list_init(&conf->pending_bio_list);
2438 2439 conf->pending_count = 0;
  2440 + conf->recovery_disabled = mddev->recovery_disabled - 1;
2439 2441  
2440 2442 conf->last_used = -1;
2441 2443 for (i = 0; i < conf->raid_disks; i++) {
... ... @@ -1373,6 +1373,7 @@
1373 1373 }
1374 1374  
1375 1375 p->head_position = 0;
  1376 + p->recovery_disabled = mddev->recovery_disabled - 1;
1376 1377 rdev->raid_disk = mirror;
1377 1378 err = 0;
1378 1379 if (rdev->saved_raid_disk != mirror)
... ... @@ -2931,6 +2932,7 @@
2931 2932 if (disk->rdev)
2932 2933 conf->fullsync = 1;
2933 2934 }
  2935 + disk->recovery_disabled = mddev->recovery_disabled - 1;
2934 2936 }
2935 2937  
2936 2938 if (mddev->recovery_cp != MaxSector)
... ... @@ -4591,6 +4591,7 @@
4591 4591 atomic_set(&conf->preread_active_stripes, 0);
4592 4592 atomic_set(&conf->active_aligned_reads, 0);
4593 4593 conf->bypass_threshold = BYPASS_THRESHOLD;
  4594 + conf->recovery_disabled = mddev->recovery_disabled - 1;
4594 4595  
4595 4596 conf->raid_disks = mddev->raid_disks;
4596 4597 if (mddev->reshape_position == MaxSector)