All of lore.kernel.org
 help / color / mirror / Atom feed
From: Trond Myklebust <Trond.Myklebust@netapp.com>
To: Sergey Vlasov <vsu@altlinux.ru>
Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	Alexander Morozov <amorozov@etersoft.ru>,
	stable@kernel.org
Subject: Re: [PATCH] NFS: Fix fcntl F_GETLK not reporting some conflicts
Date: Tue, 07 Dec 2010 17:38:46 -0500	[thread overview]
Message-ID: <1291761526.3049.48.camel@heimdal.trondhjem.org> (raw)
In-Reply-To: <1290978245-14415-1-git-send-email-vsu@altlinux.ru>

On Mon, 2010-11-29 at 00:04 +0300, Sergey Vlasov wrote:
> The commit 129a84de2347002f09721cda3155ccfd19fade40 (locks: fix F_GETLK
> regression (failure to find conflicts)) fixed the posix_test_lock()
> function by itself, however, its usage in NFS changed by the commit
> 9d6a8c5c213e34c475e72b245a8eb709258e968c (locks: give posix_test_lock
> same interface as ->lock) remained broken - subsequent NFS-specific
> locking code received F_UNLCK instead of the user-specified lock type.
> To fix the problem, fl->fl_type needs to be saved before the
> posix_test_lock() call and restored if no local conflicts were reported.
> 
> Reference: https://bugzilla.kernel.org/show_bug.cgi?id=23892
> Tested-by: Alexander Morozov <amorozov@etersoft.ru>
> Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
> Cc: <stable@kernel.org>
> ---
>  fs/nfs/file.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
>  There seems to be a similar bug in fs/9p/vfs_file.c:v9fs_file_getlock()
>  and an even worse confusion in fs/afs/flock.c:afs_do_getlk(), but I
>  can't test them.
> 
> diff --git a/fs/nfs/file.c b/fs/nfs/file.c
> index 60677f9..7bf029e 100644
> --- a/fs/nfs/file.c
> +++ b/fs/nfs/file.c
> @@ -693,6 +693,7 @@ do_getlk(struct file *filp, int cmd, struct file_lock *fl, int is_local)
>  {
>  	struct inode *inode = filp->f_mapping->host;
>  	int status = 0;
> +	unsigned int saved_type = fl->fl_type;
>  
>  	/* Try local locking first */
>  	posix_test_lock(filp, fl);
> @@ -700,6 +701,7 @@ do_getlk(struct file *filp, int cmd, struct file_lock *fl, int is_local)
>  		/* found a conflict */
>  		goto out;
>  	}
> +	fl->fl_type = saved_type;
>  
>  	if (nfs_have_delegation(inode, FMODE_READ))
>  		goto out_noconflict;

Thanks! Applied...

-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@netapp.com
www.netapp.com


      reply	other threads:[~2010-12-07 22:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-28 21:04 [PATCH] NFS: Fix fcntl F_GETLK not reporting some conflicts Sergey Vlasov
2010-12-07 22:38 ` Trond Myklebust [this message]

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=1291761526.3049.48.camel@heimdal.trondhjem.org \
    --to=trond.myklebust@netapp.com \
    --cc=amorozov@etersoft.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=stable@kernel.org \
    --cc=vsu@altlinux.ru \
    /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.