summaryrefslogtreecommitdiffstats
path: root/net/ceph/messenger.c
diff options
context:
space:
mode:
authorIlya Dryomov <idryomov@gmail.com>2018-09-28 16:02:53 +0200
committerIlya Dryomov <idryomov@gmail.com>2018-10-22 10:28:21 +0200
commit894868330a1e038ea4a65dbb81741eef70ad71b1 (patch)
tree50c12aec68b82146b05c6e18cc76117af0047ded /net/ceph/messenger.c
parentlibceph: introduce ceph_pagelist_alloc() (diff)
downloadlinux-894868330a1e038ea4a65dbb81741eef70ad71b1.tar.xz
linux-894868330a1e038ea4a65dbb81741eef70ad71b1.zip
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 'net/ceph/messenger.c')
-rw-r--r--net/ceph/messenger.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 0a187196aeed..76684edc43ef 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -3313,6 +3313,7 @@ void ceph_msg_data_add_pagelist(struct ceph_msg *msg,
data = ceph_msg_data_create(CEPH_MSG_DATA_PAGELIST);
BUG_ON(!data);
+ refcount_inc(&pagelist->refcnt);
data->pagelist = pagelist;
list_add_tail(&data->links, &msg->data);