ceph-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: xiubli@redhat.com
To: ceph-devel@vger.kernel.org
Cc: idryomov@gmail.com, jlayton@kernel.org, vshankar@redhat.com,
	mchangir@redhat.com, Xiubo Li <xiubli@redhat.com>
Subject: [PATCH 1/3] ceph: do not break the loop if CEPH_I_FLUSH is set
Date: Mon, 25 Sep 2023 13:28:08 +0800	[thread overview]
Message-ID: <20230925052810.21914-2-xiubli@redhat.com> (raw)
In-Reply-To: <20230925052810.21914-1-xiubli@redhat.com>

From: Xiubo Li <xiubli@redhat.com>

For the unlink case we do not want it to be delayed. Else it will
be trigger 5 seconds later. Because the MDS maybe stuck waiting
for cap revocation.

URL: https://tracker.ceph.com/issues/50223
Signed-off-by: Xiubo Li <xiubli@redhat.com>
---
 fs/ceph/caps.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index dc0402258384..efa036e7619f 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -4624,7 +4624,7 @@ unsigned long ceph_check_delayed_caps(struct ceph_mds_client *mdsc)
 	struct ceph_inode_info *ci;
 	struct ceph_mount_options *opt = mdsc->fsc->mount_options;
 	unsigned long delay_max = opt->caps_wanted_delay_max * HZ;
-	unsigned long loop_start = jiffies;
+	unsigned long loop_start = jiffies, end;
 	unsigned long delay = 0;
 
 	doutc(cl, "begin\n");
@@ -4633,14 +4633,17 @@ unsigned long ceph_check_delayed_caps(struct ceph_mds_client *mdsc)
 		ci = list_first_entry(&mdsc->cap_delay_list,
 				      struct ceph_inode_info,
 				      i_cap_delay_list);
-		if (time_before(loop_start, ci->i_hold_caps_max - delay_max)) {
-			doutc(cl, "caps added recently.  Exiting loop");
-			delay = ci->i_hold_caps_max;
-			break;
+		/* Do not break the loop if CEPH_I_FLUSH is set. */
+		if (!(ci->i_ceph_flags & CEPH_I_FLUSH)) {
+			end = ci->i_hold_caps_max - delay_max;
+			if (time_before(loop_start, end)) {
+				doutc(cl, "caps added recently.  Exiting loop");
+				delay = ci->i_hold_caps_max;
+				break;
+			}
+			if (time_before(jiffies, ci->i_hold_caps_max))
+				break;
 		}
-		if ((ci->i_ceph_flags & CEPH_I_FLUSH) == 0 &&
-		    time_before(jiffies, ci->i_hold_caps_max))
-			break;
 		list_del_init(&ci->i_cap_delay_list);
 
 		inode = igrab(&ci->netfs.inode);
-- 
2.39.1


  reply	other threads:[~2023-09-25  5:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-25  5:28 [PATCH 0/3] ceph: fix caps revocation stuck xiubli
2023-09-25  5:28 ` xiubli [this message]
2023-09-25  5:28 ` [PATCH 2/3] ceph: always queue a writeback when revoking the Fb caps xiubli
2023-09-25  5:28 ` [PATCH 3/3] ceph: add ceph_cap_unlink_work to fire check caps immediately xiubli

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=20230925052810.21914-2-xiubli@redhat.com \
    --to=xiubli@redhat.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \
    --cc=jlayton@kernel.org \
    --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 NNTP newsgroup(s).