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.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 451afbd543b5..66411463b734 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1346,13 +1346,12 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
1346 return ret; 1346 return ret;
1347 } 1347 }
1348 1348
1349 lock_kernel();
1350 restart: 1349 restart:
1351 1350
1352 ret = -ENXIO; 1351 ret = -ENXIO;
1353 disk = get_gendisk(bdev->bd_dev, &partno); 1352 disk = get_gendisk(bdev->bd_dev, &partno);
1354 if (!disk) 1353 if (!disk)
1355 goto out_unlock_kernel; 1354 goto out;
1356 1355
1357 mutex_lock_nested(&bdev->bd_mutex, for_part); 1356 mutex_lock_nested(&bdev->bd_mutex, for_part);
1358 if (!bdev->bd_openers) { 1357 if (!bdev->bd_openers) {
@@ -1432,7 +1431,6 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
1432 if (for_part) 1431 if (for_part)
1433 bdev->bd_part_count++; 1432 bdev->bd_part_count++;
1434 mutex_unlock(&bdev->bd_mutex); 1433 mutex_unlock(&bdev->bd_mutex);
1435 unlock_kernel();
1436 return 0; 1434 return 0;
1437 1435
1438 out_clear: 1436 out_clear:
@@ -1445,9 +1443,7 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
1445 bdev->bd_contains = NULL; 1443 bdev->bd_contains = NULL;
1446 out_unlock_bdev: 1444 out_unlock_bdev:
1447 mutex_unlock(&bdev->bd_mutex); 1445 mutex_unlock(&bdev->bd_mutex);
1448 out_unlock_kernel: 1446 out:
1449 unlock_kernel();
1450
1451 if (disk) 1447 if (disk)
1452 module_put(disk->fops->owner); 1448 module_put(disk->fops->owner);
1453 put_disk(disk); 1449 put_disk(disk);
@@ -1516,7 +1512,6 @@ static int __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part)
1516 struct block_device *victim = NULL; 1512 struct block_device *victim = NULL;
1517 1513
1518 mutex_lock_nested(&bdev->bd_mutex, for_part); 1514 mutex_lock_nested(&bdev->bd_mutex, for_part);
1519 lock_kernel();
1520 if (for_part) 1515 if (for_part)
1521 bdev->bd_part_count--; 1516 bdev->bd_part_count--;
1522 1517
@@ -1541,7 +1536,6 @@ static int __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part)
1541 victim = bdev->bd_contains; 1536 victim = bdev->bd_contains;
1542 bdev->bd_contains = NULL; 1537 bdev->bd_contains = NULL;
1543 } 1538 }
1544 unlock_kernel();
1545 mutex_unlock(&bdev->bd_mutex); 1539 mutex_unlock(&bdev->bd_mutex);
1546 bdput(bdev); 1540 bdput(bdev);
1547 if (victim) 1541 if (victim)