]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ext4: fix FS_IOC_GETFSMAP handling
authorTheodore Ts'o <tytso@mit.edu>
Wed, 23 Oct 2024 04:25:37 +0000 (00:25 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2024 09:59:38 +0000 (10:59 +0100)
commitd714aa0399cfc692170801bce09fc11c66552f29
treeeea7b60606d914886a66fb0e7e2c36c25043be01
parent319bf0c0b825f00d35cf3c1e3c1c7444ae6dad78
ext4: fix FS_IOC_GETFSMAP handling

commit 4a622e4d477bb12ad5ed4abbc7ad1365de1fa347 upstream.

The original implementation ext4's FS_IOC_GETFSMAP handling only
worked when the range of queried blocks included at least one free
(unallocated) block range.  This is because how the metadata blocks
were emitted was as a side effect of ext4_mballoc_query_range()
calling ext4_getfsmap_datadev_helper(), and that function was only
called when a free block range was identified.  As a result, this
caused generic/365 to fail.

Fix this by creating a new function ext4_getfsmap_meta_helper() which
gets called so that blocks before the first free block range in a
block group can get properly reported.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/fsmap.c
fs/ext4/mballoc.c
fs/ext4/mballoc.h