From: "J. Bruce Fields" <bfields@fieldses.org>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH 10/23] NFSD: move lockd_up() before svc_addsock()
Date: Mon, 9 Mar 2009 14:19:51 -0400 [thread overview]
Message-ID: <20090309181951.GC9408@fieldses.org> (raw)
In-Reply-To: <565D1A54-1E66-46B0-B57A-E7108BC12E9D@oracle.com>
On Mon, Mar 09, 2009 at 02:15:11PM -0400, Chuck Lever wrote:
>
> On Mar 5, 2009, at Mar 5, 2009, 4:32 PM, Chuck Lever wrote:
>
>> Clean up.
>>
>> A couple of years ago, a series of commits, finishing with commit
>> 5680c446, swapped the order of the lockd_up() and svc_addsock() calls
>> in __write_ports(). At that time lockd_up() needed to know the
>> transport protocol of the passed-in socket to start a listener on the
>> same transport protocol.
>>
>> These days, lockd_up() doesn't take a protocol argument; it always
>> starts both a UDP and TCP listener. It's now more straightforward to
>> try the lockd_up() first, then do a lockd_down() if the svc_addsock()
>> fails.
>>
>> Careful review of this code shows that the svc_sock_names() call is
>> used only to close the just-opened socket in case lockd_up() fails.
>> So it is no longer needed if lockd_up() is done first.
>>
>> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
>> ---
>>
>> fs/nfsd/nfsctl.c | 19 ++++++++++---------
>> 1 files changed, 10 insertions(+), 9 deletions(-)
>>
>> diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
>> index 80f773b..aa60191 100644
>> --- a/fs/nfsd/nfsctl.c
>> +++ b/fs/nfsd/nfsctl.c
>> @@ -908,17 +908,18 @@ static ssize_t __write_ports_addfd(char *buf)
>> if (err != 0)
>> return err;
>>
>> - err = svc_addsock(nfsd_serv, fd, buf);
>> - if (err >= 0) {
>> - err = lockd_up();
>> - if (err < 0)
>> - svc_sock_names(buf + strlen(buf) + 1, nfsd_serv, buf);
>> + err = lockd_up();
>> + if (err != 0)
>> + goto out;
>>
>> - /* Decrease the count, but don't shut down the service */
>> - nfsd_serv->sv_nrthreads--;
>> - }
>> + err = svc_addsock(nfsd_serv, fd, buf);
>> + if (err != 0)
>
> Found the "lockd: no users" BUG... this line needs to be "if (err < 0)".
> Fix tested by Jeff Layton.
OK, good. Will you resend that one patch at some point? Are there any
known problems left with that series?
--b.
>
>> + lockd_down();
>>
>> - return err < 0 ? err : 0;
>> +out:
>> + /* Decrease the count, but don't shut down the service */
>> + nfsd_serv->sv_nrthreads--;
>> + return err;
>> }
>>
>> /*
>
> --
> Chuck Lever
> chuck[dot]lever[at]oracle[dot]com
next prev parent reply other threads:[~2009-03-09 18:19 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-05 21:31 [PATCH 00/23] Clean ups and bug fixes for 2.6.30 Chuck Lever
[not found] ` <20090305212823.21342.38352.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2009-03-05 21:31 ` [PATCH 01/23] SUNRPC: Fix return type of svc_addr_len() Chuck Lever
2009-03-05 21:31 ` [PATCH 02/23] SUNRPC: Clean up static inline functions in svc_xprt.h Chuck Lever
2009-03-05 21:31 ` [PATCH 03/23] SUNRPC: Clean up svc_find_xprt() calling sequence Chuck Lever
2009-03-05 21:31 ` [PATCH 04/23] NFSD: Refactor transport removal out of __write_ports() Chuck Lever
2009-03-05 21:32 ` [PATCH 05/23] NFSD: Refactor transport addition " Chuck Lever
2009-03-05 21:32 ` [PATCH 06/23] NFSD: Refactor portlist socket closing into a helper Chuck Lever
2009-03-05 21:32 ` [PATCH 07/23] NFSD: Refactor socket creation out of __write_ports() Chuck Lever
2009-03-05 21:32 ` [PATCH 08/23] NFSD: Note an additional requirement when passing TCP sockets to portlist Chuck Lever
2009-03-05 21:32 ` [PATCH 09/23] NFSD: Finish refactoring __write_ports() Chuck Lever
2009-03-05 21:32 ` [PATCH 10/23] NFSD: move lockd_up() before svc_addsock() Chuck Lever
[not found] ` <20090305213238.21342.13075.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2009-03-09 18:15 ` Chuck Lever
2009-03-09 18:19 ` J. Bruce Fields [this message]
2009-03-09 18:24 ` Chuck Lever
2009-03-05 21:32 ` [PATCH 11/23] NFSD: Prevent a buffer overflow in svc_xprt_names() Chuck Lever
2009-03-05 21:32 ` [PATCH 12/23] SUNRPC: pass buffer size to svc_addsock() Chuck Lever
2009-03-05 21:33 ` [PATCH 13/23] SUNRPC: pass buffer size to svc_sock_names() Chuck Lever
2009-03-05 21:33 ` [PATCH 14/23] SUNRPC: Switch one_sock_name() to use snprintf() Chuck Lever
2009-03-05 21:33 ` [PATCH 15/23] SUNRPC: Support PF_INET6 in one_sock_name() Chuck Lever
2009-03-05 21:33 ` [PATCH 16/23] SUNRPC: Clean up one_sock_name() Chuck Lever
2009-03-05 21:33 ` [PATCH 17/23] NFS: Move NFS client's IP address parser to nfs_common/ Chuck Lever
[not found] ` <20090305213330.21342.96742.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2009-03-06 2:10 ` Jeff Layton
[not found] ` <20090305211001.2fbecabe-PC62bkCOHzGdMjc06nkz3ljfA9RmPOcC@public.gmane.org>
2009-03-06 16:16 ` Chuck Lever
2009-03-06 16:33 ` Jeff Layton
2009-03-05 21:33 ` [PATCH 18/23] NFSD: Support IPv6 addresses in write_failover_ip() Chuck Lever
2009-03-05 21:33 ` [PATCH 19/23] NFSD: Prevent buffer overflow in write_threads() Chuck Lever
2009-03-05 21:33 ` [PATCH 20/23] NFSD: Prevent buffer overflow in write_versions() Chuck Lever
2009-03-05 21:34 ` [PATCH 21/23] NFSD: Prevent buffer overflow in write_maxblksize() Chuck Lever
2009-03-05 21:34 ` [PATCH 22/23] NFSD: Prevent buffer overflow in write_leasetime() Chuck Lever
2009-03-05 21:34 ` [PATCH 23/23] NFSD: Prevent buffer overflow in write_recoverydir() Chuck Lever
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=20090309181951.GC9408@fieldses.org \
--to=bfields@fieldses.org \
--cc=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
/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