/* Open the blockdevice described by the special file at @path, claim it for the @holder.  */
struct block_device* open_bdev_exclusive(const char *path, fmode_t mode, void *holder)
/* Open the blockdevice described by the special file at @path, claim it for the @holder.  */
struct block_device* open_bdev_exclusive(const char *path, fmode_t mode, void *holder)
{
	struct block_device *bdev;
	int error = 0;
	bdev = lookup_bdev(path);
	if (IS_ERR(bdev))
		return bdev;
	error = blkdev_get(bdev, mode);
	if (error)
		return ERR_PTR(error);
	error = -EACCES;
	if ((mode & FMODE_WRITE) && bdev_read_only(bdev))
		goto blkdev_put;
	error = bd_claim(bdev, holder);
	if (error)
		goto blkdev_put;
	return bdev;
blkdev_put:
	blkdev_put(bdev, mode);
	return ERR_PTR(error);
}