linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/11] NFSv4.1: Fix matching of the stateids when returning a delegation
@ 2012-03-04 23:02 Trond Myklebust
  2012-03-04 23:02 ` [PATCH 02/11] NFSv4: Further clean-ups of delegation stateid validation Trond Myklebust
  0 siblings, 1 reply; 17+ messages in thread
From: Trond Myklebust @ 2012-03-04 23:02 UTC (permalink / raw)
  To: linux-nfs

nfs41_validate_delegation_stateid is broken if we supply a stateid with
a non-zero sequence id. Instead of trying to match the sequence id,
the function assumes that we always want to error. While this is
true for a delegation callback, it is not true in general.

Also fix a typo in nfs4_callback_recall.

Reported-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: stable@vger.kernel.org
---
 fs/nfs/callback_proc.c |   10 +++++-----
 fs/nfs/delegation.c    |    2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
index 1bb2972..ea83219 100644
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -87,8 +87,7 @@ __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy,
 		res = 0;
 		break;
 	case -ENOENT:
-		if (res != 0)
-			res = htonl(NFS4ERR_BAD_STATEID);
+		res = htonl(NFS4ERR_BAD_STATEID);
 		break;
 	default:
 		res = htonl(NFS4ERR_RESOURCE);
@@ -325,10 +324,11 @@ int nfs41_validate_delegation_stateid(struct nfs_delegation *delegation, const n
 	if (delegation == NULL)
 		return 0;
 
-	if (stateid->stateid.seqid != 0)
+	if (stateid->stateid.seqid != 0 &&
+	    stateid->stateid.seqid != delegation->stateid.stateid.seqid)
 		return 0;
-	if (memcmp(&delegation->stateid.stateid.other,
-		   &stateid->stateid.other,
+	if (memcmp(delegation->stateid.stateid.other,
+		   stateid->stateid.other,
 		   NFS4_STATEID_OTHER_SIZE))
 		return 0;
 
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index 7f26540..1596098 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -531,7 +531,7 @@ void nfs_expire_unreferenced_delegations(struct nfs_client *clp)
 /**
  * nfs_async_inode_return_delegation - asynchronously return a delegation
  * @inode: inode to process
- * @stateid: state ID information from CB_RECALL arguments
+ * @stateid: state ID information
  *
  * Returns zero on success, or a negative errno value.
  */
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2012-03-05 17:36 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-04 23:02 [PATCH 01/11] NFSv4.1: Fix matching of the stateids when returning a delegation Trond Myklebust
2012-03-04 23:02 ` [PATCH 02/11] NFSv4: Further clean-ups of delegation stateid validation Trond Myklebust
2012-03-04 23:02   ` [PATCH 03/11] NFSv4: Rename encode_stateid() to encode_open_stateid() Trond Myklebust
2012-03-04 23:02     ` [PATCH 04/11] NFSv4: Add a helper for encoding opaque data Trond Myklebust
2012-03-04 23:02       ` [PATCH 05/11] NFSv4: Add a helper for encoding stateids Trond Myklebust
2012-03-04 23:02         ` [PATCH 06/11] NFSv4: Rename nfs4_copy_stateid() Trond Myklebust
2012-03-04 23:02           ` [PATCH 07/11] NFSv4: Add helpers for basic copying of stateids Trond Myklebust
2012-03-04 23:03             ` [PATCH 08/11] NFSv4: Simplify the struct nfs4_stateid Trond Myklebust
2012-03-04 23:03               ` [PATCH 09/11] NFSv4: Minor clean ups for encode_string() Trond Myklebust
2012-03-04 23:03                 ` [PATCH 10/11] NFSv4: Add a helper for encoding NFSv4 sequence ids Trond Myklebust
2012-03-04 23:03                   ` [PATCH 11/11] NFSv4: Add a encode op helper Trond Myklebust
     [not found]               ` <FA8A9A935BFD3A4D8F0CDA1C4F611BCC062D48307D@IT-1874.Isys.com>
2012-03-05 16:52                 ` [PATCH 08/11] NFSv4: Simplify the struct nfs4_stateid Myklebust, Trond
2012-03-05 17:14               ` Bryan Schumaker
2012-03-05 17:35                 ` Myklebust, Trond
2012-03-05  1:08       ` [PATCH 04/11] NFSv4: Add a helper for encoding opaque data Chuck Lever
2012-03-05  2:00         ` Myklebust, Trond
2012-03-05  2:04         ` Myklebust, Trond

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).