From: Janek Kozicki <janek_listy@wp.pl>
Cc: linux-raid@vger.kernel.org
Subject: Re: [PATCH 001 of 9] md: Fix deadlock in md/raid1 and md/raid10 when handling a read error.
Date: Thu, 6 Mar 2008 17:34:42 +0100 [thread overview]
Message-ID: <20080306173442.4516645f@szpak> (raw)
In-Reply-To: <20080306105134.GC32242@skl-net.de>
Andre Noll said: (by the date of Thu, 6 Mar 2008 11:51:34 +0100)
> But is that enough to avoid the deadlock? I think the following
> scenario would be possible with the code in the original patch:
>
> // suppose conf->pending_bio_list.head==NULL ATM
>
> CPU0:
> int rv = 0;
> spin_lock_irq(&conf->device_lock);
> if (conf->pending_bio_list.head) // false
> spin_unlock_irq(&conf->device_lock);
>
> CPU1:
> conf->pending_bio_list.head = something;
>
> CPU0:
> return rv; // zero
Remember that it's impossible to predict when is executed what. This
scenario can be true also, will it work?
CPU0:
int rv = 0;
CPU1:
conf->
CPU0:
spin_lock_irq(&conf->device_lock);
CPU1:
->pending_bio_list.
CPU0:
if (conf->pending_bio_list.head) // false
CPU1:
.head =
CPU0:
spin_unlock_irq(&conf->device_lock);
return rv; // zero
CPU1:
= something;
This is exaggerated of course. But if you want to think "concurrent
execution" you must think that way.
--
Janek Kozicki |
next prev parent reply other threads:[~2008-03-06 16:34 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-03 0:16 [PATCH 000 of 9] md: Introduction EXPLAIN PATCH SET HERE NeilBrown
2008-03-03 0:17 ` [PATCH 001 of 9] md: Fix deadlock in md/raid1 and md/raid10 when handling a read error NeilBrown
2008-03-03 15:54 ` Andre Noll
2008-03-04 6:08 ` Neil Brown
2008-03-04 11:29 ` Andre Noll
2008-03-06 3:29 ` Neil Brown
2008-03-06 10:51 ` Andre Noll
2008-03-06 16:34 ` Janek Kozicki [this message]
2008-03-03 0:17 ` [PATCH 002 of 9] md: Reduce CPU wastage on idle md array with a write-intent bitmap NeilBrown
2008-03-03 0:17 ` [PATCH 003 of 9] md: Guard against possible bad array geometry in v1 metadata NeilBrown
2008-03-03 0:17 ` [PATCH 004 of 9] md: Clean up irregularity with raid autodetect NeilBrown
2008-03-03 0:17 ` [PATCH 005 of 9] md: Make sure a reshape is started when device switches to read-write NeilBrown
2008-03-03 0:17 ` [PATCH 006 of 9] md: Lock access to rdev attributes properly NeilBrown
2008-03-03 0:17 ` [PATCH 007 of 9] md: Don't attempt read-balancing for raid10 'far' layouts NeilBrown
2008-03-03 0:17 ` [PATCH 008 of 9] md: Fix possible raid1/raid10 deadlock on read error during resync NeilBrown
2008-03-03 0:18 ` [PATCH 009 of 9] md: The md RAID10 resync thread could cause a md RAID10 array deadlock NeilBrown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080306173442.4516645f@szpak \
--to=janek_listy@wp.pl \
--cc=linux-raid@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).