From: Wendy Cheng <wcheng@redhat.com>
To: NFS list <linux-nfs@vger.kernel.org>
Cc: cluster-devel@redhat.com
Subject: [PATCH 2/2] Fix lockd panic
Date: Mon, 07 Jan 2008 00:53:54 -0500 [thread overview]
Message-ID: <4781BE72.7050404@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1055 bytes --]
This small patch has not been changed since our last discussion:
http://www.opensubscriber.com/message/nfs@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.
-- Wendy
[-- Attachment #2: unlock_002.patch --]
[-- Type: text/x-patch, Size: 939 bytes --]
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 reply other threads:[~2008-01-07 5:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-07 5:53 Wendy Cheng [this message]
2008-01-08 5:31 ` [PATCH 2/2] Fix lockd panic Neil Brown
[not found] ` <18307.2757.579354.785142-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2008-01-09 3:02 ` Wendy Cheng
2008-01-09 4:43 ` Wendy Cheng
2008-01-09 23:33 ` Wendy Cheng
2008-01-12 6:51 ` 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=4781BE72.7050404@redhat.com \
--to=wcheng@redhat.com \
--cc=cluster-devel@redhat.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