]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - mm/swapfile.c
Merge tag 'tegra-for-5.5-cpufreq' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux.git] / mm / swapfile.c
index dab43523afdd351426ef5c92e5306a04a9820b36..bb3261d45b6a3ea6af720bee1abd0bc9a7a3e34e 100644 (file)
@@ -2887,6 +2887,13 @@ static int claim_swapfile(struct swap_info_struct *p, struct inode *inode)
                error = set_blocksize(p->bdev, PAGE_SIZE);
                if (error < 0)
                        return error;
+               /*
+                * Zoned block devices contain zones that have a sequential
+                * write only restriction.  Hence zoned block devices are not
+                * suitable for swapping.  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;