From patchwork Tue Aug 16 13:27:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 597548 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 6024DC2BB41 for ; Tue, 16 Aug 2022 13:28:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235732AbiHPN2P (ORCPT ); Tue, 16 Aug 2022 09:28:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235572AbiHPN2J (ORCPT ); Tue, 16 Aug 2022 09:28:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3B87286F1; Tue, 16 Aug 2022 06:28:07 -0700 (PDT) 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 873A4B81A21; Tue, 16 Aug 2022 13:28:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83B01C433D6; Tue, 16 Aug 2022 13:28:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660656485; bh=WDIrsbOP3njOorYL2sAcnE2hJpRqVDbN3dfL/42j+/g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HVXEtDS1FUczDN+l+uPOQ1A17CtM836+UL6FweXJxLsSedwHBKlj49XpUpCWqsffD 5phGdeY4c97Pf107QATwIK3IAbBlnnvOyU0Bzes6Ts0IreSlWbuymrDYkKIYQM8iLM 1KhhhQolM4UlbnnaU9TiGSE3Yy4HJ2cuPozOffK9jlL27eHpi3N7VtS1BPt/EhyXY7 FI6fI/eytYM/dF/7YlWuXi0SGlEIP7ZxZCuG3lU6h57CZ8VLBUT8WudXyFR0SDtuDJ DcGE3z1LTKj0kZcnrII9XtSk/TdEHcUfjpnn6eWXupKXwV0V8fFUBJ4LmGf6k0XI30 OHRZ87O9E/pgg== From: Jeff Layton To: viro@zeniv.linux.org.uk Cc: dhowells@redhat.com, linux-afs@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, Xiubo Li Subject: [PATCH 4/4] ceph: fill in the change attribute in statx requests Date: Tue, 16 Aug 2022 09:27:59 -0400 Message-Id: <20220816132759.43248-5-jlayton@kernel.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220816132759.43248-1-jlayton@kernel.org> References: <20220816132759.43248-1-jlayton@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org When statx requests the change attribute, request the full gamut of caps (similarly to how ctime is handled). When the change attribute seems to be valid, return it in the chgattr field. Reviewed-by: Xiubo Li Signed-off-by: Jeff Layton --- fs/ceph/inode.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 42351d7a0dd6..171a32d623d2 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -2415,10 +2415,10 @@ static int statx_to_caps(u32 want, umode_t mode) { int mask = 0; - if (want & (STATX_MODE|STATX_UID|STATX_GID|STATX_CTIME|STATX_BTIME)) + if (want & (STATX_MODE|STATX_UID|STATX_GID|STATX_CTIME|STATX_BTIME|STATX_CHANGE_ATTR)) mask |= CEPH_CAP_AUTH_SHARED; - if (want & (STATX_NLINK|STATX_CTIME)) { + if (want & (STATX_NLINK|STATX_CTIME|STATX_CHANGE_ATTR)) { /* * The link count for directories depends on inode->i_subdirs, * and that is only updated when Fs caps are held. @@ -2429,11 +2429,10 @@ static int statx_to_caps(u32 want, umode_t mode) mask |= CEPH_CAP_LINK_SHARED; } - if (want & (STATX_ATIME|STATX_MTIME|STATX_CTIME|STATX_SIZE| - STATX_BLOCKS)) + if (want & (STATX_ATIME|STATX_MTIME|STATX_CTIME|STATX_SIZE|STATX_BLOCKS|STATX_CHANGE_ATTR)) mask |= CEPH_CAP_FILE_SHARED; - if (want & (STATX_CTIME)) + if (want & (STATX_CTIME|STATX_CHANGE_ATTR)) mask |= CEPH_CAP_XATTR_SHARED; return mask; @@ -2475,6 +2474,11 @@ int ceph_getattr(struct user_namespace *mnt_userns, const struct path *path, valid_mask |= STATX_BTIME; } + if (request_mask & STATX_CHANGE_ATTR) { + stat->change_attr = inode_peek_iversion_raw(inode); + valid_mask |= STATX_CHANGE_ATTR; + } + if (ceph_snap(inode) == CEPH_NOSNAP) stat->dev = inode->i_sb->s_dev; else