The patch titled Subject: mm, swap: disallow swapon() on zoned block devices has been added to the -mm tree. Its filename is mm-swap-disallow-swapon-on-zoned-block-devices.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-swap-disallow-swapon-on-zoned-block-devices.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-swap-disallow-swapon-on-zoned-block-devices.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Naohiro Aota <naohiro.aota@xxxxxxx> Subject: mm, swap: disallow swapon() on zoned block devices A zoned block device consists of a number of zones. Zones are either conventional and accepting random writes or sequential and requiring that writes be issued in LBA order from each zone write pointer position. For the write restriction, zoned block devices are not suitable for a swap device. Disallow swapon on them. Link: http://lkml.kernel.org/r/20191015085814.637837-1-naohiro.aota@xxxxxxx Signed-off-by: Naohiro Aota <naohiro.aota@xxxxxxx> Reviewed-by: Christoph Hellwig <hch@xxxxxx> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx> Cc: "Theodore Y. Ts'o" <tytso@xxxxxxx> Cc: Hannes Reinecke <hare@xxxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/swapfile.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/mm/swapfile.c~mm-swap-disallow-swapon-on-zoned-block-devices +++ a/mm/swapfile.c @@ -2887,6 +2887,14 @@ static int claim_swapfile(struct swap_in error = set_blocksize(p->bdev, PAGE_SIZE); if (error < 0) return error; + /* + * Zoned block device contains zones that have + * sequential write only restriction. For the restriction, + * zoned block devices are not suitable for a swap device. + * Disallow them here. + */ + if (blk_queue_is_zoned(p->bdev->bd_queue)) + return -EINVAL; p->flags |= SWP_BLKDEV; } else if (S_ISREG(inode->i_mode)) { p->bdev = inode->i_sb->s_bdev; _ Patches currently in -mm which might be from naohiro.aota@xxxxxxx are mm-swap-disallow-swapon-on-zoned-block-devices.patch