From: "Jörg Henne" <j.henne@levigo.de>
To: linux-kernel@vger.kernel.org
Subject: Spurious disk change detections interferes with disk access
Date: Fri, 29 Apr 2005 22:16:43 +0200 [thread overview]
Message-ID: <4272962B.9000502@levigo.de> (raw)
Hi all,
using a CompactFlash based system, I am experiencing a very weird
behaviour I just don't understand.
The system is based on
- 2.4.28
- devfs
- a CompactFlash IDE drive attached to a real IDE controller (in
contrast to a PC-Card adapter)
- the root filesystem resides on the CF
While booting, there are irregular but frequent errors which manifest in
messages like
hda1: bad access: block=<something> count=<something>
which are followed by error messages from the filesystem and finally
errors in the boot process itself.
I added some more debug output to drivers/ide/ide-io.c and found that
while the block offset was well within the nominal bounds of the device,
the message was actually caused by the fact that while the error
occurred, the partition table was all zeroed-out, i.e.
drive->part[minor&PARTN_MASK].nr_sects == 0.
The reason why the drive's partition table is zeroed-out temporarily
seems to be that there is an ide_revalidate_disk() going on at that
time, which in turn is explained by messages like
VFS: Disk change detected on device 03:00
/dev/ide/host0/bus0/target0/lun0: p1 p2
which precede the "bad access" message.
As I see it, the core of the problem is:
- something accesses the devfs directory associated with the drive (ls
/dev/ide/host0/bus0/target0/lun0 will do)
- defvs runs a check_media_change which ends up at
ide-disk.c:idedisk_media_change() which is implemented like this:
/* if removable, always assume it was changed */
return drive->removable;
- devfs decides that a revalidate is appropriate since the media hash
changed, which trashes the partition table for a brief moment
- processes accessing the drive at that time see lots of errors
Is it really true, that for removable devices, a simple directory access
on the devfs can interfere with accesses to the drive? Sounds like a
great start for DOSing the system.
I see two possible solutions for the problem:
- A lock is put in place which guards access to the drive while the
partition table is re-built. Seems fairly hacky to me.
- The media change detection mechanism is improved, so that it can
detect when the media REALLY changed.
Thanks in advance for any input on this.
Joerg Henne
reply other threads:[~2005-04-29 20:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4272962B.9000502@levigo.de \
--to=j.henne@levigo.de \
--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