On Thu, Oct 19, 2017 at 09:49:27AM +0800, Gu Jinxiang wrote:
> From: Gu JinXiang <g...@cn.fujitsu.com>
> 
> Fix bug of commit 74d46992e0d9
> ("block: replace bi_bdev with a gendisk pointer and partitions index").
> 
> In this modify, use bio_dev(bio) to find dev state in function
> __btrfsic_submit_bio. But when dev_state added to hashtable, it is using
> dev_t of block_device.
> 
> bio_dev(bio) returns a dev_t of part0 which is different from dev_t in
> block_device(bd_dev). bd_dev in block_device represents the exact
> partition.
> block_device.bd_dev = 
>       bio->bi_partno (same as block_device.bd_partno) + bio_dev(bio).
> 
> When add a dev_state into hashtable it is using the exact partition's dev_t.
> So when lookup it, it should also use the exact partition's dev_t.
> 
> Reproduce of this bug:
> Use MOUNT_OPTIONS="-o check_int" when run btrfs/001 in xfstest.
> Then there will be WARNING like below.
> WARNING:
> btrfs: attempt to write superblock which references block M @29523968 (sda7   
>   /1111654400/2) which is never written!
> 
> changelog:
> v1->v2: Add explanation that bio_dev(bio) is different with 
> block_device(bd_dev).
> 
> Signed-off-by: Gu JinXiang <g...@cn.fujitsu.com>

Reviewed-by: David Sterba <dste...@suse.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to