Skip to contentSkip to conversation

2.6.20-rc4-mm1 md problem

DISCUSSION Michal Piotrowski 5 participants 12 messages Jan 12, 2007 – Jan 16, 2007

Subsystems (2)
lore
Share & tools
lore
#1 lore raw
Quoted 9 lines · Michal Piotrowski

My system hangs on this
http://www.stardust.webpages.pl/files/tbf/euridica/2.6.20-rc4-mm1/bug2.jpg
http://www.stardust.webpages.pl/files/tbf/euridica/2.6.20-rc4-mm1/mm-config

Debug plan:
- revert md-* patches
- binary search

Does someone have a better idea?

Revert git-block.patch and related stuff?

Greetings,
Rafael

Signature · 3 lines
If you don't have the time to read,
you don't have the time or the tools to write.
		- Stephen King
#2 lore raw
Quoted 5 lines · Rafael J. Wysocki
Quoted 4 lines · Michal Piotrowski

My system hangs on this
http://www.stardust.webpages.pl/files/tbf/euridica/2.6.20-rc4-mm1/bug2.jpg
http://www.stardust.webpages.pl/files/tbf/euridica/2.6.20-rc4-mm1/mm-config

Quoted 7 lines
Quoted 5 lines

Debug plan:
- revert md-* patches
- binary search

Does someone have a better idea?

Revert git-block.patch and related stuff?

Indeed.

GOOD
#
##git-sym2.patch
#git-scsi-target.patch
#git-scsi-target-fixup.patch
#
git-block.patch
git-block-fixup.patch
BAD

git-block.patch it's huge patch.

diffstat git-block.patch
[..]

drivers/md/bitmap.c             |    1
drivers/md/dm-emc.c             |    2
drivers/md/dm-table.c           |   14 -
drivers/md/dm.c                 |   18 -
drivers/md/dm.h                 |    1
drivers/md/linear.c             |   14 -
drivers/md/md.c                 |    3
drivers/md/multipath.c          |   32 --
drivers/md/raid0.c              |   17 -
drivers/md/raid1.c              |   70 -----
drivers/md/raid10.c             |   73 ------
drivers/md/raid5.c              |   60 ----

[..]

I'll do a binary search through those files.

Quoted 3 lines

Greetings,
Rafael

Regards,
Michal

