aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/ioctl.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/block/ioctl.c b/block/ioctl.c
index e1109491c234..35fdb7dc6512 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -42,9 +42,9 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user
42 return -EINVAL; 42 return -EINVAL;
43 } 43 }
44 /* partition number in use? */ 44 /* partition number in use? */
45 down(&bdev->bd_sem); 45 mutex_lock(&bdev->bd_mutex);
46 if (disk->part[part - 1]) { 46 if (disk->part[part - 1]) {
47 up(&bdev->bd_sem); 47 mutex_unlock(&bdev->bd_mutex);
48 return -EBUSY; 48 return -EBUSY;
49 } 49 }
50 /* overlap? */ 50 /* overlap? */
@@ -55,13 +55,13 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user
55 continue; 55 continue;
56 if (!(start+length <= s->start_sect || 56 if (!(start+length <= s->start_sect ||
57 start >= s->start_sect + s->nr_sects)) { 57 start >= s->start_sect + s->nr_sects)) {
58 up(&bdev->bd_sem); 58 mutex_unlock(&bdev->bd_mutex);
59 return -EBUSY; 59 return -EBUSY;
60 } 60 }
61 } 61 }
62 /* all seems OK */ 62 /* all seems OK */
63 add_partition(disk, part, start, length); 63 add_partition(disk, part, start, length);
64 up(&bdev->bd_sem); 64 mutex_unlock(&bdev->bd_mutex);
65 return 0; 65 return 0;
66 case BLKPG_DEL_PARTITION: 66 case BLKPG_DEL_PARTITION:
67 if (!disk->part[part-1]) 67 if (!disk->part[part-1])
@@ -71,9 +71,9 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user
71 bdevp = bdget_disk(disk, part); 71 bdevp = bdget_disk(disk, part);
72 if (!bdevp) 72 if (!bdevp)
73 return -ENOMEM; 73 return -ENOMEM;
74 down(&bdevp->bd_sem); 74 mutex_lock(&bdevp->bd_mutex);
75 if (bdevp->bd_openers) { 75 if (bdevp->bd_openers) {
76 up(&bdevp->bd_sem); 76 mutex_unlock(&bdevp->bd_mutex);
77 bdput(bdevp); 77 bdput(bdevp);
78 return -EBUSY; 78 return -EBUSY;
79 } 79 }
@@ -81,10 +81,10 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user
81 fsync_bdev(bdevp); 81 fsync_bdev(bdevp);
82 invalidate_bdev(bdevp, 0); 82 invalidate_bdev(bdevp, 0);
83 83
84 down(&bdev->bd_sem); 84 mutex_lock(&bdev->bd_mutex);
85 delete_partition(disk, part); 85 delete_partition(disk, part);
86 up(&bdev->bd_sem); 86 mutex_unlock(&bdev->bd_mutex);
87 up(&bdevp->bd_sem); 87 mutex_unlock(&bdevp->bd_mutex);
88 bdput(bdevp); 88 bdput(bdevp);
89 89
90 return 0; 90 return 0;
@@ -102,10 +102,10 @@ static int blkdev_reread_part(struct block_device *bdev)
102 return -EINVAL; 102 return -EINVAL;
103 if (!capable(CAP_SYS_ADMIN)) 103 if (!capable(CAP_SYS_ADMIN))
104 return -EACCES; 104 return -EACCES;
105 if (down_trylock(&bdev->bd_sem)) 105 if (!mutex_trylock(&bdev->bd_mutex))
106 return -EBUSY; 106 return -EBUSY;
107 res = rescan_partitions(disk, bdev); 107 res = rescan_partitions(disk, bdev);
108 up(&bdev->bd_sem); 108 mutex_unlock(&bdev->bd_mutex);
109 return res; 109 return res;
110} 110}
111 111