ide-cd: fix REQ_QUIET tests in cdrom_decode_status
Subsystems (2)
PATCH 1/1 ide-cd: fix REQ_QUIET tests in cdrom_decode_status
From: Borislav Petkov <[email protected]>
Date: Mon, 27 Apr 2009 14:11:32 +0200
Subject: [PATCH] ide-cd: fix REQ_QUIET tests in cdrom_decode_status
Original patch (dfa4411cc3a690011cab90e9a536938795366cf9) was buggy. This is a more proper fix which introduces blk_rq_quiet() macro alleviating the need for dumb, too short caching variables.
Thanks to Helge Deller and Bart for debugging this.
--- drivers/ide/ide-cd.c | 9 ++++----- include/linux/blkdev.h | 1 + 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/ide/ide-cd.c +2 -3
@@ -283,7 +283,6 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)ide_hwif_t *hwif = drive->hwif;struct request *rq = hwif->rq;int err, sense_key, do_end_request =0 ; -u8 quiet = rq->cmd_flags &REQ_QUIET ;/* get the IDE error register */ err =ide_read_error (drive);
@@ -318,7 +317,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) }else {cdrom_saw_media_change (drive); -if (blk_fs_request (rq) && !quiet) +if (blk_fs_request (rq) && !blk_rq_quiet (rq)) printk(KERN_ERR PFX "%s: tray open\n", drive->name); }
@@ -353,7 +352,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)* No point in retrying after an illegal request or data * protect error. */ -if (!quiet) +if (!blk_rq_quiet (rq))ide_dump_status (drive,"command error" , stat); do_end_request =1 ;break ;
@@ -362,14 +361,14 @@ static int cdrom_decode_status(ide_drive_t
*drive, u8 stat)
* No point in re-trying a zillion times on a bad sector.
* If we got here the error is not correctable. */
- if (!quiet)
+ if (!blk_rq_quiet(rq))
ide_dump_status(drive, "media error "
"(bad sector)", stat);
do_end_request = 1;
break;
case BLANK_CHECK:
/* disk appears blank? */
- if (!quiet)
+ if (!blk_rq_quiet(rq))
ide_dump_status(drive, "media error (blank)",
stat);
do_end_request = 1;
include/linux/blkdev.h +1 -0
@@ -598,6 +598,7 @@ enum { blk_failfast_transport(rq) || \ blk_failfast_driver(rq))#define blk_rq_started (rq) ((rq)->cmd_flags & REQ_STARTED) +#define blk_rq_quiet (rq) ((rq)->cmd_flags & REQ_QUIET)#define blk_account_rq (rq) (blk_rq_started(rq) && (blk_fs_request(rq)
|| blk_discard_rq(rq)))
Signature · 6 lines
1.6.2.4 -- Regards/Gruss, Boris
Quoted 13 lines · Borislav Petkov
Original patch (
dfa4411cc3a690011cab90e9a536938795366cf9) was buggy. This is a more proper fix which introducesblk_rq_quiet()macro alleviating the need for dumb, too short caching variables.Thanks to Helge Deller and Bart for debugging this.
Signed-off-by Borislav Petkov <[email protected]>include/linux/blkdev.h +0
-0
include/linux/blkdev.h enum { · line 604
Quoted 7 lines
include/linux/blkdev.h +1
-0@@ -598,6 +598,7 @@ enum { blk_failfast_transport(rq) || \ blk_failfast_driver(rq))#define blk_rq_started (rq) ((rq)->cmd_flags & REQ_STARTED) +#define blk_rq_quiet (rq) ((rq)->cmd_flags & REQ_QUIET)#define blk_account_rq (rq) (blk_rq_started(rq) && (blk_fs_request(rq) || blk_discard_rq(rq)))
The patch looks like-wrapped...
MBR, Sergei
PATCH 1/1 ide-cd: fix REQ_QUIET tests in cdrom_decode_status
Here's a non-wrapped version, Sergei thanks for catching that.
--
From: Borislav Petkov <[email protected]>
Date: Mon, 27 Apr 2009 14:11:32 +0200
Subject: [PATCH] ide-cd: fix REQ_QUIET tests in cdrom_decode_status
Original patch (dfa4411cc3a690011cab90e9a536938795366cf9) was buggy. This is a more proper fix which introduces blk_rq_quiet() macro alleviating the need for dumb, too short caching variables.
Thanks to Helge Deller and Bart for debugging this.
--- drivers/ide/ide-cd.c | 9 ++++----- include/linux/blkdev.h | 1 + 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/ide/ide-cd.c +4 -5
@@ -282,7 +282,6 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)ide_hwif_t *hwif = drive->hwif;struct request *rq = hwif->rq;int err, sense_key, do_end_request =0 ; -u8 quiet = rq->cmd_flags &REQ_QUIET ;/* get the IDE error register */ err =ide_read_error (drive);
@@ -317,7 +316,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) }else {cdrom_saw_media_change (drive); -if (blk_fs_request (rq) && !quiet) +if (blk_fs_request (rq) && !blk_rq_quiet (rq)) printk(KERN_ERR PFX "%s: tray open\n", drive->name); }
@@ -352,7 +351,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)* No point in retrying after an illegal request or data * protect error. */ -if (!quiet) +if (!blk_rq_quiet (rq))ide_dump_status (drive,"command error" , stat); do_end_request =1 ;break ;
@@ -361,14 +360,14 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)* No point in re-trying a zillion times on a bad sector. * If we got here the error is not correctable. */ -if (!quiet) +if (!blk_rq_quiet (rq))ide_dump_status (drive,"media error " "(bad sector)" , stat); do_end_request =1 ;break ;case BLANK_CHECK :/* disk appears blank? */ -if (!quiet) +if (!blk_rq_quiet (rq))ide_dump_status (drive,"media error (blank)" , stat); do_end_request =1 ;
include/linux/blkdev.h +1 -0
@@ -598,6 +598,7 @@ enum { blk_failfast_transport(rq) || \ blk_failfast_driver(rq))#define blk_rq_started (rq) ((rq)->cmd_flags & REQ_STARTED) +#define blk_rq_quiet (rq) ((rq)->cmd_flags & REQ_QUIET)#define blk_account_rq (rq) (blk_rq_started(rq) && (blk_fs_request(rq) || blk_discard_rq(rq)))
Signature · 6 lines
1.6.2.4
--
Regards/Gruss,
Boris.Bartlomiej Zolnierkiewicz
AppliedQuoted 7 lines · On Tuesday 28 April 2009 23:38:14 Borislav Petkov wrote:
Here's a non-wrapped version, Sergei thanks for catching that.
--
From: Borislav Petkov <[email protected]>
Date: Mon, 27 Apr 2009 14:11:32 +0200
Subject: [PATCH] ide-cd: fixREQ_QUIETtests incdrom_decode_status
Quoted 7 lines
Original patch (
dfa4411cc3a690011cab90e9a536938795366cf9) was buggy. This is a more proper fix which introducesblk_rq_quiet()macro alleviating the need for dumb, too short caching variables.Thanks to Helge Deller and Bart for debugging this.
Signed-off-by Borislav Petkov <[email protected]>
applied to ide-2.6.git/for-linus branch
[ with "Reported-and-tested-by: Helge Deller <[email protected]>" added ]
Quoted 11 lines · Borislav Petkov
From: Borislav Petkov <[email protected]>
Date: Mon, 27 Apr 2009 14:11:32 +0200
Subject: [PATCH] ide-cd: fixREQ_QUIETtests incdrom_decode_statusOriginal patch (
dfa4411cc3a690011cab90e9a536938795366cf9) was buggy. This is a more proper fix which introducesblk_rq_quiet()macro alleviating the need for dumb, too short caching variables.Thanks to Helge Deller and Bart for debugging this.
Signed-off-by Borislav Petkov <[email protected]>
Thanks a lot Borislav !
As Sergei already mentioned, the patch below is line-wrapped.
Anyway, I applied it on top of 2.6.30-rc3, fixed up the rejections manually and can confirm that this patch fixes the problems I reported for the parisc platform.
You may add my signed-off-by when you resend the fixed patch:
Quoted 66 lines
--- drivers/ide/ide-cd.c | 9 ++++----- include/linux/blkdev.h | 1 + 2 files changed, 5 insertions(+), 5 deletions(-)drivers/ide/ide-cd.c +4
-5@@ -283,7 +283,6 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)ide_hwif_t *hwif = drive->hwif;struct request *rq = hwif->rq;int err, sense_key, do_end_request =0 ; -u8 quiet = rq->cmd_flags &REQ_QUIET ;/* get the IDE error register */ err =ide_read_error (drive);@@ -318,7 +317,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) }else {cdrom_saw_media_change (drive); -if (blk_fs_request (rq) && !quiet) +if (blk_fs_request (rq) && !blk_rq_quiet (rq)) printk(KERN_ERR PFX "%s: tray open\n", drive->name); }@@ -353,7 +352,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)* No point in retrying after an illegal request or data * protect error. */ -if (!quiet) +if (!blk_rq_quiet (rq))ide_dump_status (drive,"command error" , stat); do_end_request =1 ;break ;@@ -362,14 +361,14 @@ static int cdrom_decode_status(ide_drive_t*drive, u8 stat) * No point in re-trying a zillion times on a bad sector. * If we got here the error is not correctable. */ -if (!quiet) +if (!blk_rq_quiet (rq))ide_dump_status (drive,"media error " "(bad sector)" , stat); do_end_request =1 ;break ;case BLANK_CHECK :/* disk appears blank? */ -if (!quiet) +if (!blk_rq_quiet (rq))ide_dump_status (drive,"media error (blank)" , stat);drivers/ide/ide-cd.c +0
-0do_end_request =1 ;include/linux/blkdev.h +1
-0@@ -598,6 +598,7 @@ enum { blk_failfast_transport(rq) || \ blk_failfast_driver(rq))#define blk_rq_started (rq) ((rq)->cmd_flags & REQ_STARTED) +#define blk_rq_quiet (rq) ((rq)->cmd_flags & REQ_QUIET)#define blk_account_rq (rq) (blk_rq_started(rq) && (blk_fs_request(rq) || blk_discard_rq(rq)))
Quoted 13 lines · Helge Deller
Quoted 11 lines · Borislav Petkov
From: Borislav Petkov <[email protected]>
Date: Mon, 27 Apr 2009 14:11:32 +0200
Subject: [PATCH] ide-cd: fixREQ_QUIETtests incdrom_decode_statusOriginal patch (
dfa4411cc3a690011cab90e9a536938795366cf9) was buggy. This is a more proper fix which introducesblk_rq_quiet()macro alleviating the need for dumb, too short caching variables.Thanks to Helge Deller and Bart for debugging this.
Signed-off-by Borislav Petkov <[email protected]>
Quoted 8 lines
Thanks a lot Borislav !
As Sergei already mentioned, the patch below is line-wrapped.Anyway, I applied it on top of 2.6.30-rc3, fixed up the rejections manually and can confirm that this patch fixes the problems I reported for the parisc platform.
You may add my signed-off-by when you resend the fixed patch:
Thanks, but I sent a fixed one exactly two minutes :) before your message.
Signature · 2 lines
Regards/Gruss,
Boris.