summaryrefslogtreecommitdiffstats
path: root/fs/ceph/caps.c
diff options
context:
space:
mode:
authorYan, Zheng2017-05-16 02:55:34 +0200
committerIlya Dryomov2017-07-07 17:25:12 +0200
commit84eea8c79090c44564877cd47c73455e32ec4846 (patch)
tree6ac69a8fb4b084b7a046adc4bf41ed56316fe82a /fs/ceph/caps.c
parentLinux 4.12 (diff)
downloadkernel-qcow2-linux-84eea8c79090c44564877cd47c73455e32ec4846.tar.gz
kernel-qcow2-linux-84eea8c79090c44564877cd47c73455e32ec4846.tar.xz
kernel-qcow2-linux-84eea8c79090c44564877cd47c73455e32ec4846.zip
ceph: re-request max size after importing caps
The 'wanted max size' could be sent to inode's old auth mds, re-send it to inode's new auth mds if necessary. Otherwise write syscall may hang. Signed-off-by: "Yan, Zheng" <zyan@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph/caps.c')
-rw-r--r--fs/ceph/caps.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index a3ebb632294e..6752223dc81c 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -3027,8 +3027,10 @@ static void handle_cap_grant(struct ceph_mds_client *mdsc,
le32_to_cpu(grant->truncate_seq),
le64_to_cpu(grant->truncate_size),
size);
- /* max size increase? */
- if (ci->i_auth_cap == cap && max_size != ci->i_max_size) {
+ }
+
+ if (ci->i_auth_cap == cap && (newcaps & CEPH_CAP_ANY_FILE_WR)) {
+ if (max_size != ci->i_max_size) {
dout("max_size %lld -> %llu\n",
ci->i_max_size, max_size);
ci->i_max_size = max_size;
@@ -3037,6 +3039,10 @@ static void handle_cap_grant(struct ceph_mds_client *mdsc,
ci->i_requested_max_size = 0;
}
wake = true;
+ } else if (ci->i_wanted_max_size > ci->i_max_size &&
+ ci->i_wanted_max_size > ci->i_requested_max_size) {
+ /* CEPH_CAP_OP_IMPORT */
+ wake = true;
}
}
@@ -3554,7 +3560,6 @@ retry:
}
/* make sure we re-request max_size, if necessary */
- ci->i_wanted_max_size = 0;
ci->i_requested_max_size = 0;
*old_issued = issued;