ceph-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ceph: fix request refcount leak when session can't be acquired
@ 2022-04-22 17:29 Jeff Layton
  2022-04-24  0:16 ` Xiubo Li
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Layton @ 2022-04-22 17:29 UTC (permalink / raw)
  To: xiubli; +Cc: ceph-devel

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ceph: fix request refcount leak when session can't be acquired
  2022-04-22 17:29 [PATCH] ceph: fix request refcount leak when session can't be acquired Jeff Layton
@ 2022-04-24  0:16 ` Xiubo Li
  0 siblings, 0 replies; 2+ messages in thread
From: Xiubo Li @ 2022-04-24  0:16 UTC (permalink / raw)
  To: Jeff Layton; +Cc: ceph-devel


On 4/23/22 1:29 AM, Jeff Layton wrote:
> ...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);
>   

Good catch!

Thanks Jeff, I will fold this into the original patch.

-- Xiubo



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-24  0:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-22 17:29 [PATCH] ceph: fix request refcount leak when session can't be acquired Jeff Layton
2022-04-24  0:16 ` Xiubo Li

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).