Commit 1a95620f authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
 "I had actually prepared this fix set before I left for KS + Plumbers,
  so it's been incubating much longer than it should have.  I'll be
  picking up my three week backlog this week, so more fixes will then be
  forthcoming

  This set consist of three minor and one fairly major (the device not
  ready causing offlining problem which is a serious regression
  introduced by the media change update) fixes.

  Signed-off-by: James Bottomley <JBottomley@Parallels.com>"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  [SCSI] Fix 'Device not ready' issue on mpt2sas
  [SCSI] scsi_lib: fix scsi_io_completion's SG_IO error propagation
  [SCSI] megaraid_sas: Move poll_aen_lock initializer
  [SCSI] mpt2sas: Fix for Driver oops, when loading driver with max_queue_depth command line option to a very small value
parents ffc29649 14216561
...@@ -4066,7 +4066,6 @@ megasas_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -4066,7 +4066,6 @@ megasas_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
spin_lock_init(&instance->cmd_pool_lock); spin_lock_init(&instance->cmd_pool_lock);
spin_lock_init(&instance->hba_lock); spin_lock_init(&instance->hba_lock);
spin_lock_init(&instance->completion_lock); spin_lock_init(&instance->completion_lock);
spin_lock_init(&poll_aen_lock);
mutex_init(&instance->aen_mutex); mutex_init(&instance->aen_mutex);
mutex_init(&instance->reset_mutex); mutex_init(&instance->reset_mutex);
...@@ -5392,6 +5391,8 @@ static int __init megasas_init(void) ...@@ -5392,6 +5391,8 @@ static int __init megasas_init(void)
printk(KERN_INFO "megasas: %s %s\n", MEGASAS_VERSION, printk(KERN_INFO "megasas: %s %s\n", MEGASAS_VERSION,
MEGASAS_EXT_VERSION); MEGASAS_EXT_VERSION);
spin_lock_init(&poll_aen_lock);
support_poll_for_event = 2; support_poll_for_event = 2;
support_device_change = 1; support_device_change = 1;
......
...@@ -2424,10 +2424,13 @@ _base_allocate_memory_pools(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) ...@@ -2424,10 +2424,13 @@ _base_allocate_memory_pools(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
} }
/* command line tunables for max controller queue depth */ /* command line tunables for max controller queue depth */
if (max_queue_depth != -1) if (max_queue_depth != -1 && max_queue_depth != 0) {
max_request_credit = (max_queue_depth < facts->RequestCredit) max_request_credit = min_t(u16, max_queue_depth +
? max_queue_depth : facts->RequestCredit; ioc->hi_priority_depth + ioc->internal_depth,
else facts->RequestCredit);
if (max_request_credit > MAX_HBA_QUEUE_DEPTH)
max_request_credit = MAX_HBA_QUEUE_DEPTH;
} else
max_request_credit = min_t(u16, facts->RequestCredit, max_request_credit = min_t(u16, facts->RequestCredit,
MAX_HBA_QUEUE_DEPTH); MAX_HBA_QUEUE_DEPTH);
...@@ -2502,7 +2505,7 @@ _base_allocate_memory_pools(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) ...@@ -2502,7 +2505,7 @@ _base_allocate_memory_pools(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
/* set the scsi host can_queue depth /* set the scsi host can_queue depth
* with some internal commands that could be outstanding * with some internal commands that could be outstanding
*/ */
ioc->shost->can_queue = ioc->scsiio_depth - (2); ioc->shost->can_queue = ioc->scsiio_depth;
dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "scsi host: " dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "scsi host: "
"can_queue depth (%d)\n", ioc->name, ioc->shost->can_queue)); "can_queue depth (%d)\n", ioc->name, ioc->shost->can_queue));
......
...@@ -42,6 +42,8 @@ ...@@ -42,6 +42,8 @@
#include <trace/events/scsi.h> #include <trace/events/scsi.h>
static void scsi_eh_done(struct scsi_cmnd *scmd);
#define SENSE_TIMEOUT (10*HZ) #define SENSE_TIMEOUT (10*HZ)
/* /*
...@@ -241,6 +243,14 @@ static int scsi_check_sense(struct scsi_cmnd *scmd) ...@@ -241,6 +243,14 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
if (! scsi_command_normalize_sense(scmd, &sshdr)) if (! scsi_command_normalize_sense(scmd, &sshdr))
return FAILED; /* no valid sense data */ return FAILED; /* no valid sense data */
if (scmd->cmnd[0] == TEST_UNIT_READY && scmd->scsi_done != scsi_eh_done)
/*
* nasty: for mid-layer issued TURs, we need to return the
* actual sense data without any recovery attempt. For eh
* issued ones, we need to try to recover and interpret
*/
return SUCCESS;
if (scsi_sense_is_deferred(&sshdr)) if (scsi_sense_is_deferred(&sshdr))
return NEEDS_RETRY; return NEEDS_RETRY;
......
...@@ -776,7 +776,6 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) ...@@ -776,7 +776,6 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
} }
if (req->cmd_type == REQ_TYPE_BLOCK_PC) { /* SG_IO ioctl from block level */ if (req->cmd_type == REQ_TYPE_BLOCK_PC) { /* SG_IO ioctl from block level */
req->errors = result;
if (result) { if (result) {
if (sense_valid && req->sense) { if (sense_valid && req->sense) {
/* /*
...@@ -792,6 +791,10 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) ...@@ -792,6 +791,10 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
if (!sense_deferred) if (!sense_deferred)
error = __scsi_error_from_host_byte(cmd, result); error = __scsi_error_from_host_byte(cmd, result);
} }
/*
* __scsi_error_from_host_byte may have reset the host_byte
*/
req->errors = cmd->result;
req->resid_len = scsi_get_resid(cmd); req->resid_len = scsi_get_resid(cmd);
......
...@@ -764,6 +764,16 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result, ...@@ -764,6 +764,16 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
sdev->model = (char *) (sdev->inquiry + 16); sdev->model = (char *) (sdev->inquiry + 16);
sdev->rev = (char *) (sdev->inquiry + 32); sdev->rev = (char *) (sdev->inquiry + 32);
if (strncmp(sdev->vendor, "ATA ", 8) == 0) {
/*
* sata emulation layer device. This is a hack to work around
* the SATL power management specifications which state that
* when the SATL detects the device has gone into standby
* mode, it shall respond with NOT READY.
*/
sdev->allow_restart = 1;
}
if (*bflags & BLIST_ISROM) { if (*bflags & BLIST_ISROM) {
sdev->type = TYPE_ROM; sdev->type = TYPE_ROM;
sdev->removable = 1; sdev->removable = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment