CEPH-Devel archive mirror
 help / color / mirror / Atom feed
From: xiubli@redhat.com
To: ceph-devel@vger.kernel.org, idryomov@gmail.com
Cc: vshankar@redhat.com, mchangir@redhat.com, Xiubo Li <xiubli@redhat.com>
Subject: [PATCH] ceph: defer clearing the CEPH_I_FLUSH_SNAPS flag
Date: Wed,  8 May 2024 17:43:49 +0800	[thread overview]
Message-ID: <20240508094349.179222-1-xiubli@redhat.com> (raw)

From: Xiubo Li <xiubli@redhat.com>

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 | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 197cb383f829..fe6452321466 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -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,
-- 
2.44.0


                 reply	other threads:[~2024-05-08  9:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240508094349.179222-1-xiubli@redhat.com \
    --to=xiubli@redhat.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \
    --cc=mchangir@redhat.com \
    --cc=vshankar@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).