]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.0.1/nfsd-don-t-break-lease-on-claim_delegate_cur.patch
fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 3.0.1 / nfsd-don-t-break-lease-on-claim_delegate_cur.patch
CommitLineData
0d1514e0
GKH
1From 0c12eaffdf09466f36a9ffe970dda8f4aeb6efc0 Mon Sep 17 00:00:00 2001
2From: Casey Bodley <cbodley@citi.umich.edu>
3Date: Sat, 23 Jul 2011 14:58:10 -0400
4Subject: nfsd: don't break lease on CLAIM_DELEGATE_CUR
5
6From: Casey Bodley <cbodley@citi.umich.edu>
7
8commit 0c12eaffdf09466f36a9ffe970dda8f4aeb6efc0 upstream.
9
10CLAIM_DELEGATE_CUR is used in response to a broken lease; allowing it
11to break the lease and return EAGAIN leaves the client unable to make
12progress in returning the delegation
13
14nfs4_get_vfs_file() now takes struct nfsd4_open for access to the
15claim type, and calls nfsd_open() with NFSD_MAY_NOT_BREAK_LEASE when
16claim type is CLAIM_DELEGATE_CUR
17
18Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
19Signed-off-by: J. Bruce Fields <bfields@redhat.com>
20Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
21
22---
23 fs/nfsd/nfs4state.c | 18 ++++++++++++------
24 1 file changed, 12 insertions(+), 6 deletions(-)
25
26--- a/fs/nfsd/nfs4state.c
27+++ b/fs/nfsd/nfs4state.c
28@@ -2556,12 +2556,18 @@ static inline int nfs4_access_to_access(
29 return flags;
30 }
31
32-static __be32 nfs4_get_vfs_file(struct svc_rqst *rqstp, struct nfs4_file
33-*fp, struct svc_fh *cur_fh, u32 nfs4_access)
34+static __be32 nfs4_get_vfs_file(struct svc_rqst *rqstp, struct nfs4_file *fp,
35+ struct svc_fh *cur_fh, struct nfsd4_open *open)
36 {
37 __be32 status;
38- int oflag = nfs4_access_to_omode(nfs4_access);
39- int access = nfs4_access_to_access(nfs4_access);
40+ int oflag = nfs4_access_to_omode(open->op_share_access);
41+ int access = nfs4_access_to_access(open->op_share_access);
42+
43+ /* CLAIM_DELEGATE_CUR is used in response to a broken lease;
44+ * allowing it to break the lease and return EAGAIN leaves the
45+ * client unable to make progress in returning the delegation */
46+ if (open->op_claim_type == NFS4_OPEN_CLAIM_DELEGATE_CUR)
47+ access |= NFSD_MAY_NOT_BREAK_LEASE;
48
49 if (!fp->fi_fds[oflag]) {
50 status = nfsd_open(rqstp, cur_fh, S_IFREG, access,
51@@ -2586,7 +2592,7 @@ nfs4_new_open(struct svc_rqst *rqstp, st
52 if (stp == NULL)
53 return nfserr_resource;
54
55- status = nfs4_get_vfs_file(rqstp, fp, cur_fh, open->op_share_access);
56+ status = nfs4_get_vfs_file(rqstp, fp, cur_fh, open);
57 if (status) {
58 kmem_cache_free(stateid_slab, stp);
59 return status;
60@@ -2619,7 +2625,7 @@ nfs4_upgrade_open(struct svc_rqst *rqstp
61
62 new_access = !test_bit(op_share_access, &stp->st_access_bmap);
63 if (new_access) {
64- status = nfs4_get_vfs_file(rqstp, fp, cur_fh, op_share_access);
65+ status = nfs4_get_vfs_file(rqstp, fp, cur_fh, open);
66 if (status)
67 return status;
68 }