Skip to content

Commit 0c12eaf

Browse files
Casey BodleyJ. Bruce Fields
Casey Bodley
authored and
J. Bruce Fields
committed
nfsd: don't break lease on CLAIM_DELEGATE_CUR
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 <[email protected]> Cc: [email protected] Signed-off-by: J. Bruce Fields <[email protected]>
1 parent 8fb47a4 commit 0c12eaf

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

fs/nfsd/nfs4state.c

+12-6
Original file line numberDiff line numberDiff line change
@@ -2585,12 +2585,18 @@ static inline int nfs4_access_to_access(u32 nfs4_access)
25852585
return flags;
25862586
}
25872587

2588-
static __be32 nfs4_get_vfs_file(struct svc_rqst *rqstp, struct nfs4_file
2589-
*fp, struct svc_fh *cur_fh, u32 nfs4_access)
2588+
static __be32 nfs4_get_vfs_file(struct svc_rqst *rqstp, struct nfs4_file *fp,
2589+
struct svc_fh *cur_fh, struct nfsd4_open *open)
25902590
{
25912591
__be32 status;
2592-
int oflag = nfs4_access_to_omode(nfs4_access);
2593-
int access = nfs4_access_to_access(nfs4_access);
2592+
int oflag = nfs4_access_to_omode(open->op_share_access);
2593+
int access = nfs4_access_to_access(open->op_share_access);
2594+
2595+
/* CLAIM_DELEGATE_CUR is used in response to a broken lease;
2596+
* allowing it to break the lease and return EAGAIN leaves the
2597+
* client unable to make progress in returning the delegation */
2598+
if (open->op_claim_type == NFS4_OPEN_CLAIM_DELEGATE_CUR)
2599+
access |= NFSD_MAY_NOT_BREAK_LEASE;
25942600

25952601
if (!fp->fi_fds[oflag]) {
25962602
status = nfsd_open(rqstp, cur_fh, S_IFREG, access,
@@ -2615,7 +2621,7 @@ nfs4_new_open(struct svc_rqst *rqstp, struct nfs4_stateid **stpp,
26152621
if (stp == NULL)
26162622
return nfserr_resource;
26172623

2618-
status = nfs4_get_vfs_file(rqstp, fp, cur_fh, open->op_share_access);
2624+
status = nfs4_get_vfs_file(rqstp, fp, cur_fh, open);
26192625
if (status) {
26202626
kmem_cache_free(stateid_slab, stp);
26212627
return status;
@@ -2648,7 +2654,7 @@ nfs4_upgrade_open(struct svc_rqst *rqstp, struct nfs4_file *fp, struct svc_fh *c
26482654

26492655
new_access = !test_bit(op_share_access, &stp->st_access_bmap);
26502656
if (new_access) {
2651-
status = nfs4_get_vfs_file(rqstp, fp, cur_fh, op_share_access);
2657+
status = nfs4_get_vfs_file(rqstp, fp, cur_fh, open);
26522658
if (status)
26532659
return status;
26542660
}

0 commit comments

Comments
 (0)