From: Neil Brown <neilb@suse.de>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] Re: [PATCH 2/2] Fix lockd panic
Date: Tue, 8 Jan 2008 16:31:49 +1100 [thread overview]
Message-ID: <18307.2757.579354.785142@notabene.brown> (raw)
In-Reply-To: <message from Wendy Cheng on Monday January 7>
On Monday January 7, wcheng at redhat.com wrote:
> This small patch has not been changed since our last discussion:
> http://www.opensubscriber.com/message/nfs at lists.sourceforge.net/6348912.html
>
> To recap the issue, a client could ask for a posix lock that invokes:
>
> >>> server calls nlm4svc_proc_lock() ->
> >>> * server lookup file (f_count++)
> >>> * server lock the file
> >>> * server calls nlm_release_host
> >>> * server calls nlm_release_file (f_count--)
> >>> * server return to client with status 0
> >>>
>
> As part of the lookup file, the lock stays on vfs inode->i_flock list
> with zero f_count. Any call into nlm_traverse_files() will BUG() in
> locks_remove_flock() (fs/locks.c:2034) during fclose(), if that file
> happens to be of no interest to that particular search. Since after
> nlm_inspect_file(), the logic unconditionally checks for possible
> removing of the file. As the file is not blocked, nothing to do with
> shares, and f_count is zero, it will get removed from hash and fclose()
> invoked with the posix lock hanging on i_flock list.
If I'm reading this correctly, this bug is introduced by your previous
patch.
The important difference between the old code and the new code here is
that the old code tests "file->f_locks" while the new code iterates
through i_flock to see if there are any lockd locks.
f_locks is set to a count of lockd locks in nlm_traverse_locks which
*was* always called by nlm_inspect_file which is called immediately
before the code you are changing.
But since your patch, nlm_inspect_file does not always call
nlm_traverse_locks, so there is a chance that f_locks is wrong.
With this patch, f_locks it not used at all any more.
Introducing a bug in one patch and fixing in the next is bad style.
Some options:
Have an initial patch which removes all references to f_locks and
includes the change in this patch. With that in place your main
patch won't introduce a bug. If you do this, you should attempt to
understand and justify the performance impact (does nlm_traverse_files
become quadratic in number of locks. Is that acceptable?).
Change the first patch to explicitly update f_count if you bypass the
call to nlm_inspect_file.
something else???
So NAK for this one in it's current form... unless I've misunderstood
something.
NeilBrown
>
> -- Wendy
>
> This fixes the incorrect fclose call inside nlm_traverse_files() where
> a posix lock could still be held by NFS client. Problem was found in a
> kernel panic inside locks_remove_flock() (fs/locks.c:2034) as part of
> the fclose call due to NFS-NLM locks still hanging on inode->i_flock list.
>
> Signed-off-by: S. Wendy Cheng <wcheng@redhat.com>
>
> svcsubs.c | 3 +--
> 1 files changed, 1 insertion(+), 2 deletions(-)
>
> --- linux-nlm-1/fs/lockd/svcsubs.c 2008-01-06 18:23:20.000000000 -0500
> +++ linux/fs/lockd/svcsubs.c 2008-01-06 18:24:12.000000000 -0500
> @@ -332,8 +332,7 @@ nlm_traverse_files(struct nlm_host *host
> mutex_lock(&nlm_file_mutex);
> file->f_count--;
> /* No more references to this file. Let go of it. */
> - if (list_empty(&file->f_blocks) && !file->f_locks
> - && !file->f_shares && !file->f_count) {
> + if (!nlm_file_inuse(file)) {
> hlist_del(&file->f_list);
> nlmsvc_ops->fclose(file->f_file);
> kfree(file);
next prev parent reply other threads:[~2008-01-08 5:31 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-07 5:39 [Cluster-devel] [PATCH 1/2] NLM failover unlock commands Wendy Cheng
[not found] ` <message from Wendy Cheng on Monday January 7>
2008-01-08 5:18 ` [Cluster-devel] " Neil Brown
2008-01-09 2:51 ` Wendy Cheng
2008-01-08 5:31 ` Neil Brown [this message]
2008-01-09 3:02 ` [Cluster-devel] Re: [PATCH 2/2] Fix lockd panic Wendy Cheng
2008-01-09 4:43 ` Wendy Cheng
2008-01-09 23:33 ` Wendy Cheng
2008-01-12 6:51 ` Wendy Cheng
2008-01-08 17:02 ` [Cluster-devel] Re: [PATCH 1/2] NLM failover unlock commands Christoph Hellwig
2008-01-08 17:49 ` Christoph Hellwig
2008-01-08 20:57 ` Wendy Cheng
2008-01-09 18:02 ` Christoph Hellwig
2008-01-10 7:59 ` Christoph Hellwig
2008-01-12 7:03 ` Wendy Cheng
2008-01-12 9:38 ` Christoph Hellwig
2008-01-14 23:07 ` J. Bruce Fields
[not found] ` <message from J. Bruce Fields on Monday January 14>
2008-01-14 23:31 ` Neil Brown
2008-01-22 22:53 ` J. Bruce Fields
[not found] ` <message from J. Bruce Fields on Tuesday January 22>
2008-01-24 4:02 ` Neil Brown
2008-01-15 16:14 ` Wendy Cheng
2008-01-15 16:30 ` J. Bruce Fields
[not found] ` <message from Wendy Cheng on Saturday January 12>
2008-01-14 23:52 ` Neil Brown
2008-01-15 20:17 ` Wendy Cheng
[not found] ` <message from Wendy Cheng on Tuesday January 15>
2008-01-15 20:50 ` Neil Brown
2008-01-15 20:56 ` Wendy Cheng
2008-01-15 22:48 ` Wendy Cheng
2008-01-17 15:10 ` J. Bruce Fields
2008-01-17 15:48 ` Wendy Cheng
2008-01-17 16:08 ` Wendy Cheng
2008-01-17 16:10 ` Wendy Cheng
2008-01-18 10:21 ` Frank van Maarseveen
2008-01-18 15:00 ` Wendy Cheng
2008-01-17 16:14 ` J. Bruce Fields
2008-01-17 16:17 ` Wendy Cheng
2008-01-17 16:21 ` J. Bruce Fields
2008-01-17 16:31 ` J. Bruce Fields
2008-01-17 16:31 ` Wendy Cheng
2008-01-17 16:40 ` J. Bruce Fields
[not found] ` <1200591323.13670.34.camel@dyn9047022153>
2008-01-17 17:59 ` Wendy Cheng
2008-01-17 18:07 ` Wendy Cheng
2008-01-17 20:23 ` J. Bruce Fields
2008-01-18 10:03 ` Frank van Maarseveen
2008-01-18 14:56 ` Wendy Cheng
2008-01-24 16:00 ` J. Bruce Fields
[not found] ` <4798BAAE.6090107@redhat.com>
2008-01-24 16:39 ` J. Bruce Fields
2008-01-24 19:45 ` Wendy Cheng
2008-01-24 20:19 ` J. Bruce Fields
2008-01-24 21:06 ` Wendy Cheng
2008-01-24 21:40 ` J. Bruce Fields
2008-01-24 21:49 ` Wendy Cheng
2008-01-28 3:46 ` Felix Blyakher
2008-01-28 15:56 ` Wendy Cheng
2008-01-28 17:06 ` Felix Blyakher
2008-01-16 4:19 ` Neil Brown
2008-01-09 3:49 ` Wendy Cheng
2008-01-09 16:13 ` J. Bruce Fields
-- strict thread matches above, loose matches on Subject: below --
2008-01-07 5:53 [Cluster-devel] [PATCH 2/2] Fix lockd panic Wendy Cheng
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=18307.2757.579354.785142@notabene.brown \
--to=neilb@suse.de \
/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).