Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp862468pxb; Tue, 1 Feb 2022 12:00:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJxZP6DU62HT2WH3pyaI7e3839VY7YSXttkd0cCKebpMO6aLRLiBCaTs9GAviaciK/sK7Tft X-Received: by 2002:a17:906:dc8f:: with SMTP id cs15mr22413709ejc.546.1643745641542; Tue, 01 Feb 2022 12:00:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643745641; cv=none; d=google.com; s=arc-20160816; b=lgAYHS/HyThWbj8ICLBi7iuysDSTbmQA8U+e1uJlDEvYYjtKKu+O2T9XfD3YPwHAIy tKvDKK6tkIzYMDKigSnK/cV89RVGwP796xTpLwPu2D22nvum17utp9qffs1Uf0iTSS8V MrW/HSNVgejMEtRJrx3DpJ+JBrk/cOWV1Vxd4ICVGuTXjFN5Y10cB45h4xK7L/5C3RHd YVLhvJlKDC48EzNmwf6N9TOCXPmO9NDbSwxo1b6Jh6R/nHzj3mriHHZEHtFxPh57LUv3 XTvUHNn9BwevEjepMvMIuy7oAlHtHXMpA2C9Vpq9uH59zbzW2XDzfIaNuxx8OT0eEO2p Lx4A== 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=ZxZ4cfp9nX8ROdaJY6qiSaRz1XSp9hfkmRU5cx0lSLk=; b=jhl5ckSsZzFpMsYAiezgsFGNryaykulpBu9e4ugQbWj+7P8A9UrhFD2TFaoMS7nmOP xMZmeNgdo7/RclDGfhmFg2+pi8H80XsLV9yupdHi9YJ1zwMFi2M0uUbji1InpTPwx4aC psUn3YbgWWwY+daOJ2O6I25YTd9gyK18tLua3DuKNPDY0OgusrEd2BLkwKXYAEY0ZD+h m/KQ/5H8EhMt5GSZ35GIJre5B0BtYZ6WWkJB+o2m2CI4YLeWz90isEgbcd6CZL1hB6LL XUjbSTlR2pnswGxETGZr6DNpPqLXDaiFD+L9uDbSFh/lRiYkwAKeuYVs5Z5QI4/izYd9 6fUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0wzKYjIr; 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 gt7si8792711ejc.986.2022.02.01.12.00.15; Tue, 01 Feb 2022 12:00:41 -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=0wzKYjIr; 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 S1376323AbiAaLIM (ORCPT + 99 others); Mon, 31 Jan 2022 06:08:12 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52594 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359219AbiAaLEp (ORCPT ); Mon, 31 Jan 2022 06:04:45 -0500 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 ams.source.kernel.org (Postfix) with ESMTPS id BEB25B82A4E; Mon, 31 Jan 2022 11:04:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC15FC340E8; Mon, 31 Jan 2022 11:04:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643627083; bh=SVOi54IO0O8pR2wEHYPHjVnXxF8fVBac/BX3gwFelaU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0wzKYjIrhiU8LZYoyE6NIWXFhJi06QelyQPwVDFM+nQ0JuLYJgc2F0upLjM7Cgkxq nxcP1RhzbszwZ3v0QGSbiOm95VOjMJSqC1BI2Bk+pgXZn1JtL46QiDi7i17HEUe3LH V56OYe52nq0tyvaw8o1qHGc2iBp9DJIoyFiiG2Zg= 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 067/100] NFS: Ensure the server has an up to date ctime before renaming Date: Mon, 31 Jan 2022 11:56:28 +0100 Message-Id: <20220131105222.683259865@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 6ff9d99bb88faebf134ca668842349d9718e5464 ] Renaming a file 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: f2c2c552f119 ("NFS: Move delegation recall into the NFSv4 callback for rename_setup()") 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 @@ -2282,6 +2282,8 @@ int nfs_rename(struct inode *old_dir, st } } + if (S_ISREG(old_inode->i_mode)) + nfs_sync_inode(old_inode); task = nfs_async_rename(old_dir, new_dir, old_dentry, new_dentry, NULL); if (IS_ERR(task)) { error = PTR_ERR(task);