diff options
author | Omar Sandoval <osandov@fb.com> | 2018-05-16 11:13:34 -0700 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2018-05-17 07:17:14 -0700 |
commit | 19e129618d47987618c71c4f129ba8dfa2669569 (patch) | |
tree | d2f02868d75acb3debe87376cb32a7fe9f4d3633 /fs/iomap.c | |
parent | ec601924df0f8fc4f66ac04eaa6bccde87b2f569 (diff) | |
download | op-kernel-dev-19e129618d47987618c71c4f129ba8dfa2669569.zip op-kernel-dev-19e129618d47987618c71c4f129ba8dfa2669569.tar.gz |
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>
Diffstat (limited to 'fs/iomap.c')
-rw-r--r-- | fs/iomap.c | 5 |
1 files changed, 0 insertions, 5 deletions
@@ -1220,10 +1220,6 @@ static loff_t iomap_swapfile_activate_actor(struct inode *inode, loff_t pos, return -EINVAL; } - /* Skip holes. */ - if (iomap->type == IOMAP_HOLE) - goto out; - /* Only real or unwritten extents. */ if (iomap->type != IOMAP_MAPPED && iomap->type != IOMAP_UNWRITTEN) { pr_err("swapon: file has unallocated extents\n"); @@ -1259,7 +1255,6 @@ static loff_t iomap_swapfile_activate_actor(struct inode *inode, loff_t pos, return error; memcpy(&isi->iomap, iomap, sizeof(isi->iomap)); } -out: return count; } |