iomap: don't allow holes in swapfiles
authorOmar Sandoval <osandov@fb.com>
Wed, 16 May 2018 18:13:34 +0000 (11:13 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Thu, 17 May 2018 14:17:14 +0000 (07:17 -0700)
commit19e129618d47987618c71c4f129ba8dfa2669569
treed2f02868d75acb3debe87376cb32a7fe9f4d3633
parentec601924df0f8fc4f66ac04eaa6bccde87b2f569
iomap: don't allow holes in swapfiles

generic_swapfile_activate() doesn't allow holes, so we should be
consistent here. This is also a bit safer: if the user creates a
swapfile with, say, truncate -s $SIZE followed by mkswap, they should
really get an error and not much less swap space than they expected.
swapon(8) will error out before calling swapon(2) if the file has holes,
anyways.

Fixes: 9d93388b0afe ("iomap: add a swapfile activation function")
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Omar Sandoval <osandov@fb.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/iomap.c