NFSv4: Fix error handling and improve error reporting for file locking (Closes: #669270)
- Rate limit the state manager for lock reclaim warning messages - Ensure that the LOCK code sets exception->inode - Ensure that we check lock exclusive/shared type against open modes svn path=/dists/sid/linux-2.6/; revision=18955
This commit is contained in:
parent
4c8e51eed3
commit
c5f48a38f4
|
@ -19,6 +19,11 @@ linux-2.6 (3.2.16-1) UNRELEASED; urgency=low
|
|||
* rt2x00: Identify rt2800usb chipsets. (Closes: #658067)
|
||||
* [x86] Add EFI boot stub support (Closes: #669033)
|
||||
* brcmsmac: "INTERMEDIATE but not AMPDU" only when tracing
|
||||
* NFSv4: Fix error handling and improve error reporting for file locking
|
||||
(Closes: #669270)
|
||||
- Rate limit the state manager for lock reclaim warning messages
|
||||
- Ensure that the LOCK code sets exception->inode
|
||||
- Ensure that we check lock exclusive/shared type against open modes
|
||||
|
||||
-- Ben Hutchings <ben@decadent.org.uk> Mon, 16 Apr 2012 02:27:29 +0100
|
||||
|
||||
|
|
52
debian/patches/bugfix/all/NFSv4-Ensure-that-the-LOCK-code-sets-exception-inode.patch
vendored
Normal file
52
debian/patches/bugfix/all/NFSv4-Ensure-that-the-LOCK-code-sets-exception-inode.patch
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
From: Trond Myklebust <Trond.Myklebust@netapp.com>
|
||||
Date: Wed, 18 Apr 2012 12:20:10 -0400
|
||||
Subject: [PATCH 1/2] NFSv4: Ensure that the LOCK code sets exception->inode
|
||||
|
||||
commit 05ffe24f5290dc095f98fbaf84afe51ef404ccc5 upstream.
|
||||
|
||||
All callers of nfs4_handle_exception() that need to handle
|
||||
NFS4ERR_OPENMODE correctly should set exception->inode
|
||||
|
||||
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
|
||||
Cc: stable@vger.kernel.org
|
||||
---
|
||||
fs/nfs/nfs4proc.c | 9 +++++++--
|
||||
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
|
||||
index f82bde0..3c787d0 100644
|
||||
--- a/fs/nfs/nfs4proc.c
|
||||
+++ b/fs/nfs/nfs4proc.c
|
||||
@@ -4558,7 +4558,9 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f
|
||||
static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request)
|
||||
{
|
||||
struct nfs_server *server = NFS_SERVER(state->inode);
|
||||
- struct nfs4_exception exception = { };
|
||||
+ struct nfs4_exception exception = {
|
||||
+ .inode = state->inode,
|
||||
+ };
|
||||
int err;
|
||||
|
||||
do {
|
||||
@@ -4576,7 +4578,9 @@ static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request
|
||||
static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request)
|
||||
{
|
||||
struct nfs_server *server = NFS_SERVER(state->inode);
|
||||
- struct nfs4_exception exception = { };
|
||||
+ struct nfs4_exception exception = {
|
||||
+ .inode = state->inode,
|
||||
+ };
|
||||
int err;
|
||||
|
||||
err = nfs4_set_lock_state(state, request);
|
||||
@@ -4676,6 +4680,7 @@ static int nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock *
|
||||
{
|
||||
struct nfs4_exception exception = {
|
||||
.state = state,
|
||||
+ .inode = state->inode,
|
||||
};
|
||||
int err;
|
||||
|
||||
--
|
||||
1.7.10
|
||||
|
44
debian/patches/bugfix/all/NFSv4-Ensure-that-we-check-lock-exclusive-shared-typ.patch
vendored
Normal file
44
debian/patches/bugfix/all/NFSv4-Ensure-that-we-check-lock-exclusive-shared-typ.patch
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
From: Trond Myklebust <Trond.Myklebust@netapp.com>
|
||||
Date: Wed, 18 Apr 2012 12:48:35 -0400
|
||||
Subject: [PATCH 2/2] NFSv4: Ensure that we check lock exclusive/shared type
|
||||
against open modes
|
||||
|
||||
commit 55725513b5ef9d462aa3e18527658a0362aaae83 upstream.
|
||||
|
||||
Since we may be simulating flock() locks using NFS byte range locks,
|
||||
we can't rely on the VFS having checked the file open mode for us.
|
||||
|
||||
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
|
||||
Cc: stable@vger.kernel.org
|
||||
---
|
||||
fs/nfs/nfs4proc.c | 14 ++++++++++++++
|
||||
1 file changed, 14 insertions(+)
|
||||
|
||||
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
|
||||
index 3c787d0..ba837d9 100644
|
||||
--- a/fs/nfs/nfs4proc.c
|
||||
+++ b/fs/nfs/nfs4proc.c
|
||||
@@ -4726,6 +4726,20 @@ nfs4_proc_lock(struct file *filp, int cmd, struct file_lock *request)
|
||||
|
||||
if (state == NULL)
|
||||
return -ENOLCK;
|
||||
+ /*
|
||||
+ * Don't rely on the VFS having checked the file open mode,
|
||||
+ * since it won't do this for flock() locks.
|
||||
+ */
|
||||
+ switch (request->fl_type & (F_RDLCK|F_WRLCK|F_UNLCK)) {
|
||||
+ case F_RDLCK:
|
||||
+ if (!(filp->f_mode & FMODE_READ))
|
||||
+ return -EBADF;
|
||||
+ break;
|
||||
+ case F_WRLCK:
|
||||
+ if (!(filp->f_mode & FMODE_WRITE))
|
||||
+ return -EBADF;
|
||||
+ }
|
||||
+
|
||||
do {
|
||||
status = nfs4_proc_setlk(state, cmd, request);
|
||||
if ((status != -EAGAIN) || IS_SETLK(cmd))
|
||||
--
|
||||
1.7.10
|
||||
|
28
debian/patches/bugfix/all/NFSv4-Rate-limit-the-state-manager-for-lock-reclaim-.patch
vendored
Normal file
28
debian/patches/bugfix/all/NFSv4-Rate-limit-the-state-manager-for-lock-reclaim-.patch
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
From: William Dauchy <wdauchy@gmail.com>
|
||||
Date: Wed, 14 Mar 2012 12:32:04 +0100
|
||||
Subject: [PATCH] NFSv4: Rate limit the state manager for lock reclaim warning
|
||||
messages
|
||||
|
||||
commit 96dcadc2fdd111dca90d559f189a30c65394451a upstream.
|
||||
|
||||
Adding rate limit on `Lock reclaim failed` messages since it could fill
|
||||
up system logs
|
||||
Signed-off-by: William Dauchy <wdauchy@gmail.com>
|
||||
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
|
||||
[bwh: Backported to 3.2: add the 'NFS:' prefix at the same time]
|
||||
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
|
||||
---
|
||||
--- a/fs/nfs/nfs4state.c
|
||||
+++ b/fs/nfs/nfs4state.c
|
||||
@@ -1261,8 +1261,9 @@ restart:
|
||||
spin_lock(&state->state_lock);
|
||||
list_for_each_entry(lock, &state->lock_states, ls_locks) {
|
||||
if (!(lock->ls_flags & NFS_LOCK_INITIALIZED))
|
||||
- printk("%s: Lock reclaim failed!\n",
|
||||
- __func__);
|
||||
+ pr_warn_ratelimited("NFS: "
|
||||
+ "%s: Lock reclaim "
|
||||
+ "failed!\n", __func__);
|
||||
}
|
||||
spin_unlock(&state->state_lock);
|
||||
nfs4_put_open_state(state);
|
|
@ -184,3 +184,6 @@
|
|||
+ features/x86/efi-stub/0010-x86-efi-Break-up-large-initrd-reads.patch
|
||||
+ features/x86/efi-stub/0011-x86-efi-Fix-pointer-math-issue-in-handle_ramdisks.patch
|
||||
+ bugfix/all/brcmsmac-INTERMEDIATE-but-not-AMPDU-only-when-tracin.patch
|
||||
+ bugfix/all/NFSv4-Rate-limit-the-state-manager-for-lock-reclaim-.patch
|
||||
+ bugfix/all/NFSv4-Ensure-that-the-LOCK-code-sets-exception-inode.patch
|
||||
+ bugfix/all/NFSv4-Ensure-that-we-check-lock-exclusive-shared-typ.patch
|
||||
|
|
Loading…
Reference in New Issue