Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp865217pxb; Tue, 1 Feb 2022 12:02:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJzf9WukkZI0XPe1CdxZjdcz0f2/sRfWJf0qtdBaI1HNqUt8t8bnq1whq5hBee+0+hBWVs9W X-Received: by 2002:aa7:d8c5:: with SMTP id k5mr5358063eds.420.1643745773389; Tue, 01 Feb 2022 12:02:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643745773; cv=none; d=google.com; s=arc-20160816; b=cQ/5EyAR0yoBL09sTyJew0nKFAUT+RoDqD9MA8KckZF9fgYSoj3a2wwGGZQfbsL8eO Z3eO08mYM50FxxSRCRTSE58J4ZMWoav9vC4IznVaRmRf0QIh5mbwZ5ApjjuJbnDZ1Kpz gZKgGLUNZ9NBZIe/8MZwo+jx9gqvzj6aHrIsrdrkd7omAFhCPYrcG2IQBGzssL+N/qoR fej0zEjo9108Ej6hCPf3RvmZPjY494uHGBmMdHb+tEpHeY6kF0HBoA1pemqr08zZlMMO +SNjBh+eLBwtx4fLIJk8zOpw2Ztqn4S3nau9knwko0ShagaNZNuRlXPyExQ/xyPhxl49 vuWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ebIDuN/DoJr8RRkQGe4+lLgN4WSULdy3fQjbxUYL/FQ=; b=kkiept+SZ8S2vDkwxiSikX/3nztenvDby3iNjhHuXhMRnmUUi9CuBYTedRBu+EkDxW uUiCjCJhM9Zw7oreWH0HsnWf8WOGuZkaqRd97o3LMJlCH/R5tv9cMDeXraDvVW7gsS55 EaXSqJaz1gVgpTAqSdGCH8LCXwPXt2Yzu2HaCYqaadZN9TcPFVi5ctgSYFFLFPmV3M+l TyyqfYZK8jDD2jtwvjg34hfA/mnFt8WFoqggPifWulNPP/AsTUWk6YkQTbMQ9MICUE8K 7Im+QP3vOzMiJTn+mMYa3q8Eleta8UruMv2RQbHrqnsbO46tsogZgEw86X6736ulrTey S5Ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="QBg+R/3A"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ds19si10721698ejc.458.2022.02.01.12.02.26; Tue, 01 Feb 2022 12:02:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="QBg+R/3A"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359375AbiAaLOs (ORCPT + 99 others); Mon, 31 Jan 2022 06:14:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359713AbiAaLGh (ORCPT ); Mon, 31 Jan 2022 06:06:37 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C9AFC06134D; Mon, 31 Jan 2022 03:04:36 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2CD9E60E76; Mon, 31 Jan 2022 11:04:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 185CAC340E8; Mon, 31 Jan 2022 11:04:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643627075; bh=c5JibMQ6CaH1JvwizkX77Go+XV1EzuwLJ33t5ObNBSs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QBg+R/3AK7rnJs2qJzRgmF8wXaRDjdeLWLZm5055wu+bMtgXrMs5WMWI9FWnZzsuz BdxArPZTs7rK1YU/r7hGWGU971NAIamhxBhZdSoG2DddqYOh2uFSBKOjOXAgynKpcB uqelzXjTDkPaCZ1fQvMwi+r6yNzD3XqhbTPWXuxQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust , Anna Schumaker , Sasha Levin Subject: [PATCH 5.10 066/100] NFS: Ensure the server has an up to date ctime before hardlinking Date: Mon, 31 Jan 2022 11:56:27 +0100 Message-Id: <20220131105222.649556104@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220131105220.424085452@linuxfoundation.org> References: <20220131105220.424085452@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Trond Myklebust [ Upstream commit 204975036b34f55237bc44c8a302a88468ef21b5 ] Creating a hard link is required by POSIX to update the file ctime, so ensure that the file data is synced to disk so that we don't clobber the updated ctime by writing back after creating the hard link. Fixes: 9f7682728728 ("NFS: Move the delegation return down into nfs4_proc_link()") Signed-off-by: Trond Myklebust Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin --- fs/nfs/dir.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -2192,6 +2192,8 @@ nfs_link(struct dentry *old_dentry, stru trace_nfs_link_enter(inode, dir, dentry); d_drop(dentry); + if (S_ISREG(inode->i_mode)) + nfs_sync_inode(inode); error = NFS_PROTO(dir)->link(inode, dir, &dentry->d_name); if (error == 0) { ihold(inode);