summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Vlasov <vsu@altlinux.ru>2010-11-28 21:04:05 +0000
committerWilly Tarreau <w@1wt.eu>2011-02-09 22:15:37 +0100
commit2d5ba8979460dbd072cde2cd9224917f61c10ddb (patch)
treed2152977b1d34eac57ab05caec204e7ec4a2c3e7
parent69b74dfe7cc2022a2f2e0cf920f0c24e72c0d387 (diff)
NFS: Fix fcntl F_GETLK not reporting some conflicts
commit 21ac19d484a8ffb66f64487846c8d53afef04d2b upstream. 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> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Willy Tarreau <w@1wt.eu>
-rw-r--r--fs/nfs/file.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 4a57a0f9a2ac..e5a08740d4f5 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -552,6 +552,7 @@ static int do_getlk(struct file *filp, int cmd, struct file_lock *fl)
{
struct inode *inode = filp->f_mapping->host;
int status = 0;
+ unsigned int saved_type = fl->fl_type;
lock_kernel();
/* Try local locking first */
@@ -560,6 +561,7 @@ static int do_getlk(struct file *filp, int cmd, struct file_lock *fl)
/* found a conflict */
goto out;
}
+ fl->fl_type = saved_type;
if (nfs_have_delegation(inode, FMODE_READ))
goto out_noconflict;