Re: [linus:master] [fs/dax] bde708f1a6: WARNING:at_mm/truncate.c:#truncate_folio_batch_exceptionals

Jan Kara
2025-04-10T10:35:49Z

On Thu 10-04-25 17:01:26, Alistair Popple wrote:
> On Thu, Apr 10, 2025 at 01:14:42PM +0800, kernel test robot wrote:
> >
> >
> > Hello,
> >
> > kernel test robot noticed "WARNING:at_mm/truncate.c:#truncate_folio_batch_exceptionals" on:
> >
> > commit: bde708f1a65d025c45575bfe1e7bf7bdf7e71e87 ("fs/dax: always remove DAX page-cache entries when breaking layouts")
>
> This is warning about hitting the bug that commit 0e2f80afcfa6 ("fs/dax: ensure
> all pages are idle prior to filesystem unmount") fixes. I couldn't reorder that
> patch before this one because it relies on the DAX page-cache entries always
> being removed when breaking layouts.
>
> However I note that this is ext2. Commit 0e2f80afcfa6 doesn't actually update
> ext2 so the warning will persist. The fix should basically be the same as for
> ext4:
>
> --- a/fs/ext2/inode.c
> +++ b/fs/ext2/inode.c
> @@ -74,6 +74,8 @@ void ext2_evict_inode(struct inode * inode)
> struct ext2_block_alloc_info *rsv;
> int want_delete = 0;
>
> + dax_break_layout_final(inode);
> +
> if (!inode->i_nlink && !is_bad_inode(inode)) {
> want_delete = 1;
> dquot_initialize(inode);
>
> What's more troubling though is unlike ext4 there is no ext2_dax_break_layouts()
> defined, which is how I missed updating it. That means truncate with FS DAX
> is already pretty broken for ext2, and will need more than just the above fix
> to ensure DAX pages are idle before truncate. So I think FS DAX on ext2 should
> probably just be removed or marked broken unless someone with more knowledge of
> ext2 wants to fix it up?

Yeah, with a hindsight, implementing fsdax for ext2 was a mistake (although
it was meant as a replacement for the old execute-in-place feature that
ext2 had for s390 and which we wanted to remove). At this point when pmem
didn't lift off and DAX ended up being kind of niche, I think the effort
to maintain DAX in ext2 is not justified and we should just drop it (and
direct existing users to use ext4 driver instead for the cases where they
need it). I'll have a look into it.

Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR