Skip to contentSkip to conversation

ide-cd question

DISCUSSION Stuart Hayes 2 participants 2 messages Mar 3, 2005 libata

lore
Share & tools
lore
#0 lore raw

I sent in this patch a few weeks ago, and never saw a response... I was wondering if there was a problem with it, or if I need to supply more info...? This patch is against 2.6.11-rc3. It makes sure that when ide_atapi_error() tries to end a failing ATAPI request after 2 reset attempts by calling drive->driver->end_request(), it will really be ended. Right now, a request that has a non-null rq->bio will not get ended, nor will rq->errors get cleared, so it will get retried forever with no more reset attempts.

My fingers are crossed that this patch won't be mangled... I seem to have a problem with that...

Thanks,
Stuart

ide-io.c.new 2005-02-10 15:23:31.000000000 -0500 renamed from ide-io.c.orig 2005-02-10 15:23:52.000000000 -0500 +10 -1
@@ -515,7 +515,18 @@ static ide_startstop_t ide_atapi_error(i
  hwif->OUTB(WIN_IDLEIMMEDIATE, IDE_COMMAND_REG);
 
 if (rq->errors >= ERROR_MAX) {
-  drive->driver->end_request(drive, 0, 0);
+  /* +   * make sure request is fully ended--otherwise bio might get updated and the
+   * command will be retried without rq->errors getting reset to zero, which
+   * could cause us to get stuck in a loop with infinite retries without any +   * more reset attempts (borrowed from cdrom_end_request)
+   */
+  int nsectors;
+  if (blk_pc_request(rq))
+   nsectors = (rq->data_len + 511) >> 9;
+  if (!nsectors)
+   nsectors = 1;
+  drive->driver->end_request(drive, 0, nsectors);
 } else {
  if ((rq->errors & ERROR_RESET) == ERROR_RESET) {
   ++rq->errors;
#1 lore raw
Quoted 8 lines · Stuart Hayes

I sent in this patch a few weeks ago, and never saw a response... I was wondering if there was a problem with it, or if I need to supply more info...? This patch is against 2.6.11-rc3. It makes sure that when ide_atapi_error() tries to end a failing ATAPI request after 2 reset attempts by calling drive->driver->end_request(), it will really be ended. Right now, a request that has a non-null rq->bio will not get ended, nor will rq->errors get cleared, so it will get retried forever with no more reset attempts.

Indeed a problem. Would be nice to switch the ->end_request() to be byte based like SCSI, would make it cleaner.

But do you really need the !nsectors check? If ->data_len is 0, there should not be a need to pass a non-zero sector count.

Quoted 2 lines

My fingers are crossed that this patch won't be mangled... I seem to have a problem with that...

No such luck, it's mangled :). Looks like tabs turned to a single space. Maybe you have better luck with attaching the file.

Signature · 1 line
Jens Axboe