All of lore.kernel.org
 help / color / mirror / Atom feed
* - nfs-infinite-loop-in-fcntlf_setlkw.patch removed from -mm tree
@ 2008-04-10 21:36 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2008-04-10 21:36 UTC (permalink / raw)
  To: miklos, bfields, cel, mszeredi, neilb, trond.myklebust,
	mm-commits


The patch titled
     nfs: infinite loop in fcntl(F_SETLKW)
has been removed from the -mm tree.  Its filename was
     nfs-infinite-loop-in-fcntlf_setlkw.patch

This patch was dropped because an updated version will be merged

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: nfs: infinite loop in fcntl(F_SETLKW)
From: Miklos Szeredi <miklos@szeredi.hu>

Another infinite loop, this one involving both client and server.

Basically what happens is that on the server nlm_fopen() calls nfsd_open()
which returns -EACCES, to which nlm_fopen() returns NLM_LCK_DENIED.

On the client this will turn into a -EAGAIN (nlm_stat_to_errno()), which in
will cause fcntl_setlk() to retry forever.

I _think_ the solution is to turn NLM_LCK_DENIED into ENOLCK for blocking
locks, as NLM_LCK_BLOCKED is for the contended case.  For testing the lock
leave NLM_LCK_DENIED as EAGAIN.  That still could be misleading, but at least
there's no infinite loop in that case.

I've minimally tested this patch to verify that it cures the lockup,
and that simple blocking locks keep working.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: Neil Brown <neilb@suse.de>
Cc: Chuck Lever <cel@citi.umich.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 fs/lockd/clntproc.c |    3 +++
 1 file changed, 3 insertions(+)

diff -puN fs/lockd/clntproc.c~nfs-infinite-loop-in-fcntlf_setlkw fs/lockd/clntproc.c
--- a/fs/lockd/clntproc.c~nfs-infinite-loop-in-fcntlf_setlkw
+++ a/fs/lockd/clntproc.c
@@ -536,6 +536,9 @@ again:
 		up_read(&host->h_rwsem);
 	}
 	status = nlm_stat_to_errno(resp->status);
+	/* Don't return EAGAIN, as that would make fcntl_setlk() loop */
+	if (status == -EAGAIN)
+		status = -ENOLCK;
 out_unblock:
 	nlmclnt_finish_block(block);
 	/* Cancel the blocked request if it is still pending */
_

Patches currently in -mm which might be from miklos@szeredi.hu are

generic_file_splice_read-fix-lockups.patch
git-nfsd.patch
nfs-infinite-loop-in-fcntlf_setlkw.patch
mmap_region-cleanup-the-final-vma_merge-related-code.patch
mm-bdi-move-statistics-to-debugfs.patch
add-macros-similar-to-min-max-min_t-max_t.patch
fuse-use-clamp-rather-than-nested-min-max.patch
notify_change-callers-must-hold-i_mutex.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-04-10 21:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-10 21:36 - nfs-infinite-loop-in-fcntlf_setlkw.patch removed from -mm tree akpm

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.