dm-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/6] scsi_dh : release the refcounts in scsi_dh_alua handler when activate is complete
@ 2010-07-28 22:59 Moger, Babu
  2010-07-30  0:12 ` James Bottomley
  0 siblings, 1 reply; 2+ messages in thread
From: Moger, Babu @ 2010-07-28 22:59 UTC (permalink / raw)
  To: device-mapper development, linux-scsi@vger.kernel.org
  Cc: Qi, Yanling, Chauhan, Vijay, Stankey, Robert, Dachepalli, Sudhir

This patch releases the refcounts when activate is complete in alua handler.

Signed-off-by: Babu Moger <babu.moger@lsi.com>
---
--- linux-2.6.35-rc5/drivers/scsi/device_handler/scsi_dh_alua.c.orig	2010-07-23 05:58:39.000000000 -0500
+++ linux-2.6.35-rc5/drivers/scsi/device_handler/scsi_dh_alua.c	2010-07-23 06:00:54.000000000 -0500
@@ -287,6 +287,8 @@ done:
 		h->callback_fn(h->callback_data, err);
 		h->callback_fn = h->callback_data = NULL;
 	}
+	kref_put(&h->sdev->scsi_dh_data->kref, scsi_dh_handler_cleanup);
+	put_device(&h->sdev->sdev_gendev);
 	return;
 }
 
@@ -684,6 +686,8 @@ static int alua_activate(struct scsi_dev
 out:
 	if (fn)
 		fn(data, err);
+	kref_put(&sdev->scsi_dh_data->kref, scsi_dh_handler_cleanup);
+	put_device(&sdev->sdev_gendev);
 	return 0;
 }
 



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

* Re: [PATCH 3/6] scsi_dh : release the refcounts in scsi_dh_alua handler when activate is complete
  2010-07-28 22:59 [PATCH 3/6] scsi_dh : release the refcounts in scsi_dh_alua handler when activate is complete Moger, Babu
@ 2010-07-30  0:12 ` James Bottomley
  0 siblings, 0 replies; 2+ messages in thread
From: James Bottomley @ 2010-07-30  0:12 UTC (permalink / raw)
  To: Moger, Babu
  Cc: device-mapper development, linux-scsi@vger.kernel.org,
	Qi, Yanling, Chauhan, Vijay, Stankey, Robert, Dachepalli, Sudhir

On Wed, 2010-07-28 at 16:59 -0600, Moger, Babu wrote:
> This patch releases the refcounts when activate is complete in alua handler.
> 
> Signed-off-by: Babu Moger <babu.moger@lsi.com>
> ---
> --- linux-2.6.35-rc5/drivers/scsi/device_handler/scsi_dh_alua.c.orig	2010-07-23 05:58:39.000000000 -0500
> +++ linux-2.6.35-rc5/drivers/scsi/device_handler/scsi_dh_alua.c	2010-07-23 06:00:54.000000000 -0500
> @@ -287,6 +287,8 @@ done:
>  		h->callback_fn(h->callback_data, err);
>  		h->callback_fn = h->callback_data = NULL;
>  	}
> +	kref_put(&h->sdev->scsi_dh_data->kref, scsi_dh_handler_cleanup);
> +	put_device(&h->sdev->sdev_gendev);
>  	return;
>  }
>  
> @@ -684,6 +686,8 @@ static int alua_activate(struct scsi_dev
>  out:
>  	if (fn)
>  		fn(data, err);
> +	kref_put(&sdev->scsi_dh_data->kref, scsi_dh_handler_cleanup);
> +	put_device(&sdev->sdev_gendev);

This sequence is asking for trouble: having to remember to release two
separate references at once.

Logically what should happen is that the reference seems to be on
scsi_dh_data->sdev, so it should be taken when that's initialised and
put in scsi_dh_handler_cleanup ... so no-one has to worry about
forgetting it.

James



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

end of thread, other threads:[~2010-07-30  0:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-28 22:59 [PATCH 3/6] scsi_dh : release the refcounts in scsi_dh_alua handler when activate is complete Moger, Babu
2010-07-30  0:12 ` James Bottomley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).