Re: Unable to remove directory entry

Mike Gilbert
2019-12-09T01:51:15Z

On Sun, Dec 8, 2019 at 8:45 PM Qu Wenruo <quwenruo.btrfs@gmx.com> wrote:
>
>
>
> 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

Here you go.

I ran this while the filesystem was mounted; if you need it to be run
while offline, I'll have to fire up a livecd.

location key (4065004 INODE_ITEM 1073741824) type FILE
transid 21397 data_len 0 name_len 44
name: 0390cb341d248c589c419007da68b2-7351.manifest
item 63 key (486836 DIR_INDEX 13905) itemoff 6199 itemsize 74
location key (4065004 INODE_ITEM 0) type FILE
transid 21397 data_len 0 name_len 44
name: 0390cb341d248c589c419007da68b2-7351.manifest
leaf 533498265600 items 128 free space 6682 generation 176439 owner FS_TREE
leaf 533498265600 flags 0x1(WRITTEN) backref revision 1
fs uuid 5e9dcab6-036d-40f1-8b40-24ab4c062bf6
chunk uuid 0be705de-5d3b-4c23-979e-d7aaad224cfb
item 0 key (1059762 INODE_ITEM 0) itemoff 16123 itemsize 160
--
item 6 key (4065004 INODE_ITEM 0) itemoff 15158 itemsize 160
generation 21397 transid 21397 size 12261 nbytes 12288
block group 0 mode 100644 links 1 uid 250 gid 250 rdev 0
sequence 23 flags 0x0(none)
atime 1565546668.383680243 (2019-08-11 14:04:28)
ctime 1565546668.383680243 (2019-08-11 14:04:28)
mtime 1565546668.383680243 (2019-08-11 14:04:28)
otime 1565546668.336681213 (2019-08-11 14:04:28)
item 7 key (4065004 INODE_REF 486836) itemoff 15104 itemsize 54
index 13905 namelen 44 name:
0390cb341d248c589c419007da68b2-7351.manifest
item 8 key (4065004 EXTENT_DATA 0) itemoff 15051 itemsize 53
generation 21397 type 1 (regular)
extent data disk byte 6288928768 nr 12288
extent data offset 0 nr 12288 ram 12288
extent compression 0 (none)
item 9 key (4210974 INODE_ITEM 0) itemoff 14891 itemsize 160
item 63 key (486836 DIR_INDEX 13905) itemoff 6199 itemsize 74
location key (4065004 INODE_ITEM 0) type FILE
transid 21397 data_len 0 name_len 44
name: 0390cb341d248c589c419007da68b2-7351.manifest
leaf 533498265600 items 128 free space 6682 generation 176439 owner FS_TREE
leaf 533498265600 flags 0x1(WRITTEN) backref revision 1
fs uuid 5e9dcab6-036d-40f1-8b40-24ab4c062bf6
chunk uuid 0be705de-5d3b-4c23-979e-d7aaad224cfb
item 62 key (486836 DIR_ITEM 2543451757) itemoff 6273 itemsize 74
location key (4065004 INODE_ITEM 1073741824) type FILE
transid 21397 data_len 0 name_len 44
name: 0390cb341d248c589c419007da68b2-7351.manifest
item 63 key (486836 DIR_INDEX 13905) itemoff 6199 itemsize 74
location key (4065004 INODE_ITEM 0) type FILE
transid 21397 data_len 0 name_len 44
name: 0390cb341d248c589c419007da68b2-7351.manifest
parent transid verify failed on 629293056 wanted 177041 found 177044
parent transid verify failed on 629293056 wanted 177041 found 177044
Ignoring transid failure