From patchwork Thu May 18 11:47:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13246632 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27795C7EE2E for ; Thu, 18 May 2023 11:48:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AD5D6280005; Thu, 18 May 2023 07:48:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A8544280001; Thu, 18 May 2023 07:48:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 94DAB280005; Thu, 18 May 2023 07:48:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 88576280001 for ; Thu, 18 May 2023 07:48:00 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 5433D1C75EF for ; Thu, 18 May 2023 11:48:00 +0000 (UTC) X-FDA: 80803201920.16.0DB5E8D Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf30.hostedemail.com (Postfix) with ESMTP id A2B3880010 for ; Thu, 18 May 2023 11:47:58 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=E4LAb0nI; spf=pass (imf30.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684410478; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=E45ftUt+La85JZW631KM+z9pPgcCPE3ssg5Uuu6Ne3s=; b=X0TeSpsE1QhRXBpafapo8BInBljb+Ap1gFzqzRuLXPfgg3SJRl/lzoyiKwPmstxIEyx/mz lcMZceK23RKR1b3ftNPy0XItr5YsxQysKsA1AnP7RaEDzSdB0T7iVkWVN456EtLqv4Q9yk UfrIFZ2MWFRl0fwwkH5h7/O2elEe7Tk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684410478; a=rsa-sha256; cv=none; b=UUa9drpQPIaIUUdZImfemJc520AXg5QfjlV34XOMdDl+aMbUqgJT0KIgFAR009kv/Q7Pxk J+wNO0Z3Y+fj2BcjZYnW6tetMZB9yDDl9Q2fmzwxqN++4ZYgiaQxPukcvO5IjfIf3WGjy4 +zdaqPhwqkp/okkAaZushovUnFZTRf0= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=E4LAb0nI; spf=pass (imf30.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org; dmarc=pass (policy=none) header.from=kernel.org 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 C60BC64E9D; Thu, 18 May 2023 11:47:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0DD8C433A0; Thu, 18 May 2023 11:47:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684410477; bh=en20+kwYIb+rQx+Bs8McKeHFRgrQ8XEHcOk9MVmU7iY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E4LAb0nIr9avuLF6bnhNgC2cRv8n+Y1r1x0zPOZeGu+bmo0SCl5MMh4ksQB9eom5S CEPIxNX0JYB+XiFpj7TAYcNwACJZ0aG2sE7DrRd8kZiFZMB+MkW7P2Gk7W1du57+Tx BMsp9pM/wLI2kWZmup7SdZvctIT91uMob/wvifDVVh88XCAtTac7bHJkRuxHrr8ZN2 jrlGYU74z7oZ6tQP5ksyrgyn3awO7cIF7AtozH7MMlARxYEikZaguKB2DTP6z6xi6M Wm8fgVO2JxxmGPrUz5pDiYBZcTOycshUgvJF3oY9yDGZ5hzJhsgwGrWv6Kl3g/82aL D7C397+DhZIWQ== From: Jeff Layton To: Alexander Viro , Christian Brauner , "Darrick J. Wong" , Hugh Dickins , Andrew Morton , Dave Chinner , Chuck Lever Cc: Jan Kara , Amir Goldstein , David Howells , Neil Brown , Matthew Wilcox , Andreas Dilger , Theodore T'so , Chris Mason , Josef Bacik , David Sterba , Namjae Jeon , Steve French , Sergey Senozhatsky , Tom Talpey , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-mm@kvack.org, linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org Subject: [PATCH v4 4/9] nfsd: ensure we use ctime_peek to grab the inode->i_ctime Date: Thu, 18 May 2023 07:47:37 -0400 Message-Id: <20230518114742.128950-5-jlayton@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230518114742.128950-1-jlayton@kernel.org> References: <20230518114742.128950-1-jlayton@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: A2B3880010 X-Stat-Signature: ek7y46qp3tsonmthf89ztdd4zsyiu9xc X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1684410478-789965 X-HE-Meta: U2FsdGVkX19Qlo6iH8rf0bnZTU3kJmpJgBCiCmPAilzaZarvHoexDlcLRqmJ9KHLhLsRDYNXTp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L5I1Ew20iu4ot1QOdHe+2NIU/Jvv36tz7TurEX+EEVQpOF/BRUOwqaZxWBDG3b5WalceHZlGn0D+x2IBqyb6d+4lnpjpIE7tjFUfYDbBjcpV+tObzaZ16Ar66migt/BPAuuZZXSY/TAC0JuPsCACVaE+8G7jDFb5TiUqXya5VUevPSQFBaOwe+qWiD2j0F9KBpYJ9LsXdH2k9EzNdAZS X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: If getattr fails, then nfsd can end up scraping the time values directly out of the inode for pre and post-op attrs. This may or may not be the right thing to do, but for now make it at least use ctime_peek in this situation to ensure that the QUERIED flag is masked. Signed-off-by: Jeff Layton --- fs/nfsd/nfsfh.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c index ccd8485fee04..f053cf20dd8a 100644 --- a/fs/nfsd/nfsfh.c +++ b/fs/nfsd/nfsfh.c @@ -624,9 +624,14 @@ void fh_fill_pre_attrs(struct svc_fh *fhp) inode = d_inode(fhp->fh_dentry); err = fh_getattr(fhp, &stat); if (err) { - /* Grab the times from inode anyway */ + /* + * Grab the times from inode anyway. + * + * FIXME: is this the right thing to do? Or should we just + * not send pre and post-op attrs in this case? + */ stat.mtime = inode->i_mtime; - stat.ctime = inode->i_ctime; + stat.ctime = ctime_peek(inode); stat.size = inode->i_size; if (v4 && IS_I_VERSION(inode)) { stat.change_cookie = inode_query_iversion(inode); @@ -662,7 +667,7 @@ void fh_fill_post_attrs(struct svc_fh *fhp) err = fh_getattr(fhp, &fhp->fh_post_attr); if (err) { fhp->fh_post_saved = false; - fhp->fh_post_attr.ctime = inode->i_ctime; + fhp->fh_post_attr.ctime = ctime_peek(inode); if (v4 && IS_I_VERSION(inode)) { fhp->fh_post_attr.change_cookie = inode_query_iversion(inode); fhp->fh_post_attr.result_mask |= STATX_CHANGE_COOKIE;