2 * Engenio/LSI RDAC SCSI Device Handler
4 * Copyright (C) 2005 Mike Christie. All rights reserved.
5 * Copyright (C) Chandra Seetharaman, IBM Corp. 2007
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #include <scsi/scsi.h>
23 #include <scsi/scsi_eh.h>
24 #include <scsi/scsi_dh.h>
25 #include <linux/workqueue.h>
26 #include <linux/slab.h>
28 #define RDAC_NAME "rdac"
29 #define RDAC_RETRY_COUNT 5
34 * These struct definitions and the forming of the
35 * mode page were taken from the LSI RDAC 2.4 GPL'd
36 * driver, and then converted to Linux conventions.
38 #define RDAC_QUIESCENCE_TIME 20
42 #define RDAC_PAGE_CODE_REDUNDANT_CONTROLLER 0x2c
45 * Controller modes definitions
47 #define RDAC_MODE_TRANSFER_SPECIFIED_LUNS 0x02
52 #define RDAC_FORCED_QUIESENCE 0x02
54 #define RDAC_TIMEOUT (60 * HZ)
55 #define RDAC_RETRIES 3
57 struct rdac_mode_6_hdr {
64 struct rdac_mode_10_hdr {
72 struct rdac_mode_common {
73 u8 controller_serial[16];
74 u8 alt_controller_serial[16];
77 u8 quiescence_timeout;
81 struct rdac_pg_legacy {
82 struct rdac_mode_6_hdr hdr;
85 struct rdac_mode_common common;
86 #define MODE6_MAX_LUN 32
87 u8 lun_table[MODE6_MAX_LUN];
93 struct rdac_pg_expanded {
94 struct rdac_mode_10_hdr hdr;
98 struct rdac_mode_common common;
106 u8 page_code; /* 0xC9 */
109 u8 page_id[4]; /* "vace" */
115 #define SUBSYS_ID_LEN 16
116 #define SLOT_ID_LEN 2
117 #define ARRAY_LABEL_LEN 31
121 u8 page_code; /* 0xC4 */
124 u8 page_id[4]; /* "subs" */
125 u8 subsys_id[SUBSYS_ID_LEN];
127 u8 slot_id[SLOT_ID_LEN];
131 struct rdac_controller {
132 u8 subsys_id[SUBSYS_ID_LEN];
133 u8 slot_id[SLOT_ID_LEN];
136 struct list_head node; /* list of all controllers */
138 struct rdac_pg_legacy legacy;
139 struct rdac_pg_expanded expanded;
142 u8 array_name[ARRAY_LABEL_LEN];
145 struct work_struct ms_work;
146 struct scsi_device *ms_sdev;
147 struct list_head ms_head;
152 u8 page_code; /* 0xC8 */
155 u8 page_id[4]; /* "edid" */
159 u8 vol_user_label_len;
160 u8 vol_user_label[60];
161 u8 array_uniq_id_len;
162 u8 array_unique_id[16];
163 u8 array_user_label_len;
164 u8 array_user_label[60];
170 u8 page_code; /* 0xC2 */
173 u8 page_id[4]; /* "swr4" */
177 u8 max_lun_supported;
178 u8 partitions[239]; /* Total allocation length should be 0xFF */
181 struct rdac_dh_data {
182 struct rdac_controller *ctlr;
183 #define UNINITIALIZED_LUN (1 << 8)
187 #define RDAC_MODE_AVT 1
188 #define RDAC_MODE_IOSHIP 2
191 #define RDAC_STATE_ACTIVE 0
192 #define RDAC_STATE_PASSIVE 1
195 #define RDAC_LUN_UNOWNED 0
196 #define RDAC_LUN_OWNED 1
199 #define RDAC_PREFERRED 0
200 #define RDAC_NON_PREFERRED 1
203 unsigned char sense[SCSI_SENSE_BUFFERSIZE];
205 struct c2_inquiry c2;
206 struct c4_inquiry c4;
207 struct c8_inquiry c8;
208 struct c9_inquiry c9;
212 static const char *mode[] = {
217 static const char *lun_state[] =
223 struct rdac_queue_data {
224 struct list_head entry;
225 struct rdac_dh_data *h;
226 activate_complete callback_fn;
230 static LIST_HEAD(ctlr_list);
231 static DEFINE_SPINLOCK(list_lock);
232 static struct workqueue_struct *kmpath_rdacd;
233 static void send_mode_select(struct work_struct *work);
236 * module parameter to enable rdac debug logging.
237 * 2 bits for each type of logging, only two types defined for now
238 * Can be enhanced if required at later point
240 static int rdac_logging = 1;
241 module_param(rdac_logging, int, S_IRUGO|S_IWUSR);
242 MODULE_PARM_DESC(rdac_logging, "A bit mask of rdac logging levels, "
243 "Default is 1 - failover logging enabled, "
244 "set it to 0xF to enable all the logs");
246 #define RDAC_LOG_FAILOVER 0
247 #define RDAC_LOG_SENSE 2
249 #define RDAC_LOG_BITS 2
251 #define RDAC_LOG_LEVEL(SHIFT) \
252 ((rdac_logging >> (SHIFT)) & ((1 << (RDAC_LOG_BITS)) - 1))
254 #define RDAC_LOG(SHIFT, sdev, f, arg...) \
256 if (unlikely(RDAC_LOG_LEVEL(SHIFT))) \
257 sdev_printk(KERN_INFO, sdev, RDAC_NAME ": " f "\n", ## arg); \
260 static inline struct rdac_dh_data *get_rdac_data(struct scsi_device *sdev)
262 struct scsi_dh_data *scsi_dh_data = sdev->scsi_dh_data;
263 BUG_ON(scsi_dh_data == NULL);
264 return ((struct rdac_dh_data *) scsi_dh_data->buf);
267 static struct request *get_rdac_req(struct scsi_device *sdev,
268 void *buffer, unsigned buflen, int rw)
271 struct request_queue *q = sdev->request_queue;
273 rq = blk_get_request(q, rw, GFP_NOIO);
276 sdev_printk(KERN_INFO, sdev,
277 "get_rdac_req: blk_get_request failed.\n");
281 if (buflen && blk_rq_map_kern(q, rq, buffer, buflen, GFP_NOIO)) {
283 sdev_printk(KERN_INFO, sdev,
284 "get_rdac_req: blk_rq_map_kern failed.\n");
288 rq->cmd_type = REQ_TYPE_BLOCK_PC;
289 rq->cmd_flags |= REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT |
291 rq->retries = RDAC_RETRIES;
292 rq->timeout = RDAC_TIMEOUT;
297 static struct request *rdac_failover_get(struct scsi_device *sdev,
298 struct rdac_dh_data *h, struct list_head *list)
301 struct rdac_mode_common *common;
303 struct rdac_queue_data *qdata;
306 if (h->ctlr->use_ms10) {
307 struct rdac_pg_expanded *rdac_pg;
309 data_size = sizeof(struct rdac_pg_expanded);
310 rdac_pg = &h->ctlr->mode_select.expanded;
311 memset(rdac_pg, 0, data_size);
312 common = &rdac_pg->common;
313 rdac_pg->page_code = RDAC_PAGE_CODE_REDUNDANT_CONTROLLER + 0x40;
314 rdac_pg->subpage_code = 0x1;
315 rdac_pg->page_len[0] = 0x01;
316 rdac_pg->page_len[1] = 0x28;
317 lun_table = rdac_pg->lun_table;
319 struct rdac_pg_legacy *rdac_pg;
321 data_size = sizeof(struct rdac_pg_legacy);
322 rdac_pg = &h->ctlr->mode_select.legacy;
323 memset(rdac_pg, 0, data_size);
324 common = &rdac_pg->common;
325 rdac_pg->page_code = RDAC_PAGE_CODE_REDUNDANT_CONTROLLER;
326 rdac_pg->page_len = 0x68;
327 lun_table = rdac_pg->lun_table;
329 common->rdac_mode[1] = RDAC_MODE_TRANSFER_SPECIFIED_LUNS;
330 common->quiescence_timeout = RDAC_QUIESCENCE_TIME;
331 common->rdac_options = RDAC_FORCED_QUIESENCE;
333 list_for_each_entry(qdata, list, entry) {
334 lun_table[qdata->h->lun] = 0x81;
337 /* get request for block layer packet command */
338 rq = get_rdac_req(sdev, &h->ctlr->mode_select, data_size, WRITE);
342 /* Prepare the command. */
343 if (h->ctlr->use_ms10) {
344 rq->cmd[0] = MODE_SELECT_10;
345 rq->cmd[7] = data_size >> 8;
346 rq->cmd[8] = data_size & 0xff;
348 rq->cmd[0] = MODE_SELECT;
349 rq->cmd[4] = data_size;
351 rq->cmd_len = COMMAND_SIZE(rq->cmd[0]);
353 rq->sense = h->sense;
354 memset(rq->sense, 0, SCSI_SENSE_BUFFERSIZE);
360 static void release_controller(struct kref *kref)
362 struct rdac_controller *ctlr;
363 ctlr = container_of(kref, struct rdac_controller, kref);
365 flush_workqueue(kmpath_rdacd);
366 spin_lock(&list_lock);
367 list_del(&ctlr->node);
368 spin_unlock(&list_lock);
372 static struct rdac_controller *get_controller(u8 *subsys_id, u8 *slot_id,
375 struct rdac_controller *ctlr, *tmp;
377 spin_lock(&list_lock);
379 list_for_each_entry(tmp, &ctlr_list, node) {
380 if ((memcmp(tmp->subsys_id, subsys_id, SUBSYS_ID_LEN) == 0) &&
381 (memcmp(tmp->slot_id, slot_id, SLOT_ID_LEN) == 0)) {
382 kref_get(&tmp->kref);
383 spin_unlock(&list_lock);
387 ctlr = kmalloc(sizeof(*ctlr), GFP_ATOMIC);
391 /* initialize fields of controller */
392 memcpy(ctlr->subsys_id, subsys_id, SUBSYS_ID_LEN);
393 memcpy(ctlr->slot_id, slot_id, SLOT_ID_LEN);
394 memcpy(ctlr->array_name, array_name, ARRAY_LABEL_LEN);
396 /* update the controller index */
397 if (slot_id[1] == 0x31)
402 kref_init(&ctlr->kref);
405 ctlr->ms_sdev = NULL;
406 spin_lock_init(&ctlr->ms_lock);
407 INIT_WORK(&ctlr->ms_work, send_mode_select);
408 INIT_LIST_HEAD(&ctlr->ms_head);
409 list_add(&ctlr->node, &ctlr_list);
411 spin_unlock(&list_lock);
415 static int submit_inquiry(struct scsi_device *sdev, int page_code,
416 unsigned int len, struct rdac_dh_data *h)
419 struct request_queue *q = sdev->request_queue;
420 int err = SCSI_DH_RES_TEMP_UNAVAIL;
422 rq = get_rdac_req(sdev, &h->inq, len, READ);
426 /* Prepare the command. */
427 rq->cmd[0] = INQUIRY;
429 rq->cmd[2] = page_code;
431 rq->cmd_len = COMMAND_SIZE(INQUIRY);
433 rq->sense = h->sense;
434 memset(rq->sense, 0, SCSI_SENSE_BUFFERSIZE);
437 err = blk_execute_rq(q, NULL, rq, 1);
446 static int get_lun_info(struct scsi_device *sdev, struct rdac_dh_data *h,
450 struct c8_inquiry *inqp;
452 err = submit_inquiry(sdev, 0xC8, sizeof(struct c8_inquiry), h);
453 if (err == SCSI_DH_OK) {
455 if (inqp->page_code != 0xc8)
456 return SCSI_DH_NOSYS;
457 if (inqp->page_id[0] != 'e' || inqp->page_id[1] != 'd' ||
458 inqp->page_id[2] != 'i' || inqp->page_id[3] != 'd')
459 return SCSI_DH_NOSYS;
460 h->lun = inqp->lun[7]; /* Uses only the last byte */
462 for(i=0; i<ARRAY_LABEL_LEN-1; ++i)
463 *(array_name+i) = inqp->array_user_label[(2*i)+1];
465 *(array_name+ARRAY_LABEL_LEN-1) = '\0';
470 static int check_ownership(struct scsi_device *sdev, struct rdac_dh_data *h)
473 struct c9_inquiry *inqp;
475 h->state = RDAC_STATE_ACTIVE;
476 err = submit_inquiry(sdev, 0xC9, sizeof(struct c9_inquiry), h);
477 if (err == SCSI_DH_OK) {
479 /* detect the operating mode */
480 if ((inqp->avte_cvp >> 5) & 0x1)
481 h->mode = RDAC_MODE_IOSHIP; /* LUN in IOSHIP mode */
482 else if (inqp->avte_cvp >> 7)
483 h->mode = RDAC_MODE_AVT; /* LUN in AVT mode */
485 h->mode = RDAC_MODE; /* LUN in RDAC mode */
487 /* Update ownership */
488 if (inqp->avte_cvp & 0x1)
489 h->lun_state = RDAC_LUN_OWNED;
491 h->lun_state = RDAC_LUN_UNOWNED;
492 if (h->mode == RDAC_MODE)
493 h->state = RDAC_STATE_PASSIVE;
496 /* Update path prio*/
497 if (inqp->path_prio & 0x1)
498 h->preferred = RDAC_PREFERRED;
500 h->preferred = RDAC_NON_PREFERRED;
506 static int initialize_controller(struct scsi_device *sdev,
507 struct rdac_dh_data *h, char *array_name)
510 struct c4_inquiry *inqp;
512 err = submit_inquiry(sdev, 0xC4, sizeof(struct c4_inquiry), h);
513 if (err == SCSI_DH_OK) {
515 h->ctlr = get_controller(inqp->subsys_id, inqp->slot_id,
518 err = SCSI_DH_RES_TEMP_UNAVAIL;
523 static int set_mode_select(struct scsi_device *sdev, struct rdac_dh_data *h)
526 struct c2_inquiry *inqp;
528 err = submit_inquiry(sdev, 0xC2, sizeof(struct c2_inquiry), h);
529 if (err == SCSI_DH_OK) {
532 * If more than MODE6_MAX_LUN luns are supported, use
535 if (inqp->max_lun_supported >= MODE6_MAX_LUN)
536 h->ctlr->use_ms10 = 1;
538 h->ctlr->use_ms10 = 0;
543 static int mode_select_handle_sense(struct scsi_device *sdev,
544 unsigned char *sensebuf)
546 struct scsi_sense_hdr sense_hdr;
547 int err = SCSI_DH_IO, ret;
548 struct rdac_dh_data *h = get_rdac_data(sdev);
550 ret = scsi_normalize_sense(sensebuf, SCSI_SENSE_BUFFERSIZE, &sense_hdr);
554 switch (sense_hdr.sense_key) {
556 case ABORTED_COMMAND:
561 if (sense_hdr.asc == 0x04 && sense_hdr.ascq == 0x01)
562 /* LUN Not Ready and is in the Process of Becoming
567 case ILLEGAL_REQUEST:
568 if (sense_hdr.asc == 0x91 && sense_hdr.ascq == 0x36)
570 * Command Lock contention
578 RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, "
579 "MODE_SELECT returned with sense %02x/%02x/%02x",
580 (char *) h->ctlr->array_name, h->ctlr->index,
581 sense_hdr.sense_key, sense_hdr.asc, sense_hdr.ascq);
587 static void send_mode_select(struct work_struct *work)
589 struct rdac_controller *ctlr =
590 container_of(work, struct rdac_controller, ms_work);
592 struct scsi_device *sdev = ctlr->ms_sdev;
593 struct rdac_dh_data *h = get_rdac_data(sdev);
594 struct request_queue *q = sdev->request_queue;
595 int err, retry_cnt = RDAC_RETRY_COUNT;
596 struct rdac_queue_data *tmp, *qdata;
599 spin_lock(&ctlr->ms_lock);
600 list_splice_init(&ctlr->ms_head, &list);
602 ctlr->ms_sdev = NULL;
603 spin_unlock(&ctlr->ms_lock);
606 err = SCSI_DH_RES_TEMP_UNAVAIL;
607 rq = rdac_failover_get(sdev, h, &list);
611 RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, "
612 "%s MODE_SELECT command",
613 (char *) h->ctlr->array_name, h->ctlr->index,
614 (retry_cnt == RDAC_RETRY_COUNT) ? "queueing" : "retrying");
616 err = blk_execute_rq(q, NULL, rq, 1);
618 if (err != SCSI_DH_OK) {
619 err = mode_select_handle_sense(sdev, h->sense);
620 if (err == SCSI_DH_RETRY && retry_cnt--)
623 if (err == SCSI_DH_OK) {
624 h->state = RDAC_STATE_ACTIVE;
625 RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, "
626 "MODE_SELECT completed",
627 (char *) h->ctlr->array_name, h->ctlr->index);
631 list_for_each_entry_safe(qdata, tmp, &list, entry) {
632 list_del(&qdata->entry);
633 if (err == SCSI_DH_OK)
634 qdata->h->state = RDAC_STATE_ACTIVE;
635 if (qdata->callback_fn)
636 qdata->callback_fn(qdata->callback_data, err);
642 static int queue_mode_select(struct scsi_device *sdev,
643 activate_complete fn, void *data)
645 struct rdac_queue_data *qdata;
646 struct rdac_controller *ctlr;
648 qdata = kzalloc(sizeof(*qdata), GFP_KERNEL);
650 return SCSI_DH_RETRY;
652 qdata->h = get_rdac_data(sdev);
653 qdata->callback_fn = fn;
654 qdata->callback_data = data;
656 ctlr = qdata->h->ctlr;
657 spin_lock(&ctlr->ms_lock);
658 list_add_tail(&qdata->entry, &ctlr->ms_head);
659 if (!ctlr->ms_queued) {
661 ctlr->ms_sdev = sdev;
662 queue_work(kmpath_rdacd, &ctlr->ms_work);
664 spin_unlock(&ctlr->ms_lock);
668 static int rdac_activate(struct scsi_device *sdev,
669 activate_complete fn, void *data)
671 struct rdac_dh_data *h = get_rdac_data(sdev);
672 int err = SCSI_DH_OK;
675 err = check_ownership(sdev, h);
676 if (err != SCSI_DH_OK)
681 if (h->lun_state == RDAC_LUN_UNOWNED)
684 case RDAC_MODE_IOSHIP:
685 if ((h->lun_state == RDAC_LUN_UNOWNED) &&
686 (h->preferred == RDAC_PREFERRED))
694 err = queue_mode_select(sdev, fn, data);
695 if (err == SCSI_DH_OK)
704 static int rdac_prep_fn(struct scsi_device *sdev, struct request *req)
706 struct rdac_dh_data *h = get_rdac_data(sdev);
707 int ret = BLKPREP_OK;
709 if (h->state != RDAC_STATE_ACTIVE) {
711 req->cmd_flags |= REQ_QUIET;
717 static int rdac_check_sense(struct scsi_device *sdev,
718 struct scsi_sense_hdr *sense_hdr)
720 struct rdac_dh_data *h = get_rdac_data(sdev);
722 RDAC_LOG(RDAC_LOG_SENSE, sdev, "array %s, ctlr %d, "
723 "I/O returned with sense %02x/%02x/%02x",
724 (char *) h->ctlr->array_name, h->ctlr->index,
725 sense_hdr->sense_key, sense_hdr->asc, sense_hdr->ascq);
727 switch (sense_hdr->sense_key) {
729 if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x01)
730 /* LUN Not Ready - Logical Unit Not Ready and is in
731 * the process of becoming ready
734 return ADD_TO_MLQUEUE;
735 if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x81)
736 /* LUN Not Ready - Storage firmware incompatible
737 * Manual code synchonisation required.
739 * Nothing we can do here. Try to bypass the path.
742 if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0xA1)
743 /* LUN Not Ready - Quiescense in progress
745 * Just retry and wait.
747 return ADD_TO_MLQUEUE;
748 if (sense_hdr->asc == 0xA1 && sense_hdr->ascq == 0x02)
749 /* LUN Not Ready - Quiescense in progress
750 * or has been achieved
753 return ADD_TO_MLQUEUE;
755 case ILLEGAL_REQUEST:
756 if (sense_hdr->asc == 0x94 && sense_hdr->ascq == 0x01) {
757 /* Invalid Request - Current Logical Unit Ownership.
758 * Controller is not the current owner of the LUN,
759 * Fail the path, so that the other path be used.
761 h->state = RDAC_STATE_PASSIVE;
766 if (sense_hdr->asc == 0x29 && sense_hdr->ascq == 0x00)
768 * Power On, Reset, or Bus Device Reset, just retry.
770 return ADD_TO_MLQUEUE;
771 if (sense_hdr->asc == 0x8b && sense_hdr->ascq == 0x02)
773 * Quiescence in progress , just retry.
775 return ADD_TO_MLQUEUE;
778 /* success just means we do not care what scsi-ml does */
779 return SCSI_RETURN_NOT_HANDLED;
782 static const struct scsi_dh_devlist rdac_dev_list[] = {
796 {"STK", "OPENstorage D280"},
798 {"SUN", "LCSM100_I"},
799 {"SUN", "LCSM100_S"},
800 {"SUN", "LCSM100_E"},
801 {"SUN", "LCSM100_F"},
808 {"LSI", "INF-01-00"},
809 {"ENGENIO", "INF-01-00"},
810 {"STK", "FLEXLINE 380"},
811 {"SUN", "CSM100_R_FC"},
812 {"SUN", "STK6580_6780"},
817 static int rdac_bus_attach(struct scsi_device *sdev);
818 static void rdac_bus_detach(struct scsi_device *sdev);
820 static struct scsi_device_handler rdac_dh = {
822 .module = THIS_MODULE,
823 .devlist = rdac_dev_list,
824 .prep_fn = rdac_prep_fn,
825 .check_sense = rdac_check_sense,
826 .attach = rdac_bus_attach,
827 .detach = rdac_bus_detach,
828 .activate = rdac_activate,
831 static int rdac_bus_attach(struct scsi_device *sdev)
833 struct scsi_dh_data *scsi_dh_data;
834 struct rdac_dh_data *h;
837 char array_name[ARRAY_LABEL_LEN];
839 scsi_dh_data = kzalloc(sizeof(*scsi_dh_data)
840 + sizeof(*h) , GFP_KERNEL);
842 sdev_printk(KERN_ERR, sdev, "%s: Attach failed\n",
847 scsi_dh_data->scsi_dh = &rdac_dh;
848 h = (struct rdac_dh_data *) scsi_dh_data->buf;
849 h->lun = UNINITIALIZED_LUN;
850 h->state = RDAC_STATE_ACTIVE;
852 err = get_lun_info(sdev, h, array_name);
853 if (err != SCSI_DH_OK)
856 err = initialize_controller(sdev, h, array_name);
857 if (err != SCSI_DH_OK)
860 err = check_ownership(sdev, h);
861 if (err != SCSI_DH_OK)
864 err = set_mode_select(sdev, h);
865 if (err != SCSI_DH_OK)
868 if (!try_module_get(THIS_MODULE))
871 spin_lock_irqsave(sdev->request_queue->queue_lock, flags);
872 sdev->scsi_dh_data = scsi_dh_data;
873 spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);
875 sdev_printk(KERN_NOTICE, sdev,
876 "%s: LUN %d (%s) (%s)\n",
877 RDAC_NAME, h->lun, mode[(int)h->mode],
878 lun_state[(int)h->lun_state]);
883 kref_put(&h->ctlr->kref, release_controller);
887 sdev_printk(KERN_ERR, sdev, "%s: not attached\n",
892 static void rdac_bus_detach( struct scsi_device *sdev )
894 struct scsi_dh_data *scsi_dh_data;
895 struct rdac_dh_data *h;
898 spin_lock_irqsave(sdev->request_queue->queue_lock, flags);
899 scsi_dh_data = sdev->scsi_dh_data;
900 sdev->scsi_dh_data = NULL;
901 spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);
903 h = (struct rdac_dh_data *) scsi_dh_data->buf;
905 kref_put(&h->ctlr->kref, release_controller);
907 module_put(THIS_MODULE);
908 sdev_printk(KERN_NOTICE, sdev, "%s: Detached\n", RDAC_NAME);
913 static int __init rdac_init(void)
917 r = scsi_register_device_handler(&rdac_dh);
919 printk(KERN_ERR "Failed to register scsi device handler.");
924 * Create workqueue to handle mode selects for rdac
926 kmpath_rdacd = create_singlethread_workqueue("kmpath_rdacd");
928 scsi_unregister_device_handler(&rdac_dh);
929 printk(KERN_ERR "kmpath_rdacd creation failed.\n");
935 static void __exit rdac_exit(void)
937 destroy_workqueue(kmpath_rdacd);
938 scsi_unregister_device_handler(&rdac_dh);
941 module_init(rdac_init);
942 module_exit(rdac_exit);
944 MODULE_DESCRIPTION("Multipath LSI/Engenio RDAC driver");
945 MODULE_AUTHOR("Mike Christie, Chandra Seetharaman");
946 MODULE_VERSION("01.00.0000.0000");
947 MODULE_LICENSE("GPL");