From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Peter Osterlund <petero2@telia.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Matthew Wilcox <matthew@wil.cx>, Ingo Molnar <mingo@elte.hu>,
linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Al Viro <viro@ftp.linux.org.uk>
Subject: Re: [patch] scsi: revert "[SCSI] Get rid of scsi_cmnd->done"
Date: Sun, 06 Jan 2008 07:57:55 -0600 [thread overview]
Message-ID: <1199627875.5205.1.camel@localhost.localdomain> (raw)
In-Reply-To: <m3ir27oe7f.fsf@telia.com>
On Sun, 2008-01-06 at 03:55 +0100, Peter Osterlund wrote:
> Linus Torvalds <torvalds@linux-foundation.org> writes:
>
> > On Wed, 2 Jan 2008, James Bottomley wrote:
> >
> > > Look at the taxonomy of the bug. This is the form of the error:
> > >
> > > buffer I/O error on device sr0, logical block 20304
> > > attempt to access beyond end of device
> > > sr0: rw=0, want=81224, limit=40944
> > >
> > > The last limit is the most suggestive, that comes straight from
> > > bdev->bd_inode->i_size>>9 and is supposed to be the size of the block
> > > device in 512 byte blocks. For a 4.7GB DVD, it's a little small.
> > > Nothing in the sr code sets this directly (although it does come from
> > > get_blkdev() for the first opener). pktcdvd does set it, though ... and
> > > probably wrongly if the drive in question isn't UDF formatted.
>
> pktcdvd sets it when opening the /dev/pktcdvd device, but when the
> drive is later opened as /dev/scd0, there is nothing that sets it
> back. (Btw, 40944 is possible if the disk is a CDRW that was formatted
> with "cdrwtool -m 10236".)
>
> The problem is that pktcdvd opens the cd device in non-blocking mode
> when pktsetup is run, and doesn't close it again until pktsetup -d
> is run. The effect is that if you meanwhile open the cd device,
> blkdev.c:do_open() doesn't call bd_set_size() because bdev->bd_openers
> is non-zero.
>
> I don't know the correct way to fix this. Maybe adding bd_set_size()
> to sr.c:get_sectorsize() which already does set_capacity() would
> work.
Could be ... this is deep viro magic, though; I've added him to the Cc
list to get his input.
> > .. but you're ignoring the fact that if pktcdvd sets it wrong, then it
> > should be visible with the pre-commit kernel *also*.
>
> I can repeat this bug, both with and without the scsi patch that is
> claimed to make a difference, both with an external USB drive and an
> internal IDE drive.
>
> To repeat:
>
> 1. Start with an empty drive.
> 2. pktsetup 0 /dev/scd0
> 3. Insert a CD containing an isofs filesystem.
> 4. mount /dev/pktcdvd/0 /mnt/tmp
> 5. umount /mnt/tmp
> 6. Press the eject button.
> 7. Insert a DVD containing a non-writable filesystem.
> 8. mount /dev/scd0 /mnt/tmp
> 9. find /mnt/tmp -type f -print0 | xargs -0 sha1sum >/dev/null
> 10. If the DVD contains data beyond the physical size of a CD, you
> get I/O errors in the terminal, and dmesg reports lots of
> "attempt to access beyond end of device" errors.
Brilliant! I can confirm the reproduction of the bug too (that's with
the originally fingered commit reverted).
James
next prev parent reply other threads:[~2008-01-06 13:58 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-02 16:25 [patch] scsi: revert "[SCSI] Get rid of scsi_cmnd->done" Ingo Molnar
2008-01-02 16:46 ` James Bottomley
2008-01-02 19:19 ` Linus Torvalds
2008-01-02 19:40 ` Matthew Wilcox
2008-01-02 19:57 ` Linus Torvalds
2008-01-02 20:17 ` Christoph Hellwig
2008-01-02 20:49 ` Linus Torvalds
2008-01-02 20:53 ` Matthew Wilcox
2008-01-02 20:18 ` Matthew Wilcox
2008-01-02 20:12 ` James Bottomley
2008-01-02 20:45 ` Linus Torvalds
2008-01-02 23:33 ` James Bottomley
2008-01-03 1:58 ` Linus Torvalds
2008-01-06 2:55 ` Peter Osterlund
2008-01-06 3:43 ` Linus Torvalds
2008-01-06 10:17 ` Peter Osterlund
2008-01-06 14:04 ` James Bottomley
2008-01-06 14:42 ` James Bottomley
2008-01-06 15:01 ` Peter Osterlund
2008-01-06 18:14 ` Linus Torvalds
2008-01-06 18:44 ` Linus Torvalds
2008-01-06 18:54 ` James Bottomley
2008-01-06 16:19 ` Boaz Harrosh
2008-01-06 16:47 ` James Bottomley
2008-01-06 13:57 ` James Bottomley [this message]
2008-01-06 14:47 ` Ingo Molnar
2008-01-06 15:20 ` James Bottomley
2008-01-06 15:45 ` Adrian Bunk
2008-01-06 16:00 ` James Bottomley
2008-01-06 16:12 ` Ingo Molnar
2008-01-06 17:10 ` James Bottomley
2008-01-08 16:55 ` Ingo Molnar
2008-01-06 17:11 ` Matthew Wilcox
2008-01-06 17:36 ` James Bottomley
2008-01-06 18:34 ` Willy Tarreau
2008-01-06 18:56 ` Adrian Bunk
2008-01-06 19:10 ` Willy Tarreau
2008-01-06 19:58 ` Adrian Bunk
2008-01-06 21:08 ` Willy Tarreau
2008-01-06 22:25 ` Adrian Bunk
2008-01-07 20:50 ` Valdis.Kletnieks
2008-01-07 21:31 ` Alan Cox
2008-01-07 21:37 ` Matthew Wilcox
2008-01-07 23:04 ` Valdis.Kletnieks
2008-01-07 23:19 ` Matthew Wilcox
2008-01-08 16:47 ` Stefan Richter
2008-01-08 17:11 ` Linus Torvalds
2008-01-08 20:01 ` Ingo Molnar
2008-01-09 4:01 ` Valdis.Kletnieks
2008-01-09 4:10 ` Andrew Morton
2008-01-09 6:03 ` Willy Tarreau
2008-01-09 4:03 ` Valdis.Kletnieks
2008-01-07 15:25 ` John Stoffel
2008-01-07 19:04 ` Stefan Richter
2008-01-07 19:59 ` John Stoffel
2008-01-06 17:29 ` Stefan Richter
2008-01-06 20:26 ` Ingo Molnar
-- strict thread matches above, loose matches on Subject: below --
2008-01-06 13:55 Thomas Meyer
2008-01-06 16:56 ` Matthew Wilcox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1199627875.5205.1.camel@localhost.localdomain \
--to=james.bottomley@hansenpartnership.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew@wil.cx \
--cc=mingo@elte.hu \
--cc=petero2@telia.com \
--cc=torvalds@linux-foundation.org \
--cc=viro@ftp.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox