Skip to content

Commit 93cb463

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6: [SCSI] Retry commands with UNIT_ATTENTION sense codes to fix ext3/ext4 I/O error [SCSI] Enable retries for SYNCRONIZE_CACHE commands to fix I/O error [SCSI] scsi_debug: virtual_gb ignores sector_size [SCSI] libiscsi: regression: fix header digest errors [SCSI] fix locking around blk_abort_request() [SCSI] advansys: fix narrow board error path
2 parents 1c6fe03 + 77a4229 commit 93cb463

File tree

7 files changed

+62
-17
lines changed

7 files changed

+62
-17
lines changed

drivers/scsi/advansys.c

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4724,6 +4724,10 @@ static ushort AscInitMicroCodeVar(ASC_DVC_VAR *asc_dvc)
47244724
BUG_ON((unsigned long)asc_dvc->overrun_buf & 7);
47254725
asc_dvc->overrun_dma = dma_map_single(board->dev, asc_dvc->overrun_buf,
47264726
ASC_OVERRUN_BSIZE, DMA_FROM_DEVICE);
4727+
if (dma_mapping_error(board->dev, asc_dvc->overrun_dma)) {
4728+
warn_code = -ENOMEM;
4729+
goto err_dma_map;
4730+
}
47274731
phy_addr = cpu_to_le32(asc_dvc->overrun_dma);
47284732
AscMemDWordCopyPtrToLram(iop_base, ASCV_OVERRUN_PADDR_D,
47294733
(uchar *)&phy_addr, 1);
@@ -4739,14 +4743,23 @@ static ushort AscInitMicroCodeVar(ASC_DVC_VAR *asc_dvc)
47394743
AscSetPCAddr(iop_base, ASC_MCODE_START_ADDR);
47404744
if (AscGetPCAddr(iop_base) != ASC_MCODE_START_ADDR) {
47414745
asc_dvc->err_code |= ASC_IERR_SET_PC_ADDR;
4742-
return warn_code;
4746+
warn_code = UW_ERR;
4747+
goto err_mcode_start;
47434748
}
47444749
if (AscStartChip(iop_base) != 1) {
47454750
asc_dvc->err_code |= ASC_IERR_START_STOP_CHIP;
4746-
return warn_code;
4751+
warn_code = UW_ERR;
4752+
goto err_mcode_start;
47474753
}
47484754

47494755
return warn_code;
4756+
4757+
err_mcode_start:
4758+
dma_unmap_single(board->dev, asc_dvc->overrun_dma,
4759+
ASC_OVERRUN_BSIZE, DMA_FROM_DEVICE);
4760+
err_dma_map:
4761+
asc_dvc->overrun_dma = 0;
4762+
return warn_code;
47504763
}
47514764

47524765
static ushort AscInitAsc1000Driver(ASC_DVC_VAR *asc_dvc)
@@ -4802,6 +4815,8 @@ static ushort AscInitAsc1000Driver(ASC_DVC_VAR *asc_dvc)
48024815
}
48034816
release_firmware(fw);
48044817
warn_code |= AscInitMicroCodeVar(asc_dvc);
4818+
if (!asc_dvc->overrun_dma)
4819+
return warn_code;
48054820
asc_dvc->init_state |= ASC_INIT_STATE_END_LOAD_MC;
48064821
AscEnableInterrupt(iop_base);
48074822
return warn_code;
@@ -7978,9 +7993,10 @@ static int advansys_reset(struct scsi_cmnd *scp)
79787993
status = AscInitAsc1000Driver(asc_dvc);
79797994

79807995
/* Refer to ASC_IERR_* definitions for meaning of 'err_code'. */
7981-
if (asc_dvc->err_code) {
7996+
if (asc_dvc->err_code || !asc_dvc->overrun_dma) {
79827997
scmd_printk(KERN_INFO, scp, "SCSI bus reset error: "
7983-
"0x%x\n", asc_dvc->err_code);
7998+
"0x%x, status: 0x%x\n", asc_dvc->err_code,
7999+
status);
79848000
ret = FAILED;
79858001
} else if (status) {
79868002
scmd_printk(KERN_INFO, scp, "SCSI bus reset warning: "
@@ -12311,7 +12327,7 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
1231112327
asc_dvc_varp->overrun_buf = kzalloc(ASC_OVERRUN_BSIZE, GFP_KERNEL);
1231212328
if (!asc_dvc_varp->overrun_buf) {
1231312329
ret = -ENOMEM;
12314-
goto err_free_wide_mem;
12330+
goto err_free_irq;
1231512331
}
1231612332
warn_code = AscInitAsc1000Driver(asc_dvc_varp);
1231712333

@@ -12320,30 +12336,36 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
1232012336
"warn 0x%x, error 0x%x\n",
1232112337
asc_dvc_varp->init_state, warn_code,
1232212338
asc_dvc_varp->err_code);
12323-
if (asc_dvc_varp->err_code) {
12339+
if (!asc_dvc_varp->overrun_dma) {
1232412340
ret = -ENODEV;
12325-
kfree(asc_dvc_varp->overrun_buf);
12341+
goto err_free_mem;
1232612342
}
1232712343
}
1232812344
} else {
12329-
if (advansys_wide_init_chip(shost))
12345+
if (advansys_wide_init_chip(shost)) {
1233012346
ret = -ENODEV;
12347+
goto err_free_mem;
12348+
}
1233112349
}
1233212350

