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.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 55124ac8c7ad..05131baf3cf8 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -977,7 +977,7 @@ EXPORT_SYMBOL(bd_set_size);
977 977
978static int __blkdev_get(struct block_device *bdev, fmode_t mode, unsigned flags, 978static int __blkdev_get(struct block_device *bdev, fmode_t mode, unsigned flags,
979 int for_part); 979 int for_part);
980static int __blkdev_put(struct block_device *bdev, int for_part); 980static int __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part);
981 981
982/* 982/*
983 * bd_mutex locking: 983 * bd_mutex locking:
@@ -1095,7 +1095,7 @@ static int do_open(struct block_device *bdev, struct file *file, int for_part)
1095 bdev->bd_part = NULL; 1095 bdev->bd_part = NULL;
1096 bdev->bd_inode->i_data.backing_dev_info = &default_backing_dev_info; 1096 bdev->bd_inode->i_data.backing_dev_info = &default_backing_dev_info;
1097 if (bdev != bdev->bd_contains) 1097 if (bdev != bdev->bd_contains)
1098 __blkdev_put(bdev->bd_contains, 1); 1098 __blkdev_put(bdev->bd_contains, file->f_mode, 1);
1099 bdev->bd_contains = NULL; 1099 bdev->bd_contains = NULL;
1100 out_unlock_bdev: 1100 out_unlock_bdev:
1101 mutex_unlock(&bdev->bd_mutex); 1101 mutex_unlock(&bdev->bd_mutex);
@@ -1163,11 +1163,11 @@ static int blkdev_open(struct inode * inode, struct file * filp)
1163 if (!(res = bd_claim(bdev, filp))) 1163 if (!(res = bd_claim(bdev, filp)))
1164 return 0; 1164 return 0;
1165 1165
1166 blkdev_put(bdev); 1166 blkdev_put(bdev, filp->f_mode);
1167 return res; 1167 return res;
1168} 1168}
1169 1169
1170static int __blkdev_put(struct block_device *bdev, int for_part) 1170static int __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part)
1171{ 1171{
1172 int ret = 0; 1172 int ret = 0;
1173 struct gendisk *disk = bdev->bd_disk; 1173 struct gendisk *disk = bdev->bd_disk;
@@ -1184,7 +1184,7 @@ static int __blkdev_put(struct block_device *bdev, int for_part)
1184 } 1184 }
1185 if (bdev->bd_contains == bdev) { 1185 if (bdev->bd_contains == bdev) {
1186 if (disk->fops->release) 1186 if (disk->fops->release)
1187 ret = disk->fops->release(disk, 0); 1187 ret = disk->fops->release(disk, mode);
1188 } 1188 }
1189 if (!bdev->bd_openers) { 1189 if (!bdev->bd_openers) {
1190 struct module *owner = disk->fops->owner; 1190 struct module *owner = disk->fops->owner;
@@ -1203,13 +1203,13 @@ static int __blkdev_put(struct block_device *bdev, int for_part)
1203 mutex_unlock(&bdev->bd_mutex); 1203 mutex_unlock(&bdev->bd_mutex);
1204 bdput(bdev); 1204 bdput(bdev);
1205 if (victim) 1205 if (victim)
1206 __blkdev_put(victim, 1); 1206 __blkdev_put(victim, mode, 1);
1207 return ret; 1207 return ret;
1208} 1208}
1209 1209
1210int blkdev_put(struct block_device *bdev) 1210int blkdev_put(struct block_device *bdev, fmode_t mode)
1211{ 1211{
1212 return __blkdev_put(bdev, 0); 1212 return __blkdev_put(bdev, mode, 0);
1213} 1213}
1214EXPORT_SYMBOL(blkdev_put); 1214EXPORT_SYMBOL(blkdev_put);
1215 1215
@@ -1218,7 +1218,7 @@ static int blkdev_close(struct inode * inode, struct file * filp)
1218 struct block_device *bdev = I_BDEV(filp->f_mapping->host); 1218 struct block_device *bdev = I_BDEV(filp->f_mapping->host);
1219 if (bdev->bd_holder == filp) 1219 if (bdev->bd_holder == filp)
1220 bd_release(bdev); 1220 bd_release(bdev);
1221 return blkdev_put(bdev); 1221 return blkdev_put(bdev, filp->f_mode);
1222} 1222}
1223 1223
1224static long block_ioctl(struct file *file, unsigned cmd, unsigned long arg) 1224static long block_ioctl(struct file *file, unsigned cmd, unsigned long arg)
@@ -1343,7 +1343,7 @@ struct block_device *open_bdev_excl(const char *path, int flags, void *holder)
1343 return bdev; 1343 return bdev;
1344 1344
1345blkdev_put: 1345blkdev_put:
1346 blkdev_put(bdev); 1346 blkdev_put(bdev, mode);
1347 return ERR_PTR(error); 1347 return ERR_PTR(error);
1348} 1348}
1349 1349
@@ -1359,7 +1359,7 @@ EXPORT_SYMBOL(open_bdev_excl);
1359void close_bdev_excl(struct block_device *bdev) 1359void close_bdev_excl(struct block_device *bdev)
1360{ 1360{
1361 bd_release(bdev); 1361 bd_release(bdev);
1362 blkdev_put(bdev); 1362 blkdev_put(bdev, 0); /* move up in the next patches */
1363} 1363}
1364 1364
1365EXPORT_SYMBOL(close_bdev_excl); 1365EXPORT_SYMBOL(close_bdev_excl);