diff options
author | Guo Chao <yan@linux.vnet.ibm.com> | 2013-02-21 18:16:42 -0500 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2013-02-22 04:42:46 -0500 |
commit | d646a02a9d44d1421f273ae3923d97b47b918176 (patch) | |
tree | 371fd1c8f675ff8532337b913a24237501c7d394 /fs/block_dev.c | |
parent | a3cc86c2f00839453d2dbeb46bfc44e885b073db (diff) |
block: use i_size_write() in bd_set_size()
blkdev_ioctl(GETBLKSIZE) uses i_size_read() to read size of block device.
If we update block size directly, reader may see intermediate result in
some machines and configurations. Use i_size_write() instead.
Signed-off-by: Guo Chao <yan@linux.vnet.ibm.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Guo Chao <yan@linux.vnet.ibm.com>
Cc: M. Hindess <hindessm@uk.ibm.com>
Cc: Nikanth Karthikesan <knikanth@suse.de>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r-- | fs/block_dev.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index 172f8491a2bd..82b7c9ad29ac 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -1032,7 +1032,9 @@ void bd_set_size(struct block_device *bdev, loff_t size) | |||
1032 | { | 1032 | { |
1033 | unsigned bsize = bdev_logical_block_size(bdev); | 1033 | unsigned bsize = bdev_logical_block_size(bdev); |
1034 | 1034 | ||
1035 | bdev->bd_inode->i_size = size; | 1035 | mutex_lock(&bdev->bd_inode->i_mutex); |
1036 | i_size_write(bdev->bd_inode, size); | ||
1037 | mutex_unlock(&bdev->bd_inode->i_mutex); | ||
1036 | while (bsize < PAGE_CACHE_SIZE) { | 1038 | while (bsize < PAGE_CACHE_SIZE) { |
1037 | if (size & bsize) | 1039 | if (size & bsize) |
1038 | break; | 1040 | break; |