ceph: fix request refcount leak when session can't be acquired
PATCH 1/1 ceph: fix request refcount leak when session can't be acquired
...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 <[email protected]>
--- 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.
fs/ceph/mds_client.c +5 -7
@@ -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);
Signature · 1 line
2.35.1
Quoted 30 lines · Jeff Layton
...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 <[email protected]>--- 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.
fs/ceph/mds_client.c +1
-7@@ -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) {
fs/ceph/mds_client.c static void flush_mdlog_and_wait_mdsc_unsafe_requests(struct ceph_mds_client *md · line 4805
Quoted 10 lines
fs/ceph/mds_client.c +4
-0req = 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