Re: [dm-devel] linux-next - WARNING: at fs/block_dev.c:824bd_link_disk_holder+0x92/0x1ac()

From: NeilBrown
Date: Thu Jan 13 2011 - 15:19:23 EST


On Thu, 13 Jan 2011 09:45:54 -0500 Theodore Tso <tytso@xxxxxxx> wrote:

>
> On Jan 13, 2011, at 9:30 AM, Tejun Heo wrote:
> >>
> >
> > Yeah, that's the most bothering part for me. The biggest customers of
> > bd_claim are filesystems and all these custom symlinkeries don't do
> > nothing for them. It just doesn't make a whole lot of sense to me.
> >
>
> Well, if there's better way to do things, we can send patches to libblkid to switch away from using sysfs, assuming it's using a new enough kernel.
>
> The primary problem that we're trying to solve is to know whether a particular device contains a file system that should potentially mounted (or fsck'ed, or used as a external journal device, etc.)
>
> If the file system is located on a raid 0 device created using devicemapper, the first physical block device could look like a file system. So what we want is a very easy way of determining, "is this device being used by the device mapper layer"? If it is, then it's probably not the droids we are looking for. We'll keep looking at the rest of the block devices in the system, and when we find the dm-concatenated devices, we can properly identify it.
>
> Can you suggest a better way doing what it is we need to do?

open(O_EXCL) will fail on a block device if it is being used by anything else
- a filesystem or a dm target or an md array or ....

So if the *only* thing you want is "is this currently an active part of
something else", then O_EXCL works since 2.6.0 (I think).

NeilBrown

--
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/