libceph: don't consume a ref on pagelist in ceph_msg_data_add_pagelist()
authorIlya Dryomov <idryomov@gmail.com>
Fri, 28 Sep 2018 14:02:53 +0000 (16:02 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 22 Oct 2018 08:28:21 +0000 (10:28 +0200)
commit894868330a1e038ea4a65dbb81741eef70ad71b1
tree50c12aec68b82146b05c6e18cc76117af0047ded
parent33165d472310262d8c79c7e4d1a17dc60cea7e35
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>
fs/ceph/mds_client.c
net/ceph/messenger.c
net/ceph/osd_client.c