diff options
Diffstat (limited to 'drivers/ide/ide-eh.c')
-rw-r--r-- | drivers/ide/ide-eh.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/drivers/ide/ide-eh.c b/drivers/ide/ide-eh.c index 1231b5e486f2..11664976eea3 100644 --- a/drivers/ide/ide-eh.c +++ b/drivers/ide/ide-eh.c | |||
@@ -123,8 +123,18 @@ ide_startstop_t ide_error(ide_drive_t *drive, const char *msg, u8 stat) | |||
123 | 123 | ||
124 | /* retry only "normal" I/O: */ | 124 | /* retry only "normal" I/O: */ |
125 | if (!blk_fs_request(rq)) { | 125 | if (!blk_fs_request(rq)) { |
126 | rq->errors = 1; | 126 | if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { |
127 | ide_end_drive_cmd(drive, stat, err); | 127 | struct ide_cmd *cmd = rq->special; |
128 | |||
129 | if (cmd) | ||
130 | ide_complete_cmd(drive, cmd, stat, err); | ||
131 | } else if (blk_pm_request(rq)) { | ||
132 | rq->errors = 1; | ||
133 | ide_complete_pm_rq(drive, rq); | ||
134 | return ide_stopped; | ||
135 | } | ||
136 | rq->errors = err; | ||
137 | ide_complete_rq(drive, err ? -EIO : 0, blk_rq_bytes(rq)); | ||
128 | return ide_stopped; | 138 | return ide_stopped; |
129 | } | 139 | } |
130 | 140 | ||
@@ -136,8 +146,11 @@ static inline void ide_complete_drive_reset(ide_drive_t *drive, int err) | |||
136 | { | 146 | { |
137 | struct request *rq = drive->hwif->rq; | 147 | struct request *rq = drive->hwif->rq; |
138 | 148 | ||
139 | if (rq && blk_special_request(rq) && rq->cmd[0] == REQ_DRIVE_RESET) | 149 | if (rq && blk_special_request(rq) && rq->cmd[0] == REQ_DRIVE_RESET) { |
140 | ide_end_request(drive, err ? err : 1, 0); | 150 | if (err <= 0 && rq->errors == 0) |
151 | rq->errors = -EIO; | ||
152 | ide_complete_rq(drive, err ? err : 0, ide_rq_bytes(rq)); | ||
153 | } | ||
141 | } | 154 | } |
142 | 155 | ||
143 | /* needed below */ | 156 | /* needed below */ |
@@ -162,8 +175,7 @@ static ide_startstop_t atapi_reset_pollfunc(ide_drive_t *drive) | |||
162 | printk(KERN_INFO "%s: ATAPI reset complete\n", drive->name); | 175 | printk(KERN_INFO "%s: ATAPI reset complete\n", drive->name); |
163 | else { | 176 | else { |
164 | if (time_before(jiffies, hwif->poll_timeout)) { | 177 | if (time_before(jiffies, hwif->poll_timeout)) { |
165 | ide_set_handler(drive, &atapi_reset_pollfunc, HZ/20, | 178 | ide_set_handler(drive, &atapi_reset_pollfunc, HZ/20); |
166 | NULL); | ||
167 | /* continue polling */ | 179 | /* continue polling */ |
168 | return ide_started; | 180 | return ide_started; |
169 | } | 181 | } |
@@ -225,7 +237,7 @@ static ide_startstop_t reset_pollfunc(ide_drive_t *drive) | |||
225 | 237 | ||
226 | if (!OK_STAT(tmp, 0, ATA_BUSY)) { | 238 | if (!OK_STAT(tmp, 0, ATA_BUSY)) { |
227 | if (time_before(jiffies, hwif->poll_timeout)) { | 239 | if (time_before(jiffies, hwif->poll_timeout)) { |
228 | ide_set_handler(drive, &reset_pollfunc, HZ/20, NULL); | 240 | ide_set_handler(drive, &reset_pollfunc, HZ/20); |
229 | /* continue polling */ | 241 | /* continue polling */ |
230 | return ide_started; | 242 | return ide_started; |
231 | } | 243 | } |
@@ -342,7 +354,7 @@ static ide_startstop_t do_reset1(ide_drive_t *drive, int do_not_try_atapi) | |||
342 | ndelay(400); | 354 | ndelay(400); |
343 | hwif->poll_timeout = jiffies + WAIT_WORSTCASE; | 355 | hwif->poll_timeout = jiffies + WAIT_WORSTCASE; |
344 | hwif->polling = 1; | 356 | hwif->polling = 1; |
345 | __ide_set_handler(drive, &atapi_reset_pollfunc, HZ/20, NULL); | 357 | __ide_set_handler(drive, &atapi_reset_pollfunc, HZ/20); |
346 | spin_unlock_irqrestore(&hwif->lock, flags); | 358 | spin_unlock_irqrestore(&hwif->lock, flags); |
347 | return ide_started; | 359 | return ide_started; |
348 | } | 360 | } |
@@ -402,7 +414,7 @@ static ide_startstop_t do_reset1(ide_drive_t *drive, int do_not_try_atapi) | |||
402 | udelay(10); | 414 | udelay(10); |
403 | hwif->poll_timeout = jiffies + WAIT_WORSTCASE; | 415 | hwif->poll_timeout = jiffies + WAIT_WORSTCASE; |
404 | hwif->polling = 1; | 416 | hwif->polling = 1; |
405 | __ide_set_handler(drive, &reset_pollfunc, HZ/20, NULL); | 417 | __ide_set_handler(drive, &reset_pollfunc, HZ/20); |
406 | 418 | ||
407 | /* | 419 | /* |
408 | * Some weird controller like resetting themselves to a strange | 420 | * Some weird controller like resetting themselves to a strange |