Signature · 3 lines
Michal K. K. Piotrowski
LTG - Linux Testers Group
(http://www.stardust.webpages.pl/ltg/)
#3 lore raw
Quoted 42 lines · Michal Piotrowski
Quoted 5 lines · Rafael J. Wysocki
Quoted 4 lines · Michal Piotrowski

My system hangs on this
http://www.stardust.webpages.pl/files/tbf/euridica/2.6.20-rc4-mm1/bug2.jpg
http://www.stardust.webpages.pl/files/tbf/euridica/2.6.20-rc4-mm1/mm-config

Quoted 7 lines
Quoted 5 lines

Debug plan:
- revert md-* patches
- binary search

Does someone have a better idea?

Revert git-block.patch and related stuff?

Indeed.

GOOD
#
##git-sym2.patch
#git-scsi-target.patch
#git-scsi-target-fixup.patch
#
git-block.patch
git-block-fixup.patch
BAD

git-block.patch it's huge patch.

diffstat git-block.patch
[..]
drivers/md/bitmap.c | 1

 drivers/md/dm-emc.c             |    2
 drivers/md/dm-table.c           |   14 -
 drivers/md/dm.c                 |   18 -
 drivers/md/dm.h                 |    1
 drivers/md/linear.c             |   14 -
 drivers/md/md.c                 |    3
 drivers/md/multipath.c          |   32 --
 drivers/md/raid0.c              |   17 -
 drivers/md/raid1.c              |   70 -----
 drivers/md/raid10.c             |   73 ------
 drivers/md/raid5.c              |   60 ----
Quoted 4 lines

[..]

I'll do a binary search through those files.

That wasn't a good idea.

/mnt/md0/devel/linux-mm/drivers/md/raid1.c: In function 'unplug_slaves':
/mnt/md0/devel/linux-mm/drivers/md/raid1.c:556: error:
'request_queue_t' has no member named 'unplug_fn'

Regards,
Michal

Signature · 3 lines
Michal K. K. Piotrowski
LTG - Linux Testers Group
(http://www.stardust.webpages.pl/ltg/)
#4 lore raw
Quoted 47 lines · Michal Piotrowski
Quoted 46 lines · Michal Piotrowski
Quoted 3 lines · Rafael J. Wysocki
Quoted 2 lines · Michal Piotrowski

My system hangs on this

http://www.stardust.webpages.pl/files/tbf/euridica/2.6.20-rc4-mm1/bug2.jpg

Quoted 1 line
Quoted 1 line

http://www.stardust.webpages.pl/files/tbf/euridica/2.6.20-rc4-mm1/mm-config

Quoted 8 lines
Quoted 6 lines

Debug plan:
- revert md-* patches
- binary search

Does someone have a better idea?

Revert git-block.patch and related stuff?

Indeed.

GOOD
#
##git-sym2.patch
#git-scsi-target.patch
#git-scsi-target-fixup.patch
#
git-block.patch
git-block-fixup.patch
BAD

git-block.patch it's huge patch.

diffstat git-block.patch
[..]

drivers/md/bitmap.c             |    1
drivers/md/dm-emc.c             |    2
drivers/md/dm-table.c           |   14 -
drivers/md/dm.c                 |   18 -
drivers/md/dm.h                 |    1
drivers/md/linear.c             |   14 -
drivers/md/md.c                 |    3
drivers/md/multipath.c          |   32 --
drivers/md/raid0.c              |   17 -
drivers/md/raid1.c              |   70 -----
drivers/md/raid10.c             |   73 ------
drivers/md/raid5.c              |   60 ----

[..]

Quoted 8 lines
Quoted 2 lines

I'll do a binary search through those files.

That wasn't a good idea.

/mnt/md0/devel/linux-mm/drivers/md/raid1.c: In function 'unplug_slaves':
/mnt/md0/devel/linux-mm/drivers/md/raid1.c:556: error:
'request_queue_t' has no member named 'unplug_fn'

You can't go throught he individual files and expect that to compile, yet alone work. Fortunately I think I already fixed this last week, unfortunately I think I forgot to push the #plug branch for #for-akpm so that Andrew automatically picks it up...

Signature · 1 line
Jens Axboe
#5 lore raw
In reply to Michal Piotrowski
Quoted 9 lines · Michal Piotrowski

My system hangs on this
http://www.stardust.webpages.pl/files/tbf/euridica/2.6.20-rc4-mm1/bug2.jpg
http://www.stardust.webpages.pl/files/tbf/euridica/2.6.20-rc4-mm1/mm-config

Debug plan:
- revert md-* patches
- binary search

Does someone have a better idea?

Thomas saw something similar yesterday and he the partial results that git.block (between rc2-mm1 and rc4-mm1) breaks certain disk drivers or filesystems drivers. For me it worked fine, so it must be only on some combinations. The changes to ll_rw_block.c look quite extensive.

Ingo

#6 lore raw
Quoted 10 lines · Ingo Molnar
Quoted 5 lines

Debug plan:
- revert md-* patches
- binary search

Does someone have a better idea?

Thomas saw something similar yesterday and he the partial results that git.block (between rc2-mm1 and rc4-mm1) breaks certain disk drivers or filesystems drivers. For me it worked fine, so it must be only on some combinations. The changes to ll_rw_block.c look quite extensive.

Yes. Jens Axboe confirmed yesterday that the plug changes broke RAID.

tglx

#7 lore raw

[patch-mm] Workaround for RAID breakage

Quoted 6 lines · Thomas Gleixner
Quoted 4 lines

Thomas saw something similar yesterday and he the partial results that git.block (between rc2-mm1 and rc4-mm1) breaks certain disk drivers or filesystems drivers. For me it worked fine, so it must be only on some combinations. The changes to ll_rw_block.c look quite extensive.

Yes. Jens Axboe confirmed yesterday that the plug changes broke RAID.

I tracked this down and found two problems:

- The new plug/unplug code does not check for underruns. That allows the plug count (ioc->plugged) to become negative. This gets triggered from various places.

AFAICS this is intentional to avoid checks all over the place, but the underflow check is missing. All we need to do is make sure, that in case of ioc->plugged == 0 we return early and bug, if there is either a queue plugged in or the plugged_list is not empty.

Jens ?

- The raid1 code has no bitmap set in remount r/w. So the pending_bio_list gets not processed for quite a time. The workaround is to kick mddev->thread, so the list is processed. Not sure about that.

Neil ?

At least it boots and behaves normal.

tglx

block/ll_rw_blk.c +6 -0
Index: linux-2.6.20-rc4-mm1/block/ll_rw_blk.c
===================================================================
@@ -3757,6 +3757,12 @@ void blk_unplug_current(void)
 	if (!ioc)
 		return;
 
+	if (!ioc->plugged) {
+		BUG_ON(!list_empty(&ioc->plugged_list));
+		BUG_ON(ioc->plugged_queue);
+		return;
+	}
+
 	ioc->plugged--;
 	if (ioc->plugged)
 		return;
drivers/md/raid1.c +1 -1
Index: linux-2.6.20-rc4-mm1/drivers/md/raid1.c
===================================================================
@@ -897,7 +897,7 @@ static int make_request(request_queue_t 
 
 	spin_unlock_irqrestore(&conf->device_lock, flags);
 
-	if (do_sync)
+	if (do_sync || !bitmap)
 		md_wakeup_thread(mddev->thread);
 #if 0
 	while ((bio = bio_list_pop(&bl)) != NULL)
#8 lore raw

Re: [patch-mm] Workaround for RAID breakage

Quoted 21 lines · Thomas Gleixner
Quoted 6 lines · Thomas Gleixner
Quoted 4 lines

Thomas saw something similar yesterday and he the partial results that git.block (between rc2-mm1 and rc4-mm1) breaks certain disk drivers or filesystems drivers. For me it worked fine, so it must be only on some combinations. The changes to ll_rw_block.c look quite extensive.

Yes. Jens Axboe confirmed yesterday that the plug changes broke RAID.

I tracked this down and found two problems:

- The new plug/unplug code does not check for underruns. That allows the plug count (ioc->plugged) to become negative. This gets triggered from various places.

AFAICS this is intentional to avoid checks all over the place, but the underflow check is missing. All we need to do is make sure, that in case of ioc->plugged == 0 we return early and bug, if there is either a queue plugged in or the plugged_list is not empty.

Jens ?

Quoted 7 lines

- The raid1 code has no bitmap set in remount r/w. So the pending_bio_list gets not processed for quite a time. The workaround is to kick mddev->thread, so the list is processed. Not sure about that.

Neil ?

At least it boots and behaves normal.

Yes, it works fine now. Thanks!

Quoted 1 line

tglx

Regards,
Michal

Signature · 3 lines
Michal K. K. Piotrowski
LTG - Linux Testers Group
(http://www.stardust.webpages.pl/ltg/)
#9 lore raw

Re: [patch-mm] Workaround for RAID breakage

In reply to Thomas Gleixner
Quoted 14 lines · Thomas Gleixner
Quoted 6 lines · Thomas Gleixner
Quoted 4 lines

Thomas saw something similar yesterday and he the partial results that git.block (between rc2-mm1 and rc4-mm1) breaks certain disk drivers or filesystems drivers. For me it worked fine, so it must be only on some combinations. The changes to ll_rw_block.c look quite extensive.

Yes. Jens Axboe confirmed yesterday that the plug changes broke RAID.

I tracked this down and found two problems:

- The new plug/unplug code does not check for underruns. That allows the plug count (ioc->plugged) to become negative. This gets triggered from various places.

Quoted 6 lines

AFAICS this is intentional to avoid checks all over the place, but the underflow check is missing. All we need to do is make sure, that in case of ioc->plugged == 0 we return early and bug, if there is either a queue plugged in or the plugged_list is not empty.

Jens ?

It should not go negative, that would be a bug elsewhere. So it's interesting if it does, we should definitely put a WARN_ON() check in there for that.

Quoted 5 lines

- The raid1 code has no bitmap set in remount r/w. So the pending_bio_list gets not processed for quite a time. The workaround is to kick mddev->thread, so the list is processed. Not sure about that.

Neil ?

Super, thanks for that Thomas! I'll merge it in the plug branch.

Signature · 1 line
Jens Axboe
#10 lore raw

Re: [patch-mm] Workaround for RAID breakage

Quoted 10 lines · Jens Axboe
Quoted 6 lines

AFAICS this is intentional to avoid checks all over the place, but the underflow check is missing. All we need to do is make sure, that in case of ioc->plugged == 0 we return early and bug, if there is either a queue plugged in or the plugged_list is not empty.

Jens ?

It should not go negative, that would be a bug elsewhere. So it's interesting if it does, we should definitely put a WARN_ON() check in there for that.

Well. All offenders come via queue_sync_plugs(). queue_sync_plugs() calls blk_unplug_current().

One path which triggers is blk_sync_queue(). This happens e.g. in the cleanup of the floppy check. There are other call pathes too.

The other is raid md_super_write(). It is not plugged and calls with the barrier bit set, which executes the unlikely path in __make_request():

        if (unlikely(bio_barrier(bio))) {
                queue_sync_plugs(q);
                spin_lock_irq(q->queue_lock);
                goto get_rq;
        }

So you either need checks all over the place to avoid calling blk_unplug_current(), or you prevent the unplug below 0 like I did. The BUG_ON()s I added should catch any real invalid callers. But it's up to you.

tglx

#11 lore raw

Re: [patch-mm] Workaround for RAID breakage

Quoted 6 lines · Thomas Gleixner
Quoted 5 lines · Jens Axboe
Quoted 5 lines

AFAICS this is intentional to avoid checks all over the place, but the underflow check is missing. All we need to do is make sure, that in case of ioc->plugged == 0 we return early and bug, if there is either a queue plugged in or the plugged_list is not empty.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Jens ?

It should not go negative, that would be a bug elsewhere. So it's interesting if it does, we should definitely put a WARN_ON() check in there for that.

Well. All offenders come via queue_sync_plugs(). queue_sync_plugs() calls blk_unplug_current().

Ah, again a problem because the #plug branch wasn't pushed to #for-akpm in due time. That problem was fixed already :/

Quoted 12 lines

One path which triggers is blk_sync_queue(). This happens e.g. in the cleanup of the floppy check. There are other call pathes too.

The other is raid md_super_write(). It is not plugged and calls with the barrier bit set, which executes the unlikely path in __make_request():

        if (unlikely(bio_barrier(bio))) {
                queue_sync_plugs(q);
                spin_lock_irq(q->queue_lock);
                goto get_rq;
        }
Quoted 4 lines

So you either need checks all over the place to avoid calling blk_unplug_current(), or you prevent the unplug below 0 like I did. The BUG_ON()s I added should catch any real invalid callers. But it's up to you.

blk_replug_current_nested() should do it. I'll make sure the branch is updated for next -mm.

The BUG_ON()'s are indeed correct, they should just be moved further down the function.

Signature · 1 line
Jens Axboe