aboutsummaryrefslogtreecommitdiffstats
path: root/fs/block_dev.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r--fs/block_dev.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 1dd07e66e98a..ac7031f12ea5 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1005,6 +1005,7 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
1005 } 1005 }
1006 1006
1007 lock_kernel(); 1007 lock_kernel();
1008 restart:
1008 1009
1009 ret = -ENXIO; 1010 ret = -ENXIO;
1010 disk = get_gendisk(bdev->bd_dev, &partno); 1011 disk = get_gendisk(bdev->bd_dev, &partno);
@@ -1025,6 +1026,19 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
1025 1026
1026 if (disk->fops->open) { 1027 if (disk->fops->open) {
1027 ret = disk->fops->open(bdev, mode); 1028 ret = disk->fops->open(bdev, mode);
1029 if (ret == -ERESTARTSYS) {
1030 /* Lost a race with 'disk' being
1031 * deleted, try again.
1032 * See md.c
1033 */
1034 disk_put_part(bdev->bd_part);
1035 bdev->bd_part = NULL;
1036 module_put(disk->fops->owner);
1037 put_disk(disk);
1038 bdev->bd_disk = NULL;
1039 mutex_unlock(&bdev->bd_mutex);
1040 goto restart;
1041 }
1028 if (ret) 1042 if (ret)
1029 goto out_clear; 1043 goto out_clear;
1030 } 1044 }
@@ -1277,7 +1291,7 @@ EXPORT_SYMBOL(ioctl_by_bdev);
1277 1291
1278/** 1292/**
1279 * lookup_bdev - lookup a struct block_device by name 1293 * lookup_bdev - lookup a struct block_device by name
1280 * @path: special file representing the block device 1294 * @pathname: special file representing the block device
1281 * 1295 *
1282 * Get a reference to the blockdevice at @pathname in the current 1296 * Get a reference to the blockdevice at @pathname in the current
1283 * namespace if possible and return it. Return ERR_PTR(error) 1297 * namespace if possible and return it. Return ERR_PTR(error)