From: NeilBrown <neilb@suse.com>
To: Marc Smith <marc.smith@mcc.edu>
Cc: linux-raid@vger.kernel.org
Subject: Re: MD Remnants After --stop
Date: Mon, 28 Nov 2016 09:20:42 +1100 [thread overview]
Message-ID: <8760n8a7k5.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <CAHkw+LfJzZoWVnO8kDi+YVV09fas2DveQoChh10wEBZfYin6aQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 4146 bytes --]
On Sun, Nov 27 2016, Marc Smith wrote:
> So, I modified mdopen.c to look like this:
>
> --- a/mdopen.c 2016-11-25 17:04:25.782299330 -0500
> +++ b/mdopen.c 2016-11-26 10:57:35.883621355 -0500
> @@ -416,7 +416,7 @@
> */
> int open_mddev(char *dev, int report_errors)
> {
> - int mdfd = open(dev, O_RDWR);
> + int mdfd = open(dev, O_RDONLY);
> if (mdfd < 0 && errno == EACCES)
> mdfd = open(dev, O_RDONLY);
> if (mdfd < 0) {
>
>
> And now, when running 'mdadm --stop' here is what I see...
>
> From the output 'udevadm monitor -pku':
>
> --snip--
> KERNEL[297486.536908] offline
> /kernel/dlm/62fccfd6-605f-19e6-be6d-99a1e3cb987e (dlm)
> ACTION=offline
> DEVPATH=/kernel/dlm/62fccfd6-605f-19e6-be6d-99a1e3cb987e
> LOCKSPACE=62fccfd6-605f-19e6-be6d-99a1e3cb987e
> SEQNUM=3651
> SUBSYSTEM=dlm
>
> UDEV [297486.537541] offline
> /kernel/dlm/62fccfd6-605f-19e6-be6d-99a1e3cb987e (dlm)
> ACTION=offline
> DEVPATH=/kernel/dlm/62fccfd6-605f-19e6-be6d-99a1e3cb987e
> LOCKSPACE=62fccfd6-605f-19e6-be6d-99a1e3cb987e
> SEQNUM=3651
> SUBSYSTEM=dlm
> USEC_INITIALIZED=7486537404
>
> KERNEL[297486.538325] remove
> /kernel/dlm/62fccfd6-605f-19e6-be6d-99a1e3cb987e (dlm)
> ACTION=remove
> DEVPATH=/kernel/dlm/62fccfd6-605f-19e6-be6d-99a1e3cb987e
> LOCKSPACE=62fccfd6-605f-19e6-be6d-99a1e3cb987e
> SEQNUM=3652
> SUBSYSTEM=dlm
>
> UDEV [297486.538644] remove
> /kernel/dlm/62fccfd6-605f-19e6-be6d-99a1e3cb987e (dlm)
> ACTION=remove
> DEVPATH=/kernel/dlm/62fccfd6-605f-19e6-be6d-99a1e3cb987e
> LOCKSPACE=62fccfd6-605f-19e6-be6d-99a1e3cb987e
> SEQNUM=3652
> SUBSYSTEM=dlm
> USEC_INITIALIZED=86538345
> --snip--
>
> And from the kernel log:
>
> --snip--
> [297504.958244] md127: detected capacity change from 73340747776 to 0
> [297504.958249] md: md127 stopped.
> [297504.958884] dlm: 62fccfd6-605f-19e6-be6d-99a1e3cb987e: leaving the
> lockspace group...
> [297504.959004] udevd[487]: seq 3651 queued, 'offline' 'dlm'
> [297504.959161] udevd[487]: seq 3651 forked new worker [5392]
> [297504.959417] udevd[5392]: seq 3651 running
> [297504.959474] udevd[5392]: no db file to read
> /run/udev/data/+dlm:62fccfd6-605f-19e6-be6d-99a1e3cb987e: No such file
> or directory
> [297504.959524] udevd[5392]: passed device to netlink monitor 0x2251c30
> [297504.959527] udevd[5392]: seq 3651 processed
> [297504.960101] dlm: 62fccfd6-605f-19e6-be6d-99a1e3cb987e: group event done 0 0
> [297504.960299] dlm: 62fccfd6-605f-19e6-be6d-99a1e3cb987e:
> release_lockspace final free
> [297504.960329] md: unbind<dm-0>
> [297504.960448] udevd[487]: seq 3652 queued, 'remove' 'dlm'
> [297504.960500] udevd[487]: passed 214 byte device to netlink monitor 0x224b130
> [297504.960584] udevd[5392]: seq 3652 running
> [297504.960606] udevd[5392]: no db file to read
> /run/udev/data/+dlm:62fccfd6-605f-19e6-be6d-99a1e3cb987e: No such file
> or directory
> [297504.967168] md: export_rdev(dm-0)
> [297504.967231] md: unbind<dm-1>
> [297504.975176] md: export_rdev(dm-1)
> --snip--
>
> So that did get rid of the synthesized CHANGE event, but still no
> REMOVE event. =)
>
> Still trying to rule-out there isn't anything strange with my Linux
> distro / setup... but I assume even if udev was mishandling something,
> we should still be seeing a REMOVE event on '--stop'.
>
Getting rid of the CHANGE events is good as they can muddy the waters a
bit.
The lack of a REMOVE event suggests that something it still holding a
reference to the 'md' kobject. There aren't many references though.
One is held when the array is active. That is dropped by
mddev_delayed_delete() which is called from a work-queue. So it can be
delayed a little bit, but not much.
The other references are held by member devices, and dropped when the
devices are unbound from the array - and the kernel log shows the
"unbind" messages.
In either case, if there is a reference outstanding, there should be
some evidence in the /sys/mdXX/md directory. Either a 'dev-XX'
directory or the various bitmap attributes..
Can you report the result of
find /sys/block/md127/md
and
find /sys/block/md127/md -type file | xargs grep .
after stopping the array?
Thanks,
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2016-11-27 22:20 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-04 15:35 MD Remnants After --stop Marc Smith
2016-11-07 5:44 ` NeilBrown
2016-11-18 19:31 ` Marc Smith
2016-11-21 3:42 ` NeilBrown
2016-11-21 14:08 ` Marc Smith
2016-11-22 15:12 ` Marc Smith
2016-11-22 23:51 ` NeilBrown
2016-11-23 15:21 ` Marc Smith
2016-11-23 23:38 ` NeilBrown
2016-11-26 16:41 ` Marc Smith
2016-11-27 22:20 ` NeilBrown [this message]
2016-11-28 2:25 ` Marc Smith
2016-12-01 2:52 ` NeilBrown
2016-12-01 19:40 ` Marc Smith
2016-12-01 22:35 ` NeilBrown
2016-12-02 18:18 ` Stephane Thiell
2016-12-02 19:12 ` Marc Smith
2016-12-02 20:22 ` Marc Smith
2016-12-05 0:41 ` NeilBrown
2016-12-05 21:37 ` Marc Smith
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=8760n8a7k5.fsf@notabene.neil.brown.name \
--to=neilb@suse.com \
--cc=linux-raid@vger.kernel.org \
--cc=marc.smith@mcc.edu \
/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).