[Drbd-dev] [PATCH] Added missing kref_debug_put()'s on failure path of drbd_create_device().
johannes at johannesthoma.com
johannes at johannesthoma.com
Wed May 30 17:37:27 CEST 2018
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;
--
2.7.4
More information about the drbd-dev
mailing list