From patchwork Wed Apr 22 09:56:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 227143 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70AF4C5518C for ; Wed, 22 Apr 2020 10:45:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 48D532073A for ; Wed, 22 Apr 2020 10:45:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587552328; bh=gESVvPTfx2xSpiVG8TxKGdtaWIy+comoS9exNaI75lo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=S3XBR04Xt5UBaRL+AU41I1BhhPFErBXMs7AByXF4XuKfURSEtDYShIHFFZCXZv8F3 mjdJHwap8dDppKe9oTwwu9AWlbaWXl9UdVQdqdpeNGvbkjOGCvgXBAvUCFCVGCopjQ BkltQuxfQTZOLEppMVwdSXMea+v7nMYOJ2GcP88c= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729917AbgDVKSK (ORCPT ); Wed, 22 Apr 2020 06:18:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:54508 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729584AbgDVKSF (ORCPT ); Wed, 22 Apr 2020 06:18:05 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9F56F2075A; Wed, 22 Apr 2020 10:18:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587550685; bh=gESVvPTfx2xSpiVG8TxKGdtaWIy+comoS9exNaI75lo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fBoBKJa5D3s/93pmEwVb5SJo41be55o/aBNA/ybgwdCpiw9gjiE82klFYyH5Rz/ws yTay5CrsF4lou1ukZZFrlFgzZkzM0M+Wdf+Z/zRrGvJrzL11KM122nAtY9WZqOOWAq KoU90F9EdxuvGnVZQCSloCJsUQX6zTCiZB1E2mNU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Murphy Zhou , Trond Myklebust , Sasha Levin Subject: [PATCH 5.4 052/118] NFSv4.2: error out when relink swapfile Date: Wed, 22 Apr 2020 11:56:53 +0200 Message-Id: <20200422095040.570318881@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200422095031.522502705@linuxfoundation.org> References: <20200422095031.522502705@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Murphy Zhou [ Upstream commit f5fdf1243fb750598b46305dd03c553949cfa14f ] This fixes xfstests generic/356 failure on NFSv4.2. Signed-off-by: Murphy Zhou Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin --- fs/nfs/nfs4file.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c index 54f1c1f626fc5..fb55c04cdc6bd 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) {