[PATCH] sem2mutex: blockdev #2
Semaphore to mutex conversion. The conversion was generated via scripts, and the result was validated automatically via a script as well. Signed-off-by: Arjan van de Ven <arjan@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu> Acked-by: Jens Axboe <axboe@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
6f87f0deeb
commit
c039e3134a
@@ -42,9 +42,9 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user
|
||||
return -EINVAL;
|
||||
}
|
||||
/* partition number in use? */
|
||||
down(&bdev->bd_sem);
|
||||
mutex_lock(&bdev->bd_mutex);
|
||||
if (disk->part[part - 1]) {
|
||||
up(&bdev->bd_sem);
|
||||
mutex_unlock(&bdev->bd_mutex);
|
||||
return -EBUSY;
|
||||
}
|
||||
/* overlap? */
|
||||
@@ -55,13 +55,13 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user
|
||||
continue;
|
||||
if (!(start+length <= s->start_sect ||
|
||||
start >= s->start_sect + s->nr_sects)) {
|
||||
up(&bdev->bd_sem);
|
||||
mutex_unlock(&bdev->bd_mutex);
|
||||
return -EBUSY;
|
||||
}
|
||||
}
|
||||
/* all seems OK */
|
||||
add_partition(disk, part, start, length);
|
||||
up(&bdev->bd_sem);
|
||||
mutex_unlock(&bdev->bd_mutex);
|
||||
return 0;
|
||||
case BLKPG_DEL_PARTITION:
|
||||
if (!disk->part[part-1])
|
||||
@@ -71,9 +71,9 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user
|
||||
bdevp = bdget_disk(disk, part);
|
||||
if (!bdevp)
|
||||
return -ENOMEM;
|
||||
down(&bdevp->bd_sem);
|
||||
mutex_lock(&bdevp->bd_mutex);
|
||||
if (bdevp->bd_openers) {
|
||||
up(&bdevp->bd_sem);
|
||||
mutex_unlock(&bdevp->bd_mutex);
|
||||
bdput(bdevp);
|
||||
return -EBUSY;
|
||||
}
|
||||
@@ -81,10 +81,10 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user
|
||||
fsync_bdev(bdevp);
|
||||
invalidate_bdev(bdevp, 0);
|
||||
|
||||
down(&bdev->bd_sem);
|
||||
mutex_lock(&bdev->bd_mutex);
|
||||
delete_partition(disk, part);
|
||||
up(&bdev->bd_sem);
|
||||
up(&bdevp->bd_sem);
|
||||
mutex_unlock(&bdev->bd_mutex);
|
||||
mutex_unlock(&bdevp->bd_mutex);
|
||||
bdput(bdevp);
|
||||
|
||||
return 0;
|
||||
@@ -102,10 +102,10 @@ static int blkdev_reread_part(struct block_device *bdev)
|
||||
return -EINVAL;
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EACCES;
|
||||
if (down_trylock(&bdev->bd_sem))
|
||||
if (!mutex_trylock(&bdev->bd_mutex))
|
||||
return -EBUSY;
|
||||
res = rescan_partitions(disk, bdev);
|
||||
up(&bdev->bd_sem);
|
||||
mutex_unlock(&bdev->bd_mutex);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user