NFS fix error return in nfs4_select_rw_stateid
Subsystems (2)
PATCH 1/12 NFS fix error return in nfs4_select_rw_stateid
From: Andy Adamson <[email protected]>
Do not return an error when nfs4_copy_delegation_stateid succeeds.
--- fs/nfs/nfs4state.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/nfs/nfs4state.c +4 -1
@@ -1120,8 +1120,11 @@ int nfs4_select_rw_stateid(nfs4_stateid *dst, struct nfs4_state *state,if (ret == -EIO )/* A lost lock - don't even consider delegations */ goto out; -if (nfs4_copy_delegation_stateid (dst, state->inode, fmode)) +/* returns true if delegation stateid found and copied */ +if (nfs4_copy_delegation_stateid (dst, state->inode, fmode)) { + ret =0 ; goto out; + }if (ret != -ENOENT )/* nfs4_copy_delegation_stateid() didn't over-write * dst, so it still has the lock stateid which we now
Signature · 1 line
1.8.2.1
Quoted 16 lines · On Tue, 2014-02-18 at 10:36 -0500, [email protected] wrote:
From: Andy Adamson <[email protected]>
Do not return an error when
nfs4_copy_delegation_stateidsucceeds.Signed-off-by Andy Adamson <[email protected]>--- fs/nfs/nfs4state.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)fs/nfs/nfs4state.c +0
-0@@ -1120,8 +1120,11 @@ int nfs4_select_rw_stateid(nfs4_stateid *dst, struct nfs4_state *state,if (ret == -EIO )/* A lost lock - don't even consider delegations */
fs/nfs/nfs4state.c int nfs4_select_rw_stateid(nfs4_stateid *dst, struct nfs4_state *state, · line 1130
Quoted 10 lines
fs/nfs/nfs4state.c +4
-1goto out; -if (nfs4_copy_delegation_stateid (dst, state->inode, fmode)) +/* returns true if delegation stateid found and copied */ +if (nfs4_copy_delegation_stateid (dst, state->inode, fmode)) { + ret =0 ; goto out; + }if (ret != -ENOENT )/* nfs4_copy_delegation_stateid() didn't over-write * dst, so it still has the lock stateid which we now
Ouch! That looks like it would trigger looping in both the read and write code when we're holding a delegation. Is that what you end up seeing?
It looks like it was introduced by commit ef1820f9be27b...
Signature · 3 lines
Trond Myklebust Linux NFS client maintainer, PrimaryData [email protected]
Quoted 23 lines · Trond Myklebust
Quoted 22 lines · On Tue, 2014-02-18 at 10:36 -0500, [email protected] wrote:
From: Andy Adamson <[email protected]>
Do not return an error when
nfs4_copy_delegation_stateidsucceeds.Signed-off-by Andy Adamson <[email protected]>---
fs/nfs/nfs4state.c| 5 ++++-1 file changed, 4 insertions(+), 1 deletion(-)fs/nfs/nfs4state.c +3
-1@@ -1120,8 +1120,11 @@ int nfs4_select_rw_stateid(nfs4_stateid *dst, struct nfs4_state *state,if (ret == -EIO )/* A lost lock - don't even consider delegations */ goto out; -if (nfs4_copy_delegation_stateid (dst, state->inode, fmode)) +/* returns true if delegation stateid found and copied */ +if (nfs4_copy_delegation_stateid (dst, state->inode, fmode)) { + ret =0 ; goto out;
Quoted 8 lines
fs/nfs/nfs4state.c int nfs4_select_rw_stateid(nfs4_stateid *dst, struct nfs4_state *state, · line 1130
Quoted 4 lines
fs/nfs/nfs4state.c +1
-0+ }if (ret != -ENOENT )/* nfs4_copy_delegation_stateid() didn't over-write * dst, so it still has the lock stateid which we now Ouch! That looks like it would trigger looping in both the read and write code when we're holding a delegation. Is that what you end up seeing?
Actually, I saw it trying to run Anna’s intra server to server copy code. In this case, the server side copy failed and normal READ/WRITE from the client then suceeded. In that case I did not see any looping...
Quoted 2 lines
It looks like it was introduced by commit ef1820f9be27b…
Yep. Should I include that commit in the comment?
—>Andy
Quoted 5 lines
Signature · 4 lines
-- Trond Myklebust Linux NFS client maintainer, PrimaryData [email protected]
Quoted 34 lines · Andy
Quoted 23 lines · Trond Myklebust
Quoted 22 lines · On Tue, 2014-02-18 at 10:36 -0500, [email protected] wrote:
From: Andy Adamson <[email protected]>
Do not return an error when
nfs4_copy_delegation_stateidsucceeds.Signed-off-by Andy Adamson <[email protected]>---
fs/nfs/nfs4state.c| 5 ++++-1 file changed, 4 insertions(+), 1 deletion(-)fs/nfs/nfs4state.c +3
-1@@ -1120,8 +1120,11 @@ int nfs4_select_rw_stateid(nfs4_stateid *dst, struct nfs4_state *state,if (ret == -EIO )/* A lost lock - don't even consider delegations */ goto out; -if (nfs4_copy_delegation_stateid (dst, state->inode, fmode)) +/* returns true if delegation stateid found and copied */ +if (nfs4_copy_delegation_stateid (dst, state->inode, fmode)) { + ret =0 ; goto out;Quoted 8 lines
fs/nfs/nfs4state.c int nfs4_select_rw_stateid(nfs4_stateid *dst, struct nfs4_state *state, · line 1130
Quoted 4 lines
fs/nfs/nfs4state.c +1
-0+ }if (ret != -ENOENT )/* nfs4_copy_delegation_stateid() didn't over-write * dst, so it still has the lock stateid which we now Ouch! That looks like it would trigger looping in both the read and write code when we're holding a delegation. Is that what you end up seeing?
Quoted 6 lines
Actually, I saw it trying to run Anna’s intra server to server copy code. In this case, the server side copy failed and normal READ/WRITE from the client then suceeded. In that case I did not see any looping...
Quoted 2 lines
It looks like it was introduced by commit ef1820f9be27b…
Yep. Should I include that commit in the comment?
I added a 'Fixes:' and 'Link:' to the patch before I applied it. I also added a stable fix request for 3.12+...
Signature · 3 lines
Trond Myklebust Linux NFS client maintainer, PrimaryData [email protected]
Quoted 32 lines · On Tue, 18 Feb 2014 11:33:42 -0500 Trond Myklebust…
Quoted 16 lines · On Tue, 2014-02-18 at 10:36 -0500, [email protected] wrote:
From: Andy Adamson <[email protected]>
Do not return an error when
nfs4_copy_delegation_stateidsucceeds.Signed-off-by Andy Adamson <[email protected]>--- fs/nfs/nfs4state.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)fs/nfs/nfs4state.c +0
-0@@ -1120,8 +1120,11 @@ int nfs4_select_rw_stateid(nfs4_stateid *dst, struct nfs4_state *state,if (ret == -EIO )/* A lost lock - don't even consider delegations */ fs/nfs/nfs4state.c int nfs4_select_rw_stateid(nfs4_stateid *dst, struct nfs4_state *state, · line 1130
Quoted 10 lines
fs/nfs/nfs4state.c +4
-1goto out; -if (nfs4_copy_delegation_stateid (dst, state->inode, fmode)) +/* returns true if delegation stateid found and copied */ +if (nfs4_copy_delegation_stateid (dst, state->inode, fmode)) { + ret =0 ; goto out; + }if (ret != -ENOENT )/* nfs4_copy_delegation_stateid() didn't over-write * dst, so it still has the lock stateid which we now Ouch! That looks like it would trigger looping in both the read and write code when we're holding a delegation. Is that what you end up seeing?
Quoted 2 lines
It looks like it was introduced by commit
ef1820f9be27b...
Oops- that was a little careless. Thanks for the heads-up!
NeilBrown