When f2fs is set up on zoned block devices, swap files on the file- system causes unaligned write command errors. The kernel writes to the swap files directly without the assistance of the filesystem then it can not fulfill sequential write requirements of zoned block devices.
To avoid the errors, prevent swap file activation when the filesystem enables block zoned device support. Fixes: 4969c06a0d83 ("f2fs: support swap file w/ DIO") Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawas...@wdc.com> Cc: sta...@vger.kernel.org # v5.4+ --- fs/f2fs/data.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 96f1a354f89f..51a832efd8cd 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -4050,6 +4050,12 @@ static int f2fs_swap_activate(struct swap_info_struct *sis, struct file *file, if (f2fs_readonly(F2FS_I_SB(inode)->sb)) return -EROFS; + if (f2fs_sb_has_blkzoned(F2FS_I_SB(inode))) { + f2fs_err(F2FS_I_SB(inode), + "Swapfile not supported on zoned block devices"); + return -EINVAL; + } + ret = f2fs_convert_inline_inode(inode); if (ret) return ret; -- 2.30.2 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel