Re: [PATCH] as i/o hang with aacraid driver 2.6.0-test1

James Bottomley
2003-07-18T20:07:19Z

[-- Attachment #1: Type: text/plain, Size: 703 bytes --]

On Fri, 2003-07-18 at 12:46, Mark Haverkamp wrote:
> I'll try out your test harness on our hardware and see what happens.

OK, I think I found the problem.

Parts of the SCSI and block code don't distinguish between queueing and
requeueing, so they trip over the exact same error.

The (fairly invasive) fix is to add an extra parameter to
blk_insert_request to tell it if this is a reinsertion or a new request
(patch attached--against Jens' previous one).

With this, I now get the AS ioscheduler to survive my tests.

Incidentally, I'm not sure whether scsi_requeue_command() counts as a
reinsertion. It's used to redo I/O after end_that_request_first() but
before end_that_request_last().

James

[-- Attachment #2: tmp.diff --]
[-- Type: text/plain, Size: 2981 bytes --]

===== drivers/block/ll_rw_blk.c 1.195 vs edited =====
--- 1.195/drivers/block/ll_rw_blk.c Fri Jul 18 12:36:20 2003
+++ edited/drivers/block/ll_rw_blk.c Fri Jul 18 14:54:34 2003
@@ -1518,6 +1518,7 @@
* @rq: request to be inserted
* @at_head: insert request at head or tail of queue
* @data: private data
+ * @reinsert: true if request it a reinsertion of previously processed one
*
* Description:
* Many block devices need to execute commands asynchronously, so they don't
@@ -1532,7 +1533,7 @@
* host that is unable to accept a particular command.
*/
void blk_insert_request(request_queue_t *q, struct request *rq,
- int at_head, void *data)
+ int at_head, void *data, int reinsert)
{
unsigned long flags;

@@ -1550,11 +1551,15 @@
/*
* If command is tagged, release the tag
*/
- if (blk_rq_tagged(rq))
- blk_queue_end_tag(q, rq);
+ if(reinsert) {
+ blk_requeue_request(q, rq);
+ } else {
+ if (blk_rq_tagged(rq))
+ blk_queue_end_tag(q, rq);

- drive_stat_acct(rq, rq->nr_sectors, 1);
- __elv_add_request(q, rq, !at_head, 0);
+ drive_stat_acct(rq, rq->nr_sectors, 1);
+ __elv_add_request(q, rq, !at_head, 0);
+ }
q->request_fn(q);
spin_unlock_irqrestore(q->queue_lock, flags);
}
===== drivers/scsi/scsi_lib.c 1.104 vs edited =====
--- 1.104/drivers/scsi/scsi_lib.c Fri Jul 18 12:36:25 2003
+++ edited/drivers/scsi/scsi_lib.c Fri Jul 18 14:54:35 2003
@@ -69,7 +69,7 @@
*/
sreq->sr_request->flags &= ~REQ_DONTPREP;
blk_insert_request(sreq->sr_device->request_queue, sreq->sr_request,
- at_head, sreq);
+ at_head, sreq, 0);
return 0;
}

@@ -147,7 +147,7 @@
* function. The SCSI request function detects the blocked condition
* and plugs the queue appropriately.
*/
- blk_insert_request(device->request_queue, cmd->request, 1, cmd);
+ blk_insert_request(device->request_queue, cmd->request, 1, cmd, 1);
return 0;
}

@@ -445,7 +445,7 @@
static void scsi_requeue_command(struct request_queue *q, struct scsi_cmnd *cmd)
{
cmd->request->flags &= ~REQ_DONTPREP;
- blk_insert_request(q, cmd->request, 1, cmd);
+ blk_insert_request(q, cmd->request, 1, cmd, 1);

scsi_run_queue(q);
}
===== include/linux/blkdev.h 1.118 vs edited =====
--- 1.118/include/linux/blkdev.h Fri Jul 18 12:36:34 2003
+++ edited/include/linux/blkdev.h Fri Jul 18 14:54:35 2003
@@ -490,7 +490,7 @@
extern void __blk_attempt_remerge(request_queue_t *, struct request *);
extern struct request *blk_get_request(request_queue_t *, int, int);
extern void blk_put_request(struct request *);
-extern void blk_insert_request(request_queue_t *, struct request *, int, void *);
+extern void blk_insert_request(request_queue_t *, struct request *, int, void *, int);
extern void blk_requeue_request(request_queue_t *, struct request *);
extern void blk_plug_device(request_queue_t *);
extern int blk_remove_plug(request_queue_t *);