Re: [PATCH] block: use i_size_write() in bd_set_size()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 15, 2013 at 06:24:38PM -0400, Jeff Mahoney wrote:
> Commit d646a02a9d44d1421f273ae3923d97b47b918176 upstream.

Thanks, queuing for 3.5 kernel.

Cheers,
--
Luis

> 
> 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@xxxxxxxxxxxxxxxxxx>
> Cc: Alexander Viro <viro@xxxxxxxxxxxxxxxxxx>
> Cc: Guo Chao <yan@xxxxxxxxxxxxxxxxxx>
> Cc: M. Hindess <hindessm@xxxxxxxxxx>
> Cc: Nikanth Karthikesan <knikanth@xxxxxxx>
> Cc: Jens Axboe <axboe@xxxxxxxxx>
> Cc: stable@xxxxxxxxxxxxxxx # 3.0 3.2 3.4 3.8
> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
> Acked-by: Jeff Mahoney <jeffm@xxxxxxxx>
> ---
>  fs/block_dev.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/block_dev.c b/fs/block_dev.c
> index 172f849..82b7c9a 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)
>  {
>  	unsigned bsize = bdev_logical_block_size(bdev);
>  
> -	bdev->bd_inode->i_size = size;
> +	mutex_lock(&bdev->bd_inode->i_mutex);
> +	i_size_write(bdev->bd_inode, size);
> +	mutex_unlock(&bdev->bd_inode->i_mutex);
>  	while (bsize < PAGE_CACHE_SIZE) {
>  		if (size & bsize)
>  			break;
> 
> 
> -- 
> Jeff Mahoney
> SUSE Labs
> --
> To unsubscribe from this list: send the line "unsubscribe stable" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]