12333-
if (ret)
12334-
goto err_free_wide_mem;
12335-
1233612351
ASC_DBG_PRT_SCSI_HOST(2, shost);
1233712352

1233812353
ret = scsi_add_host(shost, boardp->dev);
1233912354
if (ret)
12340-
goto err_free_wide_mem;
12355+
goto err_free_mem;
1234112356

1234212357
scsi_scan_host(shost);
1234312358
return 0;
1234412359

12345-
err_free_wide_mem:
12346-
advansys_wide_free_mem(boardp);
12360+
err_free_mem:
12361+
if (ASC_NARROW_BOARD(boardp)) {
12362+
if (asc_dvc_varp->overrun_dma)
12363+
dma_unmap_single(boardp->dev, asc_dvc_varp->overrun_dma,
12364+
ASC_OVERRUN_BSIZE, DMA_FROM_DEVICE);
12365+
kfree(asc_dvc_varp->overrun_buf);
12366+
} else
12367+
advansys_wide_free_mem(boardp);
12368+
err_free_irq:
1234712369
free_irq(boardp->irq, shost);
1234812370
err_free_dma:
1234912371
#ifdef CONFIG_ISA

drivers/scsi/libiscsi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,12 +471,12 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task)
471471

472472
WARN_ON(hdrlength >= 256);
473473
hdr->hlength = hdrlength & 0xFF;
474+
hdr->cmdsn = task->cmdsn = cpu_to_be32(session->cmdsn);
474475

475476
if (session->tt->init_task && session->tt->init_task(task))
476477
return -EIO;
477478

478479
task->state = ISCSI_TASK_RUNNING;
479-
hdr->cmdsn = task->cmdsn = cpu_to_be32(session->cmdsn);
480480
session->cmdsn++;
481481

482482
conn->scsicmd_pdus_cnt++;

drivers/scsi/libsas/sas_ata.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,11 +395,15 @@ int sas_ata_init_host_and_port(struct domain_device *found_dev,
395395
void sas_ata_task_abort(struct sas_task *task)
396396
{
397397
struct ata_queued_cmd *qc = task->uldd_task;
398+
struct request_queue *q = qc->scsicmd->device->request_queue;
398399
struct completion *waiting;
400+
unsigned long flags;
399401

400402
/* Bounce SCSI-initiated commands to the SCSI EH */
401403
if (qc->scsicmd) {
404+
spin_lock_irqsave(q->queue_lock, flags);
402405
blk_abort_request(qc->scsicmd->request);
406+
spin_unlock_irqrestore(q->queue_lock, flags);
403407
scsi_schedule_eh(qc->scsicmd->device->host);
404408
return;
405409
}

drivers/scsi/libsas/sas_scsi_host.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,6 +1030,8 @@ int __sas_task_abort(struct sas_task *task)
10301030
void sas_task_abort(struct sas_task *task)
10311031
{
10321032
struct scsi_cmnd *sc = task->uldd_task;
1033+
struct request_queue *q = sc->device->request_queue;
1034+
unsigned long flags;
10331035

10341036
/* Escape for libsas internal commands */
10351037
if (!sc) {
@@ -1044,7 +1046,9 @@ void sas_task_abort(struct sas_task *task)
10441046
return;
10451047
}
10461048

1049+
spin_lock_irqsave(q->queue_lock, flags);
10471050
blk_abort_request(sc->request);
1051+
spin_unlock_irqrestore(q->queue_lock, flags);
10481052
scsi_schedule_eh(sc->device->host);
10491053
}
10501054

drivers/scsi/scsi_debug.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,8 @@ static int resp_start_stop(struct scsi_cmnd * scp,
957957
static sector_t get_sdebug_capacity(void)
958958
{
959959
if (scsi_debug_virtual_gb > 0)
960-
return 2048 * 1024 * (sector_t)scsi_debug_virtual_gb;
960+
return (sector_t)scsi_debug_virtual_gb *
961+
(1073741824 / scsi_debug_sector_size);
961962
else
962963
return sdebug_store_sectors;
963964
}

drivers/scsi/scsi_error.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,20 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
302302
if (scmd->device->allow_restart &&
303303
(sshdr.asc == 0x04) && (sshdr.ascq == 0x02))
304304
return FAILED;
305-
return SUCCESS;
305+
306+
if (blk_barrier_rq(scmd->request))
307+
/*
308+
* barrier requests should always retry on UA
309+
* otherwise block will get a spurious error
310+
*/
311+
return NEEDS_RETRY;
312+
else
313+
/*
314+
* for normal (non barrier) commands, pass the
315+
* UA upwards for a determination in the
316+
* completion functions
317+
*/
318+
return SUCCESS;
306319

307320
/* these three are not supported */
308321
case COPY_ABORTED:

drivers/scsi/sd.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,6 +1040,7 @@ static void sd_prepare_flush(struct request_queue *q, struct request *rq)
10401040
{
10411041
rq->cmd_type = REQ_TYPE_BLOCK_PC;
10421042
rq->timeout = SD_TIMEOUT;
1043+
rq->retries = SD_MAX_RETRIES;
10431044
rq->cmd[0] = SYNCHRONIZE_CACHE;
10441045
rq->cmd_len = 10;
10451046
}

0 commit comments

Comments
 (0)