From patchwork Tue Aug 16 13:27:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 598110 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 56D58C25B0E for ; Tue, 16 Aug 2022 13:28:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235737AbiHPN2R (ORCPT ); Tue, 16 Aug 2022 09:28:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235650AbiHPN2I (ORCPT ); Tue, 16 Aug 2022 09:28:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F789E0D9; Tue, 16 Aug 2022 06:28:05 -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 E8751B81A1D; Tue, 16 Aug 2022 13:28:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5AA0C433B5; Tue, 16 Aug 2022 13:28:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660656482; bh=nK6rZB7MR8WlZXGgPQEe81a25J6Ko0zNfN9PA6j1OIc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d2Qf9sWJJ+jKzenoJEsjO5kXUBEvENGb/9K4adHHsqbTpBz+ve0QewCxtr8rJC0xv ALR36IRznlrw5ZpP2+XCQ0nh3JHgqdD5Z1M0gg/3YlYuloIn4mwhNO1tmYPEO7nERy yo5jz3GRJDqa4uPS7zAfu6LdvMTMYxgFI+jdaQAVn96pw+jnSVVSPRT4mDfo6Ij0TP FXHQIqxVlGTNeKKlwACRArrzi/+flL74w1wJX6ikPsG/X9E4R3xVBRNNVoCu+tUfcu yWrRIMka+Jfc3ND/gHKNkGcLtGnzaeBs0xDkxQNY08hBHFM9aGQsDTmq69xEVBf3bA +VCWPp1ZxmAUA== 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, Jeff Layton Subject: [PATCH 1/4] vfs: report change attribute in statx for IS_I_VERSION inodes Date: Tue, 16 Aug 2022 09:27:56 -0400 Message-Id: <20220816132759.43248-2-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 From: Jeff Layton Claim one of the spare fields in struct statx to hold a 64-bit change attribute. When statx requests this attribute, do an inode_query_iversion and fill the result in the field. Also update the test-statx.c program to display the change attribute and the mountid as well. Signed-off-by: Jeff Layton --- fs/stat.c | 7 +++++++ include/linux/stat.h | 1 + include/uapi/linux/stat.h | 3 ++- samples/vfs/test-statx.c | 8 ++++++-- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/fs/stat.c b/fs/stat.c index 9ced8860e0f3..7c3d063c31ba 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -118,6 +119,11 @@ int vfs_getattr_nosec(const struct path *path, struct kstat *stat, stat->attributes_mask |= (STATX_ATTR_AUTOMOUNT | STATX_ATTR_DAX); + if ((request_mask & STATX_CHANGE_ATTR) && IS_I_VERSION(inode)) { + stat->result_mask |= STATX_CHANGE_ATTR; + stat->change_attr = inode_query_iversion(inode); + } + mnt_userns = mnt_user_ns(path->mnt); if (inode->i_op->getattr) return inode->i_op->getattr(mnt_userns, path, stat, @@ -611,6 +617,7 @@ cp_statx(const struct kstat *stat, struct statx __user *buffer) tmp.stx_dev_major = MAJOR(stat->dev); tmp.stx_dev_minor = MINOR(stat->dev); tmp.stx_mnt_id = stat->mnt_id; + tmp.stx_change_attr = stat->change_attr; return copy_to_user(buffer, &tmp, sizeof(tmp)) ? -EFAULT : 0; } diff --git a/include/linux/stat.h b/include/linux/stat.h index 7df06931f25d..7b444c2ad0ad 100644 --- a/include/linux/stat.h +++ b/include/linux/stat.h @@ -50,6 +50,7 @@ struct kstat { struct timespec64 btime; /* File creation time */ u64 blocks; u64 mnt_id; + u64 change_attr; }; #endif diff --git a/include/uapi/linux/stat.h b/include/uapi/linux/stat.h index 1500a0f58041..fd839ec76aa4 100644 --- a/include/uapi/linux/stat.h +++ b/include/uapi/linux/stat.h @@ -124,7 +124,7 @@ struct statx { __u32 stx_dev_minor; /* 0x90 */ __u64 stx_mnt_id; - __u64 __spare2; + __u64 stx_change_attr; /* Inode change attribute */ /* 0xa0 */ __u64 __spare3[12]; /* Spare space for future expansion */ /* 0x100 */ @@ -152,6 +152,7 @@ struct statx { #define STATX_BASIC_STATS 0x000007ffU /* The stuff in the normal stat struct */ #define STATX_BTIME 0x00000800U /* Want/got stx_btime */ #define STATX_MNT_ID 0x00001000U /* Got stx_mnt_id */ +#define STATX_CHANGE_ATTR 0x00002000U /* Want/got stx_change_attr */ #define STATX__RESERVED 0x80000000U /* Reserved for future struct statx expansion */ diff --git a/samples/vfs/test-statx.c b/samples/vfs/test-statx.c index 49c7a46cee07..b104909721c4 100644 --- a/samples/vfs/test-statx.c +++ b/samples/vfs/test-statx.c @@ -107,6 +107,8 @@ static void dump_statx(struct statx *stx) printf("Device: %-15s", buffer); if (stx->stx_mask & STATX_INO) printf(" Inode: %-11llu", (unsigned long long) stx->stx_ino); + if (stx->stx_mask & STATX_MNT_ID) + printf(" MountId: %llx"), stx->stx_mnt_id; if (stx->stx_mask & STATX_NLINK) printf(" Links: %-5u", stx->stx_nlink); if (stx->stx_mask & STATX_TYPE) { @@ -145,7 +147,9 @@ static void dump_statx(struct statx *stx) if (stx->stx_mask & STATX_CTIME) print_time("Change: ", &stx->stx_ctime); if (stx->stx_mask & STATX_BTIME) - print_time(" Birth: ", &stx->stx_btime); + print_time("Birth: ", &stx->stx_btime); + if (stx->stx_mask & STATX_CHANGE_ATTR) + printf(" Change Attr: 0x%llx\n", stx->stx_change_attr); if (stx->stx_attributes_mask) { unsigned char bits, mbits; @@ -218,7 +222,7 @@ int main(int argc, char **argv) struct statx stx; int ret, raw = 0, atflag = AT_SYMLINK_NOFOLLOW; - unsigned int mask = STATX_BASIC_STATS | STATX_BTIME; + unsigned int mask = STATX_BASIC_STATS | STATX_BTIME | STATX_MNT_ID | STATX_CHANGE_ATTR; for (argv++; *argv; argv++) { if (strcmp(*argv, "-F") == 0) { From patchwork Tue Aug 16 13:27:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 598111 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 EE69EC32789 for ; Tue, 16 Aug 2022 13:28:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235720AbiHPN2N (ORCPT ); Tue, 16 Aug 2022 09:28:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235621AbiHPN2F (ORCPT ); Tue, 16 Aug 2022 09:28:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88209100B; Tue, 16 Aug 2022 06:28:04 -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 1842261389; Tue, 16 Aug 2022 13:28:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1725C433D7; Tue, 16 Aug 2022 13:28:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660656483; bh=cTr5A+pQEYd+LPQGgUFgls+hS7mB/Fi2JYqeZ2/L04E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C7ZCBf8imhM0/fi+Bb6NfnLwMInuUNICHVhP9lUxDn6lB576or/Oh0WkgeJIjOMhR Qpihrx/Ab8JhsIeG8ZcCAIHVkRRrC+6mrhkTIL88iA+zQHJX74GZbTHHI/b7fu5xyr K6vZQqIaxkYKT+qPXYXU+np/4RJEN6NkViu3FneJ1P9mFF/NQpw2t6HK/6Or1nvZDL z9Aykd7jAwAdPWpULqjHi3zKtqx/M6x/G2ABx5+uejQzjjFdwAuHsx4nyVjBF0jx1K 4B0f3+3Dfe9KLqn5SDJLMBLoetft6m6dO66gT58EobehZ0ED85j3AvAF+hGX6JBEZO MBxUydG8+1Dqw== 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 Subject: [PATCH 2/4] nfs: report the change attribute if requested Date: Tue, 16 Aug 2022 09:27:57 -0400 Message-Id: <20220816132759.43248-3-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 Allow NFS to report the i_version in statx. Since the cost to fetch it is relatively cheap, do it unconditionally and just set the flag if it looks like it's valid. Signed-off-by: Jeff Layton --- fs/nfs/inode.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index b4e46b0ffa2d..43e23ec2a64d 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -829,6 +829,8 @@ static u32 nfs_get_valid_attrmask(struct inode *inode) reply_mask |= STATX_UID | STATX_GID; if (!(cache_validity & NFS_INO_INVALID_BLOCKS)) reply_mask |= STATX_BLOCKS; + if (!(cache_validity & NFS_INO_INVALID_CHANGE)) + reply_mask |= STATX_CHANGE_ATTR; return reply_mask; } @@ -847,7 +849,7 @@ int nfs_getattr(struct user_namespace *mnt_userns, const struct path *path, request_mask &= STATX_TYPE | STATX_MODE | STATX_NLINK | STATX_UID | STATX_GID | STATX_ATIME | STATX_MTIME | STATX_CTIME | - STATX_INO | STATX_SIZE | STATX_BLOCKS; + STATX_INO | STATX_SIZE | STATX_BLOCKS | STATX_CHANGE_ATTR; if ((query_flags & AT_STATX_DONT_SYNC) && !force_sync) { if (readdirplus_enabled) @@ -876,7 +878,7 @@ int nfs_getattr(struct user_namespace *mnt_userns, const struct path *path, /* Is the user requesting attributes that might need revalidation? */ if (!(request_mask & (STATX_MODE|STATX_NLINK|STATX_ATIME|STATX_CTIME| STATX_MTIME|STATX_UID|STATX_GID| - STATX_SIZE|STATX_BLOCKS))) + STATX_SIZE|STATX_BLOCKS|STATX_CHANGE_ATTR))) goto out_no_revalidate; /* Check whether the cached attributes are stale */ @@ -914,6 +916,7 @@ int nfs_getattr(struct user_namespace *mnt_userns, const struct path *path, generic_fillattr(&init_user_ns, inode, stat); stat->ino = nfs_compat_user_ino64(NFS_FILEID(inode)); + stat->change_attr = inode_peek_iversion_raw(inode); if (S_ISDIR(inode->i_mode)) stat->blksize = NFS_SERVER(inode)->dtsize; out: From patchwork Tue Aug 16 13:27:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 597547 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 564DFC32774 for ; Tue, 16 Aug 2022 13:28:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235744AbiHPN2U (ORCPT ); Tue, 16 Aug 2022 09:28:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235651AbiHPN2I (ORCPT ); Tue, 16 Aug 2022 09:28:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33B35BF5E; 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 7AE5EB81A20; Tue, 16 Aug 2022 13:28:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA329C43470; Tue, 16 Aug 2022 13:28:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660656484; bh=2zSq9xhOslR+RZJl6daUuNMh3IFMdGv5GllfBZ7aAAE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H16bZ/ckNdffuwx6HGPkIjwjJoljvvuzvGOhu0ca0IqboR3xgmGklyR4TTtXN8bbU fWZcbVmyWifkrdZmEp3wUprf+mJgmxd8U6X2sAaegdKlcseI5Be6m3sbEBy/mtJiXi iKQRtQethI7SPJIMZ3sYA9NNGQodbNnP6libeiNo4JXZL3eOBU6zfgRSyqgepjTnYH b4s4wu8vOASbxm5i7DEy2+6QJfm2niMJm+BLqSLyftB8D+wWJUy5Vu2JqmAi4B9pjy 64As5PorAlpXYxXiLu/3Mhqm49nOrwyIzkzVGnX4nvGUJ+h4zYILErMQX/DnfiEDDY e/vHg9/ZBE/kA== 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 Subject: [PATCH 3/4] afs: fill out change attribute in statx replies Date: Tue, 16 Aug 2022 09:27:58 -0400 Message-Id: <20220816132759.43248-4-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 Always copy the change attribute in a statx reply, and set the STATX_CHGATTR bit unconditionally. Signed-off-by: Jeff Layton --- fs/afs/inode.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/afs/inode.c b/fs/afs/inode.c index 6d3a3dbe4928..bc65cc2dd2d5 100644 --- a/fs/afs/inode.c +++ b/fs/afs/inode.c @@ -762,6 +762,8 @@ int afs_getattr(struct user_namespace *mnt_userns, const struct path *path, do { read_seqbegin_or_lock(&vnode->cb_lock, &seq); generic_fillattr(&init_user_ns, inode, stat); + stat->change_attr = inode_peek_iversion_raw(inode); + stat->result_mask |= STATX_CHANGE_ATTR; if (test_bit(AFS_VNODE_SILLY_DELETED, &vnode->flags) && stat->nlink > 0) stat->nlink -= 1; 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