From: NeilBrown <neilb@cse.unsw.edu.au>
To: Marcelo Tosatti <marcelo@conectiva.com.br>
Cc: linux-raid@vger.kernel.org
Subject: [PATCH] md - 3 of 3 - Avoid races by never no releasing rdev->sb for faulty devices.
Date: Tue, 17 Dec 2002 13:00:50 +1100 [thread overview]
Message-ID: <E18O72Q-0000pZ-00@notabene.cse.unsw.edu.au> (raw)
There are races relating to the superblocks being written out
just as a device has failed, and the rdev->sb getting freeing while
it is being written out. This patch tries to avoid one of the
races by testing the faulty bit in the superblock (which gets set
early) as well as rdev->faulty (which gets set late), and does not
free rdev->sb until the rdev is fully removed, thus making the races
less critical.
----------- Diffstat output ------------
./drivers/md/md.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff ./drivers/md/md.c~current~ ./drivers/md/md.c
--- ./drivers/md/md.c~current~ 2002-12-16 16:29:52.000000000 +1100
+++ ./drivers/md/md.c 2002-12-16 16:30:42.000000000 +1100
@@ -1048,7 +1048,11 @@ repeat:
printk("(skipping faulty ");
if (rdev->alias_device)
printk("(skipping alias ");
-
+ if (disk_faulty(&rdev->sb->this_disk)) {
+ printk("(skipping new-faulty %s )\n",
+ partition_name(rdev->dev));
+ continue;
+ }
printk("%s ", partition_name(rdev->dev));
if (!rdev->faulty && !rdev->alias_device) {
printk("[events: %08lx]",
@@ -1075,7 +1079,6 @@ repeat:
* - the device is nonexistent (zero size)
* - the device has no valid superblock
*
- * a faulty rdev _never_ has rdev->sb set.
*/
static int md_import_device(kdev_t newdev, int on_disk)
{
@@ -1147,8 +1150,6 @@ static int md_import_device(kdev_t newde
md_list_add(&rdev->all, &all_raid_disks);
MD_INIT_LIST_HEAD(&rdev->pending);
- if (rdev->faulty && rdev->sb)
- free_disk_sb(rdev);
return 0;
abort_free:
@@ -3062,7 +3063,6 @@ int md_error(mddev_t *mddev, kdev_t rdev
return 0;
if (!mddev->pers->error_handler
|| mddev->pers->error_handler(mddev,rdev) <= 0) {
- free_disk_sb(rrdev);
rrdev->faulty = 1;
} else
return 1;
reply other threads:[~2002-12-17 2:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=E18O72Q-0000pZ-00@notabene.cse.unsw.edu.au \
--to=neilb@cse.unsw.edu.au \
--cc=linux-raid@vger.kernel.org \
--cc=marcelo@conectiva.com.br \
/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).