diff mbox series

NFSv4.2: error out when relink swapfile

Message ID 20200214143409.27etgp3gpvv7vgsz@xzhoux.usersys.redhat.com (mailing list archive)
State New, archived
Headers show
Series NFSv4.2: error out when relink swapfile | expand

Commit Message

Murphy Zhou Feb. 14, 2020, 2:34 p.m. UTC
This fixes xfstests generic/356 failure on NFSv4.2.

Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com>
---
 fs/nfs/nfs4file.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Murphy Zhou March 9, 2020, 4:21 a.m. UTC | #1
On Fri, Feb 14, 2020 at 10:34:09PM +0800, Murphy Zhou wrote:
> This fixes xfstests generic/356 failure on NFSv4.2.

Ping on this one?

> 
> Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com>
> ---
>  fs/nfs/nfs4file.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
> index be4eb72..993a4f0 100644
> --- a/fs/nfs/nfs4file.c
> +++ b/fs/nfs/nfs4file.c
> @@ -253,6 +253,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) {
> -- 
> 1.8.3.1
>
diff mbox series

Patch

diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
index be4eb72..993a4f0 100644
--- a/fs/nfs/nfs4file.c
+++ b/fs/nfs/nfs4file.c
@@ -253,6 +253,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) {