[Drbd-dev] [PATCH] Added missing kref_debug_put()'s on failure path of drbd_create_device().
Philipp Reisner
philipp.reisner at linbit.com
Mon Jun 18 11:26:34 CEST 2018
Hi Johannes,
the patch does not apply to the current master. Can you find out why, or
find out against which version/Git Hash this patch was created?
best regards,
Phil
Am Mittwoch, 30. Mai 2018, 17:37:27 CEST schrieb johannes at johannesthoma.com:
> From: Johannes Thoma <johannes at johannesthoma.com>
>
> On failing late in drbd_create_device() some kref_debug_put()'s
> were missing, which lead to false positives on kref_debug_destroy().
>
> This patch adds the missing calls.
>
> Signed-off-by: Johannes Thoma <johannes at johannesthoma.com>
> ---
> drbd/drbd_main.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c
> index 04ec052..ba60e3b 100644
> --- a/drbd/drbd_main.c
> +++ b/drbd/drbd_main.c
> @@ -3762,11 +3762,14 @@ out_remove_peer_device:
> kfree(peer_device);
> kref_debug_put(&connection->kref_debug, 3);
> kref_put(&connection->kref, drbd_destroy_connection);
> + kref_debug_put(&device->kref_debug, 1);
> }
> idr_remove(&resource->devices, vnr);
> + kref_debug_put(&device->kref_debug, 1);
>
> out_idr_remove_minor:
> idr_remove(&drbd_devices, minor);
> + kref_debug_put(&device->kref_debug, 1);
> out_no_minor_idr:
> if (locked)
> spin_unlock_irq(&resource->req_lock);
> @@ -3787,6 +3790,9 @@ out_no_disk:
> blk_cleanup_queue(q);
> out_no_q:
> kref_put(&resource->kref, drbd_destroy_resource);
> + kref_debug_put(&resource->kref_debug, 4);
> + /* kref debugging wants an extra put, see has_refs() */
> + kref_debug_put(&device->kref_debug, 4);
> kref_debug_destroy(&device->kref_debug);
> kfree(device);
> return err;
--
LINBIT | Keeping The Digital World Running
DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.
More information about the drbd-dev
mailing list