Skip to contentSkip to conversation

ide-cd question

DISCUSSION Stuart Hayes 1 participant 1 message Feb 12, 2005 libata

lore
Share & tools
lore
#0 lore raw
Quoted 6 lines
Quoted 6 lines

Sorry--this patch is against 2.6.11-rc3.

Also sorry for the mangled patch--I'll resend it from another email address shortly.

Quoted 8 lines
Quoted 2 lines

Thanks
Stuart

OK, here's that patch again--hopefully not mangled this time. Thanks,
Stuart

This is frustrating. Here it is again:

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;