Skip to contentSkip to conversation

raid1 integrity checking is broken on 2.6.18-rc4

bug? Chuck Ebbert 4 participants 4 messages Aug 12, 2006 – Aug 14, 2006 MD RAID

lore
Share & tools
lore
#0 lore raw

Doing this on a raid1 array:
echo "check" >/sys/block/md0/md/sync_action

On 2.6.16.27:
Activity lights on both mirrors show activity for a while, then the array status prints on the console.

On 2.6.18-rc4 + the below patch:
Drive activity light blinks once on one drive, then the array status prints (obviously no checking takes place.)

Applied hotfix on 2.6.18-rc4:

drivers/md/md.c 2006-08-08 09:04:04.000000000 +1000 renamed from drivers/md/md.c 2006-08-08 09:00:44.000000000 +1000 +13 -0
@@ -1597,6 +1597,19 @@ void md_update_sb(mddev_t * mddev)
 
 repeat:
        spin_lock_irq(&mddev->write_lock);
+
+       if (mddev->degraded && mddev->sb_dirty == 3)
+               /* If the array is degraded, then skipping spares is both
+                * dangerous and fairly pointless.
+                * Dangerous because a device that was removed from the array
+                * might have a event_count that still looks up-to-date,
+                * so it can be re-added without a resync.
+                * Pointless because if there are any spares to skip,
+                * then a recovery will happen and soon that array won't
+                * be degraded any more and the spare can go back to sleep then.
+                */
+               mddev->sb_dirty = 1;
+
        sync_req = mddev->in_sync;
        mddev->utime = get_seconds();
        if (mddev->sb_dirty == 3)
Signature · 1 line
Chuck
#1 lore raw
Quoted 44 lines · Chuck Ebbert

Doing this on a raid1 array:
echo "check" >/sys/block/md0/md/sync_action

On 2.6.16.27:
Activity lights on both mirrors show activity for a while, then the array status prints on the console.

On 2.6.18-rc4 + the below patch:
Drive activity light blinks once on one drive, then the array status prints (obviously no checking takes place.)

Applied hotfix on 2.6.18-rc4:

drivers/md/md.c 2006-08-08 09:04:04.000000000 +1000 renamed from drivers/md/md.c 2006-08-08 09:00:44.000000000 +1000 +0 -0
@@ -1597,6 +1597,19 @@ void md_update_sb(mddev_t * mddev)
 

repeat:

       spin_lock_irq(&mddev->write_lock);
drivers/md/md.c 2006-08-08 09:04:04.000000000 +1000 renamed from drivers/md/md.c 2006-08-08 09:00:44.000000000 +1000 +13 -0
+
+       if (mddev->degraded && mddev->sb_dirty == 3)
+               /* If the array is degraded, then skipping spares is both
+                * dangerous and fairly pointless.
+                * Dangerous because a device that was removed from the array
+                * might have a event_count that still looks up-to-date,
+                * so it can be re-added without a resync.
+                * Pointless because if there are any spares to skip,
+                * then a recovery will happen and soon that array won't
+                * be degraded any more and the spare can go back to sleep then.
+                */
+               mddev->sb_dirty = 1;
+
       sync_req = mddev->in_sync;
       mddev->utime = get_seconds();
       if (mddev->sb_dirty == 3)
Signature · 6 lines
Chuck

-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Is there a doc for all of the options you can echo into the sync_action? I'm assuming mdadm does these as well and echo is just another way to run work with the array?

#2 lore raw
Quoted 3 lines · Justin Piszcz

Is there a doc for all of the options you can echo into the sync_action? I'm assuming mdadm does these as well and echo is just another way to run work with the array?

How about the obvious, Documentation/md.txt ?

And no, mdadm does not perform or trigger data integrity checking.

/mjt

#3 lore raw
In reply to Chuck Ebbert
Quoted 11 lines · On Saturday August 12, [email protected] wrote:

Doing this on a raid1 array:
echo "check" >/sys/block/md0/md/sync_action

On 2.6.16.27:
Activity lights on both mirrors show activity for a while, then the array status prints on the console.

On 2.6.18-rc4 + the below patch:
Drive activity light blinks once on one drive, then the array status prints (obviously no checking takes place.)

Thanks for the report.
Easily duplicated, easily fixed.
I'll make sure this patch gets into 2.6.18.

Thanks again,
NeilBrown

drivers/md/raid1.c +4 -3
diff .prev/drivers/md/raid1.c ./drivers/md/raid1.c
@@ -1644,15 +1644,16 @@ static sector_t sync_request(mddev_t *md
 		return 0;
 	}
 
-	/* before building a request, check if we can skip these blocks..
-	 * This call the bitmap_start_sync doesn't actually record anything
-	 */
 	if (mddev->bitmap == NULL &&
 	    mddev->recovery_cp == MaxSector &&
+	    !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery) &&
 	    conf->fullsync == 0) {
 		*skipped = 1;
 		return max_sector - sector_nr;
 	}
+	/* before building a request, check if we can skip these blocks..
+	 * This call the bitmap_start_sync doesn't actually record anything
+	 */
 	if (!bitmap_start_sync(mddev->bitmap, sector_nr, &sync_blocks, 1) &&
 	    !conf->fullsync && !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) {
 		/* We can skip this block, and probably several more */