===== drivers/ide/ide-iops.c 1.7 vs 1.9 ===== --- 1.7/drivers/ide/ide-iops.c Sat Aug 9 11:48:39 2003 +++ 1.9/drivers/ide/ide-iops.c Sun Dec 28 18:14:05 2003 @@ -664,12 +664,22 @@ if ((stat = hwif->INB(IDE_STATUS_REG)) & BUSY_STAT) { local_irq_set(flags); timeout += jiffies; - while ((stat = hwif->INB(IDE_STATUS_REG)) & BUSY_STAT) { + stat = hwif->INB(IDE_STATUS_REG); + while (stat & BUSY_STAT) { if (time_after(jiffies, timeout)) { - local_irq_restore(flags); - *startstop = DRIVER(drive)->error(drive, "status timeout", stat); - return 1; + /* + * do one more status read in case we were interrupted between last + * stat = hwif->INB(IDE_STATUS_REG) and time_after(jiffies, timeout) + * in wich case the timeout might have been shorter than specified. + */ + if ((stat = hwif->INB(IDE_STATUS_REG)) & BUSY_STAT) { + local_irq_restore(flags); + *startstop = DRIVER(drive)->error(drive, "status timeout", stat); + return 1; + } } + else + stat = hwif->INB(IDE_STATUS_REG); } local_irq_restore(flags); }