A slightly more complete change to timeouts:

1. Add SA_IO_TIMEOUT as an option (4 minutes default) to cover reads,
writes, wfm, test unit ready.

2. Add internal SCSIOP_TIMEOUT (e.g., for mode sense) at 1 minute. This
should not require an option, but is cleaner to parameterize.

MFC after:	1 week
This commit is contained in:
Matt Jacob 2001-07-02 17:48:59 +00:00
parent 5640e0ac5a
commit b29f9e40f5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=79100
4 changed files with 31 additions and 14 deletions

View File

@ -65,6 +65,9 @@
#include <opt_sa.h>
#ifndef SA_IO_TIMEOUT
#define SA_IO_TIMEOUT 4
#endif
#ifndef SA_SPACE_TIMEOUT
#define SA_SPACE_TIMEOUT 1 * 60
#endif
@ -75,6 +78,9 @@
#define SA_ERASE_TIMEOUT 4 * 60
#endif
#define SCSIOP_TIMEOUT (60 * 1000) /* not an option */
#define IO_TIMEOUT (SA_IO_TIMEOUT * 60 * 1000)
#define REWIND_TIMEOUT (SA_REWIND_TIMEOUT * 60 * 1000)
#define ERASE_TIMEOUT (SA_ERASE_TIMEOUT * 60 * 1000)
#define SPACE_TIMEOUT (SA_SPACE_TIMEOUT * 60 * 1000)
@ -1635,7 +1641,7 @@ sastart(struct cam_periph *periph, union ccb *start_ccb)
MSG_SIMPLE_Q_TAG, (bp->bio_cmd == BIO_READ),
FALSE, (softc->flags & SA_FLAG_FIXED) != 0,
length, bp->bio_data, bp->bio_bcount, SSD_FULL_SIZE,
120 * 60 * 1000);
IO_TIMEOUT);
start_ccb->ccb_h.ccb_pflags &= ~SA_POSITION_UPDATED;
Set_CCB_Type(start_ccb, SA_CCB_BUFFER_IO);
start_ccb->ccb_h.ccb_bp = bp;
@ -1800,14 +1806,14 @@ samount(struct cam_periph *periph, int oflags, dev_t dev)
if (softc->flags & SA_FLAG_TAPE_MOUNTED) {
ccb = cam_periph_getccb(periph, 1);
scsi_test_unit_ready(&ccb->csio, 0, sadone,
MSG_SIMPLE_Q_TAG, SSD_FULL_SIZE, 5 * 60 * 1000);
MSG_SIMPLE_Q_TAG, SSD_FULL_SIZE, IO_TIMEOUT);
error = cam_periph_runccb(ccb, saerror, 0, SF_NO_PRINT,
&softc->device_stats);
QFRLS(ccb);
if (error == ENXIO) {
softc->flags &= ~SA_FLAG_TAPE_MOUNTED;
scsi_test_unit_ready(&ccb->csio, 0, sadone,
MSG_SIMPLE_Q_TAG, SSD_FULL_SIZE, 5 * 60 * 1000);
MSG_SIMPLE_Q_TAG, SSD_FULL_SIZE, IO_TIMEOUT);
error = cam_periph_runccb(ccb, saerror, 0, SF_NO_PRINT,
&softc->device_stats);
QFRLS(ccb);
@ -1829,7 +1835,7 @@ samount(struct cam_periph *periph, int oflags, dev_t dev)
}
ccb = cam_periph_getccb(periph, 1);
scsi_test_unit_ready(&ccb->csio, 0, sadone,
MSG_SIMPLE_Q_TAG, SSD_FULL_SIZE, 5 * 60 * 1000);
MSG_SIMPLE_Q_TAG, SSD_FULL_SIZE, IO_TIMEOUT);
error = cam_periph_runccb(ccb, saerror, 0, SF_NO_PRINT,
&softc->device_stats);
QFRLS(ccb);
@ -1893,7 +1899,7 @@ samount(struct cam_periph *periph, int oflags, dev_t dev)
scsi_sa_read_write(&ccb->csio, 0, sadone,
MSG_SIMPLE_Q_TAG, 1, FALSE, 0, 8192,
(void *) rblim, 8192, SSD_FULL_SIZE,
120 * 60 * 1000);
IO_TIMEOUT);
(void) cam_periph_runccb(ccb, saerror, 0, SF_NO_PRINT,
&softc->device_stats);
QFRLS(ccb);
@ -1915,7 +1921,7 @@ samount(struct cam_periph *periph, int oflags, dev_t dev)
* Next off, determine block limits.
*/
scsi_read_block_limits(&ccb->csio, 5, sadone, MSG_SIMPLE_Q_TAG,
rblim, SSD_FULL_SIZE, 5000);
rblim, SSD_FULL_SIZE, SCSIOP_TIMEOUT);
error = cam_periph_runccb(ccb, saerror, CAM_RETRY_SELTO,
SF_NO_PRINT | SF_RETRY_UA, &softc->device_stats);
@ -2496,7 +2502,7 @@ sagetparams(struct cam_periph *periph, sa_params params_to_get,
scsi_mode_sense(&ccb->csio, 5, sadone, MSG_SIMPLE_Q_TAG, FALSE,
SMS_PAGE_CTRL_CURRENT, (params_to_get & SA_PARAM_COMPRESSION) ?
cpage : SMS_VENDOR_SPECIFIC_PAGE, mode_buffer, mode_buffer_len,
SSD_FULL_SIZE, 5000);
SSD_FULL_SIZE, SCSIOP_TIMEOUT);
error = cam_periph_runccb(ccb, saerror, 0, SF_NO_PRINT,
&softc->device_stats);
@ -2559,7 +2565,8 @@ sagetparams(struct cam_periph *periph, sa_params params_to_get,
scsi_mode_sense(&ccb->csio, 2, sadone, MSG_SIMPLE_Q_TAG, FALSE,
SMS_PAGE_CTRL_CURRENT, SMS_VENDOR_SPECIFIC_PAGE,
mode_buffer, mode_buffer_len, SSD_FULL_SIZE, 5000);
mode_buffer, mode_buffer_len, SSD_FULL_SIZE,
SCSIOP_TIMEOUT);
error = cam_periph_runccb(ccb, saerror, 0, SF_NO_PRINT,
&softc->device_stats);
@ -2853,7 +2860,7 @@ sasetparams(struct cam_periph *periph, sa_params params_to_set,
/* It is safe to retry this operation */
scsi_mode_select(&ccb->csio, 5, sadone, MSG_SIMPLE_Q_TAG,
(params_to_set & SA_PARAM_COMPRESSION)? TRUE : FALSE,
FALSE, mode_buffer, mode_buffer_len, SSD_FULL_SIZE, 5000);
FALSE, mode_buffer, mode_buffer_len, SSD_FULL_SIZE, SCSIOP_TIMEOUT);
error = cam_periph_runccb(ccb, saerror, 0,
sense_flags, &softc->device_stats);
@ -2970,7 +2977,7 @@ saprevent(struct cam_periph *periph, int action)
/* It is safe to retry this operation */
scsi_prevent(&ccb->csio, 5, sadone, MSG_SIMPLE_Q_TAG, action,
SSD_FULL_SIZE, 100000);
SSD_FULL_SIZE, SCSIOP_TIMEOUT);
error = cam_periph_runccb(ccb, saerror, 0, sf, &softc->device_stats);
QFRLS(ccb);
@ -3105,7 +3112,7 @@ sawritefilemarks(struct cam_periph *periph, int nmarks, int setmarks)
softc->dsreg = MTIO_DSREG_FMK;
/* this *must* not be retried */
scsi_write_filemarks(&ccb->csio, 0, sadone, MSG_SIMPLE_Q_TAG,
FALSE, setmarks, nmarks, SSD_FULL_SIZE, 180000);
FALSE, setmarks, nmarks, SSD_FULL_SIZE, IO_TIMEOUT);
softc->dsreg = MTIO_DSREG_REST;
@ -3160,7 +3167,7 @@ sardpos(struct cam_periph *periph, int hard, u_int32_t *blkptr)
ccb = cam_periph_getccb(periph, 1);
scsi_read_position(&ccb->csio, 1, sadone, MSG_SIMPLE_Q_TAG,
hard, &loc, SSD_FULL_SIZE, 5000);
hard, &loc, SSD_FULL_SIZE, SCSIOP_TIMEOUT);
softc->dsreg = MTIO_DSREG_RBSY;
error = cam_periph_runccb(ccb, saerror, 0, 0, &softc->device_stats);
softc->dsreg = MTIO_DSREG_REST;
@ -3199,7 +3206,8 @@ sasetpos(struct cam_periph *periph, int hard, u_int32_t *blkptr)
scsi_set_position(&ccb->csio, 1, sadone, MSG_SIMPLE_Q_TAG,
hard, *blkptr, SSD_FULL_SIZE, 60 * 60 * 1000);
hard, *blkptr, SSD_FULL_SIZE, SPACE_TIMEOUT);
softc->dsreg = MTIO_DSREG_POS;
error = cam_periph_runccb(ccb, saerror, 0, 0, &softc->device_stats);
@ -3255,7 +3263,7 @@ sareservereleaseunit(struct cam_periph *periph, int reserve)
/* It is safe to retry this operation */
scsi_reserve_release_unit(&ccb->csio, 2, sadone, MSG_SIMPLE_Q_TAG,
FALSE, 0, SSD_FULL_SIZE, 5000, reserve);
FALSE, 0, SSD_FULL_SIZE, SCSIOP_TIMEOUT, reserve);
softc->dsreg = MTIO_DSREG_RBSY;
error = cam_periph_runccb(ccb, saerror, 0,
SF_RETRY_UA | SF_NO_PRINT, &softc->device_stats);

