blkdev_get|put and how to get excl blk dev access w/i the kernel

tpepper@vato.org
Mon, 16 Jul 2001 10:55:01 -0700


I noticed some "locking" functions in the md driver which gave me the
impression of giving exclusive access to a block device. The functions
make use of:

bdget
blkdev_get
blkdev_put
bdput

These aren't particularly documented that I've seen and I haven't traced
through enough code to figure out for sure what exactly they'd lock and
not lock. But I've been playing around with them just to see what I could
do with an sd device which I'd "locked". It seems like I'm unable to run
fdisk against the disk, but other than that I can read/write (using dd)
the sd device without a problem. Is this what's supposed to happen?

If so, is there anything else I can do to get exclusive use of a system
device (especially particular sd and sg devices) from within the kernel?
This seems like it would be a generally desireable feature, although
I can understand people taking the stance of "if the sysadmin wants to
shoot themselves in the foot by writing to an sd directly instead of to
the filesystem mounted on that sd...more power to them." That's kind of my
thought, but somebody (my employer) wants this from me.

Tim

--
*********************************************************
*  tpepper@vato dot org             * Venimus, Vidimus, *
*  http://www.vato.org/~tpepper     * Dolavimus         *
*********************************************************
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/