diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-03-04 18:13:56 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-03-06 10:32:44 -0500 |
commit | 36281caa839f4441c793c81d2e3cc5ea44ad5aa2 (patch) | |
tree | be5471741713d77681fcf1e161b0748343748977 /fs/nfs/nfs4proc.c | |
parent | 8e663f0e5fabf57065aed1cfdaff5b13057dce23 (diff) |
NFSv4: Further clean-ups of delegation stateid validation
Change the name to reflect what we're really doing: testing two
stateids for whether or not they match according the the rules in
RFC3530 and RFC5661.
Move the code from callback_proc.c to nfs4proc.c
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r-- | fs/nfs/nfs4proc.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index f31fcea1af7e..b0647b387403 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -6271,8 +6271,31 @@ static int nfs41_free_stateid(struct nfs_server *server, nfs4_stateid *stateid) | |||
6271 | } while (exception.retry); | 6271 | } while (exception.retry); |
6272 | return err; | 6272 | return err; |
6273 | } | 6273 | } |
6274 | |||
6275 | static bool nfs41_match_stateid(const nfs4_stateid *s1, | ||
6276 | const nfs4_stateid *s2) | ||
6277 | { | ||
6278 | if (memcmp(s1->stateid.other, s2->stateid.other, | ||
6279 | sizeof(s1->stateid.other)) != 0) | ||
6280 | return false; | ||
6281 | |||
6282 | if (s1->stateid.seqid == s2->stateid.seqid) | ||
6283 | return true; | ||
6284 | if (s1->stateid.seqid == 0 || s2->stateid.seqid == 0) | ||
6285 | return true; | ||
6286 | |||
6287 | return false; | ||
6288 | } | ||
6289 | |||
6274 | #endif /* CONFIG_NFS_V4_1 */ | 6290 | #endif /* CONFIG_NFS_V4_1 */ |
6275 | 6291 | ||
6292 | static bool nfs4_match_stateid(const nfs4_stateid *s1, | ||
6293 | const nfs4_stateid *s2) | ||
6294 | { | ||
6295 | return memcmp(s1->data, s2->data, sizeof(s1->data)) == 0; | ||
6296 | } | ||
6297 | |||
6298 | |||
6276 | struct nfs4_state_recovery_ops nfs40_reboot_recovery_ops = { | 6299 | struct nfs4_state_recovery_ops nfs40_reboot_recovery_ops = { |
6277 | .owner_flag_bit = NFS_OWNER_RECLAIM_REBOOT, | 6300 | .owner_flag_bit = NFS_OWNER_RECLAIM_REBOOT, |
6278 | .state_flag_bit = NFS_STATE_RECLAIM_REBOOT, | 6301 | .state_flag_bit = NFS_STATE_RECLAIM_REBOOT, |
@@ -6331,7 +6354,7 @@ struct nfs4_state_maintenance_ops nfs41_state_renewal_ops = { | |||
6331 | static const struct nfs4_minor_version_ops nfs_v4_0_minor_ops = { | 6354 | static const struct nfs4_minor_version_ops nfs_v4_0_minor_ops = { |
6332 | .minor_version = 0, | 6355 | .minor_version = 0, |
6333 | .call_sync = _nfs4_call_sync, | 6356 | .call_sync = _nfs4_call_sync, |
6334 | .validate_stateid = nfs4_validate_delegation_stateid, | 6357 | .match_stateid = nfs4_match_stateid, |
6335 | .find_root_sec = nfs4_find_root_sec, | 6358 | .find_root_sec = nfs4_find_root_sec, |
6336 | .reboot_recovery_ops = &nfs40_reboot_recovery_ops, | 6359 | .reboot_recovery_ops = &nfs40_reboot_recovery_ops, |
6337 | .nograce_recovery_ops = &nfs40_nograce_recovery_ops, | 6360 | .nograce_recovery_ops = &nfs40_nograce_recovery_ops, |
@@ -6342,7 +6365,7 @@ static const struct nfs4_minor_version_ops nfs_v4_0_minor_ops = { | |||
6342 | static const struct nfs4_minor_version_ops nfs_v4_1_minor_ops = { | 6365 | static const struct nfs4_minor_version_ops nfs_v4_1_minor_ops = { |
6343 | .minor_version = 1, | 6366 | .minor_version = 1, |
6344 | .call_sync = _nfs4_call_sync_session, | 6367 | .call_sync = _nfs4_call_sync_session, |
6345 | .validate_stateid = nfs41_validate_delegation_stateid, | 6368 | .match_stateid = nfs41_match_stateid, |
6346 | .find_root_sec = nfs41_find_root_sec, | 6369 | .find_root_sec = nfs41_find_root_sec, |
6347 | .reboot_recovery_ops = &nfs41_reboot_recovery_ops, | 6370 | .reboot_recovery_ops = &nfs41_reboot_recovery_ops, |
6348 | .nograce_recovery_ops = &nfs41_nograce_recovery_ops, | 6371 | .nograce_recovery_ops = &nfs41_nograce_recovery_ops, |