Re: Exclusive access to block devices

Andries.Brouwer@cwi.nl
Wed, 8 May 1996 01:26:59 +0200


Grant R. Guenther:

: There doesn't appear to be any general way to specify that an
: ioctl should only be executed if the access count is == 1, or to
: test that a block device is not mounted or otherwise open ... (While
: an absolute race-free lock would be nice, a simple busy test would be
: adequate for the application.)

No, there doesn't appear to be such an animal.
My fdisk uses BLKRRPART for this purpose when starting up, but
this is an ugly solution.
(Later on, BLKRRPART is used again, but then really to make the kernel
reread the partition table.)

Andries