storage device probing

Kay Sievers kay.sievers at vrfy.org
Tue Sep 13 10:20:45 PDT 2005


On Tue, Sep 13, 2005 at 09:02:08PM +0400, Andrey Borzenkov wrote:
> On Tuesday 13 September 2005 20:44, Kay Sievers wrote:
> > HAL probes a main block device for a filesystem. Normally that fails and
> > the partitions get recognized after that and everything is fine.
> >
> > The crazy ext filesystem has a amazing signature length of 16 bit (yes,
> > two bytes!) to signify a ext filesystem. If by accident that happens to be
> > on the disk, the main block device is offered by HAL for mounting. At the
> > same time the partitons get probed and announced and everything messes up.
> >
> 
> It is not limited to ext2, see <http://qa.mandriva.com/show_bug.cgi?id=15224>. 
> When I tried to report it here I was told to fix partition table. Oh well :)

Sure, probing is slippery especially with all the crappy filesystem formatters
we have. The only sane approch I've seen is libparted, that invalidates
any known signature on a volume before reformatting it.

All the other tools especially util-linux are complete crap in the area.
Just do a mkswap on a FAT volume and you can still mount and use the
corrupted volume a FAT. The "nice" maintainer says it's a "feature".

> > We should at least invalidate _any_ result for a main block device if we
> > get a partition event for the same device. Or we let HAL probe for a
> > partitiontable first, but that is also slippery.
> 
> Why? It is exactly what kernel does in the absence of HAL; so it just makes 
> HAL consistent with kernel.

But HAL is not the kernel and doesn't know all what the kernel knows.
Therefore it's absolutely not consist. It will introduce a lot of new bugs,
cause many FAT volumes look like a valid msdos partitiontable. I removed
the probe in HAL for that reason.

> > I don't see a nice solution, only invalidating a main volume result with
> > the first partition event, or wait a while if partiton events travel in
> > before we announce a possible main device filesystem.
> > Any ideas?
> 
> My last patch for this bug report probes for partition table before probing 
> for file system. It fixed the original problem and so far nobody 
> complained :) It obviously needs redo for 0.5.x and  non-x86, but I believe 
> this is the least evil approach,

I don't think so. We should better follow what the kernel tells us about
the device and leave the main device alone if we see a child.

Kay


More information about the hal mailing list