From patchwork Fri Aug 26 21:47:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 12956654 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 7528EECAAD8 for ; Fri, 26 Aug 2022 21:48:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345250AbiHZVsK (ORCPT ); Fri, 26 Aug 2022 17:48:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345138AbiHZVrp (ORCPT ); Fri, 26 Aug 2022 17:47:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 094F7C1238; Fri, 26 Aug 2022 14:47:23 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 1B16961263; Fri, 26 Aug 2022 21:47:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A57D2C433D6; Fri, 26 Aug 2022 21:47:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661550442; bh=ZydurCuLzapRGFyWJI85NhF2aLujGUa2gLgGqkVQHyE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C0MP5yczCW10cEg2fuzMkr9K18obBVZpV8hZ2R4kfD8qylNUTFWFRh36U6whsE3QP YKHeck7V4g1+VAMdzhqTwGsohjrvw3G/4XtlJ/3lwXr3FuYsE2XA2FNd5D22gMUFWd ZE5BcmJPcBgb8t9d7qPKOC99ELQnfB0fFXckYq8BunFEtw5UcbhWB1UUPNaVynb9xW YUQgJqWRvF/0Kh762nDw98e4SWG2+SS9eyrGk8ftK0MfPYsmBGMSV5rvkMkjgF4Li9 YYv+hBzjnR9EQetQUsFsJrJ90cgfIfmRxe+CsSa4O0YFo3g+eb6tpAiu4Mh8+zQ94/ I9sHTtMClJJbg== From: Jeff Layton To: tytso@mit.edu, adilger.kernel@dilger.ca, djwong@kernel.org, david@fromorbit.com, trondmy@hammerspace.com, neilb@suse.de, viro@zeniv.linux.org.uk, zohar@linux.ibm.com, xiubli@redhat.com, chuck.lever@oracle.com, lczerner@redhat.com, jack@suse.cz, brauner@kernel.org Cc: linux-api@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ceph@vger.kernel.org, linux-ext4@vger.kernel.org, linux-nfs@vger.kernel.org, linux-xfs@vger.kernel.org Subject: [PATCH v3 7/7] ceph: fill in the change attribute in statx requests Date: Fri, 26 Aug 2022 17:47:03 -0400 Message-Id: <20220826214703.134870-8-jlayton@kernel.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220826214703.134870-1-jlayton@kernel.org> References: <20220826214703.134870-1-jlayton@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@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 ino_version 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..ccc926a7dcb0 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_INO_VERSION)) mask |= CEPH_CAP_AUTH_SHARED; - if (want & (STATX_NLINK|STATX_CTIME)) { + if (want & (STATX_NLINK|STATX_CTIME|STATX_INO_VERSION)) { /* * 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_INO_VERSION)) mask |= CEPH_CAP_FILE_SHARED; - if (want & (STATX_CTIME)) + if (want & (STATX_CTIME|STATX_INO_VERSION)) 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_INO_VERSION) { + stat->ino_version = inode_peek_iversion_raw(inode); + valid_mask |= STATX_INO_VERSION; + } + if (ceph_snap(inode) == CEPH_NOSNAP) stat->dev = inode->i_sb->s_dev; else