diff options
author | Alexandros Batsakis <batsakis@netapp.com> | 2009-12-05 13:20:52 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-12-05 13:20:52 -0500 |
commit | c79571a508801e055a0be583d6dc70bddad7bb64 (patch) | |
tree | a5000c191610376a01f12ac54c08d3c1adcf5bea /fs/nfs/delegation.c | |
parent | b4a6f4966efc7e70dc8d8a9e60744de6845b14bf (diff) |
nfs4: V2 return/expire delegations depending on their type
Signed-off-by: Alexandros Batsakis <batsakis@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/delegation.c')
-rw-r--r-- | fs/nfs/delegation.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index 6fc9fe0af3d0..98dbc8f5ced8 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c | |||
@@ -385,29 +385,43 @@ void nfs_super_return_all_delegations(struct super_block *sb) | |||
385 | nfs4_schedule_state_manager(clp); | 385 | nfs4_schedule_state_manager(clp); |
386 | } | 386 | } |
387 | 387 | ||
388 | static void nfs_client_mark_return_all_delegations(struct nfs_client *clp) | 388 | static |
389 | void nfs_client_mark_return_all_delegation_types(struct nfs_client *clp, fmode_t flags) | ||
389 | { | 390 | { |
390 | struct nfs_delegation *delegation; | 391 | struct nfs_delegation *delegation; |
391 | 392 | ||
392 | rcu_read_lock(); | 393 | rcu_read_lock(); |
393 | list_for_each_entry_rcu(delegation, &clp->cl_delegations, super_list) { | 394 | list_for_each_entry_rcu(delegation, &clp->cl_delegations, super_list) { |
394 | nfs_mark_return_delegation(clp, delegation); | 395 | if ((delegation->type == (FMODE_READ|FMODE_WRITE)) && !(flags & FMODE_WRITE)) |
396 | continue; | ||
397 | if (delegation->type & flags) | ||
398 | nfs_mark_return_delegation(clp, delegation); | ||
395 | } | 399 | } |
396 | rcu_read_unlock(); | 400 | rcu_read_unlock(); |
397 | } | 401 | } |
398 | 402 | ||
403 | static void nfs_client_mark_return_all_delegations(struct nfs_client *clp) | ||
404 | { | ||
405 | nfs_client_mark_return_all_delegation_types(clp, FMODE_READ|FMODE_WRITE); | ||
406 | } | ||
407 | |||
399 | static void nfs_delegation_run_state_manager(struct nfs_client *clp) | 408 | static void nfs_delegation_run_state_manager(struct nfs_client *clp) |
400 | { | 409 | { |
401 | if (test_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state)) | 410 | if (test_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state)) |
402 | nfs4_schedule_state_manager(clp); | 411 | nfs4_schedule_state_manager(clp); |
403 | } | 412 | } |
404 | 413 | ||
405 | void nfs_expire_all_delegations(struct nfs_client *clp) | 414 | static void nfs_expire_all_delegation_types(struct nfs_client *clp, fmode_t flags) |
406 | { | 415 | { |
407 | nfs_client_mark_return_all_delegations(clp); | 416 | nfs_client_mark_return_all_delegation_types(clp, flags); |
408 | nfs_delegation_run_state_manager(clp); | 417 | nfs_delegation_run_state_manager(clp); |
409 | } | 418 | } |
410 | 419 | ||
420 | void nfs_expire_all_delegations(struct nfs_client *clp) | ||
421 | { | ||
422 | nfs_expire_all_delegation_types(clp, FMODE_READ|FMODE_WRITE); | ||
423 | } | ||
424 | |||
411 | /* | 425 | /* |
412 | * Return all delegations following an NFS4ERR_CB_PATH_DOWN error. | 426 | * Return all delegations following an NFS4ERR_CB_PATH_DOWN error. |
413 | */ | 427 | */ |