Skip to contentSkip to conversation

ceph: defer clearing the CEPH_I_FLUSH_SNAPS flag

PATCH In review [email protected] 2 participants 2 messages May 8, 2024 – Jun 4, 2024 Ceph client

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ceph: defer clearing the CEPH_I_FLUSH_SNAPS flag

From: Xiubo Li <[email protected]>

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

---
 fs/ceph/caps.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
fs/ceph/caps.c +9 -2
index 197cb383f829..fe6452321466 100644
@@ -1678,8 +1678,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;
@@ -1724,6 +1722,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,
Signature · 1 line
2.44.0
Tested-by on v1 1/1
#1 lore raw
Quoted 46 lines · On Wed, May 8, 2024 at 3:13 PM <[email protected]> wrote:

From: Xiubo Li <[email protected]>

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

---
 fs/ceph/caps.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
fs/ceph/caps.c +9 -3
index 197cb383f829..fe6452321466 100644
@@ -1678,8 +1678,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;
@@ -1724,6 +1722,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,
--
Quoted 2 lines

2.44.0

Signature · 2 lines
Cheers,
Venky