View File

@ -917,6 +917,8 @@ device pass #CAM passthrough driver
# CAM_DEBUG_SUBTRACE, and CAM_DEBUG_CDB
#
# CAM_MAX_HIGHPOWER: Maximum number of concurrent high power (start unit) cmds
# CAM_NEW_TRAN_CODE: this is the new transport layer code that will be switched
# to soon
# SCSI_NO_SENSE_STRINGS: When defined disables sense descriptions
# SCSI_NO_OP_STRINGS: When defined disables opcode descriptions
# SCSI_DELAY: The number of MILLISECONDS to freeze the SIM (scsi adapter)
@ -947,10 +949,12 @@ options CHANGER_MIN_BUSY_SECONDS=2
options CHANGER_MAX_BUSY_SECONDS=10
# Options for the CAM sequential access driver:
# SA_IO_TIMEOUT: Timeout for read/write/wfm operations, in minutes
# SA_SPACE_TIMEOUT: Timeout for space operations, in minutes
# SA_REWIND_TIMEOUT: Timeout for rewind operations, in minutes
# SA_ERASE_TIMEOUT: Timeout for erase operations, in minutes
# SA_1FM_AT_EOD: Default to model which only has a default one filemark at EOT.
options SA_IO_TIMEOUT="(4)"
options SA_SPACE_TIMEOUT="(60)"
options SA_REWIND_TIMEOUT="(2*60)"
options SA_ERASE_TIMEOUT="(4*60)"

