From: Lou Langholtz <ldl@aros.net>
To: Paul.Clements@steeleye.com
Cc: linux-kernel@vger.kernel.org, Andrew Morton <akpm@digeo.com>,
Pavel Machek <pavel@ucw.cz>,
viro@parcelfarce.linux.theplanet.co.uk
Subject: Re: [RFC][PATCH] nbd driver for 2.5+: fix locking issues with ioctl UI
Date: Wed, 25 Jun 2003 16:17:34 -0600 [thread overview]
Message-ID: <3EFA1F7E.2080602@aros.net> (raw)
In-Reply-To: <Pine.LNX.4.10.10306251516570.11076-100000@clements.sc.steeleye.com>
Paul Clements wrote:
>. . . I guess I was just wondering why the
>tx_lock was pulled out of nbd_send_req(). It just seems to make the
>code harder to follow with the overlapping locking, the duplicated
>checks for sock == NULL, and it also means the tx_lock gets held
>(a little bit) longer...
>
Reviewing the code some more, I'm not sure why I moved the tx_lock out
from nbd_send_req(). Some possible explanations are:
1. nbd_send_req() was big enough without the locking in it.
2. keeps the locking at the same level as the spin_unlock_irq() which
makes lock analysis a little easier. it's also a more consistant
level to have at for consistantly locking accross all the ioctl
handling.
3. the next patch I had done (patch 7) implements a default blocking
strategy and having the lock be outside nbd_send_req made analysis
a little easier again. as in the last reason, the locking then
fell into place more consistantly level wise.
4. in order to have the locking inside nbd_send_req it would seem
it'd help to make nbd_send_req return a value that could be checked.
I'm not convinced by any of my own reasons though. Maybe it should be
inside. There aren't duplicated checks for sock == null except in
different execution paths so it doesn't get checked twice in a row if
that's what you mean. Just larger executable size as any inlining causes.
>>that since the user space tool opened the socket to begin with, it seems
>>a better design to have the user space tool do the close as well.
>>
>>
>
>I agree, but I thought that the shutdown was causing different behavior...
>
>
What behavior would the shutdown cause that close doesn't also cause?
>>When
>>nbd-client exits, it'd effect close of this socket anyway even if
>>killed.
>>
>>
>
>Does the socket close at exit have the same effect as a socket shutdown?
>If so, then I guess the shutdown is unnecessary...
>
I believe so. I thought someone from steeleye put the call in to begin
with just in order to close up a race condition gap and that's better
handled by not having the three seperate ioctls. My understanding is
that the shutdown is analogous to calling the shutdown() system call on
the socket which is just a way to individually shutdown the read side or
write side of the socket no? In anycase, I believe close (once really
finished) has the same net effect.
>>So you'd prefer to have a new ioctl then to do this rolled together
>>NBD_DO_IT function? Say NBD_RUN or something that takes the sock
>>
>>
>
>I do like the combined ioctl, as it seems to make the code a little bit
>cleaner and safer. But, it would also be nice to maintain compatibility
>with the existing userland tools. Maybe if the driver could support both
>new and old interfaces (at least for now), then users could gradually
>move over to the new interface(s)?
>
Agreed then. That's what I'd done in my original jumbo nbd patch
(maintain suport for old and new ioctls). So I'll work on that next
week. In the meantime, the nbd-client tool currently can't correctly set
the size of the device and either that needs to be worked around in the
driver (I'd done that in the original jumbo patch), or the nbd-client
tool needs to be updated (the patch I'd mailed out for nbd-client works
around the sizing issue by re-opening the nbd). To be clear, that's not
something any of the changes that have gone in so far broke nor address.
It's a consequence of how bd_set_size() is called in fs/block_dev.c
do_open(). One of the other drivers (in drivers/block I believe) works
around the problem by updating the info in the inode but it seems kind
of like a hack. Will someone who has worked on the fs/block_dev.c file
recently chime in on this issue of how to properly effect size?
Thanks for your input on this!!!
next prev parent reply other threads:[~2003-06-25 22:03 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-25 6:51 [RFC][PATCH] nbd driver for 2.5+: fix locking issues with ioctl UI Lou Langholtz
2003-06-25 7:19 ` Andrew Morton
2003-06-25 14:24 ` Lou Langholtz
2003-06-25 15:36 ` Lou Langholtz
2003-06-25 15:55 ` Christoph Hellwig
2003-06-25 17:38 ` Lou Langholtz
2003-06-25 17:44 ` Christoph Hellwig
2003-06-25 18:16 ` Lou Langholtz
2003-06-25 18:19 ` Christoph Hellwig
2003-06-25 17:58 ` Anyone for NBD maintainer [was Re: [RFC][PATCH] nbd driver for 2.5+: fix locking issues with ioctl UI] Pavel Machek
2003-06-25 18:21 ` Lou Langholtz
2003-06-25 18:30 ` Pavel Machek
2003-06-25 21:35 ` Lou Langholtz
[not found] ` <Pine.LNX.4.10.10306251645580.11076-100000@clements.sc.steeleye.com>
2003-06-25 21:09 ` NBD maintainer change [was Re: Anyone for NBD maintainer] Pavel Machek
2003-06-25 17:48 ` [RFC][PATCH] nbd driver for 2.5+: fix locking issues with ioctl UI Paul Clements
2003-06-25 17:56 ` viro
2003-06-25 18:57 ` Lou Langholtz
2003-06-25 19:41 ` Lou Langholtz
2003-06-25 20:00 ` Paul Clements
2003-06-25 22:17 ` Lou Langholtz [this message]
2003-06-28 17:13 ` Paul Clements
2003-06-30 16:10 ` Lou Langholtz
2003-06-28 17:20 ` [PATCH] nbd: maintain compatibility with existing nbd tools Paul Clements
2003-06-29 18:42 ` Pavel Machek
2003-06-29 21:04 ` [PATCH 2.5.73] " Paul Clements
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=3EFA1F7E.2080602@aros.net \
--to=ldl@aros.net \
--cc=Paul.Clements@steeleye.com \
--cc=akpm@digeo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=viro@parcelfarce.linux.theplanet.co.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).