On Mon, Apr 08, 2019 at 12:34:48PM +0800, Qu Wenruo wrote:
>
>
> On 2019/4/8 下午12:27, Qu Wenruo wrote:
> > Under the following call traces, btrfs can commit device with 0
> > total_bytes onto disk:
> > btrfs_rm_device()
> > |- btrfs_shrink_device()
> > | |- btrfs_device_set_total_bytes(device, 0)
> > | |- btrfs_update_device()
> > | |- btrfs_commit_transaction() #1
> > |- btrfs_rm_dev_item()
> >
> > This will trigger write time tree checker warning.
> > And further more, this can create valid btrfs with device->total_bytes
> > == 0 and triggering read time tree-checker if power loss happens after
> > above transaction #1 but before next transaction.
> >
> > So this dev item check is too restrict.
> >
> > Please fold this patch into commit 87d87c6dcbbe ("btrfs: tree-checker:
> > Verify dev item") in misc-next branch.
> >
> > The fuzzed image can be already addressed by commit 1b3922a8bc74
> > ("btrfs: Use real device structure to verify dev extent") thus we don't
> > need that strict check anymore.
>
> Just a kind reminder, folding the patch will be much easier than my
> original purpose to discard that patch completely.
Agreed and patch folded, thanks.