]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
ceph: re-request max size after importing caps
authorYan, Zheng <zyan@redhat.com>
Tue, 16 May 2017 00:55:34 +0000 (08:55 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Fri, 7 Jul 2017 15:25:12 +0000 (17:25 +0200)
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>
fs/ceph/caps.c

index a3ebb632294e7b90a315508c9b75671d2ce8ff6a..6752223dc81cfa5a184c58f3b281a1de92f0b1f0 100644 (file)
@@ -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;