Re: ide-tape.c

From: Gadi Oxman (gadio@netvision.net.il)
Date: Fri Feb 18 2000 - 03:48:27 EST


Hi John,

Hmm.. it seems that the ide-tape driver is broken for some people
in current kernels. Byron reported the same behavior.

In ide.c we are checking that every access is in a valid range. We used
to initialize the range according to the partition table for disk and
floppy drives, and initialize it to a very big values for tape and cdrom,
effectively bypassing the check for those media types.

Current kernels initialize the boundary of the check only for media of
type disk or type floppy; in a tape or cdrom media (or floppy under
ide-scsi), the field will be uninitialized, with unexpected results (it
will work for some users and won't for others).

Does the following patch fix it? It will check for "bad access" only
for ide-disk/ide-floppy media, and only when the command is an external
READ/WRITE command (from ll_rw_blk.c) rather than an internal command
(from ide-tape/ide-scsi/etc).

Cheers,

Gadi

--- drivers/block/ide.c~ Wed Jan 19 04:54:21 2000
+++ drivers/block/ide.c Fri Feb 18 10:38:24 2000
@@ -1092,12 +1092,14 @@
 #endif
         block = rq->sector;
         blockend = block + rq->nr_sectors;
- if ((blockend < block) || (blockend > drive->part[minor&PARTN_MASK].nr_sects)) {
- printk("%s%c: bad access: block=%ld, count=%ld\n", drive->name,
- (minor&PARTN_MASK)?'0'+(minor&PARTN_MASK):' ', block, rq->nr_sectors);
- goto kill_rq;
+ if ((rq->cmd == READ || rq->cmd == WRITE) && (drive->media == ide_disk || drive->media == ide_floppy)) {
+ if ((blockend < block) || (blockend > drive->part[minor&PARTN_MASK].nr_sects)) {
+ printk("%s%c: bad access: block=%ld, count=%ld\n", drive->name,
+ (minor&PARTN_MASK)?'0'+(minor&PARTN_MASK):' ', block, rq->nr_sectors);
+ goto kill_rq;
+ }
+ block += drive->part[minor&PARTN_MASK].start_sect + drive->sect0;
         }
- block += drive->part[minor&PARTN_MASK].start_sect + drive->sect0;
 
         /* Yecch - this will shift the entire interval,
            possibly killing some innocent following sector */

On Thu, 17 Feb 2000, John Sieh wrote:

> > When ignoring this warning, what is the actual problem in working
> > with the tape drive?
>
> # ls test
> 2.3.40 2.3.40pre1
> # tar cvf /dev/ht0 test
> test/
> test/2.3.40
> test/2.3.40pre1
> tar: Cannot write to /dev/ht0: Input/output error
> tar: Error is not recoverable: exiting now
> # dmesg
> ide-tape: Reached idetape_chrdev_open
> ide-tape: ht0: I/O error, pc = 1e, key = 5, asc = 20, ascq = 0
> hdd : bad access: block=0, count=32
> ide-tape: ht0: I/O error, pc = 1e, key = 5, asc = 20, ascq = 0
>
> The bad access error was printed alot more than that, snipped for readability.
>
> # tar tvf /dev/ht0
> ide-tape: Reached idetape_chrdev_open
> ide-tape: ht0: I/O error, pc = 1e, key = 5, asc = 20, ascq = 0
> hdd : bad access: block=0, count=32
> ide-tape: ht0: I/O error, pc = 1e, key = 5, asc = 20, ascq = 0
>
> Again snipped bad access lines.
>
> Any suggestions?
>
>
> John
>
>
>
>
>
>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Feb 23 2000 - 21:00:21 EST