[stgt] [PATCH 2/2] tgt-admin: check if device is mounted on /
Tomasz Chmielewski
mangoo at wpkg.org
Wed Sep 10 11:02:15 CEST 2008
Doron Shoham schrieb:
> Bastian Blank wrote:
>> On Thu, Sep 04, 2008 at 04:39:24PM +0300, Doron Shoham wrote:
>>> deny allocation of a device which
>>> which mounted on the same device as rootfs.
>>> also deny the allocation of swap devices.
>>> add --allow-mounted flag for overriding this.
>> Neither /etc/mtab nor /dev/mounts provides a proper view on the mounted
>> filesystems. To check the used state you need to try to open it
>> exclusive.
>>
>> Bastian
>>
>
> Can you please explain how to do it?
> What do you mean by "try to open it exclusive"?
In C, one would use flock. I guess there is a way to do something
similar in Perl (perhaps not trivially, though).
But it would be a misleading test; you can "open exclusively" a swap
device which is in use.
However, I see that DRBD tests quite well if a given block device is in
use - when we try to use a device that is used already, we will see:
Lower device is already claimed. This usually means it is mounted.
--
Tomasz Chmielewski
http://wpkg.org
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
More information about the stgt
mailing list