ceph-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: xiubli@redhat.com
Cc: ceph-devel@vger.kernel.org
Subject: [PATCH] ceph: fix request refcount leak when session can't be acquired
Date: Fri, 22 Apr 2022 13:29:11 -0400	[thread overview]
Message-ID: <20220422172911.94861-1-jlayton@kernel.org> (raw)

...in flush_mdlog_and_wait_mdsc_unsafe_requests.

URL: https://tracker.ceph.com/issues/55411
Fixes: 86bc9a732b7f ("ceph: flush the mdlog for filesystem sync")
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/ceph/mds_client.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

Xiubo, feel free to fold this into the original patch so we can avoid
the regression.

diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 2f17ca3c10b1..1e7df3b2dffd 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -4790,18 +4790,16 @@ static void flush_mdlog_and_wait_mdsc_unsafe_requests(struct ceph_mds_client *md
 			nextreq = NULL;
 		if (req->r_op != CEPH_MDS_OP_SETFILELOCK &&
 		    (req->r_op & CEPH_MDS_OP_WRITE)) {
-			struct ceph_mds_session *s;
+			struct ceph_mds_session *s = req->r_session;
 
-			/* write op */
-			ceph_mdsc_get_request(req);
-			if (nextreq)
-				ceph_mdsc_get_request(nextreq);
-
-			s = req->r_session;
 			if (!s) {
 				req = nextreq;
 				continue;
 			}
+
+			ceph_mdsc_get_request(req);
+			if (nextreq)
+				ceph_mdsc_get_request(nextreq);
 			s = ceph_get_mds_session(s);
 			mutex_unlock(&mdsc->mutex);
 
-- 
2.35.1


             reply	other threads:[~2022-04-22 17:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-22 17:29 Jeff Layton [this message]
2022-04-24  0:16 ` [PATCH] ceph: fix request refcount leak when session can't be acquired Xiubo Li

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=20220422172911.94861-1-jlayton@kernel.org \
    --to=jlayton@kernel.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=xiubli@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).