From: Tejun Heo <tj@kernel.org>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Neil Brown <neilb@suse.de>,
linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org,
Doug Ledford <dledford@redhat.com>, Greg KH <greg@kroah.com>,
Jens Axboe <jens.axboe@oracle.com>
Subject: Re: [PATCH 1/2] md: make devices disappear when they are no longer needed.
Date: Mon, 24 Nov 2008 15:56:12 +0900 [thread overview]
Message-ID: <492A500C.9090200@kernel.org> (raw)
In-Reply-To: <20081124062417.GZ28946@ZenIV.linux.org.uk>
Al Viro wrote:
>> I suppose so. Maybe just void (*release)(struct gendisk *) but Jens is
>> the maintainer. Jens, what do you think?
>
> First of all, release is already taken (with exactly that argument, BTW).
Right. :-(
> And doing that at freeing gendisk is a bad idea - md.ko might have been
> long gone by the time you've got there, not to mention anything else...
> IOW, it's too late; once the damn thing is not opened anymore (and nobody
> is the middle of trying to open it), the module might be dead and gone,
> so all uses of ->private_data and ->fops are illegal aftenr that point.
mddev holds module reference and till the gendisk is gone mddev won't
be gone, so as long as gendisk is around the respective mddev and
md.ko are around.
This is because creation and deletion of md devices are managed by
userland and the module is kept referenced as long as there are active
devices. The current block interface only verifies ops availability
before open and asks drivers to verify object validity separately in
->open, which makes sense if the intention is to allow rmmod while
devices are hot, but it also requires the low level driver to
implement index of all active devices and look them up atomically
during ->open, which sometimes is unnatural to implement as it's
unnecesary for any other purpose and can create subtle races as shown
by md.
I don't think it's necessary to allow modules to unload while devices
are hot. SCSI doesn't follow it (at least not at the block layer),
nor does md. It's seldom necessary to unload those modules in the
first place and when necessary active devices can be killed via sysfs
or mdadm (which BTW makes more sense to me - kill the users before
unloading the module). Without such requirement, both block and
character devices can stick with more regular reference counting like
the rest of the kernel.
Thanks.
--
tejun
next prev parent reply other threads:[~2008-11-24 6:56 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-24 3:55 [PATCH 0/2] RFC: allow md devices to disappear when not in use NeilBrown
2008-11-24 3:55 ` [PATCH 1/2] md: make devices disappear when they are no longer needed NeilBrown
2008-11-24 4:18 ` Tejun Heo
2008-11-24 5:13 ` Neil Brown
2008-11-24 5:34 ` Tejun Heo
2008-11-24 6:10 ` NeilBrown
2008-11-24 6:12 ` Tejun Heo
2008-11-24 6:24 ` Al Viro
2008-11-24 6:56 ` Tejun Heo [this message]
2008-11-24 13:31 ` Al Viro
2008-11-24 14:04 ` Tejun Heo
2008-11-24 14:26 ` Tejun Heo
2008-11-24 14:48 ` Al Viro
2008-11-24 16:08 ` Tejun Heo
2008-11-24 16:42 ` Al Viro
2008-11-24 17:18 ` Tejun Heo
2008-11-28 0:23 ` Neil Brown
2008-11-24 4:24 ` Al Viro
2008-11-24 4:47 ` Neil Brown
2008-11-24 6:38 ` Al Viro
2008-11-24 3:55 ` [PATCH 2/2] Allow md devices to be created by name 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=492A500C.9090200@kernel.org \
--to=tj@kernel.org \
--cc=dledford@redhat.com \
--cc=greg@kroah.com \
--cc=jens.axboe@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.de \
--cc=viro@ZenIV.linux.org.uk \
/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).