aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2014-10-18 16:11:21 -0400
committerChristoph Hellwig <hch@lst.de>2014-11-12 05:15:54 -0500
commit26cf591e6dfc0d07495b7bcf20a557b316811f00 (patch)
treeaaebbfe8c9764f981f2fa540b6ae20c79dce55af /include/scsi
parent678e27573237a0b065defdf99e5070c9b0c403c3 (diff)
scsi: add SG_SCSI_RESET_NO_ESCALATE flag to SG_SCSI_RESET ioctl
Further to a January 2013 thread titled: "[PATCH] SG_SCSI_RESET ioctl should only perform requested operation" by Jeremy Linton a patch (v3) is presented that expands the existing ioctl to include "no_escalate" versions to the existing resets. This requires no changes to SCSI low level drivers (LLDs); it adds several more finely tuned reset options to the user space. For example: /* This call remains the same, with the same escalating semantics * if the device (LU) reset fail. That is: on failure to try a * target reset and if that fails, try a bus reset, and if that fails * try a host (i.e. LLD) reset. */ val = SG_SCSI_RESET_DEVICE; res = ioctl(<sg_or_block_fd>, SG_SCSI_RESET, &val); /* What follows is a new option introduced by this patch series. Only * a device reset is attempted. If that fails then an appropriate * error code is provided. N.B. There is no reset escalation. */ val = SG_SCSI_RESET_DEVICE | SG_SCSI_RESET_NO_ESCALATE; res = ioctl(<sg_or_block_fd>, SG_SCSI_RESET, &val); Signed-off-by: Douglas Gilbert <dgilbert@interlog.com> Reviewed-by: Jeremy Linton <jlinton@tributary.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'include/scsi')
-rw-r--r--include/scsi/scsi_eh.h5
-rw-r--r--include/scsi/sg.h5
2 files changed, 9 insertions, 1 deletions
diff --git a/include/scsi/scsi_eh.h b/include/scsi/scsi_eh.h
index 06a8790893ef..49af14ad5288 100644
--- a/include/scsi/scsi_eh.h
+++ b/include/scsi/scsi_eh.h
@@ -62,11 +62,16 @@ extern void scsi_build_sense_buffer(int desc, u8 *buf, u8 key, u8 asc, u8 ascq);
62 62
63/* 63/*
64 * Reset request from external source 64 * Reset request from external source
65 * Note: if SCSI_TRY_RESET_DEVICE fails then it will escalate to
66 * SCSI_TRY_RESET_TARGET which if it fails will escalate to
67 * SCSI_TRY_RESET_BUS which if it fails will escalate to SCSI_TRY_RESET_HOST.
68 * To prevent escalation OR with SCSI_TRY_RESET_NO_ESCALATE.
65 */ 69 */
66#define SCSI_TRY_RESET_DEVICE 1 70#define SCSI_TRY_RESET_DEVICE 1
67#define SCSI_TRY_RESET_BUS 2 71#define SCSI_TRY_RESET_BUS 2
68#define SCSI_TRY_RESET_HOST 3 72#define SCSI_TRY_RESET_HOST 3
69#define SCSI_TRY_RESET_TARGET 4 73#define SCSI_TRY_RESET_TARGET 4
74#define SCSI_TRY_RESET_NO_ESCALATE 0x100 /* OR-ed to prior defines */
70 75
71extern int scsi_reset_provider(struct scsi_device *, int); 76extern int scsi_reset_provider(struct scsi_device *, int);
72 77
diff --git a/include/scsi/sg.h b/include/scsi/sg.h
index 750e5db7c6bf..3afec7032448 100644
--- a/include/scsi/sg.h
+++ b/include/scsi/sg.h
@@ -164,12 +164,15 @@ typedef struct sg_req_info { /* used by SG_GET_REQUEST_TABLE ioctl() */
164 164
165/* Returns -EBUSY if occupied. 3rd argument pointer to int (see next) */ 165/* Returns -EBUSY if occupied. 3rd argument pointer to int (see next) */
166#define SG_SCSI_RESET 0x2284 166#define SG_SCSI_RESET 0x2284
167/* Associated values that can be given to SG_SCSI_RESET follow */ 167/* Associated values that can be given to SG_SCSI_RESET follow.
168 * SG_SCSI_RESET_NO_ESCALATE may be OR-ed to the _DEVICE, _TARGET, _BUS
169 * or _HOST reset value so only that action is attempted. */
168#define SG_SCSI_RESET_NOTHING 0 170#define SG_SCSI_RESET_NOTHING 0
169#define SG_SCSI_RESET_DEVICE 1 171#define SG_SCSI_RESET_DEVICE 1
170#define SG_SCSI_RESET_BUS 2 172#define SG_SCSI_RESET_BUS 2
171#define SG_SCSI_RESET_HOST 3 173#define SG_SCSI_RESET_HOST 3
172#define SG_SCSI_RESET_TARGET 4 174#define SG_SCSI_RESET_TARGET 4
175#define SG_SCSI_RESET_NO_ESCALATE 0x100
173 176
174/* synchronous SCSI command ioctl, (only in version 3 interface) */ 177/* synchronous SCSI command ioctl, (only in version 3 interface) */
175#define SG_IO 0x2285 /* similar effect as write() followed by read() */ 178#define SG_IO 0x2285 /* similar effect as write() followed by read() */