]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
ceph: fix flush_snap logic after putting caps
authorJeff Layton <jlayton@kernel.org>
Thu, 10 Dec 2020 18:35:46 +0000 (13:35 -0500)
committerJeff Layton <jlayton@kernel.org>
Sat, 6 Feb 2021 11:52:09 +0000 (06:52 -0500)
A primary reason for skipping ceph_check_caps after putting the
references was to avoid the locking in ceph_check_caps during a
reconnect. __ceph_put_cap_refs can still call ceph_flush_snaps in that
case though, and that takes many of the same inconvenient locks.

Fix the logic in __ceph_put_cap_refs to skip flushing snaps when the
skip_checking_caps flag is set.

Fixes: e64f44a88465 (ceph: skip checking caps when session reconnecting and releasing reqs)
Signed-off-by: Jeff Layton <jlayton@kernel.org>
fs/ceph/caps.c

index c40f713d6d21854b1d05ade6b8255329a5484fc8..54d2bebb8bbea96ef8535fd1200218c8244b4711 100644 (file)
@@ -3085,10 +3085,12 @@ static void __ceph_put_cap_refs(struct ceph_inode_info *ci, int had,
        dout("put_cap_refs %p had %s%s%s\n", inode, ceph_cap_string(had),
             last ? " last" : "", put ? " put" : "");
 
-       if (last && !skip_checking_caps)
-               ceph_check_caps(ci, 0, NULL);
-       else if (flushsnaps)
-               ceph_flush_snaps(ci, NULL);
+       if (!skip_checking_caps) {
+               if (last)
+                       ceph_check_caps(ci, 0, NULL);
+               else if (flushsnaps)
+                       ceph_flush_snaps(ci, NULL);
+       }
        if (wake)
                wake_up_all(&ci->i_cap_wq);
        while (put-- > 0)