public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexandros Batsakis <batsakis@netapp.com>
To: linux-nfs@vger.kernel.org
Cc: Alexandros Batsakis <batsakis@netapp.com>
Subject: [PATCH 03/10] nfs41: fix cb_recall bug
Date: Mon, 23 Nov 2009 13:54:40 -0800	[thread overview]
Message-ID: <1259013287-3349-3-git-send-email-batsakis@netapp.com> (raw)
In-Reply-To: <1259013287-3349-2-git-send-email-batsakis@netapp.com>

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

Signed-off-by: Alexandros Batsakis <batsakis@netapp.com>
---
 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


  reply	other threads:[~2009-11-23 21:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-23 21:54 [PATCH 01/10] nfs41: adjust max_rqst_sz, max_resp_sz w.r.t to rsize, wsize Alexandros Batsakis
2009-11-23 21:54 ` [PATCH 02/10] nfs41: add support for callback with RPC version number 4 Alexandros Batsakis
2009-11-23 21:54   ` Alexandros Batsakis [this message]
2009-11-23 21:54     ` [PATCH 04/10] nfs4: minor delegation cleaning Alexandros Batsakis
2009-11-23 21:54       ` [PATCH 05/10] nfs4: return/expire delegations depending on their type Alexandros Batsakis
2009-11-23 21:54         ` [PATCH 06/10] nfs41: initial support for CB_RECALL_ANY Alexandros Batsakis
2009-11-23 21:54           ` [PATCH 07/10] nfs41: check if session exists and if it is persistent Alexandros Batsakis
2009-11-23 21:54             ` [PATCH 08/10] nfs41: add support for the exclusive create flags Alexandros Batsakis
2009-11-23 21:54               ` [PATCH 09/10] nfs41: remove server-only EXCHGID4_FLAG_CONFIRMED_R flag from exchange_id Alexandros Batsakis
2009-11-23 21:54                 ` [PATCH 10/10] nfs41: check SEQUENCE status flag Alexandros Batsakis
2009-11-23 23:07         ` [PATCH 05/10] nfs4: return/expire delegations depending on their type Trond Myklebust
2009-11-23 23:16     ` [PATCH 03/10] nfs41: fix cb_recall bug Trond Myklebust
2009-11-23 22:06 ` [PATCH 01/10] nfs41: adjust max_rqst_sz, max_resp_sz w.r.t to rsize, wsize Peter Staubach
2009-11-23 22:57 ` Trond Myklebust
2009-11-23 23:14   ` Batsakis, Alexandros
2009-11-24 19:10   ` Peter Staubach
2009-11-24 20:39     ` J. Bruce Fields

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1259013287-3349-3-git-send-email-batsakis@netapp.com \
    --to=batsakis@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox