From: Andrew Morton <akpm@osdl.org>
To: Neil Brown <neilb@cse.unsw.edu.au>
Cc: linux-raid@vger.kernel.org, Jens Axboe <axboe@suse.de>
Subject: Re: [PATCH md 3 of 4] Delete unplug timer before shutting down md array.
Date: Mon, 1 Nov 2004 21:33:33 -0800 [thread overview]
Message-ID: <20041101213333.201769d0.akpm@osdl.org> (raw)
In-Reply-To: <16775.3329.279178.375487@cse.unsw.edu.au>
(Added Jens)
Neil Brown <neilb@cse.unsw.edu.au> wrote:
>
> On Monday November 1, akpm@osdl.org wrote:
> > Andrew Morton <akpm@osdl.org> wrote:
> > >
> > > NeilBrown <neilb@cse.unsw.edu.au> wrote:
> > > >
> > > > As the unplug timer can potentially fire at any time, and
> > > > and it access data that is released by the md ->stop function,
> > > > we need to del_timer_sync before releasing that data.
> > >
> > > raid really shouldn't know about unplug_timer.
> > >
> >
> > I mean, if we're actually destroying the queue then blk_cleanup_queue()
> > should have done the right thing here. If we're not destroying the queue
> > then an unplug timer expiry should be benign.
> >
> > Bit confused as to what's happening here.
>
> Not surprising. It's a bit ugly.
>
> md has the misfortune of working in a way that doesn't fit very well
> with some aspects of the blkdev layer.
>
> To create an md array, you open /dev/mdX, and use some ioctls to set
> up the array. Thus the block device must exist internally as a block
> device before any details about it are available.
>
> Similarly, to shut down an array, you open /dev/mdX and use an ioctl
> to shut it down. This it will still be open (though only once) after
> it has been shut down.
>
> (as I understand it) I can only safely use blk_cleanup_queue on the
> queue after (or during) the last close. Thus I cannot use it while
> shutting down an array.
> However I need to release the md personality as part of shutting down
> the array, so I have to disable the unplug function (which is handled
> by the personality).
>
> I could change ->unplug_fn to point to something safe, but there is
> still a race with the timer going off at just the wrong time.
hm, OK. So perhaps using /dev/mdX as a control channel for creating and
destroying /dev/mdX was unfortunate design. Ho hum.
> Maybe an API that allowed by to change ->make_request_fn and
> ->unplug_fn (and possibly others) and then call some interface, and be
> sure that no internal use of those functions would occur after given
> interface was called.
> This interface could then just do the del_timer_sync.
Something like that would be nicer, I think - a centralised point with
nicely apologetic commentary rather than mysterious open-coded poking at
block internals ;)
next prev parent reply other threads:[~2004-11-02 5:33 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-02 3:37 [PATCH md 0 of 4] Introduction NeilBrown
2004-11-02 3:37 ` [PATCH md 4 of 4] "Faulty" personality of md NeilBrown
2004-11-02 9:31 ` Lars Marowsky-Bree
2004-11-02 23:30 ` Neil Brown
2004-11-02 3:37 ` [PATCH md 3 of 4] Delete unplug timer before shutting down md array NeilBrown
2004-11-02 4:57 ` Andrew Morton
2004-11-02 5:00 ` Andrew Morton
2004-11-02 4:28 ` Neil Brown
2004-11-02 5:33 ` Andrew Morton [this message]
2004-11-02 7:12 ` Luca Berra
2004-11-03 0:29 ` Neil Brown
2004-11-03 23:03 ` Andrew Morton
2004-11-04 9:21 ` Jens Axboe
2004-11-05 8:52 ` Jens Axboe
2004-11-07 23:38 ` Neil Brown
2004-11-07 23:42 ` Andrew Morton
2004-11-08 1:21 ` Neil Brown
2004-11-08 11:23 ` Jens Axboe
2004-11-02 3:37 ` [PATCH md 2 of 4] Fix raid6 problem NeilBrown
2004-11-02 3:37 ` [PATCH md 1 of 4] Fix problem with md/linear for devices larger than 2 terabytes 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=20041101213333.201769d0.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=axboe@suse.de \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@cse.unsw.edu.au \
/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).