[PATCH] ceph: fix request refcount leak when session can't be acquired

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



...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@xxxxxxxxxx>
---
 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




[Index of Archives]     [CEPH Users]     [Ceph Large]     [Ceph Dev]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux