Skip to content

Commit be4bde6

Browse files
Randy HronLinus Torvalds
authored andcommitted
[PATCH] qlogic "this should not happen" fix
This patch is based on changes I've used for 2.5.31, 2.5.31-mm1, 2.5.32-mm1, 2.5.32-mm2, and 2.5.33-mm1. Without the patch, 2.5.x during heavy benchmark/stress testing eventually locks up with these final messages: kernel: qlogicfc0 : no handle slots, this should not happen. kernel: hostdata->queued is 6, in_ptr: 7d This is a combination of Doug Ledford's patch: http://marc.theaimsgroup.com/?l=linux-kernel&m=103005703808312&w=2 and Eric Weigle's patch: http://marc.theaimsgroup.com/?l=linux-kernel&m=103005790509079&w=2 2.5.33 (and all predecessors i've tested) locked up without it.
1 parent f583109 commit be4bde6

File tree

2 files changed

+3
-16
lines changed

2 files changed

+3
-16
lines changed

drivers/scsi/qlogicfc.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,18 +1342,11 @@ int isp2x00_queuecommand(Scsi_Cmnd * Cmnd, void (*done) (Scsi_Cmnd *))
13421342

13431343
num_free = QLOGICFC_REQ_QUEUE_LEN - REQ_QUEUE_DEPTH(in_ptr, out_ptr);
13441344
num_free = (num_free > 2) ? num_free - 2 : 0;
1345-
host->can_queue = hostdata->queued + num_free;
1345+
host->can_queue = host->host_busy + num_free;
13461346
if (host->can_queue > QLOGICFC_REQ_QUEUE_LEN)
13471347
host->can_queue = QLOGICFC_REQ_QUEUE_LEN;
13481348
host->sg_tablesize = QLOGICFC_MAX_SG(num_free);
13491349

1350-
/* this is really gross */
1351-
if (host->can_queue <= host->host_busy){
1352-
if (host->can_queue+2 < host->host_busy)
1353-
DEBUG(printk("qlogicfc%d.c crosses its fingers.\n", hostdata->host_id));
1354-
host->can_queue = host->host_busy + 1;
1355-
}
1356-
13571350
LEAVE("isp2x00_queuecommand");
13581351

13591352
return 0;
@@ -1623,17 +1616,11 @@ void isp2x00_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
16231616

16241617
num_free = QLOGICFC_REQ_QUEUE_LEN - REQ_QUEUE_DEPTH(in_ptr, out_ptr);
16251618
num_free = (num_free > 2) ? num_free - 2 : 0;
1626-
host->can_queue = hostdata->queued + num_free;
1619+
host->can_queue = host->host_busy + num_free;
16271620
if (host->can_queue > QLOGICFC_REQ_QUEUE_LEN)
16281621
host->can_queue = QLOGICFC_REQ_QUEUE_LEN;
16291622
host->sg_tablesize = QLOGICFC_MAX_SG(num_free);
16301623

1631-
if (host->can_queue <= host->host_busy){
1632-
if (host->can_queue+2 < host->host_busy)
1633-
DEBUG(printk("qlogicfc%d : crosses its fingers.\n", hostdata->host_id));
1634-
host->can_queue = host->host_busy + 1;
1635-
}
1636-
16371624
outw(HCCR_CLEAR_RISC_INTR, host->io_port + HOST_HCCR);
16381625
LEAVE_INTR("isp2x00_intr_handler");
16391626
}

drivers/scsi/qlogicfc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
#define DATASEGS_PER_COMMAND 2
6666
#define DATASEGS_PER_CONT 5
6767

68-
#define QLOGICFC_REQ_QUEUE_LEN 127 /* must be power of two - 1 */
68+
#define QLOGICFC_REQ_QUEUE_LEN 255 /* must be power of two - 1 */
6969
#define QLOGICFC_MAX_SG(ql) (DATASEGS_PER_COMMAND + (((ql) > 0) ? DATASEGS_PER_CONT*((ql) - 1) : 0))
7070
#define QLOGICFC_CMD_PER_LUN 8
7171

0 commit comments

Comments
 (0)