Thread (3 messages) 3 messages, 3 authors, 2022-01-03

Re: [PATCH] btrfs: respect the max size in the header when activating swap file

From: Josef Bacik <josef@toxicpanda.com>
Date: 2021-12-17 15:08:23

On Thu, Dec 16, 2021 at 03:00:32PM +0000, fdmanana@kernel.org wrote:
From: Filipe Manana <redacted>

If we extended the size of a swapfile after its header was created (by the
mkswap utility) and then try to activate it, we will map the entire file
when activating the swap file, instead of limiting to the max size defined
in the swap file's header.

Currently test case generic/643 from fstests fails because we do not
respect that size limit defined in the swap file's header.

So fix this by not mapping file ranges beyond the max size defined in the
swap header.

This is the same type of bug that iomap used to have, and was fixed in
commit 36ca7943ac18ae ("mm/swap: consider max pages in
iomap_swapfile_add_extent").

Fixes: ed46ff3d423780 ("Btrfs: support swap files")
Signed-off-by: Filipe Manana <redacted>
Validated it to make sure it fixes the problem, you can add

Reviewed-and-tested-by: Josef Bacik [off-list ref]

Thanks,

Josef
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help