From: NeilBrown <neilb@cse.unsw.edu.au>
To: Marcelo Tosatti <marcelo@conectiva.com.br>
Cc: linux-raid@vger.kernel.org
Subject: [PATCH] md - Resolve problem with refcounting of md arrays.
Date: Mon, 28 Jul 2003 16:56:43 +1000 [thread overview]
Message-ID: <E19h1w3-0002rB-00@notabene> (raw)
Because an md array may not exist yet when the device it opened, the ->active
count, which is incremented on opening if the array exists, is not 100% reliable.
This patch changes md to test inode->i_bdev->bd_openers rather than mddev->active
to test if an array is still in used before stopping it.
(patch against 2.4.22-pre9)
diff ./drivers/md/md.c~current~ ./drivers/md/md.c
--- ./drivers/md/md.c~current~ 2003-07-28 16:24:11.000000000 +1000
+++ ./drivers/md/md.c 2003-07-28 16:26:48.000000000 +1000
@@ -1805,10 +1805,12 @@ static int do_md_stop(mddev_t * mddev, i
int err = 0, resync_interrupted = 0;
kdev_t dev = mddev_to_kdev(mddev);
+#if 0 /* ->active is not currently reliable */
if (atomic_read(&mddev->active)>1) {
printk(STILL_IN_USE, mdidx(mddev));
OUT(-EBUSY);
}
+#endif
if (mddev->pers) {
/*
@@ -2742,12 +2744,17 @@ static int md_ioctl(struct inode *inode,
goto done_unlock;
case STOP_ARRAY:
- if (!(err = do_md_stop (mddev, 0)))
+ if (inode->i_bdev->bd_openers > 1)
+ err = -EBUSY;
+ else if (!(err = do_md_stop (mddev, 0)))
mddev = NULL;
goto done_unlock;
case STOP_ARRAY_RO:
- err = do_md_stop (mddev, 1);
+ if (inode->i_bdev->bd_openers > 1)
+ err = -EBUSY;
+ else
+ err = do_md_stop (mddev, 1);
goto done_unlock;
/*
reply other threads:[~2003-07-28 6:56 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=E19h1w3-0002rB-00@notabene \
--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