Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp442092iog; Mon, 13 Jun 2022 06:05:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZem9o9dCRyxqruDZlgSGrgFzuHuxeQYNEnuRueiIemdUp7NtYxazf87ahdW236cxiLyMr X-Received: by 2002:a62:d045:0:b0:51b:fcf6:3add with SMTP id p66-20020a62d045000000b0051bfcf63addmr46151541pfg.68.1655125412393; Mon, 13 Jun 2022 06:03:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655125412; cv=none; d=google.com; s=arc-20160816; b=cghrYW7HA8UOfDnGwBNHQKAr7S5lQAtt+CgFtFxZfsPX+u8NjYeQjWScPhX93Gq+K8 +HlTXXAoarOXxTVgRtsZTNVYMoRQMmosX/rEckrxQT8DyanjN6o3kmSsqNq8u3FmmLY6 DnSuRMNVL01aQkvjrRzxaYtqAko1yJLKv9kqiKyToo+KDkOWXKIqhQCCZePiFUZk/Bkc PjZ22ti0maifyDNS+8gBNzoNyWUfxYGjSEBvORSZgt6/DGPM5kiuQkdS2VcC1FEtgqFe +e78XBgj+Lv0sjIXpzU6oCqQ8B2lhcQw6Yr5GMUobZcMWZyD6Z0i3T/CoOKehEp1hm6b HAvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IuRMq9L1hgchtBOcTiVgLJg7ZY0/J8d79NTQE8S0lvk=; b=SVEzup6NGmgAMITHearn1QqXZHF/Ktlt5rkeei9cWT8XX+jtJf1W9tMuQxS3DiJ1+P EzslRxtKe5FTOZ85xx4JqfWm5YVyN84LPJ5hIF2yATO3L8XB2iTNad7fI4qofymTRRIT UQ4uNcAgbBxx3jg+RqGOS9xZkOg8fKQ3aT6rp9cnnh7W6Ve8Ad3BMu2pub5l1VQx4dYL 0GArhJaulYSxdbFr0Zf0EbjRTYLAOJzxH73m43iKj3zOTMN3R4K0O+HY+Uqt3A5Vim9W rdBx0RlwRFaX7yEWrthkZHAubXf3AdZSv4Wr8jWy1AtN5nptjzPpNt6uBOr26Um+057F Ex/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LIB6Y1rP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i24-20020a17090ad35800b001e00edc0c6csi11928926pjx.121.2022.06.13.06.03.16; Mon, 13 Jun 2022 06:03:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LIB6Y1rP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356900AbiFMLv6 (ORCPT + 99 others); Mon, 13 Jun 2022 07:51:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357515AbiFMLqS (ORCPT ); Mon, 13 Jun 2022 07:46:18 -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 F25F8DFE0; Mon, 13 Jun 2022 03:52:29 -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 0AAF9B80D3A; Mon, 13 Jun 2022 10:52:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71382C34114; Mon, 13 Jun 2022 10:52:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655117546; bh=hMR4mJxRTbcnFioLYn9YBF9bnoQ3ApVCooUwafH/D54=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LIB6Y1rPLR+1U0iQ1tiBqrUMbdPwdfsxUn4m6G1UuXTyNrax6g0xm0ARoHjudlUAt v3ujXqgw2ggi8k3AC4ncCuv9E/z4wClq3IGblC+qSybCjdeQIcZFtiyNJSSgQrdoFb Lc4MSNeH/prxrWbJ/xLA0GBgiUZO6fai5gp4L4oU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Venky Shankar , Xiubo Li , Ilya Dryomov , Sasha Levin Subject: [PATCH 5.4 388/411] ceph: allow ceph.dir.rctime xattr to be updatable Date: Mon, 13 Jun 2022 12:11:01 +0200 Message-Id: <20220613094940.305918929@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094928.482772422@linuxfoundation.org> References: <20220613094928.482772422@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Venky Shankar [ Upstream commit d7a2dc523085f8b8c60548ceedc696934aefeb0e ] `rctime' has been a pain point in cephfs due to its buggy nature - inconsistent values reported and those sorts. Fixing rctime is non-trivial needing an overall redesign of the entire nested statistics infrastructure. As a workaround, PR http://github.com/ceph/ceph/pull/37938 allows this extended attribute to be manually set. This allows users to "fixup" inconsistent rctime values. While this sounds messy, its probably the wisest approach allowing users/scripts to workaround buggy rctime values. The above PR enables Ceph MDS to allow manually setting rctime extended attribute with the corresponding user-land changes. We may as well allow the same to be done via kclient for parity. Signed-off-by: Venky Shankar Reviewed-by: Xiubo Li Signed-off-by: Ilya Dryomov Signed-off-by: Sasha Levin --- fs/ceph/xattr.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c index cb18ee637cb7..4bcf0226818d 100644 --- a/fs/ceph/xattr.c +++ b/fs/ceph/xattr.c @@ -316,6 +316,14 @@ static ssize_t ceph_vxattrcb_snap_btime(struct ceph_inode_info *ci, char *val, } #define XATTR_RSTAT_FIELD(_type, _name) \ XATTR_NAME_CEPH(_type, _name, VXATTR_FLAG_RSTAT) +#define XATTR_RSTAT_FIELD_UPDATABLE(_type, _name) \ + { \ + .name = CEPH_XATTR_NAME(_type, _name), \ + .name_size = sizeof (CEPH_XATTR_NAME(_type, _name)), \ + .getxattr_cb = ceph_vxattrcb_ ## _type ## _ ## _name, \ + .exists_cb = NULL, \ + .flags = VXATTR_FLAG_RSTAT, \ + } #define XATTR_LAYOUT_FIELD(_type, _name, _field) \ { \ .name = CEPH_XATTR_NAME2(_type, _name, _field), \ @@ -353,7 +361,7 @@ static struct ceph_vxattr ceph_dir_vxattrs[] = { XATTR_RSTAT_FIELD(dir, rfiles), XATTR_RSTAT_FIELD(dir, rsubdirs), XATTR_RSTAT_FIELD(dir, rbytes), - XATTR_RSTAT_FIELD(dir, rctime), + XATTR_RSTAT_FIELD_UPDATABLE(dir, rctime), { .name = "ceph.dir.pin", .name_size = sizeof("ceph.dir.pin"), -- 2.35.1