Re: [RFC v4 linux-next 15/19] bcache: prevent direct access of bd_inode

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

 



On Thu 22-02-24 20:45:51, Yu Kuai wrote:
> From: Yu Kuai <yukuai3@xxxxxxxxxx>
> 
> Now that all bcache stash the file of opened bdev, it's ok to get
> mapping from the file.
> 
> Signed-off-by: Yu Kuai <yukuai3@xxxxxxxxxx>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@xxxxxxx>

								Honza

> ---
>  drivers/md/bcache/super.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
> index 4153c9ddbe0b..ec9efa79d5a8 100644
> --- a/drivers/md/bcache/super.c
> +++ b/drivers/md/bcache/super.c
> @@ -163,15 +163,16 @@ static const char *read_super_common(struct cache_sb *sb,  struct block_device *
>  }
>  
>  
> -static const char *read_super(struct cache_sb *sb, struct block_device *bdev,
> +static const char *read_super(struct cache_sb *sb, struct file *bdev_file,
>  			      struct cache_sb_disk **res)
>  {
>  	const char *err;
> +	struct block_device *bdev = file_bdev(bdev_file);
>  	struct cache_sb_disk *s;
>  	struct page *page;
>  	unsigned int i;
>  
> -	page = read_cache_page_gfp(bdev->bd_inode->i_mapping,
> +	page = read_cache_page_gfp(bdev_file->f_mapping,
>  				   SB_OFFSET >> PAGE_SHIFT, GFP_KERNEL);
>  	if (IS_ERR(page))
>  		return "IO error";
> @@ -2564,7 +2565,7 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr,
>  	if (set_blocksize(file_bdev(bdev_file), 4096))
>  		goto out_blkdev_put;
>  
> -	err = read_super(sb, file_bdev(bdev_file), &sb_disk);
> +	err = read_super(sb, bdev_file, &sb_disk);
>  	if (err)
>  		goto out_blkdev_put;
>  
> -- 
> 2.39.2
> 
-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux