From: Xiao Ni <xni@redhat.com>
To: NeilBrown <neilb@suse.com>
Cc: linux-raid@vger.kernel.org
Subject: Re: The dev node can't be released at once after stopping raid
Date: Thu, 31 Aug 2017 03:16:50 -0400 (EDT) [thread overview]
Message-ID: <716638049.3884368.1504163810231.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <8760d4fd25.fsf@notabene.neil.brown.name>
----- Original Message -----
> From: "NeilBrown" <neilb@suse.com>
> To: "Xiao Ni" <xni@redhat.com>
> Cc: linux-raid@vger.kernel.org
> Sent: Thursday, August 31, 2017 2:48:02 PM
> Subject: Re: The dev node can't be released at once after stopping raid
>
> On Thu, Aug 31 2017, Xiao Ni wrote:
> >
> > There is a bug https://bugzilla.redhat.com/show_bug.cgi?id=1444434.
> > Another tool(blivet) stops raid device and the device node still exists.
> > Then it calls mdadm -S xxx again and it fails.
>
> I would suggest that the tool is broken. It should trust mdadm and not
> double check that it actually worked.
>
> > So I ask myself why
> > /dev/mdxxx can't be removed immediately after command mdadm -S.
>
> Because udev is asynchronous. You cannot rely on things happening
> instantly. udev doesn't work that way.
>
> mdadm has a function 'wait_for()' which waits for the device name to
> appear when the array is started. Possibly we could add something to
> wait for udev to remove the device when the array is stopped, but I
> really think it shouldn't be necessary. Nothing should look at the name
> after the device is stopped.
Hmm I want to try it. There are many topics about /dev/mdxx exists after
stop array before. I want to stop this topic forever.
Can we remove /dev/mdxx directly? Something like this:
diff --git a/Manage.c b/Manage.c
index b82a729..04994b3 100644
--- a/Manage.c
+++ b/Manage.c
@@ -482,6 +482,7 @@ done:
map_lock(&map);
map_remove(&map, devnm);
map_unlock(&map);
+ unlink(devname);
out:
sysfs_free(mdi);
Best Regards
Xiao
>
> >
> > In topic "MD Remnants After –stop", you said the REMOVE events are
> > generated by "md_free() -> del_gendisk() -> blk_unregister_queue()".
> > When mdadm -S return, the REMOVE events should be generated already,
> > right?
>
> Not necessarily. md_free is called from mddev_delayed_delete, which is
> run on a work-queue, so might be delayed briefly.
>
> >
> > I always have a question. Who is responsible for removing the device
> > node under /dev/ directory? The function unlink()?
>
> udev is responsible for removing the device. Obviously udev uses unlink()
> to do this.
>
> NeilBrown
>
>
next prev parent reply other threads:[~2017-08-31 7:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <51439640.15505639.1496113073965.JavaMail.zimbra@redhat.com>
2017-06-01 3:47 ` The dev node can't be released at once after stopping raid Xiao Ni
2017-06-01 4:43 ` Zhilong Liu
2017-06-01 5:50 ` Xiao Ni
2017-08-31 3:55 ` Xiao Ni
2017-08-31 4:36 ` NeilBrown
2017-08-31 6:17 ` Xiao Ni
2017-08-31 6:48 ` NeilBrown
2017-08-31 7:16 ` Xiao Ni [this message]
2017-08-31 23:39 ` NeilBrown
2017-09-01 0:30 ` Xiao Ni
2017-09-01 4:34 ` 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=716638049.3884368.1504163810231.JavaMail.zimbra@redhat.com \
--to=xni@redhat.com \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.com \
/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).