View File

@ -189,6 +189,7 @@ CHANGER_MIN_BUSY_SECONDS opt_cd.h
CHANGER_MAX_BUSY_SECONDS opt_cd.h
# Options used only in cam/scsi/scsi_sa.c.
SA_IO_TIMEOUT opt_sa.h
SA_SPACE_TIMEOUT opt_sa.h
SA_REWIND_TIMEOUT opt_sa.h
SA_ERASE_TIMEOUT opt_sa.h

View File

@ -917,6 +917,8 @@ device pass #CAM passthrough driver
# CAM_DEBUG_SUBTRACE, and CAM_DEBUG_CDB
#
# CAM_MAX_HIGHPOWER: Maximum number of concurrent high power (start unit) cmds
# CAM_NEW_TRAN_CODE: this is the new transport layer code that will be switched
# to soon
# SCSI_NO_SENSE_STRINGS: When defined disables sense descriptions
# SCSI_NO_OP_STRINGS: When defined disables opcode descriptions
# SCSI_DELAY: The number of MILLISECONDS to freeze the SIM (scsi adapter)
@ -947,10 +949,12 @@ options CHANGER_MIN_BUSY_SECONDS=2
options CHANGER_MAX_BUSY_SECONDS=10
# Options for the CAM sequential access driver:
# SA_IO_TIMEOUT: Timeout for read/write/wfm operations, in minutes
# SA_SPACE_TIMEOUT: Timeout for space operations, in minutes
# SA_REWIND_TIMEOUT: Timeout for rewind operations, in minutes
# SA_ERASE_TIMEOUT: Timeout for erase operations, in minutes
# SA_1FM_AT_EOD: Default to model which only has a default one filemark at EOT.
options SA_IO_TIMEOUT="(4)"
options SA_SPACE_TIMEOUT="(60)"
options SA_REWIND_TIMEOUT="(2*60)"
options SA_ERASE_TIMEOUT="(4*60)"