On 2020/7/2 上午7:55, Marc Lehmann wrote:
> On Thu, Jul 02, 2020 at 07:45:07AM +0800, Qu Wenruo <quwenruo.btrfs@xxxxxxx> wrote:
>> On 2020/7/2 上午4:14, Marc Lehmann wrote:
>>> On Wed, Jul 01, 2020 at 09:30:25AM +0800, Qu Wenruo <quwenruo.btrfs@xxxxxxx> wrote:
>>>> This looks like an old fs with some bad accounting numbers.
>>>
>>> Yeah, but it's not.
>>>
>>>> Have you tried btrfs rescue fix-device-size?
>>>
>>> Why would I want to try this?
>>
>> Read the man page of "btrfs-rescue".
>
> Well, nothing in there explains why I should use it in my situation, or
> what it has to do with the problem I reported, so again, why would I want
> to do this?
Well, if you want to go this way, let me show the code here.
From fs/btrfs/volumes.c:btrfs_read_chunk_tree():
if (btrfs_super_total_bytes(fs_info->super_copy) <
fs_info->fs_devices->total_rw_bytes) {
btrfs_err(fs_info,
"super_total_bytes %llu mismatch with fs_devices total_rw_bytes
%llu",
btrfs_super_total_bytes(fs_info->super_copy),
fs_info->fs_devices->total_rw_bytes);
ret = -EINVAL;
goto error;
}
Doesn't this explain why we abort the mount?
>
> Also, shouldn't btrfs be fixed instead? I was under the impression that
> one of the goals of btrfs is to be safe w.r.t. crashes.
That's why we provide the btrfs rescue fix-device-size.
We don't want to spend too complex logic on some already screwed
accounting numbers.
Furthermore, a btrfs check run without --repair may expose more problems.
>
> The bug I reported has very little or nothing to with strict checking.
>
I have provide the code to prove why it's related.
Whether you believe is your problem then.
Thanks,
Qu
Attachment:
signature.asc
Description: OpenPGP digital signature
