[dm-devel] [PATCH 6/6] scsi_dh : release the refcounts in scsi_dh_rdac handler when activate is complete

Moger, Babu Babu.Moger at lsi.com
Wed Jul 28 23:00:11 UTC 2010


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

Signed-off-by: Babu Moger <babu.moger at lsi.com>
---
--- linux-2.6.35-rc5/drivers/scsi/device_handler/scsi_dh_rdac.c.orig	2010-07-23 05:51:24.000000000 -0500
+++ linux-2.6.35-rc5/drivers/scsi/device_handler/scsi_dh_rdac.c	2010-07-23 05:54:05.000000000 -0500
@@ -209,6 +209,7 @@ static const char *lun_state[] =
 struct rdac_queue_data {
 	struct list_head	entry;
 	struct rdac_dh_data	*h;
+	struct scsi_device	*sdev;
 	activate_complete	callback_fn;
 	void			*callback_data;
 };
@@ -614,6 +615,9 @@ done:
 			qdata->h->state = RDAC_STATE_ACTIVE;
 		if (qdata->callback_fn)
 			qdata->callback_fn(qdata->callback_data, err);
+		kref_put(&qdata->sdev->scsi_dh_data->kref,
+			 scsi_dh_handler_cleanup);
+		put_device(&qdata->sdev->sdev_gendev);
 		kfree(qdata);
 	}
 	return;
@@ -630,6 +634,7 @@ static int queue_mode_select(struct scsi
 		return SCSI_DH_RETRY;
 
 	qdata->h = get_rdac_data(sdev);
+	qdata->sdev = sdev;
 	qdata->callback_fn = fn;
 	qdata->callback_data = data;
 
@@ -663,6 +668,8 @@ static int rdac_activate(struct scsi_dev
 done:
 	if (fn)
 		fn(data, err);
+	kref_put(&sdev->scsi_dh_data->kref, scsi_dh_handler_cleanup);
+	put_device(&sdev->sdev_gendev);
 	return 0;
 }
 






More information about the dm-devel mailing list