]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs: fix agf/agfl verification on v4 filesystems
authorDave Chinner <dchinner@redhat.com>
Fri, 16 Jun 2023 01:37:30 +0000 (18:37 -0700)
committerCarlos Maiolino <cem@kernel.org>
Thu, 22 Jun 2023 12:07:32 +0000 (14:07 +0200)
commitdaa2d8205208dfafaa8dc29310f93f6c94803e24
treeabebce29fd747f71411852fefb9967a4dca62796
parenta565e345614b6b2839fd1088dacf5957309752e2
xfs: fix agf/agfl verification on v4 filesystems

Source kernel commit: e0a8de7da35e5b22b44fa1013ccc0716e17b0c14

When a v4 filesystem has fl_last - fl_first != fl_count, we do not
not detect the corruption and allow the AGF to be used as it if was
fully valid. On V5 filesystems, we reset the AGFL to empty in these
cases and avoid the corruption at a small cost of leaked blocks.

If we don't catch the corruption on V4 filesystems, bad things
happen later when an allocation attempts to trim the free list
and either double-frees stale entries in the AGFl or tries to free
NULLAGBNO entries.

Either way, this is bad. Prevent this from happening by using the
AGFL_NEED_RESET logic for v4 filesysetms, too.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
libxfs/xfs_alloc.c