summaryrefslogtreecommitdiff
path: root/fs/nfs/nfs4file.c
diff options
context:
space:
mode:
authorMurphy Zhou <jencce.kernel@gmail.com>2020-02-14 22:34:09 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-04-23 10:36:31 +0200
commit59bafdc99440ca6aef8bd1a93491d637a09853f2 (patch)
tree04917ac54f55c36feba5a0ef250d02e94c9e5904 /fs/nfs/nfs4file.c
parent264e3f1597e8f6d45caf815f6883c4c98a8ed056 (diff)
NFSv4.2: error out when relink swapfile
[ Upstream commit f5fdf1243fb750598b46305dd03c553949cfa14f ] This fixes xfstests generic/356 failure on NFSv4.2. Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/nfs/nfs4file.c')
-rw-r--r--fs/nfs/nfs4file.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
index 54f1c1f626fc..fb55c04cdc6b 100644
--- a/fs/nfs/nfs4file.c
+++ b/fs/nfs/nfs4file.c
@@ -210,6 +210,9 @@ static loff_t nfs42_remap_file_range(struct file *src_file, loff_t src_off,
if (remap_flags & ~REMAP_FILE_ADVISORY)
return -EINVAL;
+ if (IS_SWAPFILE(dst_inode) || IS_SWAPFILE(src_inode))
+ return -ETXTBSY;
+
/* check alignment w.r.t. clone_blksize */
ret = -EINVAL;
if (bs) {