Distributed Replicated Block Device (DRBD) development
 help / color / mirror / Atom feed
* [Drbd-dev] [PATCH] Added missing kref_debug_put()'s on failure path of drbd_create_device().
@ 2018-05-30 15:37 johannes
  2018-06-18  9:26 ` Philipp Reisner
  0 siblings, 1 reply; 3+ messages in thread
From: johannes @ 2018-05-30 15:37 UTC (permalink / raw)
  To: drbd-dev

From: Johannes Thoma <johannes@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@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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Drbd-dev] [PATCH] Added missing kref_debug_put()'s on failure path of drbd_create_device().
  2018-05-30 15:37 [Drbd-dev] [PATCH] Added missing kref_debug_put()'s on failure path of drbd_create_device() johannes
@ 2018-06-18  9:26 ` Philipp Reisner
  2018-06-18  9:44   ` Philipp Reisner
  0 siblings, 1 reply; 3+ messages in thread
From: Philipp Reisner @ 2018-06-18  9:26 UTC (permalink / raw)
  To: johannes; +Cc: drbd-dev

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@johannesthoma.com:
> From: Johannes Thoma <johannes@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@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.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Drbd-dev] [PATCH] Added missing kref_debug_put()'s on failure path of drbd_create_device().
  2018-06-18  9:26 ` Philipp Reisner
@ 2018-06-18  9:44   ` Philipp Reisner
  0 siblings, 0 replies; 3+ messages in thread
From: Philipp Reisner @ 2018-06-18  9:44 UTC (permalink / raw)
  To: johannes; +Cc: drbd-dev

Hi Johannes,

Ok, I realized that you based it on the other path you sent on May 22.

Thanks for both, both applied!

best regards,
 phil


Am Montag, 18. Juni 2018, 11:26:34 CEST schrieb Philipp Reisner:
> 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@johannesthoma.com:
> > From: Johannes Thoma <johannes@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@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.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-18  9:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-30 15:37 [Drbd-dev] [PATCH] Added missing kref_debug_put()'s on failure path of drbd_create_device() johannes
2018-06-18  9:26 ` Philipp Reisner
2018-06-18  9:44   ` Philipp Reisner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox