While active, the media backing a swap file is leased to the kernel.
Userspace has no business writing to it. Make sure we can't do this.
The two kernel patches titled as below should fix the bug:
mm: set S_SWAPFILE on blockdev swap devices
vfs: don't allow writes to swap files
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>