All of lore.kernel.org
 help / color / mirror / Atom feed
From: akpm@linux-foundation.org
To: miklos@szeredi.hu, bfields@fieldses.org, cel@citi.umich.edu,
	mszeredi@suse.cz, neilb@suse.de, trond.myklebust@fys.uio.no,
	mm-commits@vger.kernel.org
Subject: - nfs-infinite-loop-in-fcntlf_setlkw.patch removed from -mm tree
Date: Thu, 10 Apr 2008 14:36:24 -0700	[thread overview]
Message-ID: <200804102136.m3ALaOh2018592@imap1.linux-foundation.org> (raw)


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


                 reply	other threads:[~2008-04-10 21:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200804102136.m3ALaOh2018592@imap1.linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=bfields@fieldses.org \
    --cc=cel@citi.umich.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=mm-commits@vger.kernel.org \
    --cc=mszeredi@suse.cz \
    --cc=neilb@suse.de \
    --cc=trond.myklebust@fys.uio.no \
    /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 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.