From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDABCC433F5 for ; Mon, 31 Jan 2022 11:01:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358673AbiAaLBA (ORCPT ); Mon, 31 Jan 2022 06:01:00 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:48104 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348546AbiAaLAO (ORCPT ); Mon, 31 Jan 2022 06:00:14 -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 1983EB82A5D; Mon, 31 Jan 2022 11:00:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44D0DC340E8; Mon, 31 Jan 2022 11:00:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643626811; bh=bwNfiph+mzFupEybTRho7bodcExQLjUfJ5lC3jX7wY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mfpwYCEbOTy2SO2GcwK6Bv2lCmYjobB60ekRByQBHAy46M9zs6iN2iJuQzBRqjCtm OeZ6pV8cyZPRacPry5N/Wz/PLh8Pl3IfM+QoOGZn6oKhDv6UC99Mfobp6WtVgQP0nc jjjqK/zPwyzWcjsE4TpKgdITz/4AydmxMpIPtoYk= 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.4 48/64] NFS: Ensure the server has an up to date ctime before renaming Date: Mon, 31 Jan 2022 11:56:33 +0100 Message-Id: <20220131105217.303568218@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220131105215.644174521@linuxfoundation.org> References: <20220131105215.644174521@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: stable@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 @@ -2143,6 +2143,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);