diff mbox

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

Message ID E463DF2B2E584B4A82673F53D62C2EF4D05DC426@cosmail01.lsi.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

babu moger July 28, 2010, 11 p.m. UTC
None
diff mbox

Patch

--- 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;
 }