]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
ceph: defer clearing the CEPH_I_FLUSH_SNAPS flag
authorXiubo Li <xiubli@redhat.com>
Tue, 7 May 2024 04:43:10 +0000 (12:43 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 11 Feb 2026 18:19:16 +0000 (19:19 +0100)
Clear the flag just after the capsnap request being sent out. Else the
ceph_check_caps() will race with it and send the cap update request
just before this capsnap request. Which will cause the cap update request
to miss setting the CEPH_CLIENT_CAPS_PENDING_CAPSNAP flag and finally
the mds will drop the capsnap request to floor.

URL: https://tracker.ceph.com/issues/64209
URL: https://tracker.ceph.com/issues/65705
Signed-off-by: Xiubo Li <xiubli@redhat.com>
fs/ceph/caps.c

index 778b4bcaecd967d7d1553cd6257d78822730f637..590386367adf7ba9ef5095672f0a846a483cca26 100644 (file)
@@ -1666,8 +1666,6 @@ static void __ceph_flush_snaps(struct ceph_inode_info *ci,
                last_tid = capsnap->cap_flush.tid;
        }
 
-       ci->i_ceph_flags &= ~CEPH_I_FLUSH_SNAPS;
-
        while (first_tid <= last_tid) {
                struct ceph_cap *cap = ci->i_auth_cap;
                struct ceph_cap_flush *cf = NULL, *iter;
@@ -1712,6 +1710,15 @@ static void __ceph_flush_snaps(struct ceph_inode_info *ci,
                ceph_put_cap_snap(capsnap);
                spin_lock(&ci->i_ceph_lock);
        }
+
+       /*
+        * Clear the flag just after the capsnap request being sent out. Else the
+        * ceph_check_caps() will race with it and send the cap update request
+        * just before this capsnap request. Which will cause the cap update request
+        * to miss setting the CEPH_CLIENT_CAPS_PENDING_CAPSNAP flag and finally
+        * the mds will drop the capsnap request to floor.
+        */
+       ci->i_ceph_flags &= ~CEPH_I_FLUSH_SNAPS;
 }
 
 void ceph_flush_snaps(struct ceph_inode_info *ci,