Re: Accessing device information in REMOVE agent

From: Andrey Borzenkov
Date: Sun Nov 09 2003 - 05:20:53 EST


On Sunday 09 November 2003 01:25, Greg KH wrote:
> On Sat, Nov 08, 2003 at 04:02:25PM +0300, Andrey Borzenkov wrote:
> > I'd like to be notified when block device goes away (e.g. USB stick
> > unplugged) basically to look if device is in use and possibly initiate
> > clean up. Block hotplug currently is passing only DEVPATH; but it alone
> > is not reliable way to identify it; device may be used under alias names
> > via symbolic links.
>
> What do you mean? DEVPATH is unique for that point in time. There are
> no alias's in sysfs.
>

Sorry I had to be more precise.

I'd like to (try to) replace current synchronous media change checks in
supermount by mounting device on insert and releasing it on remove. For those
cases when it makes sense of course, USB sticks in the first place.

But users are free to use any names or links for their device names i.e. they
can do

ln -s sda /de/myflash
mount /dev/myflash

and on remove it is rather hard to match this name against DEVPATH. But I can
save (major,minor) when mounting and use it to match mounted filesystem on
remove.

>
> > Would it make sense to add device number? It seems to be natural native
> > "block device ID" :)
>
> What "device number"? The major/minor? Why? It's about as unique as
> DEVPATH is for any point in time.
>

Hmm ... probably I can just as well use device name (meaning genhd->disk_name)
you are right.

Thank you

-andrey

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/