ide-cd: handle fragmented packet commands gracefully
PATCH 1/1 ide-cd: handle fragmented packet commands gracefully
There are some devices in the wild that clear the DRQ bit during the last word of a packet command and therefore could use a "second chance" for that last word of data to be xferred instead of simply failing the request. Do that by attempting to suck in those last bytes in PIO mode.
In addition, the ATA_ERR bit has to be cleared for we cannot be sure the data is valid otherwise.
See http://bugzilla.kernel.org/show_bug.cgi?id=13399 for details.
--- drivers/ide/ide-cd.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-)
drivers/ide/ide-cd.c +12 -2
@@ -592,9 +592,19 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) } }else if (!blk_pc_request (rq)) {ide_cd_request_sense_fixup (drive, cmd); -/* complain if we still have data left to transfer */ + uptodate = cmd->nleft ?0 :1 ; -if (uptodate ==0 ) + +/* +* suck out the remaining bytes from the drive in an +* attempt to complete the data xfer. (see BZ#13399) +*/ +if (!(stat &ATA_ERR ) && !uptodate && thislen) { +ide_pio_bytes (drive, cmd, write, thislen); + uptodate = cmd->nleft ?0 :1 ; + } + +if (!uptodate) rq->cmd_flags |=REQ_FAILED ; } goto out_end;
Signature · 1 line
1.6.3.1
Quoted 11 lines · On Sunday 21 June 2009 10:55:27 Borislav Petkov wrote:
There are some devices in the wild that clear the DRQ bit during the last word of a packet command and therefore could use a "second chance" for that last word of data to be xferred instead of simply failing the request. Do that by attempting to suck in those last bytes in PIO mode.
In addition, the
ATA_ERRbit has to be cleared for we cannot be sure the data is valid otherwise.See http://bugzilla.kernel.org/show_bug.cgi?id=13399 for details.
Signed-off-by Borislav Petkov <[email protected]>
Quoted 30 lines
--- drivers/ide/ide-cd.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-)drivers/ide/ide-cd.c +12
-2@@ -592,9 +592,19 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) } }else if (!blk_pc_request (rq)) {ide_cd_request_sense_fixup (drive, cmd); -/* complain if we still have data left to transfer */ + uptodate = cmd->nleft ?0 :1 ; -if (uptodate ==0 ) + +/* +* suck out the remaining bytes from the drive in an +* attempt to complete the data xfer. (see BZ#13399) +*/ +if (!(stat &ATA_ERR ) && !uptodate && thislen) { +ide_pio_bytes (drive, cmd, write, thislen); + uptodate = cmd->nleft ?0 :1 ; + } + +if (!uptodate) rq->cmd_flags |=REQ_FAILED ; } goto out_end;
Hi David,
Quoted 6 lines · Bartlomiej Zolnierkiewicz
Quoted 5 lines · On Sunday 21 June 2009 10:55:27 Borislav Petkov wrote:
There are some devices in the wild that clear the DRQ bit during the last word of a packet command and therefore could use a "second chance" for that last word of data to be xferred instead of simply failing the request. Do that by attempting to suck in those last bytes in PIO mode.
Quoted 8 lines
Quoted 6 lines
In addition, the
ATA_ERRbit has to be cleared for we cannot be sure the data is valid otherwise.See http://bugzilla.kernel.org/show_bug.cgi?id=13399 for details.
Signed-off-by Borislav Petkov <[email protected]>
can you pick that one too, please. I can't seem to find it on patchwork.
Thanks.
Quoted 31 lines
Quoted 31 lines
--- drivers/ide/ide-cd.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-)drivers/ide/ide-cd.c +12
-2@@ -592,9 +592,19 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) } }else if (!blk_pc_request (rq)) {ide_cd_request_sense_fixup (drive, cmd); -/* complain if we still have data left to transfer */ + uptodate = cmd->nleft ?0 :1 ; -if (uptodate ==0 ) + +/* +* suck out the remaining bytes from the drive in an +* attempt to complete the data xfer. (see BZ#13399) +*/ +if (!(stat &ATA_ERR ) && !uptodate && thislen) { +ide_pio_bytes (drive, cmd, write, thislen); + uptodate = cmd->nleft ?0 :1 ; + } + +if (!uptodate) rq->cmd_flags |=REQ_FAILED ; } goto out_end;
Signature · 2 lines
Regards/Gruss,
Boris.From: Borislav Petkov <[email protected]>
Date: Fri, 26 Jun 2009 10:19:58 +0200
Quoted 12 lines
Hi David,
Quoted 9 lines · Bartlomiej Zolnierkiewicz
Quoted 8 lines · On Sunday 21 June 2009 10:55:27 Borislav Petkov wrote:
There are some devices in the wild that clear the DRQ bit during the last word of a packet command and therefore could use a "second chance" for that last word of data to be xferred instead of simply failing the request. Do that by attempting to suck in those last bytes in PIO mode.
In addition, the
ATA_ERRbit has to be cleared for we cannot be sure the data is valid otherwise.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
See http://bugzilla.kernel.org/show_bug.cgi?id=13399 for details.
Signed-off-by Borislav Petkov <[email protected]>can you pick that one too, please. I can't seem to find it on patchwork.
Yep, I'll dig into the archives to get it, I had this on my TODO list.
Thanks!