summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorMurphy Zhou <jencce.kernel@gmail.com>2020-02-14 17:34:09 +0300
committerTrond Myklebust <trond.myklebust@hammerspace.com>2020-03-16 17:14:30 +0300
commitf5fdf1243fb750598b46305dd03c553949cfa14f (patch)
treea23dd56b1dede625415a447b15e2d42f4056ccf4 /fs
parenteb095c14030fbb07fcc61c64b6b39cc297a429c6 (diff)
downloadlinux-f5fdf1243fb750598b46305dd03c553949cfa14f.tar.xz
NFSv4.2: error out when relink swapfile
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>
Diffstat (limited to 'fs')
-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 1297919e0fce..8e5d6223ddd3 100644
--- a/fs/nfs/nfs4file.c
+++ b/fs/nfs/nfs4file.c
@@ -252,6 +252,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) {