ext4: implement swap_activate aops using iomap
authorRitesh Harjani <riteshh@linux.ibm.com>
Fri, 4 Sep 2020 09:16:53 +0000 (14:46 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Nov 2020 10:51:51 +0000 (11:51 +0100)
commit56766806588f3f20afdd7172f1a661fa0c49fecb
treeb8db4d5c066a7457f145ee11b7e2243b0325e5fb
parent9129151073eb09a20710387f0ed3e13fe3508c11
ext4: implement swap_activate aops using iomap

commit 0e6895ba00b7be45f3ab0d2107dda3ef1245f5b4 upstream.

After moving ext4's bmap to iomap interface, swapon functionality
on files created using fallocate (which creates unwritten extents) are
failing. This is since iomap_bmap interface returns 0 for unwritten
extents and thus generic_swapfile_activate considers this as holes
and hence bail out with below kernel msg :-

[340.915835] swapon: swapfile has holes

To fix this we need to implement ->swap_activate aops in ext4
which will use ext4_iomap_report_ops. Since we only need to return
the list of extents so ext4_iomap_report_ops should be enough.

Cc: stable@kernel.org
Reported-by: Yuxuan Shui <yshuiv7@gmail.com>
Fixes: ac58e4fb03f ("ext4: move ext4 bmap to use iomap infrastructure")
Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
Link: https://lore.kernel.org/r/20200904091653.1014334-1-riteshh@linux.ibm.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/inode.c