blob: 6fdf1cedc3ffff57607dffbd33d10cb08da712a6 [file] [log] [blame]
From cac4dc064409510bbe520a1ab299e5501e758cc6 Mon Sep 17 00:00:00 2001
From: Murphy Zhou <jencce.kernel@gmail.com>
Date: Fri, 14 Feb 2020 22:34:09 +0800
Subject: [PATCH] NFSv4.2: error out when relink swapfile
commit f5fdf1243fb750598b46305dd03c553949cfa14f upstream.
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: Paul Gortmaker <paul.gortmaker@windriver.com>
diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
index 49544e706c18..cec32338562a 100644
--- a/fs/nfs/nfs4file.c
+++ b/fs/nfs/nfs4file.c
@@ -193,6 +193,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) {
--
2.7.4