diff options
author | Ilya Dryomov <idryomov@gmail.com> | 2018-09-28 10:02:53 -0400 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2018-10-22 04:28:21 -0400 |
commit | 894868330a1e038ea4a65dbb81741eef70ad71b1 (patch) | |
tree | 50c12aec68b82146b05c6e18cc76117af0047ded /fs/ceph/mds_client.c | |
parent | 33165d472310262d8c79c7e4d1a17dc60cea7e35 (diff) |
libceph: don't consume a ref on pagelist in ceph_msg_data_add_pagelist()
Because send_mds_reconnect() wants to send a message with a pagelist
and pass the ownership to the messenger, ceph_msg_data_add_pagelist()
consumes a ref which is then put in ceph_msg_data_destroy(). This
makes managing pagelists in the OSD client (where they are wrapped in
ceph_osd_data) unnecessarily hard because the handoff only happens in
ceph_osdc_start_request() instead of when the pagelist is passed to
ceph_osd_data_pagelist_init(). I counted several memory leaks on
various error paths.
Fix up ceph_msg_data_add_pagelist() and carry a pagelist ref in
ceph_osd_data.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph/mds_client.c')
-rw-r--r-- | fs/ceph/mds_client.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 580a79b9a91f..97de674ea377 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
@@ -2136,7 +2136,6 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc, | |||
2136 | 2136 | ||
2137 | if (req->r_pagelist) { | 2137 | if (req->r_pagelist) { |
2138 | struct ceph_pagelist *pagelist = req->r_pagelist; | 2138 | struct ceph_pagelist *pagelist = req->r_pagelist; |
2139 | refcount_inc(&pagelist->refcnt); | ||
2140 | ceph_msg_data_add_pagelist(msg, pagelist); | 2139 | ceph_msg_data_add_pagelist(msg, pagelist); |
2141 | msg->hdr.data_len = cpu_to_le32(pagelist->length); | 2140 | msg->hdr.data_len = cpu_to_le32(pagelist->length); |
2142 | } else { | 2141 | } else { |
@@ -3240,6 +3239,7 @@ static void send_mds_reconnect(struct ceph_mds_client *mdsc, | |||
3240 | mutex_unlock(&mdsc->mutex); | 3239 | mutex_unlock(&mdsc->mutex); |
3241 | 3240 | ||
3242 | up_read(&mdsc->snap_rwsem); | 3241 | up_read(&mdsc->snap_rwsem); |
3242 | ceph_pagelist_release(pagelist); | ||
3243 | return; | 3243 | return; |
3244 | 3244 | ||
3245 | fail: | 3245 | fail: |