Commit 8e663f0e authored by Trond Myklebust's avatar Trond Myklebust

NFSv4.1: Fix matching of the stateids when returning a delegation

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: default avatarAndy Adamson <andros@netapp.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent a1d0b5ee
...@@ -87,7 +87,6 @@ __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy, ...@@ -87,7 +87,6 @@ __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy,
res = 0; res = 0;
break; break;
case -ENOENT: case -ENOENT:
if (res != 0)
res = htonl(NFS4ERR_BAD_STATEID); res = htonl(NFS4ERR_BAD_STATEID);
break; break;
default: default:
...@@ -325,10 +324,11 @@ int nfs41_validate_delegation_stateid(struct nfs_delegation *delegation, const n ...@@ -325,10 +324,11 @@ int nfs41_validate_delegation_stateid(struct nfs_delegation *delegation, const n
if (delegation == NULL) if (delegation == NULL)
return 0; return 0;
if (stateid->stateid.seqid != 0) if (stateid->stateid.seqid != 0 &&
stateid->stateid.seqid != delegation->stateid.stateid.seqid)
return 0; return 0;
if (memcmp(&delegation->stateid.stateid.other, if (memcmp(delegation->stateid.stateid.other,
&stateid->stateid.other, stateid->stateid.other,
NFS4_STATEID_OTHER_SIZE)) NFS4_STATEID_OTHER_SIZE))
return 0; return 0;
......
...@@ -542,7 +542,7 @@ void nfs_expire_unreferenced_delegations(struct nfs_client *clp) ...@@ -542,7 +542,7 @@ void nfs_expire_unreferenced_delegations(struct nfs_client *clp)
/** /**
* nfs_async_inode_return_delegation - asynchronously return a delegation * nfs_async_inode_return_delegation - asynchronously return a delegation
* @inode: inode to process * @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. * Returns zero on success, or a negative errno value.
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment