Subject: Re: bug#59821: 9.1: du Aborted (corrupt filesystem)

From: Paul Eggert <[email-masked]>
Date: Tue, 6 Dec 2022 11:08:57 -0800

On 2022-12-04 10:07, Luke Dashjr wrote:
> Version: sys-apps/coreutils-9.1-r1 (Gentoo)
> 
> Context: Linux has a long-standing bug which leads to ext4 RAM dishs (zram
> specifically) getting corrupted randomly. This manifests as various
> newfstatat calls returning -1 errno=EUCLEAN (Structure needs cleaning).
> 
> The `du` tool, when it encounters them, prints an error as expected, but later
> on aborts...
> 
> (I am not certain if the fstatat return value is related to the later abort,
> because I couldn't find a way to get gdb to break only when fstatat returns
> nonzero)

Thanks, your diagnosis looks like it's on the right track. I attempted 
to fix the bug that leads to the abort by installing the following patch 
into Gnulib:

https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=440b528b1d81dd31b2a2e4dde20d5c837c147811

and then propagating that into coreutils so that this should appear in 
the next coreutils release. Although this patch fixes two obvious bugs 
in the area, I can't easily test the patch in your situation, so please 
give it a try.