public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Mastracci <mmastrac@canada.com>
To: linux-kernel@vger.kernel.org
Subject: Removable USB device contents cached after removal?
Date: Wed, 31 Dec 2003 17:12:16 -0700	[thread overview]
Message-ID: <3FF365E0.5090507@canada.com> (raw)

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.

             reply	other threads:[~2004-01-01  0:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-01  0:12 Matthew Mastracci [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-01-01 11:48 Removable USB device contents cached after removal? Vid Strpic

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=3FF365E0.5090507@canada.com \
    --to=mmastrac@canada.com \
    --cc=linux-kernel@vger.kernel.org \
    /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