From: andros@netapp.com
To: trond.myklebust@netapp.com
Cc: linux-nfs@vger.kernel.org,
Trond Myklebust <Trond.Myklebust@netapp.com>,
stable@vger.kernel.org
Subject: [PATCH 1/3] NFSv4.1: Fix the checking of the stateid when returning a delegation
Date: Tue, 6 Mar 2012 09:46:43 -0500 [thread overview]
Message-ID: <1331045205-3031-2-git-send-email-andros@netapp.com> (raw)
In-Reply-To: <1331045205-3031-1-git-send-email-andros@netapp.com>
From: Trond Myklebust <Trond.Myklebust@netapp.com>
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 | 6 +++---
fs/nfs/delegation.c | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
index f71978d..63190c1 100644
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -86,8 +86,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);
@@ -328,7 +327,8 @@ 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,
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.6.4
next prev parent reply other threads:[~2012-03-06 14:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-06 14:46 [PATCH 0/3] NFS recover from delegation stateid error andros
2012-03-06 14:46 ` andros [this message]
2012-03-06 14:57 ` [PATCH 1/3] NFSv4.1: Fix the checking of the stateid when returning a delegation Myklebust, Trond
2012-03-06 15:13 ` Adamson, Andy
2012-03-06 18:20 ` J. Bruce Fields
2012-03-06 14:46 ` [PATCH 2/3] NFS: Properly handle the case where the delegation is revoked andros
2012-03-06 14:46 ` [PATCH 3/3] NFSv4.1 do not clear NFS_DELEAGED_STATE until stateid is tested andros
2012-03-06 14:53 ` Myklebust, Trond
2012-03-06 14:55 ` Andy Adamson
2012-03-06 15:12 ` Andy Adamson
2012-03-06 15:17 ` Myklebust, Trond
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=1331045205-3031-2-git-send-email-andros@netapp.com \
--to=andros@netapp.com \
--cc=linux-nfs@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=trond.myklebust@netapp.com \
/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;
as well as URLs for NNTP newsgroup(s).