2 * Generic SCSI-3 ALUA SCSI Device Handler
4 * Copyright (C) 2007-2010 Hannes Reinecke, SUSE Linux Products GmbH.
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 <linux/slab.h>
23 #include <linux/delay.h>
24 #include <linux/module.h>
25 #include <scsi/scsi.h>
26 #include <scsi/scsi_eh.h>
27 #include <scsi/scsi_dh.h>
29 #define ALUA_DH_NAME "alua"
30 #define ALUA_DH_VER "1.3"
32 #define TPGS_STATE_OPTIMIZED 0x0
33 #define TPGS_STATE_NONOPTIMIZED 0x1
34 #define TPGS_STATE_STANDBY 0x2
35 #define TPGS_STATE_UNAVAILABLE 0x3
36 #define TPGS_STATE_LBA_DEPENDENT 0x4
37 #define TPGS_STATE_OFFLINE 0xe
38 #define TPGS_STATE_TRANSITIONING 0xf
40 #define TPGS_SUPPORT_NONE 0x00
41 #define TPGS_SUPPORT_OPTIMIZED 0x01
42 #define TPGS_SUPPORT_NONOPTIMIZED 0x02
43 #define TPGS_SUPPORT_STANDBY 0x04
44 #define TPGS_SUPPORT_UNAVAILABLE 0x08
45 #define TPGS_SUPPORT_LBA_DEPENDENT 0x10
46 #define TPGS_SUPPORT_OFFLINE 0x40
47 #define TPGS_SUPPORT_TRANSITION 0x80
49 #define TPGS_MODE_UNINITIALIZED -1
50 #define TPGS_MODE_NONE 0x0
51 #define TPGS_MODE_IMPLICIT 0x1
52 #define TPGS_MODE_EXPLICIT 0x2
54 #define ALUA_INQUIRY_SIZE 36
55 #define ALUA_FAILOVER_TIMEOUT (60 * HZ)
56 #define ALUA_FAILOVER_RETRIES 5
63 unsigned char inq
[ALUA_INQUIRY_SIZE
];
66 unsigned char sense
[SCSI_SENSE_BUFFERSIZE
];
68 struct scsi_device
*sdev
;
69 activate_complete callback_fn
;
73 #define ALUA_POLICY_SWITCH_CURRENT 0
74 #define ALUA_POLICY_SWITCH_ALL 1
76 static char print_alua_state(int);
77 static int alua_check_sense(struct scsi_device
*, struct scsi_sense_hdr
*);
79 static inline struct alua_dh_data
*get_alua_data(struct scsi_device
*sdev
)
81 struct scsi_dh_data
*scsi_dh_data
= sdev
->scsi_dh_data
;
82 BUG_ON(scsi_dh_data
== NULL
);
83 return ((struct alua_dh_data
*) scsi_dh_data
->buf
);
86 static int realloc_buffer(struct alua_dh_data
*h
, unsigned len
)
88 if (h
->buff
&& h
->buff
!= h
->inq
)
91 h
->buff
= kmalloc(len
, GFP_NOIO
);
94 h
->bufflen
= ALUA_INQUIRY_SIZE
;
101 static struct request
*get_alua_req(struct scsi_device
*sdev
,
102 void *buffer
, unsigned buflen
, int rw
)
105 struct request_queue
*q
= sdev
->request_queue
;
107 rq
= blk_get_request(q
, rw
, GFP_NOIO
);
110 sdev_printk(KERN_INFO
, sdev
,
111 "%s: blk_get_request failed\n", __func__
);
115 if (buflen
&& blk_rq_map_kern(q
, rq
, buffer
, buflen
, GFP_NOIO
)) {
117 sdev_printk(KERN_INFO
, sdev
,
118 "%s: blk_rq_map_kern failed\n", __func__
);
122 rq
->cmd_type
= REQ_TYPE_BLOCK_PC
;
123 rq
->cmd_flags
|= REQ_FAILFAST_DEV
| REQ_FAILFAST_TRANSPORT
|
125 rq
->retries
= ALUA_FAILOVER_RETRIES
;
126 rq
->timeout
= ALUA_FAILOVER_TIMEOUT
;
132 * submit_vpd_inquiry - Issue an INQUIRY VPD page 0x83 command
133 * @sdev: sdev the command should be sent to
135 static int submit_vpd_inquiry(struct scsi_device
*sdev
, struct alua_dh_data
*h
)
138 int err
= SCSI_DH_RES_TEMP_UNAVAIL
;
140 rq
= get_alua_req(sdev
, h
->buff
, h
->bufflen
, READ
);
144 /* Prepare the command. */
145 rq
->cmd
[0] = INQUIRY
;
148 rq
->cmd
[4] = h
->bufflen
;
149 rq
->cmd_len
= COMMAND_SIZE(INQUIRY
);
151 rq
->sense
= h
->sense
;
152 memset(rq
->sense
, 0, SCSI_SENSE_BUFFERSIZE
);
153 rq
->sense_len
= h
->senselen
= 0;
155 err
= blk_execute_rq(rq
->q
, NULL
, rq
, 1);
157 sdev_printk(KERN_INFO
, sdev
,
158 "%s: evpd inquiry failed with %x\n",
159 ALUA_DH_NAME
, rq
->errors
);
160 h
->senselen
= rq
->sense_len
;
169 * submit_rtpg - Issue a REPORT TARGET GROUP STATES command
170 * @sdev: sdev the command should be sent to
172 static unsigned submit_rtpg(struct scsi_device
*sdev
, struct alua_dh_data
*h
)
175 int err
= SCSI_DH_RES_TEMP_UNAVAIL
;
177 rq
= get_alua_req(sdev
, h
->buff
, h
->bufflen
, READ
);
181 /* Prepare the command. */
182 rq
->cmd
[0] = MAINTENANCE_IN
;
183 rq
->cmd
[1] = MI_REPORT_TARGET_PGS
;
184 rq
->cmd
[6] = (h
->bufflen
>> 24) & 0xff;
185 rq
->cmd
[7] = (h
->bufflen
>> 16) & 0xff;
186 rq
->cmd
[8] = (h
->bufflen
>> 8) & 0xff;
187 rq
->cmd
[9] = h
->bufflen
& 0xff;
188 rq
->cmd_len
= COMMAND_SIZE(MAINTENANCE_IN
);
190 rq
->sense
= h
->sense
;
191 memset(rq
->sense
, 0, SCSI_SENSE_BUFFERSIZE
);
192 rq
->sense_len
= h
->senselen
= 0;
194 err
= blk_execute_rq(rq
->q
, NULL
, rq
, 1);
196 sdev_printk(KERN_INFO
, sdev
,
197 "%s: rtpg failed with %x\n",
198 ALUA_DH_NAME
, rq
->errors
);
199 h
->senselen
= rq
->sense_len
;
208 * alua_stpg - Evaluate SET TARGET GROUP STATES
209 * @sdev: the device to be evaluated
210 * @state: the new target group state
212 * Send a SET TARGET GROUP STATES command to the device.
213 * We only have to test here if we should resubmit the command;
214 * any other error is assumed as a failure.
216 static void stpg_endio(struct request
*req
, int error
)
218 struct alua_dh_data
*h
= req
->end_io_data
;
219 struct scsi_sense_hdr sense_hdr
;
220 unsigned err
= SCSI_DH_OK
;
222 if (error
|| host_byte(req
->errors
) != DID_OK
||
223 msg_byte(req
->errors
) != COMMAND_COMPLETE
) {
228 if (h
->senselen
> 0) {
229 err
= scsi_normalize_sense(h
->sense
, SCSI_SENSE_BUFFERSIZE
,
235 err
= alua_check_sense(h
->sdev
, &sense_hdr
);
236 if (err
== ADD_TO_MLQUEUE
) {
240 sdev_printk(KERN_INFO
, h
->sdev
,
241 "%s: stpg sense code: %02x/%02x/%02x\n",
242 ALUA_DH_NAME
, sense_hdr
.sense_key
,
243 sense_hdr
.asc
, sense_hdr
.ascq
);
246 if (err
== SCSI_DH_OK
) {
247 h
->state
= TPGS_STATE_OPTIMIZED
;
248 sdev_printk(KERN_INFO
, h
->sdev
,
249 "%s: port group %02x switched to state %c\n",
250 ALUA_DH_NAME
, h
->group_id
,
251 print_alua_state(h
->state
));
254 req
->end_io_data
= NULL
;
255 __blk_put_request(req
->q
, req
);
256 if (h
->callback_fn
) {
257 h
->callback_fn(h
->callback_data
, err
);
258 h
->callback_fn
= h
->callback_data
= NULL
;
264 * submit_stpg - Issue a SET TARGET GROUP STATES command
266 * Currently we're only setting the current target port group state
267 * to 'active/optimized' and let the array firmware figure out
268 * the states of the remaining groups.
270 static unsigned submit_stpg(struct alua_dh_data
*h
)
274 struct scsi_device
*sdev
= h
->sdev
;
276 /* Prepare the data buffer */
277 memset(h
->buff
, 0, stpg_len
);
278 h
->buff
[4] = TPGS_STATE_OPTIMIZED
& 0x0f;
279 h
->buff
[6] = (h
->group_id
>> 8) & 0xff;
280 h
->buff
[7] = h
->group_id
& 0xff;
282 rq
= get_alua_req(sdev
, h
->buff
, stpg_len
, WRITE
);
284 return SCSI_DH_RES_TEMP_UNAVAIL
;
286 /* Prepare the command. */
287 rq
->cmd
[0] = MAINTENANCE_OUT
;
288 rq
->cmd
[1] = MO_SET_TARGET_PGS
;
289 rq
->cmd
[6] = (stpg_len
>> 24) & 0xff;
290 rq
->cmd
[7] = (stpg_len
>> 16) & 0xff;
291 rq
->cmd
[8] = (stpg_len
>> 8) & 0xff;
292 rq
->cmd
[9] = stpg_len
& 0xff;
293 rq
->cmd_len
= COMMAND_SIZE(MAINTENANCE_OUT
);
295 rq
->sense
= h
->sense
;
296 memset(rq
->sense
, 0, SCSI_SENSE_BUFFERSIZE
);
297 rq
->sense_len
= h
->senselen
= 0;
300 blk_execute_rq_nowait(rq
->q
, NULL
, rq
, 1, stpg_endio
);
305 * alua_check_tpgs - Evaluate TPGS setting
306 * @sdev: device to be checked
308 * Examine the TPGS setting of the sdev to find out if ALUA
311 static int alua_check_tpgs(struct scsi_device
*sdev
, struct alua_dh_data
*h
)
313 int err
= SCSI_DH_OK
;
315 h
->tpgs
= scsi_device_tpgs(sdev
);
317 case TPGS_MODE_EXPLICIT
|TPGS_MODE_IMPLICIT
:
318 sdev_printk(KERN_INFO
, sdev
,
319 "%s: supports implicit and explicit TPGS\n",
322 case TPGS_MODE_EXPLICIT
:
323 sdev_printk(KERN_INFO
, sdev
, "%s: supports explicit TPGS\n",
326 case TPGS_MODE_IMPLICIT
:
327 sdev_printk(KERN_INFO
, sdev
, "%s: supports implicit TPGS\n",
331 h
->tpgs
= TPGS_MODE_NONE
;
332 sdev_printk(KERN_INFO
, sdev
, "%s: not supported\n",
334 err
= SCSI_DH_DEV_UNSUPP
;
342 * alua_vpd_inquiry - Evaluate INQUIRY vpd page 0x83
343 * @sdev: device to be checked
345 * Extract the relative target port and the target port group
346 * descriptor from the list of identificators.
348 static int alua_vpd_inquiry(struct scsi_device
*sdev
, struct alua_dh_data
*h
)
355 err
= submit_vpd_inquiry(sdev
, h
);
357 if (err
!= SCSI_DH_OK
)
360 /* Check if vpd page exceeds initial buffer */
361 len
= (h
->buff
[2] << 8) + h
->buff
[3] + 4;
362 if (len
> h
->bufflen
) {
363 /* Resubmit with the correct length */
364 if (realloc_buffer(h
, len
)) {
365 sdev_printk(KERN_WARNING
, sdev
,
366 "%s: kmalloc buffer failed\n",
368 /* Temporary failure, bypass */
369 return SCSI_DH_DEV_TEMP_BUSY
;
375 * Now look for the correct descriptor.
378 while (d
< h
->buff
+ len
) {
379 switch (d
[1] & 0xf) {
381 /* Relative target port */
382 h
->rel_port
= (d
[6] << 8) + d
[7];
385 /* Target port group */
386 h
->group_id
= (d
[6] << 8) + d
[7];
394 if (h
->group_id
== -1) {
396 * Internal error; TPGS supported but required
397 * VPD identification descriptors not present.
398 * Disable ALUA support
400 sdev_printk(KERN_INFO
, sdev
,
401 "%s: No target port descriptors found\n",
403 h
->state
= TPGS_STATE_OPTIMIZED
;
404 h
->tpgs
= TPGS_MODE_NONE
;
405 err
= SCSI_DH_DEV_UNSUPP
;
407 sdev_printk(KERN_INFO
, sdev
,
408 "%s: port group %02x rel port %02x\n",
409 ALUA_DH_NAME
, h
->group_id
, h
->rel_port
);
415 static char print_alua_state(int state
)
418 case TPGS_STATE_OPTIMIZED
:
420 case TPGS_STATE_NONOPTIMIZED
:
422 case TPGS_STATE_STANDBY
:
424 case TPGS_STATE_UNAVAILABLE
:
426 case TPGS_STATE_LBA_DEPENDENT
:
428 case TPGS_STATE_OFFLINE
:
430 case TPGS_STATE_TRANSITIONING
:
437 static int alua_check_sense(struct scsi_device
*sdev
,
438 struct scsi_sense_hdr
*sense_hdr
)
440 switch (sense_hdr
->sense_key
) {
442 if (sense_hdr
->asc
== 0x04 && sense_hdr
->ascq
== 0x0a)
444 * LUN Not Accessible - ALUA state transition
446 return ADD_TO_MLQUEUE
;
447 if (sense_hdr
->asc
== 0x04 && sense_hdr
->ascq
== 0x0b)
449 * LUN Not Accessible -- Target port in standby state
452 if (sense_hdr
->asc
== 0x04 && sense_hdr
->ascq
== 0x0c)
454 * LUN Not Accessible -- Target port in unavailable state
457 if (sense_hdr
->asc
== 0x04 && sense_hdr
->ascq
== 0x12)
459 * LUN Not Ready -- Offline
464 if (sense_hdr
->asc
== 0x29 && sense_hdr
->ascq
== 0x00)
466 * Power On, Reset, or Bus Device Reset, just retry.
468 return ADD_TO_MLQUEUE
;
469 if (sense_hdr
->asc
== 0x2a && sense_hdr
->ascq
== 0x01)
471 * Mode Parameters Changed
473 return ADD_TO_MLQUEUE
;
474 if (sense_hdr
->asc
== 0x2a && sense_hdr
->ascq
== 0x06)
478 return ADD_TO_MLQUEUE
;
479 if (sense_hdr
->asc
== 0x2a && sense_hdr
->ascq
== 0x07)
481 * Implicit ALUA state transition failed
483 return ADD_TO_MLQUEUE
;
484 if (sense_hdr
->asc
== 0x3f && sense_hdr
->ascq
== 0x03)
486 * Inquiry data has changed
488 return ADD_TO_MLQUEUE
;
489 if (sense_hdr
->asc
== 0x3f && sense_hdr
->ascq
== 0x0e)
491 * REPORTED_LUNS_DATA_HAS_CHANGED is reported
492 * when switching controllers on targets like
493 * Intel Multi-Flex. We can just retry.
495 return ADD_TO_MLQUEUE
;
499 return SCSI_RETURN_NOT_HANDLED
;
503 * alua_rtpg - Evaluate REPORT TARGET GROUP STATES
504 * @sdev: the device to be evaluated.
506 * Evaluate the Target Port Group State.
507 * Returns SCSI_DH_DEV_OFFLINED if the path is
508 * found to be unusable.
510 static int alua_rtpg(struct scsi_device
*sdev
, struct alua_dh_data
*h
)
512 struct scsi_sense_hdr sense_hdr
;
513 int len
, k
, off
, valid_states
= 0;
516 unsigned long expiry
, interval
= 1000;
518 expiry
= round_jiffies_up(jiffies
+ ALUA_FAILOVER_TIMEOUT
);
520 err
= submit_rtpg(sdev
, h
);
522 if (err
== SCSI_DH_IO
&& h
->senselen
> 0) {
523 err
= scsi_normalize_sense(h
->sense
, SCSI_SENSE_BUFFERSIZE
,
528 err
= alua_check_sense(sdev
, &sense_hdr
);
529 if (err
== ADD_TO_MLQUEUE
&& time_before(jiffies
, expiry
))
531 sdev_printk(KERN_INFO
, sdev
,
532 "%s: rtpg sense code %02x/%02x/%02x\n",
533 ALUA_DH_NAME
, sense_hdr
.sense_key
,
534 sense_hdr
.asc
, sense_hdr
.ascq
);
537 if (err
!= SCSI_DH_OK
)
540 len
= (h
->buff
[0] << 24) + (h
->buff
[1] << 16) +
541 (h
->buff
[2] << 8) + h
->buff
[3] + 4;
543 if (len
> h
->bufflen
) {
544 /* Resubmit with the correct length */
545 if (realloc_buffer(h
, len
)) {
546 sdev_printk(KERN_WARNING
, sdev
,
547 "%s: kmalloc buffer failed\n",__func__
);
548 /* Temporary failure, bypass */
549 return SCSI_DH_DEV_TEMP_BUSY
;
554 for (k
= 4, ucp
= h
->buff
+ 4; k
< len
; k
+= off
, ucp
+= off
) {
555 if (h
->group_id
== (ucp
[2] << 8) + ucp
[3]) {
556 h
->state
= ucp
[0] & 0x0f;
557 valid_states
= ucp
[1];
559 off
= 8 + (ucp
[7] * 4);
562 sdev_printk(KERN_INFO
, sdev
,
563 "%s: port group %02x state %c supports %c%c%c%c%c%c%c\n",
564 ALUA_DH_NAME
, h
->group_id
, print_alua_state(h
->state
),
565 valid_states
&TPGS_SUPPORT_TRANSITION
?'T':'t',
566 valid_states
&TPGS_SUPPORT_OFFLINE
?'O':'o',
567 valid_states
&TPGS_SUPPORT_LBA_DEPENDENT
?'L':'l',
568 valid_states
&TPGS_SUPPORT_UNAVAILABLE
?'U':'u',
569 valid_states
&TPGS_SUPPORT_STANDBY
?'S':'s',
570 valid_states
&TPGS_SUPPORT_NONOPTIMIZED
?'N':'n',
571 valid_states
&TPGS_SUPPORT_OPTIMIZED
?'A':'a');
574 case TPGS_STATE_TRANSITIONING
:
575 if (time_before(jiffies
, expiry
)) {
576 /* State transition, retry */
581 /* Transitioning time exceeded, set port to standby */
583 h
->state
= TPGS_STATE_STANDBY
;
585 case TPGS_STATE_OFFLINE
:
586 case TPGS_STATE_UNAVAILABLE
:
587 /* Path unusable for unavailable/offline */
588 err
= SCSI_DH_DEV_OFFLINED
;
591 /* Useable path if active */
599 * alua_initialize - Initialize ALUA state
600 * @sdev: the device to be initialized
602 * For the prep_fn to work correctly we have
603 * to initialize the ALUA state for the device.
605 static int alua_initialize(struct scsi_device
*sdev
, struct alua_dh_data
*h
)
609 err
= alua_check_tpgs(sdev
, h
);
610 if (err
!= SCSI_DH_OK
)
613 err
= alua_vpd_inquiry(sdev
, h
);
614 if (err
!= SCSI_DH_OK
)
617 err
= alua_rtpg(sdev
, h
);
618 if (err
!= SCSI_DH_OK
)
626 * alua_activate - activate a path
627 * @sdev: device on the path to be activated
629 * We're currently switching the port group to be activated only and
630 * let the array figure out the rest.
631 * There may be other arrays which require us to switch all port groups
632 * based on a certain policy. But until we actually encounter them it
635 static int alua_activate(struct scsi_device
*sdev
,
636 activate_complete fn
, void *data
)
638 struct alua_dh_data
*h
= get_alua_data(sdev
);
639 int err
= SCSI_DH_OK
;
641 err
= alua_rtpg(sdev
, h
);
642 if (err
!= SCSI_DH_OK
)
645 if (h
->tpgs
& TPGS_MODE_EXPLICIT
&&
646 h
->state
!= TPGS_STATE_OPTIMIZED
&&
647 h
->state
!= TPGS_STATE_LBA_DEPENDENT
) {
649 h
->callback_data
= data
;
650 err
= submit_stpg(h
);
651 if (err
== SCSI_DH_OK
)
653 h
->callback_fn
= h
->callback_data
= NULL
;
663 * alua_prep_fn - request callback
665 * Fail I/O to all paths not in state
666 * active/optimized or active/non-optimized.
668 static int alua_prep_fn(struct scsi_device
*sdev
, struct request
*req
)
670 struct alua_dh_data
*h
= get_alua_data(sdev
);
671 int ret
= BLKPREP_OK
;
673 if (h
->state
== TPGS_STATE_TRANSITIONING
)
675 else if (h
->state
!= TPGS_STATE_OPTIMIZED
&&
676 h
->state
!= TPGS_STATE_NONOPTIMIZED
&&
677 h
->state
!= TPGS_STATE_LBA_DEPENDENT
) {
679 req
->cmd_flags
|= REQ_QUIET
;
685 static bool alua_match(struct scsi_device
*sdev
)
687 return (scsi_device_tpgs(sdev
) != 0);
690 static int alua_bus_attach(struct scsi_device
*sdev
);
691 static void alua_bus_detach(struct scsi_device
*sdev
);
693 static struct scsi_device_handler alua_dh
= {
694 .name
= ALUA_DH_NAME
,
695 .module
= THIS_MODULE
,
696 .attach
= alua_bus_attach
,
697 .detach
= alua_bus_detach
,
698 .prep_fn
= alua_prep_fn
,
699 .check_sense
= alua_check_sense
,
700 .activate
= alua_activate
,
705 * alua_bus_attach - Attach device handler
706 * @sdev: device to be attached to
708 static int alua_bus_attach(struct scsi_device
*sdev
)
710 struct scsi_dh_data
*scsi_dh_data
;
711 struct alua_dh_data
*h
;
713 int err
= SCSI_DH_OK
;
715 scsi_dh_data
= kzalloc(sizeof(*scsi_dh_data
)
716 + sizeof(*h
) , GFP_KERNEL
);
718 sdev_printk(KERN_ERR
, sdev
, "%s: Attach failed\n",
723 scsi_dh_data
->scsi_dh
= &alua_dh
;
724 h
= (struct alua_dh_data
*) scsi_dh_data
->buf
;
725 h
->tpgs
= TPGS_MODE_UNINITIALIZED
;
726 h
->state
= TPGS_STATE_OPTIMIZED
;
730 h
->bufflen
= ALUA_INQUIRY_SIZE
;
733 err
= alua_initialize(sdev
, h
);
734 if ((err
!= SCSI_DH_OK
) && (err
!= SCSI_DH_DEV_OFFLINED
))
737 if (!try_module_get(THIS_MODULE
))
740 spin_lock_irqsave(sdev
->request_queue
->queue_lock
, flags
);
741 sdev
->scsi_dh_data
= scsi_dh_data
;
742 spin_unlock_irqrestore(sdev
->request_queue
->queue_lock
, flags
);
743 sdev_printk(KERN_NOTICE
, sdev
, "%s: Attached\n", ALUA_DH_NAME
);
749 sdev_printk(KERN_ERR
, sdev
, "%s: not attached\n", ALUA_DH_NAME
);
754 * alua_bus_detach - Detach device handler
755 * @sdev: device to be detached from
757 static void alua_bus_detach(struct scsi_device
*sdev
)
759 struct scsi_dh_data
*scsi_dh_data
;
760 struct alua_dh_data
*h
;
763 spin_lock_irqsave(sdev
->request_queue
->queue_lock
, flags
);
764 scsi_dh_data
= sdev
->scsi_dh_data
;
765 sdev
->scsi_dh_data
= NULL
;
766 spin_unlock_irqrestore(sdev
->request_queue
->queue_lock
, flags
);
768 h
= (struct alua_dh_data
*) scsi_dh_data
->buf
;
769 if (h
->buff
&& h
->inq
!= h
->buff
)
772 module_put(THIS_MODULE
);
773 sdev_printk(KERN_NOTICE
, sdev
, "%s: Detached\n", ALUA_DH_NAME
);
776 static int __init
alua_init(void)
780 r
= scsi_register_device_handler(&alua_dh
);
782 printk(KERN_ERR
"%s: Failed to register scsi device handler",
787 static void __exit
alua_exit(void)
789 scsi_unregister_device_handler(&alua_dh
);
792 module_init(alua_init
);
793 module_exit(alua_exit
);
795 MODULE_DESCRIPTION("DM Multipath ALUA support");
796 MODULE_AUTHOR("Hannes Reinecke <hare@suse.de>");
797 MODULE_LICENSE("GPL");
798 MODULE_VERSION(ALUA_DH_VER
);