summaryrefslogtreecommitdiff
path: root/fs/nfs/callback_proc.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-03-05 03:13:56 +0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-03-06 19:32:44 +0400
commit8e663f0e5fabf57065aed1cfdaff5b13057dce23 (patch)
tree844f5568113fe1c43a6d4ac93e9dfd5452682e06 /fs/nfs/callback_proc.c
parenta1d0b5eebc4fd6e0edb02688b35f17f67f42aea5 (diff)
downloadlinux-8e663f0e5fabf57065aed1cfdaff5b13057dce23.tar.xz
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: Andy Adamson <andros@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/callback_proc.c')
-rw-r--r--fs/nfs/callback_proc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
index 1bb297243624..ea8321923f28 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;