* Removable USB device contents cached after removal?
@ 2004-01-01 0:12 Matthew Mastracci
0 siblings, 0 replies; 2+ messages in thread
From: Matthew Mastracci @ 2004-01-01 0:12 UTC (permalink / raw)
To: linux-kernel
I've been working on getting my USB Atech 9-in-1 card reader working
with Linux. Everything mounts, unmounts and reads fine, but I'm getting
a strange situation where the contents of the card seem to be buffered
after the media has been removed from the card reader.
The strange thing is that this only happens when the card itself has
been mounted, but it does *not* happen if the card is inserted and
removed without mounting.
I'm running kernel 2.6.0-1.107 from arjanv's RedHat builds.
Here are the steps I use to reproduce it:
Working case (never mounted)
1. Insert card into reader.
2. dd if=/dev/sdd1 count=1024 bs=1 | hexdump
- results in correct filesystem dump
3. Remove card from reader.
4. cat /dev/sdd1 results in "No medium found"
Non-working case:
1. Insert card into reader.
2. Mount card as directory somewhere in root filesystem, list contents
of card
3. dd if=/dev/sdd1 count=1024 bs=1024 | hexdump
- results in correct filesystem dump
4. Remove card from reader.
5. dd if=/dev/sdd1 count=1024 bs=1024 | hexdump
- same filesystem dump as before!
6. cd to mountpoint, contents are still available
7. dd if=/dev/sdd1 of=/dev/null
- approx 3MB of card data still available
8. umount the mountpoint from before
9. dd if=/dev/sdd1 of=/dev/null results in "No medium found"
I can provide more information as required. It appears as if the reader
is correctly determining that no medium is present, but the mountpoint's
existence somehow prevents userspace code from seeing this.
Any ideas?
Here's some dumps that might assist:
[root@matt root]# lsmod | grep "usb"
usb_storage 56384 1
scsi_mod 107320 2 sd_mod,usb_storage
usbcore 93148 7 usb_storage,hid,ohci_hcd,uhci_hcd,ehci_hcd
"dd" on non-existant card (note that 8976 was the amount of data read
when the card was inserted):
[root@matt root]# dd if=/dev/sdd1 of=/dev/null
dd: reading `/dev/sdd1': Input/output error
8976+0 records in
8976+0 records out
dmesg output after "dd" on non-existant card:
Device sdd not ready.
end_request: I/O error, dev sdd, sector 9001
Buffer I/O error on device sdd1, logical block 8976
Buffer I/O error on device sdd1, logical block 8977
Buffer I/O error on device sdd1, logical block 8978
Buffer I/O error on device sdd1, logical block 8979
Buffer I/O error on device sdd1, logical block 8980
Buffer I/O error on device sdd1, logical block 8981
Buffer I/O error on device sdd1, logical block 8982
Buffer I/O error on device sdd1, logical block 8983
Matt.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Removable USB device contents cached after removal?
@ 2004-01-01 11:48 Vid Strpic
0 siblings, 0 replies; 2+ messages in thread
From: Vid Strpic @ 2004-01-01 11:48 UTC (permalink / raw)
To: Matthew Mastracci; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1071 bytes --]
On Wed, Dec 31, 2003 at 05:12:16PM -0700, Matthew Mastracci wrote:
[...]
> 1. Insert card into reader.
> 2. Mount card as directory somewhere in root filesystem, list contents
> of card
> 3. dd if=/dev/sdd1 count=1024 bs=1024 | hexdump
> - results in correct filesystem dump
> 4. Remove card from reader.
> 5. dd if=/dev/sdd1 count=1024 bs=1024 | hexdump
> - same filesystem dump as before!
> 6. cd to mountpoint, contents are still available
> 7. dd if=/dev/sdd1 of=/dev/null
> - approx 3MB of card data still available
> 8. umount the mountpoint from before
Did you try `eject sdd` after this, and if not, try, and see how it
works.
> 9. dd if=/dev/sdd1 of=/dev/null results in "No medium found"
usb-storage behaves differently in 2.6 than in 2.4, maybe this is the
problem for you now.
--
vms@bofhlet.net, IRC:*@Martin, /bin/zsh. C|N>K
Linux moria 2.6.0-mm2 #1 Tue Dec 30 10:21:33 CET 2003 i686
12:46:44 up 1 day, 23:08, 11 users, load average: 0.94, 0.68, 0.69
UNIX programmers DO IT with forks.
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-01-01 12:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-01 0:12 Removable USB device contents cached after removal? Matthew Mastracci
-- strict thread matches above, loose matches on Subject: below --
2004-01-01 11:48 Vid Strpic
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox