blob: 1c8e538d4a2e95fd4f6804bd9dc5ba1956cbb370 [file] [log] [blame]
Hannes Reinecke057ea7c2008-07-17 16:53:21 -07001/*
2 * Generic SCSI-3 ALUA SCSI Device Handler
3 *
Hannes Reinecke69723d12010-09-24 15:57:04 +02004 * Copyright (C) 2007-2010 Hannes Reinecke, SUSE Linux Products GmbH.
Hannes Reinecke057ea7c2008-07-17 16:53:21 -07005 * All rights reserved.
6 *
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.
11 *
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.
16 *
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.
20 *
21 */
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090022#include <linux/slab.h>
Hannes Reinecke69723d12010-09-24 15:57:04 +020023#include <linux/delay.h>
Paul Gortmakeracf3368f2011-05-27 09:47:43 -040024#include <linux/module.h>
Hannes Reineckea7089772015-12-01 10:16:52 +010025#include <asm/unaligned.h>
Hannes Reinecke057ea7c2008-07-17 16:53:21 -070026#include <scsi/scsi.h>
Hannes Reinecke80bd68d2015-12-01 10:16:47 +010027#include <scsi/scsi_dbg.h>
Hannes Reinecke057ea7c2008-07-17 16:53:21 -070028#include <scsi/scsi_eh.h>
29#include <scsi/scsi_dh.h>
30
31#define ALUA_DH_NAME "alua"
Hannes Reinecke69723d12010-09-24 15:57:04 +020032#define ALUA_DH_VER "1.3"
Hannes Reinecke057ea7c2008-07-17 16:53:21 -070033
34#define TPGS_STATE_OPTIMIZED 0x0
35#define TPGS_STATE_NONOPTIMIZED 0x1
36#define TPGS_STATE_STANDBY 0x2
37#define TPGS_STATE_UNAVAILABLE 0x3
Hannes Reinecke69723d12010-09-24 15:57:04 +020038#define TPGS_STATE_LBA_DEPENDENT 0x4
Hannes Reinecke057ea7c2008-07-17 16:53:21 -070039#define TPGS_STATE_OFFLINE 0xe
40#define TPGS_STATE_TRANSITIONING 0xf
41
42#define TPGS_SUPPORT_NONE 0x00
43#define TPGS_SUPPORT_OPTIMIZED 0x01
44#define TPGS_SUPPORT_NONOPTIMIZED 0x02
45#define TPGS_SUPPORT_STANDBY 0x04
46#define TPGS_SUPPORT_UNAVAILABLE 0x08
Hannes Reinecke69723d12010-09-24 15:57:04 +020047#define TPGS_SUPPORT_LBA_DEPENDENT 0x10
Hannes Reinecke057ea7c2008-07-17 16:53:21 -070048#define TPGS_SUPPORT_OFFLINE 0x40
49#define TPGS_SUPPORT_TRANSITION 0x80
50
Rob Evers3588c5a2012-05-18 14:08:54 -040051#define RTPG_FMT_MASK 0x70
52#define RTPG_FMT_EXT_HDR 0x10
53
Hannes Reinecke057ea7c2008-07-17 16:53:21 -070054#define TPGS_MODE_UNINITIALIZED -1
55#define TPGS_MODE_NONE 0x0
56#define TPGS_MODE_IMPLICIT 0x1
57#define TPGS_MODE_EXPLICIT 0x2
58
59#define ALUA_INQUIRY_SIZE 36
Rob Evers3588c5a2012-05-18 14:08:54 -040060#define ALUA_FAILOVER_TIMEOUT 60
Hannes Reinecke057ea7c2008-07-17 16:53:21 -070061#define ALUA_FAILOVER_RETRIES 5
62
Hannes Reinecke6c4fc042015-12-01 10:16:51 +010063/* device handler flags */
Moger, Babu4335d092012-03-27 20:55:49 +000064#define ALUA_OPTIMIZE_STPG 1
Hannes Reinecke6c4fc042015-12-01 10:16:51 +010065#define ALUA_RTPG_EXT_HDR_UNSUPP 2
Moger, Babu4335d092012-03-27 20:55:49 +000066
Hannes Reinecke057ea7c2008-07-17 16:53:21 -070067struct alua_dh_data {
68 int group_id;
69 int rel_port;
70 int tpgs;
71 int state;
Moger, Babudcd3a752012-03-27 20:56:08 +000072 int pref;
Moger, Babu4335d092012-03-27 20:55:49 +000073 unsigned flags; /* used for optimizing STPG */
Hannes Reinecke057ea7c2008-07-17 16:53:21 -070074 unsigned char inq[ALUA_INQUIRY_SIZE];
75 unsigned char *buff;
76 int bufflen;
Rob Evers3588c5a2012-05-18 14:08:54 -040077 unsigned char transition_tmo;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -070078 unsigned char sense[SCSI_SENSE_BUFFERSIZE];
Chandra Seetharaman96e65862009-10-21 09:23:04 -070079 struct scsi_device *sdev;
80 activate_complete callback_fn;
81 void *callback_data;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -070082};
83
84#define ALUA_POLICY_SWITCH_CURRENT 0
85#define ALUA_POLICY_SWITCH_ALL 1
86
Chandra Seetharaman96e65862009-10-21 09:23:04 -070087static char print_alua_state(int);
88static int alua_check_sense(struct scsi_device *, struct scsi_sense_hdr *);
89
Hannes Reinecke057ea7c2008-07-17 16:53:21 -070090static int realloc_buffer(struct alua_dh_data *h, unsigned len)
91{
92 if (h->buff && h->buff != h->inq)
93 kfree(h->buff);
94
95 h->buff = kmalloc(len, GFP_NOIO);
96 if (!h->buff) {
97 h->buff = h->inq;
98 h->bufflen = ALUA_INQUIRY_SIZE;
99 return 1;
100 }
101 h->bufflen = len;
102 return 0;
103}
104
105static struct request *get_alua_req(struct scsi_device *sdev,
106 void *buffer, unsigned buflen, int rw)
107{
108 struct request *rq;
109 struct request_queue *q = sdev->request_queue;
110
111 rq = blk_get_request(q, rw, GFP_NOIO);
112
Joe Lawrencea492f072014-08-28 08:15:21 -0600113 if (IS_ERR(rq)) {
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700114 sdev_printk(KERN_INFO, sdev,
Harvey Harrisoncadbd4a2008-07-03 23:47:27 -0700115 "%s: blk_get_request failed\n", __func__);
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700116 return NULL;
117 }
Jens Axboef27b0872014-06-06 07:57:37 -0600118 blk_rq_set_block_pc(rq);
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700119
120 if (buflen && blk_rq_map_kern(q, rq, buffer, buflen, GFP_NOIO)) {
121 blk_put_request(rq);
122 sdev_printk(KERN_INFO, sdev,
Harvey Harrisoncadbd4a2008-07-03 23:47:27 -0700123 "%s: blk_rq_map_kern failed\n", __func__);
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700124 return NULL;
125 }
126
Mike Christie6000a362008-08-19 18:45:30 -0500127 rq->cmd_flags |= REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT |
Mike Christie64f84bc2008-09-06 08:39:16 -0500128 REQ_FAILFAST_DRIVER;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700129 rq->retries = ALUA_FAILOVER_RETRIES;
Rob Evers3588c5a2012-05-18 14:08:54 -0400130 rq->timeout = ALUA_FAILOVER_TIMEOUT * HZ;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700131
132 return rq;
133}
134
135/*
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700136 * submit_rtpg - Issue a REPORT TARGET GROUP STATES command
137 * @sdev: sdev the command should be sent to
138 */
Hannes Reinecke6c4fc042015-12-01 10:16:51 +0100139static unsigned submit_rtpg(struct scsi_device *sdev, struct alua_dh_data *h)
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700140{
141 struct request *rq;
Hannes Reinecke5597caf2015-12-01 10:16:48 +0100142 int err = 0;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700143
144 rq = get_alua_req(sdev, h->buff, h->bufflen, READ);
Hannes Reinecke5597caf2015-12-01 10:16:48 +0100145 if (!rq) {
146 err = DRIVER_BUSY << 24;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700147 goto done;
Hannes Reinecke5597caf2015-12-01 10:16:48 +0100148 }
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700149
150 /* Prepare the command. */
151 rq->cmd[0] = MAINTENANCE_IN;
Hannes Reinecke6c4fc042015-12-01 10:16:51 +0100152 if (!(h->flags & ALUA_RTPG_EXT_HDR_UNSUPP))
Rob Evers8e67ce62012-05-18 14:08:55 -0400153 rq->cmd[1] = MI_REPORT_TARGET_PGS | MI_EXT_HDR_PARAM_FMT;
154 else
155 rq->cmd[1] = MI_REPORT_TARGET_PGS;
Hannes Reineckea7089772015-12-01 10:16:52 +0100156 put_unaligned_be32(h->bufflen, &rq->cmd[6]);
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700157 rq->cmd_len = COMMAND_SIZE(MAINTENANCE_IN);
158
159 rq->sense = h->sense;
160 memset(rq->sense, 0, SCSI_SENSE_BUFFERSIZE);
Hannes Reinecked3692a32015-12-01 10:16:46 +0100161 rq->sense_len = 0;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700162
Hannes Reinecke5597caf2015-12-01 10:16:48 +0100163 blk_execute_rq(rq->q, NULL, rq, 1);
164 if (rq->errors)
165 err = rq->errors;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700166 blk_put_request(rq);
167done:
168 return err;
169}
170
171/*
Hannes Reineckedac173e2015-12-01 10:16:49 +0100172 * stpg_endio - Evaluate SET TARGET GROUP STATES
Chandra Seetharaman96e65862009-10-21 09:23:04 -0700173 * @sdev: the device to be evaluated
174 * @state: the new target group state
175 *
Hannes Reineckedac173e2015-12-01 10:16:49 +0100176 * Evaluate a SET TARGET GROUP STATES command response.
Chandra Seetharaman96e65862009-10-21 09:23:04 -0700177 */
178static void stpg_endio(struct request *req, int error)
179{
180 struct alua_dh_data *h = req->end_io_data;
181 struct scsi_sense_hdr sense_hdr;
Joseph Gruher93499232011-01-05 16:00:22 -0500182 unsigned err = SCSI_DH_OK;
Chandra Seetharaman96e65862009-10-21 09:23:04 -0700183
Mike Christie27db6822013-03-05 22:40:24 -0600184 if (host_byte(req->errors) != DID_OK ||
185 msg_byte(req->errors) != COMMAND_COMPLETE) {
Joseph Gruher93499232011-01-05 16:00:22 -0500186 err = SCSI_DH_IO;
Chandra Seetharaman96e65862009-10-21 09:23:04 -0700187 goto done;
Joseph Gruher93499232011-01-05 16:00:22 -0500188 }
Chandra Seetharaman96e65862009-10-21 09:23:04 -0700189
Hannes Reinecked3692a32015-12-01 10:16:46 +0100190 if (scsi_normalize_sense(h->sense, SCSI_SENSE_BUFFERSIZE,
191 &sense_hdr)) {
Chandra Seetharaman96e65862009-10-21 09:23:04 -0700192 err = alua_check_sense(h->sdev, &sense_hdr);
193 if (err == ADD_TO_MLQUEUE) {
194 err = SCSI_DH_RETRY;
195 goto done;
196 }
Hannes Reinecke80bd68d2015-12-01 10:16:47 +0100197 sdev_printk(KERN_INFO, h->sdev, "%s: stpg failed\n",
198 ALUA_DH_NAME);
199 scsi_print_sense_hdr(h->sdev, ALUA_DH_NAME, &sense_hdr);
Chandra Seetharaman96e65862009-10-21 09:23:04 -0700200 err = SCSI_DH_IO;
Mike Christie27db6822013-03-05 22:40:24 -0600201 } else if (error)
202 err = SCSI_DH_IO;
203
Chandra Seetharaman96e65862009-10-21 09:23:04 -0700204 if (err == SCSI_DH_OK) {
205 h->state = TPGS_STATE_OPTIMIZED;
206 sdev_printk(KERN_INFO, h->sdev,
207 "%s: port group %02x switched to state %c\n",
208 ALUA_DH_NAME, h->group_id,
209 print_alua_state(h->state));
210 }
211done:
Joseph Gruhered0f36b2011-01-05 16:00:21 -0500212 req->end_io_data = NULL;
213 __blk_put_request(req->q, req);
Chandra Seetharaman96e65862009-10-21 09:23:04 -0700214 if (h->callback_fn) {
215 h->callback_fn(h->callback_data, err);
216 h->callback_fn = h->callback_data = NULL;
217 }
218 return;
219}
220
221/*
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700222 * submit_stpg - Issue a SET TARGET GROUP STATES command
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700223 *
224 * Currently we're only setting the current target port group state
225 * to 'active/optimized' and let the array firmware figure out
226 * the states of the remaining groups.
227 */
Chandra Seetharaman96e65862009-10-21 09:23:04 -0700228static unsigned submit_stpg(struct alua_dh_data *h)
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700229{
230 struct request *rq;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700231 int stpg_len = 8;
Chandra Seetharaman96e65862009-10-21 09:23:04 -0700232 struct scsi_device *sdev = h->sdev;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700233
234 /* Prepare the data buffer */
235 memset(h->buff, 0, stpg_len);
236 h->buff[4] = TPGS_STATE_OPTIMIZED & 0x0f;
Hannes Reineckea7089772015-12-01 10:16:52 +0100237 put_unaligned_be16(h->group_id, &h->buff[6]);
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700238
239 rq = get_alua_req(sdev, h->buff, stpg_len, WRITE);
240 if (!rq)
Chandra Seetharaman96e65862009-10-21 09:23:04 -0700241 return SCSI_DH_RES_TEMP_UNAVAIL;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700242
243 /* Prepare the command. */
244 rq->cmd[0] = MAINTENANCE_OUT;
245 rq->cmd[1] = MO_SET_TARGET_PGS;
Hannes Reineckea7089772015-12-01 10:16:52 +0100246 put_unaligned_be32(stpg_len, &rq->cmd[6]);
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700247 rq->cmd_len = COMMAND_SIZE(MAINTENANCE_OUT);
248
249 rq->sense = h->sense;
250 memset(rq->sense, 0, SCSI_SENSE_BUFFERSIZE);
Hannes Reinecked3692a32015-12-01 10:16:46 +0100251 rq->sense_len = 0;
Chandra Seetharaman96e65862009-10-21 09:23:04 -0700252 rq->end_io_data = h;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700253
Chandra Seetharaman96e65862009-10-21 09:23:04 -0700254 blk_execute_rq_nowait(rq->q, NULL, rq, 1, stpg_endio);
Joseph Gruher7c66e9a2011-01-05 16:00:20 -0500255 return SCSI_DH_OK;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700256}
257
258/*
Hannes Reinecked7c48fe2011-08-24 10:51:13 +0200259 * alua_check_tpgs - Evaluate TPGS setting
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700260 * @sdev: device to be checked
261 *
Hannes Reinecked7c48fe2011-08-24 10:51:13 +0200262 * Examine the TPGS setting of the sdev to find out if ALUA
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700263 * is supported.
264 */
Hannes Reinecked7c48fe2011-08-24 10:51:13 +0200265static int alua_check_tpgs(struct scsi_device *sdev, struct alua_dh_data *h)
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700266{
Hannes Reinecked7c48fe2011-08-24 10:51:13 +0200267 int err = SCSI_DH_OK;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700268
Hannes Reineckedb5a6a62015-12-01 10:16:43 +0100269 /*
270 * ALUA support for non-disk devices is fraught with
271 * difficulties, so disable it for now.
272 */
273 if (sdev->type != TYPE_DISK) {
274 h->tpgs = TPGS_MODE_NONE;
275 sdev_printk(KERN_INFO, sdev,
276 "%s: disable for non-disk devices\n",
277 ALUA_DH_NAME);
278 return SCSI_DH_DEV_UNSUPP;
279 }
280
Hannes Reinecked7c48fe2011-08-24 10:51:13 +0200281 h->tpgs = scsi_device_tpgs(sdev);
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700282 switch (h->tpgs) {
283 case TPGS_MODE_EXPLICIT|TPGS_MODE_IMPLICIT:
284 sdev_printk(KERN_INFO, sdev,
285 "%s: supports implicit and explicit TPGS\n",
286 ALUA_DH_NAME);
287 break;
288 case TPGS_MODE_EXPLICIT:
289 sdev_printk(KERN_INFO, sdev, "%s: supports explicit TPGS\n",
290 ALUA_DH_NAME);
291 break;
292 case TPGS_MODE_IMPLICIT:
293 sdev_printk(KERN_INFO, sdev, "%s: supports implicit TPGS\n",
294 ALUA_DH_NAME);
295 break;
Hannes Reinecke6cc05d42015-12-01 10:16:45 +0100296 case TPGS_MODE_NONE:
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700297 sdev_printk(KERN_INFO, sdev, "%s: not supported\n",
298 ALUA_DH_NAME);
299 err = SCSI_DH_DEV_UNSUPP;
300 break;
Hannes Reinecke6cc05d42015-12-01 10:16:45 +0100301 default:
302 sdev_printk(KERN_INFO, sdev,
303 "%s: unsupported TPGS setting %d\n",
304 ALUA_DH_NAME, h->tpgs);
305 h->tpgs = TPGS_MODE_NONE;
306 err = SCSI_DH_DEV_UNSUPP;
307 break;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700308 }
309
310 return err;
311}
312
313/*
Hannes Reinecke9b80dce2015-12-01 10:16:44 +0100314 * alua_check_vpd - Evaluate INQUIRY vpd page 0x83
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700315 * @sdev: device to be checked
316 *
317 * Extract the relative target port and the target port group
318 * descriptor from the list of identificators.
319 */
Hannes Reinecke9b80dce2015-12-01 10:16:44 +0100320static int alua_check_vpd(struct scsi_device *sdev, struct alua_dh_data *h)
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700321{
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700322 unsigned char *d;
Hannes Reinecke9b80dce2015-12-01 10:16:44 +0100323 unsigned char __rcu *vpd_pg83;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700324
Hannes Reinecke9b80dce2015-12-01 10:16:44 +0100325 rcu_read_lock();
326 if (!rcu_dereference(sdev->vpd_pg83)) {
327 rcu_read_unlock();
328 return SCSI_DH_DEV_UNSUPP;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700329 }
330
331 /*
Hannes Reinecke9b80dce2015-12-01 10:16:44 +0100332 * Look for the correct descriptor.
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700333 */
Hannes Reinecke9b80dce2015-12-01 10:16:44 +0100334 vpd_pg83 = rcu_dereference(sdev->vpd_pg83);
335 d = vpd_pg83 + 4;
336 while (d < vpd_pg83 + sdev->vpd_pg83_len) {
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700337 switch (d[1] & 0xf) {
338 case 0x4:
339 /* Relative target port */
Hannes Reineckea7089772015-12-01 10:16:52 +0100340 h->rel_port = get_unaligned_be16(&d[6]);
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700341 break;
342 case 0x5:
343 /* Target port group */
Hannes Reineckea7089772015-12-01 10:16:52 +0100344 h->group_id = get_unaligned_be16(&d[6]);
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700345 break;
346 default:
347 break;
348 }
349 d += d[3] + 4;
350 }
Hannes Reinecke9b80dce2015-12-01 10:16:44 +0100351 rcu_read_unlock();
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700352
353 if (h->group_id == -1) {
354 /*
355 * Internal error; TPGS supported but required
356 * VPD identification descriptors not present.
357 * Disable ALUA support
358 */
359 sdev_printk(KERN_INFO, sdev,
360 "%s: No target port descriptors found\n",
361 ALUA_DH_NAME);
362 h->state = TPGS_STATE_OPTIMIZED;
363 h->tpgs = TPGS_MODE_NONE;
Hannes Reinecke9b80dce2015-12-01 10:16:44 +0100364 return SCSI_DH_DEV_UNSUPP;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700365 }
Hannes Reinecke9b80dce2015-12-01 10:16:44 +0100366 sdev_printk(KERN_INFO, sdev,
367 "%s: port group %02x rel port %02x\n",
368 ALUA_DH_NAME, h->group_id, h->rel_port);
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700369
Hannes Reinecke9b80dce2015-12-01 10:16:44 +0100370 return 0;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700371}
372
373static char print_alua_state(int state)
374{
375 switch (state) {
376 case TPGS_STATE_OPTIMIZED:
377 return 'A';
378 case TPGS_STATE_NONOPTIMIZED:
379 return 'N';
380 case TPGS_STATE_STANDBY:
381 return 'S';
382 case TPGS_STATE_UNAVAILABLE:
383 return 'U';
Hannes Reinecke69723d12010-09-24 15:57:04 +0200384 case TPGS_STATE_LBA_DEPENDENT:
385 return 'L';
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700386 case TPGS_STATE_OFFLINE:
387 return 'O';
388 case TPGS_STATE_TRANSITIONING:
389 return 'T';
390 default:
391 return 'X';
392 }
393}
394
395static int alua_check_sense(struct scsi_device *sdev,
396 struct scsi_sense_hdr *sense_hdr)
397{
398 switch (sense_hdr->sense_key) {
399 case NOT_READY:
400 if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x0a)
401 /*
402 * LUN Not Accessible - ALUA state transition
403 */
Mike Andersonc7dbb622008-08-12 12:11:57 -0700404 return ADD_TO_MLQUEUE;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700405 if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x0b)
406 /*
407 * LUN Not Accessible -- Target port in standby state
408 */
409 return SUCCESS;
410 if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x0c)
411 /*
412 * LUN Not Accessible -- Target port in unavailable state
413 */
414 return SUCCESS;
415 if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x12)
416 /*
417 * LUN Not Ready -- Offline
418 */
419 return SUCCESS;
wenxiong@linux.vnet.ibm.com333b2442014-11-06 15:11:23 -0600420 if (sdev->allow_restart &&
421 sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x02)
422 /*
423 * if the device is not started, we need to wake
424 * the error handler to start the motor
425 */
426 return FAILED;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700427 break;
428 case UNIT_ATTENTION:
429 if (sense_hdr->asc == 0x29 && sense_hdr->ascq == 0x00)
430 /*
431 * Power On, Reset, or Bus Device Reset, just retry.
432 */
Mike Andersonc7dbb622008-08-12 12:11:57 -0700433 return ADD_TO_MLQUEUE;
Stewart, Seanc20ee7b2013-10-15 15:52:39 +0000434 if (sense_hdr->asc == 0x29 && sense_hdr->ascq == 0x04)
435 /*
436 * Device internal reset
437 */
438 return ADD_TO_MLQUEUE;
Moger, Babu410f02d2011-12-21 18:01:37 -0500439 if (sense_hdr->asc == 0x2a && sense_hdr->ascq == 0x01)
440 /*
441 * Mode Parameters Changed
442 */
443 return ADD_TO_MLQUEUE;
Moger, Babubf819732011-10-06 13:22:07 -0400444 if (sense_hdr->asc == 0x2a && sense_hdr->ascq == 0x06)
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700445 /*
446 * ALUA state changed
447 */
Mike Andersonc7dbb622008-08-12 12:11:57 -0700448 return ADD_TO_MLQUEUE;
Moger, Babubf819732011-10-06 13:22:07 -0400449 if (sense_hdr->asc == 0x2a && sense_hdr->ascq == 0x07)
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700450 /*
451 * Implicit ALUA state transition failed
452 */
Mike Andersonc7dbb622008-08-12 12:11:57 -0700453 return ADD_TO_MLQUEUE;
Moger, Babubf819732011-10-06 13:22:07 -0400454 if (sense_hdr->asc == 0x3f && sense_hdr->ascq == 0x03)
455 /*
456 * Inquiry data has changed
457 */
458 return ADD_TO_MLQUEUE;
459 if (sense_hdr->asc == 0x3f && sense_hdr->ascq == 0x0e)
Ilgu Hong4d086f62009-01-30 17:00:11 -0600460 /*
461 * REPORTED_LUNS_DATA_HAS_CHANGED is reported
462 * when switching controllers on targets like
463 * Intel Multi-Flex. We can just retry.
464 */
465 return ADD_TO_MLQUEUE;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700466 break;
467 }
468
469 return SCSI_RETURN_NOT_HANDLED;
470}
471
472/*
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700473 * alua_rtpg - Evaluate REPORT TARGET GROUP STATES
474 * @sdev: the device to be evaluated.
Stewart, Seana8e5a2d2013-10-15 15:52:54 +0000475 * @wait_for_transition: if nonzero, wait ALUA_FAILOVER_TIMEOUT seconds for device to exit transitioning state
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700476 *
477 * Evaluate the Target Port Group State.
478 * Returns SCSI_DH_DEV_OFFLINED if the path is
Lucas De Marchi25985ed2011-03-30 22:57:33 -0300479 * found to be unusable.
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700480 */
Stewart, Seana8e5a2d2013-10-15 15:52:54 +0000481static int alua_rtpg(struct scsi_device *sdev, struct alua_dh_data *h, int wait_for_transition)
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700482{
483 struct scsi_sense_hdr sense_hdr;
484 int len, k, off, valid_states = 0;
Hannes Reineckecfde3fa2011-08-24 10:51:18 +0200485 unsigned char *ucp;
Hannes Reinecke5597caf2015-12-01 10:16:48 +0100486 unsigned err, retval;
Rob Eversbc97f4b2012-05-18 14:08:56 -0400487 unsigned long expiry, interval = 0;
Rob Evers3588c5a2012-05-18 14:08:54 -0400488 unsigned int tpg_desc_tbl_off;
489 unsigned char orig_transition_tmo;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700490
Rob Evers3588c5a2012-05-18 14:08:54 -0400491 if (!h->transition_tmo)
492 expiry = round_jiffies_up(jiffies + ALUA_FAILOVER_TIMEOUT * HZ);
493 else
494 expiry = round_jiffies_up(jiffies + h->transition_tmo * HZ);
495
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700496 retry:
Hannes Reinecke6c4fc042015-12-01 10:16:51 +0100497 retval = submit_rtpg(sdev, h);
Hannes Reinecke5597caf2015-12-01 10:16:48 +0100498 if (retval) {
Hannes Reinecked3692a32015-12-01 10:16:46 +0100499 if (!scsi_normalize_sense(h->sense, SCSI_SENSE_BUFFERSIZE,
Hannes Reinecke5597caf2015-12-01 10:16:48 +0100500 &sense_hdr)) {
501 sdev_printk(KERN_INFO, sdev,
502 "%s: rtpg failed, result %d\n",
503 ALUA_DH_NAME, retval);
504 if (driver_byte(retval) == DRIVER_BUSY)
505 return SCSI_DH_DEV_TEMP_BUSY;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700506 return SCSI_DH_IO;
Hannes Reinecke5597caf2015-12-01 10:16:48 +0100507 }
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700508
Rob Evers8e67ce62012-05-18 14:08:55 -0400509 /*
510 * submit_rtpg() has failed on existing arrays
511 * when requesting extended header info, and
512 * the array doesn't support extended headers,
513 * even though it shouldn't according to T10.
514 * The retry without rtpg_ext_hdr_req set
515 * handles this.
516 */
Hannes Reinecke6c4fc042015-12-01 10:16:51 +0100517 if (!(h->flags & ALUA_RTPG_EXT_HDR_UNSUPP) &&
Rob Evers8e67ce62012-05-18 14:08:55 -0400518 sense_hdr.sense_key == ILLEGAL_REQUEST &&
519 sense_hdr.asc == 0x24 && sense_hdr.ascq == 0) {
Hannes Reinecke6c4fc042015-12-01 10:16:51 +0100520 h->flags |= ALUA_RTPG_EXT_HDR_UNSUPP;
Rob Evers8e67ce62012-05-18 14:08:55 -0400521 goto retry;
522 }
523
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700524 err = alua_check_sense(sdev, &sense_hdr);
Hannes Reinecke80bd68d2015-12-01 10:16:47 +0100525 if (err == ADD_TO_MLQUEUE && time_before(jiffies, expiry)) {
526 sdev_printk(KERN_ERR, sdev, "%s: rtpg retry\n",
527 ALUA_DH_NAME);
528 scsi_print_sense_hdr(sdev, ALUA_DH_NAME, &sense_hdr);
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700529 goto retry;
Hannes Reinecke80bd68d2015-12-01 10:16:47 +0100530 }
531 sdev_printk(KERN_ERR, sdev, "%s: rtpg failed\n",
532 ALUA_DH_NAME);
533 scsi_print_sense_hdr(sdev, ALUA_DH_NAME, &sense_hdr);
534 return SCSI_DH_IO;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700535 }
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700536
Hannes Reineckea7089772015-12-01 10:16:52 +0100537 len = get_unaligned_be32(&h->buff[0]) + 4;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700538
539 if (len > h->bufflen) {
540 /* Resubmit with the correct length */
541 if (realloc_buffer(h, len)) {
542 sdev_printk(KERN_WARNING, sdev,
Harvey Harrisoncadbd4a2008-07-03 23:47:27 -0700543 "%s: kmalloc buffer failed\n",__func__);
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700544 /* Temporary failure, bypass */
545 return SCSI_DH_DEV_TEMP_BUSY;
546 }
547 goto retry;
548 }
549
Rob Evers3588c5a2012-05-18 14:08:54 -0400550 orig_transition_tmo = h->transition_tmo;
551 if ((h->buff[4] & RTPG_FMT_MASK) == RTPG_FMT_EXT_HDR && h->buff[5] != 0)
552 h->transition_tmo = h->buff[5];
553 else
554 h->transition_tmo = ALUA_FAILOVER_TIMEOUT;
555
Stewart, Seana8e5a2d2013-10-15 15:52:54 +0000556 if (wait_for_transition && (orig_transition_tmo != h->transition_tmo)) {
Rob Evers3588c5a2012-05-18 14:08:54 -0400557 sdev_printk(KERN_INFO, sdev,
558 "%s: transition timeout set to %d seconds\n",
559 ALUA_DH_NAME, h->transition_tmo);
560 expiry = jiffies + h->transition_tmo * HZ;
561 }
562
563 if ((h->buff[4] & RTPG_FMT_MASK) == RTPG_FMT_EXT_HDR)
564 tpg_desc_tbl_off = 8;
565 else
566 tpg_desc_tbl_off = 4;
567
568 for (k = tpg_desc_tbl_off, ucp = h->buff + tpg_desc_tbl_off;
569 k < len;
570 k += off, ucp += off) {
571
Hannes Reineckea7089772015-12-01 10:16:52 +0100572 if (h->group_id == get_unaligned_be16(&ucp[2])) {
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700573 h->state = ucp[0] & 0x0f;
Moger, Babudcd3a752012-03-27 20:56:08 +0000574 h->pref = ucp[0] >> 7;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700575 valid_states = ucp[1];
576 }
577 off = 8 + (ucp[7] * 4);
578 }
579
580 sdev_printk(KERN_INFO, sdev,
Moger, Babudcd3a752012-03-27 20:56:08 +0000581 "%s: port group %02x state %c %s supports %c%c%c%c%c%c%c\n",
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700582 ALUA_DH_NAME, h->group_id, print_alua_state(h->state),
Moger, Babudcd3a752012-03-27 20:56:08 +0000583 h->pref ? "preferred" : "non-preferred",
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700584 valid_states&TPGS_SUPPORT_TRANSITION?'T':'t',
585 valid_states&TPGS_SUPPORT_OFFLINE?'O':'o',
Hannes Reinecke69723d12010-09-24 15:57:04 +0200586 valid_states&TPGS_SUPPORT_LBA_DEPENDENT?'L':'l',
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700587 valid_states&TPGS_SUPPORT_UNAVAILABLE?'U':'u',
588 valid_states&TPGS_SUPPORT_STANDBY?'S':'s',
589 valid_states&TPGS_SUPPORT_NONOPTIMIZED?'N':'n',
590 valid_states&TPGS_SUPPORT_OPTIMIZED?'A':'a');
591
Hannes Reinecke69723d12010-09-24 15:57:04 +0200592 switch (h->state) {
593 case TPGS_STATE_TRANSITIONING:
Stewart, Seana8e5a2d2013-10-15 15:52:54 +0000594 if (wait_for_transition) {
595 if (time_before(jiffies, expiry)) {
596 /* State transition, retry */
597 interval += 2000;
598 msleep(interval);
599 goto retry;
600 }
601 err = SCSI_DH_RETRY;
602 } else {
603 err = SCSI_DH_OK;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700604 }
Stewart, Seana8e5a2d2013-10-15 15:52:54 +0000605
Hannes Reinecke69723d12010-09-24 15:57:04 +0200606 /* Transitioning time exceeded, set port to standby */
Hannes Reinecke69723d12010-09-24 15:57:04 +0200607 h->state = TPGS_STATE_STANDBY;
608 break;
609 case TPGS_STATE_OFFLINE:
Bart Van Asschee47f8972012-08-24 09:08:41 +0000610 /* Path unusable */
Hannes Reinecke69723d12010-09-24 15:57:04 +0200611 err = SCSI_DH_DEV_OFFLINED;
612 break;
613 default:
614 /* Useable path if active */
615 err = SCSI_DH_OK;
616 break;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700617 }
618 return err;
619}
620
621/*
622 * alua_initialize - Initialize ALUA state
623 * @sdev: the device to be initialized
624 *
625 * For the prep_fn to work correctly we have
626 * to initialize the ALUA state for the device.
627 */
628static int alua_initialize(struct scsi_device *sdev, struct alua_dh_data *h)
629{
630 int err;
631
Hannes Reinecked7c48fe2011-08-24 10:51:13 +0200632 err = alua_check_tpgs(sdev, h);
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700633 if (err != SCSI_DH_OK)
634 goto out;
635
Hannes Reinecke9b80dce2015-12-01 10:16:44 +0100636 err = alua_check_vpd(sdev, h);
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700637 if (err != SCSI_DH_OK)
638 goto out;
639
Stewart, Seana8e5a2d2013-10-15 15:52:54 +0000640 err = alua_rtpg(sdev, h, 0);
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700641 if (err != SCSI_DH_OK)
642 goto out;
643
644out:
645 return err;
646}
Moger, Babu4335d092012-03-27 20:55:49 +0000647/*
648 * alua_set_params - set/unset the optimize flag
649 * @sdev: device on the path to be activated
650 * params - parameters in the following format
651 * "no_of_params\0param1\0param2\0param3\0...\0"
652 * For example, to set the flag pass the following parameters
653 * from multipath.conf
654 * hardware_handler "2 alua 1"
655 */
656static int alua_set_params(struct scsi_device *sdev, const char *params)
657{
Christoph Hellwigee14c672015-08-27 14:16:59 +0200658 struct alua_dh_data *h = sdev->handler_data;
Moger, Babu4335d092012-03-27 20:55:49 +0000659 unsigned int optimize = 0, argc;
660 const char *p = params;
661 int result = SCSI_DH_OK;
662
663 if ((sscanf(params, "%u", &argc) != 1) || (argc != 1))
664 return -EINVAL;
665
666 while (*p++)
667 ;
668 if ((sscanf(p, "%u", &optimize) != 1) || (optimize > 1))
669 return -EINVAL;
670
671 if (optimize)
672 h->flags |= ALUA_OPTIMIZE_STPG;
673 else
674 h->flags &= ~ALUA_OPTIMIZE_STPG;
675
676 return result;
677}
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700678
Stewart, Sean7a3ad392013-04-04 14:54:47 +0000679static uint optimize_stpg;
680module_param(optimize_stpg, uint, S_IRUGO|S_IWUSR);
681MODULE_PARM_DESC(optimize_stpg, "Allow use of a non-optimized path, rather than sending a STPG, when implicit TPGS is supported (0=No,1=Yes). Default is 0.");
682
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700683/*
684 * alua_activate - activate a path
685 * @sdev: device on the path to be activated
686 *
687 * We're currently switching the port group to be activated only and
688 * let the array figure out the rest.
689 * There may be other arrays which require us to switch all port groups
690 * based on a certain policy. But until we actually encounter them it
691 * should be okay.
692 */
Chandra Seetharaman3ae31f62009-10-21 09:22:46 -0700693static int alua_activate(struct scsi_device *sdev,
694 activate_complete fn, void *data)
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700695{
Christoph Hellwigee14c672015-08-27 14:16:59 +0200696 struct alua_dh_data *h = sdev->handler_data;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700697 int err = SCSI_DH_OK;
Moger, Babu72d9e0f2012-03-27 20:56:20 +0000698 int stpg = 0;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700699
Stewart, Seana8e5a2d2013-10-15 15:52:54 +0000700 err = alua_rtpg(sdev, h, 1);
Hannes Reinecke46ccf6b2011-08-24 10:51:16 +0200701 if (err != SCSI_DH_OK)
702 goto out;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700703
Stewart, Sean7a3ad392013-04-04 14:54:47 +0000704 if (optimize_stpg)
705 h->flags |= ALUA_OPTIMIZE_STPG;
706
Moger, Babu72d9e0f2012-03-27 20:56:20 +0000707 if (h->tpgs & TPGS_MODE_EXPLICIT) {
708 switch (h->state) {
709 case TPGS_STATE_NONOPTIMIZED:
710 stpg = 1;
711 if ((h->flags & ALUA_OPTIMIZE_STPG) &&
712 (!h->pref) &&
713 (h->tpgs & TPGS_MODE_IMPLICIT))
714 stpg = 0;
715 break;
716 case TPGS_STATE_STANDBY:
Bart Van Asschebb2c94a2012-06-22 08:49:38 +0000717 case TPGS_STATE_UNAVAILABLE:
Moger, Babu72d9e0f2012-03-27 20:56:20 +0000718 stpg = 1;
719 break;
Moger, Babu72d9e0f2012-03-27 20:56:20 +0000720 case TPGS_STATE_OFFLINE:
721 err = SCSI_DH_IO;
722 break;
723 case TPGS_STATE_TRANSITIONING:
724 err = SCSI_DH_RETRY;
725 break;
726 default:
727 break;
728 }
729 }
730
731 if (stpg) {
Chandra Seetharaman96e65862009-10-21 09:23:04 -0700732 h->callback_fn = fn;
733 h->callback_data = data;
734 err = submit_stpg(h);
735 if (err == SCSI_DH_OK)
736 return 0;
737 h->callback_fn = h->callback_data = NULL;
738 }
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700739
740out:
Chandra Seetharaman3ae31f62009-10-21 09:22:46 -0700741 if (fn)
742 fn(data, err);
743 return 0;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700744}
745
746/*
747 * alua_prep_fn - request callback
748 *
749 * Fail I/O to all paths not in state
750 * active/optimized or active/non-optimized.
751 */
752static int alua_prep_fn(struct scsi_device *sdev, struct request *req)
753{
Christoph Hellwigee14c672015-08-27 14:16:59 +0200754 struct alua_dh_data *h = sdev->handler_data;
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700755 int ret = BLKPREP_OK;
756
Hannes Reinecke69723d12010-09-24 15:57:04 +0200757 if (h->state == TPGS_STATE_TRANSITIONING)
758 ret = BLKPREP_DEFER;
759 else if (h->state != TPGS_STATE_OPTIMIZED &&
760 h->state != TPGS_STATE_NONOPTIMIZED &&
761 h->state != TPGS_STATE_LBA_DEPENDENT) {
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700762 ret = BLKPREP_KILL;
763 req->cmd_flags |= REQ_QUIET;
764 }
765 return ret;
766
767}
768
Christoph Hellwig1d520322014-09-14 11:08:21 -0700769/*
770 * alua_bus_attach - Attach device handler
771 * @sdev: device to be attached to
772 */
Christoph Hellwigee14c672015-08-27 14:16:59 +0200773static int alua_bus_attach(struct scsi_device *sdev)
Christoph Hellwig1d520322014-09-14 11:08:21 -0700774{
775 struct alua_dh_data *h;
776 int err;
777
778 h = kzalloc(sizeof(*h) , GFP_KERNEL);
779 if (!h)
Christoph Hellwigee14c672015-08-27 14:16:59 +0200780 return -ENOMEM;
Christoph Hellwig1d520322014-09-14 11:08:21 -0700781 h->tpgs = TPGS_MODE_UNINITIALIZED;
782 h->state = TPGS_STATE_OPTIMIZED;
783 h->group_id = -1;
784 h->rel_port = -1;
785 h->buff = h->inq;
786 h->bufflen = ALUA_INQUIRY_SIZE;
787 h->sdev = sdev;
788
789 err = alua_initialize(sdev, h);
790 if (err != SCSI_DH_OK && err != SCSI_DH_DEV_OFFLINED)
791 goto failed;
792
Christoph Hellwigee14c672015-08-27 14:16:59 +0200793 sdev->handler_data = h;
794 return 0;
Christoph Hellwig1d520322014-09-14 11:08:21 -0700795failed:
796 kfree(h);
Christoph Hellwigee14c672015-08-27 14:16:59 +0200797 return -EINVAL;
Christoph Hellwig1d520322014-09-14 11:08:21 -0700798}
799
800/*
801 * alua_bus_detach - Detach device handler
802 * @sdev: device to be detached from
803 */
804static void alua_bus_detach(struct scsi_device *sdev)
805{
Christoph Hellwigee14c672015-08-27 14:16:59 +0200806 struct alua_dh_data *h = sdev->handler_data;
Christoph Hellwig1d520322014-09-14 11:08:21 -0700807
808 if (h->buff && h->inq != h->buff)
809 kfree(h->buff);
Christoph Hellwigee14c672015-08-27 14:16:59 +0200810 sdev->handler_data = NULL;
Christoph Hellwig1d520322014-09-14 11:08:21 -0700811 kfree(h);
812}
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700813
814static struct scsi_device_handler alua_dh = {
815 .name = ALUA_DH_NAME,
816 .module = THIS_MODULE,
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700817 .attach = alua_bus_attach,
818 .detach = alua_bus_detach,
819 .prep_fn = alua_prep_fn,
820 .check_sense = alua_check_sense,
821 .activate = alua_activate,
Moger, Babu4335d092012-03-27 20:55:49 +0000822 .set_params = alua_set_params,
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700823};
824
Hannes Reinecke057ea7c2008-07-17 16:53:21 -0700825static int __init alua_init(void)
826{
827 int r;
828
829 r = scsi_register_device_handler(&alua_dh);
830 if (r != 0)
831 printk(KERN_ERR "%s: Failed to register scsi device handler",
832 ALUA_DH_NAME);
833 return r;
834}
835
836static void __exit alua_exit(void)
837{
838 scsi_unregister_device_handler(&alua_dh);
839}
840
841module_init(alua_init);
842module_exit(alua_exit);
843
844MODULE_DESCRIPTION("DM Multipath ALUA support");
845MODULE_AUTHOR("Hannes Reinecke <hare@suse.de>");
846MODULE_LICENSE("GPL");
847MODULE_VERSION(ALUA_DH_VER);