aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorCasey Bodley <cbodley@citi.umich.edu>2011-07-23 14:58:10 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-08-05 00:58:39 -0400
commitf6d7de0ee45c2408056bb2a9e2b21ba86fbfd833 (patch)
tree5ac496786f1e0a8bbef8d161de1e7c9e58d54e61 /fs/nfsd
parentefc977be4683816c39dfab38a34f68e07b78997e (diff)
nfsd: don't break lease on CLAIM_DELEGATE_CUR
commit 0c12eaffdf09466f36a9ffe970dda8f4aeb6efc0 upstream. CLAIM_DELEGATE_CUR is used in response to a broken lease; allowing it to break the lease and return EAGAIN leaves the client unable to make progress in returning the delegation nfs4_get_vfs_file() now takes struct nfsd4_open for access to the claim type, and calls nfsd_open() with NFSD_MAY_NOT_BREAK_LEASE when claim type is CLAIM_DELEGATE_CUR Signed-off-by: Casey Bodley <cbodley@citi.umich.edu> Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/nfs4state.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index e98f3c2e949..bdf81bf0861 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -2556,12 +2556,18 @@ static inline int nfs4_access_to_access(u32 nfs4_access)
2556 return flags; 2556 return flags;
2557} 2557}
2558 2558
2559static __be32 nfs4_get_vfs_file(struct svc_rqst *rqstp, struct nfs4_file 2559static __be32 nfs4_get_vfs_file(struct svc_rqst *rqstp, struct nfs4_file *fp,
2560*fp, struct svc_fh *cur_fh, u32 nfs4_access) 2560 struct svc_fh *cur_fh, struct nfsd4_open *open)
2561{ 2561{
2562 __be32 status; 2562 __be32 status;
2563 int oflag = nfs4_access_to_omode(nfs4_access); 2563 int oflag = nfs4_access_to_omode(open->op_share_access);
2564 int access = nfs4_access_to_access(nfs4_access); 2564 int access = nfs4_access_to_access(open->op_share_access);
2565
2566 /* CLAIM_DELEGATE_CUR is used in response to a broken lease;
2567 * allowing it to break the lease and return EAGAIN leaves the
2568 * client unable to make progress in returning the delegation */
2569 if (open->op_claim_type == NFS4_OPEN_CLAIM_DELEGATE_CUR)
2570 access |= NFSD_MAY_NOT_BREAK_LEASE;
2565 2571
2566 if (!fp->fi_fds[oflag]) { 2572 if (!fp->fi_fds[oflag]) {
2567 status = nfsd_open(rqstp, cur_fh, S_IFREG, access, 2573 status = nfsd_open(rqstp, cur_fh, S_IFREG, access,
@@ -2586,7 +2592,7 @@ nfs4_new_open(struct svc_rqst *rqstp, struct nfs4_stateid **stpp,
2586 if (stp == NULL) 2592 if (stp == NULL)
2587 return nfserr_resource; 2593 return nfserr_resource;
2588 2594
2589 status = nfs4_get_vfs_file(rqstp, fp, cur_fh, open->op_share_access); 2595 status = nfs4_get_vfs_file(rqstp, fp, cur_fh, open);
2590 if (status) { 2596 if (status) {
2591 kmem_cache_free(stateid_slab, stp); 2597 kmem_cache_free(stateid_slab, stp);
2592 return status; 2598 return status;
@@ -2619,7 +2625,7 @@ nfs4_upgrade_open(struct svc_rqst *rqstp, struct nfs4_file *fp, struct svc_fh *c
2619 2625
2620 new_access = !test_bit(op_share_access, &stp->st_access_bmap); 2626 new_access = !test_bit(op_share_access, &stp->st_access_bmap);
2621 if (new_access) { 2627 if (new_access) {
2622 status = nfs4_get_vfs_file(rqstp, fp, cur_fh, op_share_access); 2628 status = nfs4_get_vfs_file(rqstp, fp, cur_fh, open);
2623 if (status) 2629 if (status)
2624 return status; 2630 return status;
2625 } 2631 }