Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 444F747A0B7; Wed, 1 Apr 2026 14:41:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775054473; cv=none; b=aQuyUWOldSRwmBbKL47uJNKJYYBVysVnneycxcRzIBPT61a8ssyPjjHdR2cr/kOe8nVgmEbTg9ig6HF6N93HeaJa+iD/wydtdlgw6IJ1o4zocE8NpZfRRbdhapzf3GE5cRiiN7uqqwfG+IUIE92oirCB7yP6T1MP4cdExsTywrs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775054473; c=relaxed/simple; bh=CsQIt4rrcqbUyJIevTieiMJVaS5ujztb4O4ap5rGSYQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hUNi7nmZC/eAMgDYfPpNWyH3kf/sq73daZOkPCVIWzZCNavbrSNcEDNYVHltVq0BsI28nX6dMAbeFwuMqam6MLFdahIXkHgnBxb4Oi17O+4CHdPw8oOQHjnS/ORYvc5EaS5zUZtBdc4qkMVN94FwMBWx2I82hhvIfrJ5ESGj2Vo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=MQ+nMyQj; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="MQ+nMyQj" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=5N9sq4ehrSVxYOuHl/SZW1mE9RtMm40ldsKZtLoNhJo=; b=MQ+nMyQjlXEHdW7hd/aAzL7Izn kBiwboxP9zkFpDTuH8ed7qYuOvNUUYnnVhKyVFlUyVr8YcYChQkJH4H5N83k+r639gMui9UWGpAKr ocYnqE9wHkKQhsfgRn+q/z6VhCTr4I/zdYLi1zg5Y8/Df+JCnFynJxqZPxlAAVr48RJBTJnSMufoO tEVpQ3xb9kgw4FPEa9o3g7RI6mYeTeY4/GPe9kQIr2cMjeSU+HW7Yh9acJQyM410/QovqvQLNy9YG ksBKrnN21Rgms9E8ileNhZQIHKZK2AWZSYakrqVMVhEu3hx4YsmXAFMREvwjt+ISFa+1EPVrVvR5d h2hV32kA==; Received: from [2a02:1210:321a:af00:3fa:89ae:5c22:a910] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1w7wkm-0000000FWGn-2aHT; Wed, 01 Apr 2026 14:41:08 +0000 From: Christoph Hellwig To: Chuck Lever , Jeff Layton , Amir Goldstein Cc: NeilBrown , Olga Kornievskaia , Dai Ngo , Tom Talpey , linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 1/4] nfsd/blocklayout: always ignore loca_time_modify Date: Wed, 1 Apr 2026 16:40:22 +0200 Message-ID: <20260401144059.160746-2-hch@lst.de> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260401144059.160746-1-hch@lst.de> References: <20260401144059.160746-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html RFC 8881 Section 18.42 makes it clear that the client provided timestamp is a "may" condition, and clients that want to force a specific timestamp should send a separate SETATTR in the compound. Since commit b82f92d5dd1a ("fs: have setattr_copy handle multigrain timestamps appropriately") the ia_mtime value is ignored by file systems using multi-grain timestamps like XFS, which is the only file system supporting blocklayout exports right now, so make that explicit in NFSD as well. Signed-off-by: Christoph Hellwig Reviewed-by: Jeff Layton --- fs/nfsd/blocklayout.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/fs/nfsd/blocklayout.c b/fs/nfsd/blocklayout.c index a7cfba29990e..5ee5735b39bb 100644 --- a/fs/nfsd/blocklayout.c +++ b/fs/nfsd/blocklayout.c @@ -179,15 +179,20 @@ static __be32 nfsd4_block_commit_blocks(struct inode *inode, struct nfsd4_layoutcommit *lcp, struct iomap *iomaps, int nr_iomaps) { - struct timespec64 mtime = inode_get_mtime(inode); struct iattr iattr = { .ia_valid = 0 }; int error; - if (lcp->lc_mtime.tv_nsec == UTIME_NOW || - timespec64_compare(&lcp->lc_mtime, &mtime) < 0) - lcp->lc_mtime = current_time(inode); + /* + * This ignores the client provided mtime in loca_time_modify, as a + * fully client specified mtime doesn't really fit into the Linux + * multi-grain timestamp architecture. + * + * RFC 8881 Section 18.42 makes it clear that the client provided + * timestamp is a "may" condition, and clients that want to force a + * specific timestamp should send a separate SETATTR in the compound. + */ iattr.ia_valid |= ATTR_ATIME | ATTR_CTIME | ATTR_MTIME; - iattr.ia_atime = iattr.ia_ctime = iattr.ia_mtime = lcp->lc_mtime; + iattr.ia_atime = iattr.ia_ctime = iattr.ia_mtime = current_time(inode); if (lcp->lc_size_chg) { iattr.ia_valid |= ATTR_SIZE; -- 2.47.3