[PATCH 03/10] nfs41: fix cb_recall bug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



in NFSv4.1 the seqid part of a stateid in CB_RECALL must be 0

Signed-off-by: Alexandros Batsakis <batsakis@xxxxxxxxxx>
---
 fs/nfs/delegation.c |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index 6dd48a4..4096dcf 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -432,18 +432,31 @@ int nfs_async_inode_return_delegation(struct inode *inode, const nfs4_stateid *s
 {
 	struct nfs_client *clp = NFS_SERVER(inode)->nfs_client;
 	struct nfs_delegation *delegation;
+	u32 seqid_len = 0;
 
 	rcu_read_lock();
 	delegation = rcu_dereference(NFS_I(inode)->delegation);
-	if (delegation == NULL || memcmp(delegation->stateid.data, stateid->data,
-				sizeof(delegation->stateid.data)) != 0) {
-		rcu_read_unlock();
-		return -ENOENT;
+	if (delegation == NULL)
+		goto enoent;
+
+	if (clp->cl_minorversion > 0) {
+		if (((u32 *) &stateid->data)[0] != 0)
+			goto enoent;
+		seqid_len = 4;
 	}
+
+	if (memcmp(&delegation->stateid.data[seqid_len],
+		   &stateid->data[seqid_len],
+		   sizeof(stateid->data)-seqid_len))
+		goto enoent;
+
 	nfs_mark_return_delegation(clp, delegation);
 	rcu_read_unlock();
 	nfs_delegation_run_state_manager(clp);
 	return 0;
+enoent:
+	rcu_read_unlock();
+	return -ENOENT;
 }
 
 /*
-- 
1.6.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux