Re: Unable to remove directory entry

Qu Wenruo
2019-12-09T01:45:37Z

[-- Attachment #1.1: Type: text/plain, Size: 2650 bytes --]

On 2019/12/9 上午9:31, Mike Gilbert wrote:
> On Sun, Dec 8, 2019 at 7:41 PM Qu Wenruo <quwenruo.btrfs@gmx.com> wrote:
>>
>>
>>
>> On 2019/12/9 上午8:30, Mike Gilbert wrote:
>>> On Sun, Dec 8, 2019 at 7:11 PM Qu Wenruo <quwenruo.btrfs@gmx.com> wrote:
>>>>
>>>>
>>>>
>>>> On 2019/12/9 上午3:19, Mike Gilbert wrote:
>>>>> Hello,
>>>>>
>>>>> I have a directory entry that cannot be stat-ed or unlinked. This
>>>>> issue persists across reboots, so it seems there is something wrong on
>>>>> disk.
>>>>>
>>>>> % ls -l /var/cache/ccache.bad/2/c
>>>>> ls: cannot access
>>>>> '/var/cache/ccache.bad/2/c/0390cb341d248c589c419007da68b2-7351.manifest':
>>>>> No such
>>>>> file or directory
>>>>> total 0
>>>>> -????????? ? ? ? ? ? 0390cb341d248c589c419007da68b2-7351.manifest
>>>>
>>>> Dmesg if any, please.
>>>
>>> There's nothing btrfs-related in the dmesg output.
>>>
>>>>>
>>>>> % uname -a
>>>>> Linux naomi 4.19.67 #4 SMP Sun Aug 18 14:35:39 EDT 2019 x86_64 AMD
>>>>> Phenom(tm) II X6 1055T Processor
>>>>> AuthenticAMD GNU/Linux
>>>>
>>>> The kernel is not new enough to btrfs' standard.
>>>>
>>>> For this possibility name hash mismatch bug, newer kernel will reported
>>>> detailed problems.
>>>
>>> Would 4.19.88 suffice, or do I need to switch to a newer release branch?
>>>
>> I'd recommend to go at least latest LTS (v5.3.x).
>>
>> .88 is just backports, nothing really different. And sometimes big fixes
>> won't get backported.
>
> I upgraded to linux-5.4.2, and attempted to remove the file, with the
> same results.
>
> ls: cannot access
> '/var/cache/ccache.bad/2/c/0390cb341d248c589c419007da68b2-7351.manifest':
> No such
> file or directory
> total 0
> -????????? ? ? ? ? ? 0390cb341d248c589c419007da68b2-7351.manifest
>
> rm: cannot remove
> '/var/cache/ccache.bad/2/c/0390cb341d248c589c419007da68b2-7351.manifest':
> No such
> file or directory
>
> I don't see any output in dmesg. Is there some option I need to enable?
>
Then it's not name hash mismatch, but just index mismatch.

In that case, kernel won't detect such problem by tree-checker. I'll
update tree-checker to handle the case.

I guess the only way to fix it is to rely on btrfs check --mode=lowmem
--repair.
But before that, would you please provde the following dump? So that I
can be sure before crafting the enhanced tree-checker patch.

# btrfs ins dump-tree -t 5 /dev/sda3 | grep "(4065004 INO" -A7
# btrfs ins dump-tree -t 5 /dev/sda3 | grep "(486836.*13905)" -A7
# btrfs ins dump-tree -t 5 /dev/sda3 | grep "(486836.*2543451757)" -A7

Thanks,
Qu

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]