From patchwork Wed Jul 26 14:10:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 126459 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp484145vqo; Wed, 26 Jul 2023 08:34:38 -0700 (PDT) X-Google-Smtp-Source: APBJJlE15CvGENbksHRKnbmpwOY59WWI9n+GeUeKC3F50KQ6gLRbTuf7vvPG1+OmSggPp/U/c3sY X-Received: by 2002:a05:6a00:c93:b0:67e:bf65:ae68 with SMTP id a19-20020a056a000c9300b0067ebf65ae68mr2468919pfv.3.1690385678476; Wed, 26 Jul 2023 08:34:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690385678; cv=none; d=google.com; s=arc-20160816; b=z8aZkvDDVgPFVW/K3SJBZoX9+tJdYxrU55wNQhVxJnKxbJiU32DW25GjZvUjR8amew XQPODY7elIzPobZC+BZZYN4JDYBHY7JxQ+AC25yUf+2sxJasudMnJPLhvnQAUFrBpY0s AXtm+uodCJhEWvgJ+CJI8M7AgSTa8Liwcf8POaFZmx4LOzm0yLOh4439UnrdrPfK5KpT xr+R/FO0wJhIKSRH0gvIQ/Ny+qJuXJCjTo1cMdcAjn6uSmscVxEOtJlc2kw03jwnoeBz 4Nma1gVgK2YEdIre/Ct0JKo8MsxWaRpHHDqpzuY4GsUr7V6EbtWeK3g8THuFZ/ep+Rja Io3Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GFNwWvhavDkNrI4eqwez7OWrv+w+Iw1WNhnwQW/Fw7E=; fh=0hEZqZysaqRii9oPb0PwkVGpwiTSSI2s9+F6mN71kBs=; b=iIJg07lSe7TcfVXekKSKUiULlijVTjdeuZ1PYOK4tfDhn9zL1cLRYiK28bIOzEimmF evByI9oE6YbmThtgEqOI2LTkJyxZYGnUpUDmDlDmMR1Ylnr5axQGqLRW/vhDxEoyQ+4c freYb87U04ZsWW77wHD4d1+3JBNTEB3dF+al5EfeZfgZ/qEUwbLxKB9Q3/NyxYkArLHK +dARUBbqF2EKfWtxNr7YSfcIdlq/ErWqYFKWpPM2KE74N6aO1GZaZol8LzLvxr8fmwvY komSebPR5K+09eZ7qcJFoUZzG5dgbH6etnHgvuPf4VXygs9wl6ltsAWLocgq8UXG81Jw qYfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=Mgrx7z6y; 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=canonical.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d5-20020a056a0010c500b006863085981esi13461972pfu.68.2023.07.26.08.34.24; Wed, 26 Jul 2023 08:34:38 -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=@canonical.com header.s=20210705 header.b=Mgrx7z6y; 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=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233015AbjGZOMJ (ORCPT + 99 others); Wed, 26 Jul 2023 10:12:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233828AbjGZOLq (ORCPT ); Wed, 26 Jul 2023 10:11:46 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0F603A9A for ; Wed, 26 Jul 2023 07:11:01 -0700 (PDT) Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 6D3BB420BE for ; Wed, 26 Jul 2023 14:10:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380637; bh=GFNwWvhavDkNrI4eqwez7OWrv+w+Iw1WNhnwQW/Fw7E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Mgrx7z6yozfoTxgYHpGQiGQPM71+PsK2RzMgfb8SNzC7G9O2EttikVb8iicd917Rh FCUDWAlcs3ns7vp9dvC/LsCpMgtC+6KyA7pDL/3VVgrAztkRmeZ84MgGFgpm6H+m+E 0QtHQCzVFgRpe6FlWvnP1fT6MS7+e/11P4fl61pGMuuFrkYobc93DGKZ63KkGyi0OQ Q8hARDkrUJiBpQdGzSkWWp1sHOQUOkHcYJvripPwF6wFk+SKAOwyCVGEgJEMuyTV+s SvElTwRQ6Wu8I+qhRBCSbejshJPMAnC9jsOO5ClCT9cQTuptVr1Hvbxxdm6KBVx+xB TBfwipjVyRfcw== Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-3fc0855dcc5so33936755e9.2 for ; Wed, 26 Jul 2023 07:10:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380637; x=1690985437; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GFNwWvhavDkNrI4eqwez7OWrv+w+Iw1WNhnwQW/Fw7E=; b=ZF4El+VdTXS9FgRZBwqVe2Uq9Bt7yWr+klTWRlFuLwTFIn0czPXnTVUGvq1Jb18LmF YS4hTMaSEXg/0PaHaI7Op+POD04YlFjPP8aRQXMJMXomwuzE+sHDPiOFR77T0rVV8PRD HtzOAus6kV0VJ9keqi2U5QfVhVx5YuD2RsuEervWNYnjlOl6tHZ8up9lc6ym12R6AVMV oizaRG3TFm+PRhqdwze1iJtFiRkcWg6z6fjcBPoWUeMjLgtl5QpQ5dkVdaf1vlAAHk0s Ifys9B0ExPe/8md70Ee404MUYmYKsKtjVDmpK4yMx+tA4aHXkb5tJo7DUzbTxE5NHRPC HYvQ== X-Gm-Message-State: ABy/qLbRmguNh8+nNFB1IXKK9/WwsdiJpO/Gu98PGsE8/V1xmC9QCx9F BaHXsY7WmYJD7oVU7AOYEqoh5+RO7XunFNDbAPIGDAbAZgF8NSDacKrOLWIGw9AOygzDRuzzH+f FIlvIYre6xfN8UfhhAKvb34EKEzfiLEdD5MZ7SCi5nA== X-Received: by 2002:a05:600c:2299:b0:3fc:1f8:41f1 with SMTP id 25-20020a05600c229900b003fc01f841f1mr1600051wmf.1.1690380636977; Wed, 26 Jul 2023 07:10:36 -0700 (PDT) X-Received: by 2002:a05:600c:2299:b0:3fc:1f8:41f1 with SMTP id 25-20020a05600c229900b003fc01f841f1mr1600034wmf.1.1690380636714; Wed, 26 Jul 2023 07:10:36 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-066-182-192.088.066.pools.vodafone-ip.de. [88.66.182.192]) by smtp.gmail.com with ESMTPSA id k14-20020a7bc30e000000b003fc02219081sm2099714wmj.33.2023.07.26.07.10.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:10:36 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Alexander Mikhalitsyn , Alexander Viro , Seth Forshee , linux-kernel@vger.kernel.org Subject: [PATCH v7 01/11] fs: export mnt_idmap_get/mnt_idmap_put Date: Wed, 26 Jul 2023 16:10:16 +0200 Message-Id: <20230726141026.307690-2-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772497853387478548 X-GMAIL-MSGID: 1772497853387478548 These helpers are required to support idmapped mounts in the Cephfs. Cc: Christian Brauner Cc: Xiubo Li Cc: Jeff Layton Cc: Ilya Dryomov Cc: ceph-devel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org Signed-off-by: Alexander Mikhalitsyn Reviewed-by: Christian Brauner --- v3: - EXPORT_SYMBOL -> EXPORT_SYMBOL_GPL as Christoph Hellwig suggested --- fs/mnt_idmapping.c | 2 ++ include/linux/mnt_idmapping.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/fs/mnt_idmapping.c b/fs/mnt_idmapping.c index 4905665c47d0..57d1dedf3f8f 100644 --- a/fs/mnt_idmapping.c +++ b/fs/mnt_idmapping.c @@ -256,6 +256,7 @@ struct mnt_idmap *mnt_idmap_get(struct mnt_idmap *idmap) return idmap; } +EXPORT_SYMBOL_GPL(mnt_idmap_get); /** * mnt_idmap_put - put a reference to an idmapping @@ -271,3 +272,4 @@ void mnt_idmap_put(struct mnt_idmap *idmap) kfree(idmap); } } +EXPORT_SYMBOL_GPL(mnt_idmap_put); diff --git a/include/linux/mnt_idmapping.h b/include/linux/mnt_idmapping.h index 057c89867aa2..b8da2db4ecd2 100644 --- a/include/linux/mnt_idmapping.h +++ b/include/linux/mnt_idmapping.h @@ -115,6 +115,9 @@ static inline bool vfsgid_eq_kgid(vfsgid_t vfsgid, kgid_t kgid) int vfsgid_in_group_p(vfsgid_t vfsgid); +struct mnt_idmap *mnt_idmap_get(struct mnt_idmap *idmap); +void mnt_idmap_put(struct mnt_idmap *idmap); + vfsuid_t make_vfsuid(struct mnt_idmap *idmap, struct user_namespace *fs_userns, kuid_t kuid); From patchwork Wed Jul 26 14:10:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 126404 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp436979vqo; Wed, 26 Jul 2023 07:19:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlF6LWgjhRrHlWhUVVVMszFM2GX4PkxmOXwp38zNYDe1KobgwYzOocSbF2gHLq8IZ5+qJyeQ X-Received: by 2002:aa7:8894:0:b0:663:5624:6fde with SMTP id z20-20020aa78894000000b0066356246fdemr2305783pfe.22.1690381178736; Wed, 26 Jul 2023 07:19:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690381178; cv=none; d=google.com; s=arc-20160816; b=lAEkEnRCqcnEeM5HfPOz2bSwmxfIm9MZc8OSaW/es4UJZEWeCGfPA0sZDof1alXVnV oR9U2FeM4zp6rB0cxFWJuIyeKVgC+0ilKlL0386vm+702y8Fe+vd3gIE1YUKLGVcpaqJ cr2fhFZItlivG5iaHkLbR1SCnzMTeWWX+fdQR++Gq7AES4NQHAg3pEnuYR96F9bThIeD PVE4NA+RJiB5WQlKJICa28w4i0b9wcxRTz4dhupAznK2StogW9GIQnRpyQvQmYhfr9gw lBzysPthRSF9Q1WIOc/BemVIaZEXCQ6GIRRPJ1jAUkASEMK+8YMd+bGEISSqvOtp3zXl 9oRQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1S1U/zjZd3rVIX0g7C71Py6TvgiMco2DPzTIrhllhdU=; fh=4TkUEkUtkmMzuUVnw4jjBfLQ2m58OJnBJO1eZJpOGII=; b=Ml9I3qedl2UBDjM1A1TnwItaHku+WQZ6+UZmQFhmt7qwMzHbwXWyU1MOgOW7zw3bfA IeTm/UEDRcv4VePD1wIe9XtwkofTYytqVwIpS2RZhhpmMfLqi8FUKwn2toD9Tdw5ZDvq yJWkP5C0WD7NWS4qKSfqq058c4poZmPswFM8cC6HfwwJDMohyrmsur2y6Qyp41vcM1mJ e7uq/3W++II8wkuEhf2MXHURhq7C0nJZvpd3HQgBQQOwybfxFkICH8F9u+y+Th6HF8rm fXhG2UdENCnZUBi2yyZofTsdk9pdyF26ZRLdndeQNJE7O/myrl1ddztXhn8jxJkzUcSC RGkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b="sTNJYG/c"; 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=canonical.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ea26-20020a056a004c1a00b00672ad8f037esi12761942pfb.231.2023.07.26.07.19.24; Wed, 26 Jul 2023 07:19:38 -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=@canonical.com header.s=20210705 header.b="sTNJYG/c"; 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=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234024AbjGZOMZ (ORCPT + 99 others); Wed, 26 Jul 2023 10:12:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231912AbjGZOLr (ORCPT ); Wed, 26 Jul 2023 10:11:47 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89DAE46B3 for ; Wed, 26 Jul 2023 07:11:02 -0700 (PDT) Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 5687C420C0 for ; Wed, 26 Jul 2023 14:10:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380642; bh=1S1U/zjZd3rVIX0g7C71Py6TvgiMco2DPzTIrhllhdU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=sTNJYG/c+U2EAnCreRPNQlYYW+VPs0thnWiiKcndHMFG0YHEQUoJPYOlBji0ED3N4 H9Ch74xpK3TzE2pBMaudFnB9gjPUF3Jp/AU0TA3/c567YcrkRgXGajC83G/ha8JOE7 eWz0gVwxBbBPENY2xavBUQsY6zhGkP1WY52ZRBn9Kw6w5oewhcmQfWsugCBz7gZnIh Z9zJE4IZ5xPfTHDLz9h5U4Z8pPYlMaAjGmzp5CzPsvy/aSMMpemXVQkKiN7y65tl5o GKZHrarDumbrcZPw76mtWvIt3GrhtZmYOfAoiyCmEtvmymdRmQLOISl/QEAeESAKlW 5+Pv0VD1/WNQw== Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-3faabd8fd33so33230545e9.0 for ; Wed, 26 Jul 2023 07:10:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380639; x=1690985439; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1S1U/zjZd3rVIX0g7C71Py6TvgiMco2DPzTIrhllhdU=; b=PUuHAeIxaX/h1iGItcnf9yZzhzTGBauTNM7/tyx6QDhldjkHBZ1obSUOhy8ezLm54Y /czaRhtqHEa/AcoRnlfXx/nFbf92mCeVdPfEbsgxLTZCEMwrq1vG3NopnJLo7pRg3cND Dq0gIby1xKz9cVXpznm311jBSLkrN5z5yvYBWY56Fb978XlRvwSQYHbwQR6szcSPh9nO jTraRDKNr1y7c0b/X/7qR2JACRHltE9z8+vi7lQ022sxHhPvDRUVqd1GtEECQ7pQXQkk 7umvW/IxVJh3r5z73PxhIhcbk4BnKFBwGdQ2loMYXYDVp6no9ZZW0JIGXYkgIiGjq62L WIww== X-Gm-Message-State: ABy/qLZ0pzNtdS3Zh+muSGKfQ2iLAot0L5qxlURGdMyfs2QJe9nkTV0T DEtq5jTMQ+woTcz3jOxZ9YuMZGyRG8v7MX9jFMGqB5bEODg8sNQuYORaycZ0D1LXaVrYK3zrf4J sj1bGyvvYjfti9D5lkTBKWEVfWoAQMa3785S0A4921Q== X-Received: by 2002:a05:600c:244:b0:3fb:cfe8:8d12 with SMTP id 4-20020a05600c024400b003fbcfe88d12mr1446340wmj.14.1690380639077; Wed, 26 Jul 2023 07:10:39 -0700 (PDT) X-Received: by 2002:a05:600c:244:b0:3fb:cfe8:8d12 with SMTP id 4-20020a05600c024400b003fbcfe88d12mr1446334wmj.14.1690380638896; Wed, 26 Jul 2023 07:10:38 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-066-182-192.088.066.pools.vodafone-ip.de. [88.66.182.192]) by smtp.gmail.com with ESMTPSA id k14-20020a7bc30e000000b003fc02219081sm2099714wmj.33.2023.07.26.07.10.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:10:38 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Christian Brauner , Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v7 02/11] ceph: stash idmapping in mdsc request Date: Wed, 26 Jul 2023 16:10:17 +0200 Message-Id: <20230726141026.307690-3-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772493134836174730 X-GMAIL-MSGID: 1772493134836174730 From: Christian Brauner When sending a mds request cephfs will send relevant data for the requested operation. For creation requests the caller's fs{g,u}id is used to set the ownership of the newly created filesystem object. For setattr requests the caller can pass in arbitrary {g,u}id values to which the relevant filesystem object is supposed to be changed. If the caller is performing the relevant operation via an idmapped mount cephfs simply needs to take the idmapping into account when it sends the relevant mds request. In order to support idmapped mounts for cephfs we stash the idmapping whenever they are relevant for the operation for the duration of the request. Since mds requests can be queued and performed asynchronously we make sure to keep the idmapping around and release it once the request has finished. In follow-up patches we will use this to send correct ownership information over the wire. This patch just adds the basic infrastructure to keep the idmapping around. The actual conversion patches are all fairly minimal. Cc: Xiubo Li Cc: Jeff Layton Cc: Ilya Dryomov Cc: ceph-devel@vger.kernel.org Signed-off-by: Christian Brauner Signed-off-by: Alexander Mikhalitsyn --- v4: - don't call mnt_idmap_get(..) in __register_request --- fs/ceph/mds_client.c | 5 +++++ fs/ceph/mds_client.h | 1 + 2 files changed, 6 insertions(+) diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 191bae3a4ee6..c641ab046e98 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "super.h" #include "crypto.h" @@ -1121,6 +1122,8 @@ void ceph_mdsc_release_request(struct kref *kref) kfree(req->r_path1); kfree(req->r_path2); put_cred(req->r_cred); + if (req->r_mnt_idmap) + mnt_idmap_put(req->r_mnt_idmap); if (req->r_pagelist) ceph_pagelist_release(req->r_pagelist); kfree(req->r_fscrypt_auth); @@ -1180,6 +1183,8 @@ static void __register_request(struct ceph_mds_client *mdsc, insert_request(&mdsc->request_tree, req); req->r_cred = get_current_cred(); + if (!req->r_mnt_idmap) + req->r_mnt_idmap = &nop_mnt_idmap; if (mdsc->oldest_tid == 0 && req->r_op != CEPH_MDS_OP_SETFILELOCK) mdsc->oldest_tid = req->r_tid; diff --git a/fs/ceph/mds_client.h b/fs/ceph/mds_client.h index 717a7399bacb..e3bbf3ba8ee8 100644 --- a/fs/ceph/mds_client.h +++ b/fs/ceph/mds_client.h @@ -300,6 +300,7 @@ struct ceph_mds_request { int r_fmode; /* file mode, if expecting cap */ int r_request_release_offset; const struct cred *r_cred; + struct mnt_idmap *r_mnt_idmap; struct timespec64 r_stamp; /* for choosing which mds to send this request to */ From patchwork Wed Jul 26 14:10:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 126452 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp483108vqo; Wed, 26 Jul 2023 08:32:55 -0700 (PDT) X-Google-Smtp-Source: APBJJlFo3E6VGMixQ7Z7GxskGtldyo5z9u3JhLAKhrKjX0BBqVpH/416PwZakP+bka48X39elWkI X-Received: by 2002:a19:e019:0:b0:4fb:897e:21cc with SMTP id x25-20020a19e019000000b004fb897e21ccmr1583886lfg.67.1690385575032; Wed, 26 Jul 2023 08:32:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690385575; cv=none; d=google.com; s=arc-20160816; b=MJoMEoE9wbLD1PhTfb+JzO6C0MLedJhYDxf1Oy59wQqqv531bQu3S2S6sefbtAZ5ij 9y2QwVtLBTF4Mhk5w2D/QYzK5ah/m9MRBaDmMtsUyaNJiAFsAr1c9RP3ZdqPlqMOl3iL cJ3cCQWq25dXrNMAkpNu6kddVmVXZER1cfhqqNJcXueymwTNsxtNab1Hj1G1+N/g30Qj eYcEchI7mrk2yHWAKX4s2fPLHQPTz0efnUqas1h2+zjftL61Sa8CnQLcDFMpwfw0R/re EDbkEAWrK3MQWVz48ZoS7qp4/PfAC+JoXqaylrVSNnDJVapM+UPcnuuVad9EuZAEcrYW mMbA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ifNPKcEIq/Tv2vsoKX4zAa3gfholzjGLVEwPWVuZYK8=; fh=AB88THZ7e4yf+XqQ54VOhi5v1RBcLVn7ZMnG2pE+330=; b=W+BWO5FPLLWL6d6eBHj4Qt4JKPnFr7qRbwOv6NaePSZiYe1YtZNNDhAjVLRhjoU6Qg HwIVoJy7H5sJvIk7PPnCP533qdQCvaPoGJLx+CORgONJjCPRKEJMenpOeLOuMZD2xFrq +6lvvZCZwPk5qqqGFbQG2C4XK2TCbuGCzQ4GjMfJue0zu9ItMUcetOVBeL8QKTWPUNC/ QB9YouHoQMdnMnBZtuZMcMLuJIrygnS1v//UuwB6mhPNdrh04sjbc3Km3sF+j9QAfSxM m/g/q/xw9JcHrbexXwb5E23QNH1osbJjWKBESXv8G/NQUuWn0Rmb0LBIlEMPdgty+2CQ aIRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=KnchRmlD; 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=canonical.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a11-20020aa7d74b000000b005222968fc70si5410948eds.194.2023.07.26.08.32.29; Wed, 26 Jul 2023 08:32:54 -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=@canonical.com header.s=20210705 header.b=KnchRmlD; 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=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234443AbjGZOMS (ORCPT + 99 others); Wed, 26 Jul 2023 10:12:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232183AbjGZOLt (ORCPT ); Wed, 26 Jul 2023 10:11:49 -0400 Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15CDA3ABD for ; Wed, 26 Jul 2023 07:11:18 -0700 (PDT) Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 630A9413CB for ; Wed, 26 Jul 2023 14:10:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380642; bh=ifNPKcEIq/Tv2vsoKX4zAa3gfholzjGLVEwPWVuZYK8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KnchRmlDTs1KiN/izXGpgRCki/d/1hYblcl7SKJiANjnVNkaNeWnKqqP7ftH0CJlo GXpMn6HRsmRuLdac9ExCAFn4krEElHIGreSpavTWHw5P1GQ326qN/b5viv6QWw9ihH o26T2xiduW5YwjSQmwiOj3oBtMBWXUEP8SXtiEXwsUp+v7HHRNwxk7vJel25N0IJeQ gNC48NxT020tXd78XQ1mVRXm0KFcr2zflKYwp99/uYWNpImXII+8DQothBJraJgTO9 eWZOTciV/1nkRJfa0UsMII6s8QZjA0L98tgxuearAXrg4BE99X0I5mT3pISlHyA40x pEAlD/pc/XoNA== Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-4fb9087a677so6196618e87.1 for ; Wed, 26 Jul 2023 07:10:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380642; x=1690985442; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ifNPKcEIq/Tv2vsoKX4zAa3gfholzjGLVEwPWVuZYK8=; b=TP1K5KsBpexax5uy25bLMvCQyotfL+r9E2vx1cE+lf7ji8i3Sn32GWUXk36TEPeMdE dYAVNPPz86p0rFs4xbN38HKWRdHJnGQVuY8HYnZK2chKe+vLyG+hA8QFk9ckZzNNk6kw UTSLJhn2zh35AOH7ZX6TnGVH4K5K4wXIkBzMk3aoFsNesE2r2/QNPumMZ1ONhA6YSOZL qrfOrX0EOuvLkk2vcqZKECTEueV3vB3DEEk2/+b5FIl1yb/ATFXRYO0/v/2yzStZnQ0q wiQHexQFndPzkQeEOhBGP+jp5wJCPduXlCc6EXXhJ/DpNB5AX9Pkz3GkYpiVdcrH98mC R39w== X-Gm-Message-State: ABy/qLb4lp26qo+f1iL/AHesuoCpmVma/EVgTRN5FMyjjge9s57vfNTn ILeqRv7l69rniv2bcKCARGKgSDwMCQU5a93VGrwne0gVuuxiOpnsfwclso186xK+6HMYYGnRfcc hU2bC8MRUp/Dg7JSmcwmHn5O+5Yvred8ycs2QI0+KWA== X-Received: by 2002:a19:500b:0:b0:4f8:78c9:4f00 with SMTP id e11-20020a19500b000000b004f878c94f00mr1362281lfb.20.1690380641770; Wed, 26 Jul 2023 07:10:41 -0700 (PDT) X-Received: by 2002:a19:500b:0:b0:4f8:78c9:4f00 with SMTP id e11-20020a19500b000000b004f878c94f00mr1362257lfb.20.1690380641324; Wed, 26 Jul 2023 07:10:41 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-066-182-192.088.066.pools.vodafone-ip.de. [88.66.182.192]) by smtp.gmail.com with ESMTPSA id k14-20020a7bc30e000000b003fc02219081sm2099714wmj.33.2023.07.26.07.10.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:10:40 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Alexander Mikhalitsyn , Christian Brauner , linux-kernel@vger.kernel.org Subject: [PATCH v7 03/11] ceph: handle idmapped mounts in create_request_message() Date: Wed, 26 Jul 2023 16:10:18 +0200 Message-Id: <20230726141026.307690-4-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772497744728140745 X-GMAIL-MSGID: 1772497744728140745 Inode operations that create a new filesystem object such as ->mknod, ->create, ->mkdir() and others don't take a {g,u}id argument explicitly. Instead the caller's fs{g,u}id is used for the {g,u}id of the new filesystem object. In order to ensure that the correct {g,u}id is used map the caller's fs{g,u}id for creation requests. This doesn't require complex changes. It suffices to pass in the relevant idmapping recorded in the request message. If this request message was triggered from an inode operation that creates filesystem objects it will have passed down the relevant idmaping. If this is a request message that was triggered from an inode operation that doens't need to take idmappings into account the initial idmapping is passed down which is an identity mapping. This change uses a new cephfs protocol extension CEPHFS_FEATURE_HAS_OWNER_UIDGID which adds two new fields (owner_{u,g}id) to the request head structure. So, we need to ensure that MDS supports it otherwise we need to fail any IO that comes through an idmapped mount because we can't process it in a proper way. MDS server without such an extension will use caller_{u,g}id fields to set a new inode owner UID/GID which is incorrect because caller_{u,g}id values are unmapped. At the same time we can't map these fields with an idmapping as it can break UID/GID-based permission checks logic on the MDS side. This problem was described with a lot of details at [1], [2]. [1] https://lore.kernel.org/lkml/CAEivzxfw1fHO2TFA4dx3u23ZKK6Q+EThfzuibrhA3RKM=ZOYLg@mail.gmail.com/ [2] https://lore.kernel.org/all/20220104140414.155198-3-brauner@kernel.org/ Cc: Xiubo Li Cc: Jeff Layton Cc: Ilya Dryomov Cc: ceph-devel@vger.kernel.org Co-Developed-by: Alexander Mikhalitsyn Signed-off-by: Christian Brauner Signed-off-by: Alexander Mikhalitsyn --- v7: - reworked to use two new fields for owner UID/GID (https://github.com/ceph/ceph/pull/52575) --- fs/ceph/mds_client.c | 20 ++++++++++++++++++++ fs/ceph/mds_client.h | 5 ++++- include/linux/ceph/ceph_fs.h | 4 +++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index c641ab046e98..ac095a95f3d0 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -2923,6 +2923,7 @@ static struct ceph_msg *create_request_message(struct ceph_mds_session *session, { int mds = session->s_mds; struct ceph_mds_client *mdsc = session->s_mdsc; + struct ceph_client *cl = mdsc->fsc->client; struct ceph_msg *msg; struct ceph_mds_request_head_legacy *lhead; const char *path1 = NULL; @@ -3028,6 +3029,16 @@ static struct ceph_msg *create_request_message(struct ceph_mds_session *session, lhead = find_legacy_request_head(msg->front.iov_base, session->s_con.peer_features); + if ((req->r_mnt_idmap != &nop_mnt_idmap) && + !test_bit(CEPHFS_FEATURE_HAS_OWNER_UIDGID, &session->s_features)) { + pr_err_ratelimited_client(cl, + "idmapped mount is used and CEPHFS_FEATURE_HAS_OWNER_UIDGID" + " is not supported by MDS. Fail request with -EIO.\n"); + + ret = -EIO; + goto out_err; + } + /* * The ceph_mds_request_head_legacy didn't contain a version field, and * one was added when we moved the message version from 3->4. @@ -3043,10 +3054,19 @@ static struct ceph_msg *create_request_message(struct ceph_mds_session *session, p = msg->front.iov_base + sizeof(*ohead); } else { struct ceph_mds_request_head *nhead = msg->front.iov_base; + kuid_t owner_fsuid; + kgid_t owner_fsgid; msg->hdr.version = cpu_to_le16(6); nhead->version = cpu_to_le16(CEPH_MDS_REQUEST_HEAD_VERSION); p = msg->front.iov_base + sizeof(*nhead); + + owner_fsuid = from_vfsuid(req->r_mnt_idmap, &init_user_ns, + VFSUIDT_INIT(req->r_cred->fsuid)); + owner_fsgid = from_vfsgid(req->r_mnt_idmap, &init_user_ns, + VFSGIDT_INIT(req->r_cred->fsgid)); + nhead->owner_uid = cpu_to_le32(from_kuid(&init_user_ns, owner_fsuid)); + nhead->owner_gid = cpu_to_le32(from_kgid(&init_user_ns, owner_fsgid)); } end = msg->front.iov_base + msg->front.iov_len; diff --git a/fs/ceph/mds_client.h b/fs/ceph/mds_client.h index e3bbf3ba8ee8..8f683e8203bd 100644 --- a/fs/ceph/mds_client.h +++ b/fs/ceph/mds_client.h @@ -33,8 +33,10 @@ enum ceph_feature_type { CEPHFS_FEATURE_NOTIFY_SESSION_STATE, CEPHFS_FEATURE_OP_GETVXATTR, CEPHFS_FEATURE_32BITS_RETRY_FWD, + CEPHFS_FEATURE_NEW_SNAPREALM_INFO, + CEPHFS_FEATURE_HAS_OWNER_UIDGID, - CEPHFS_FEATURE_MAX = CEPHFS_FEATURE_32BITS_RETRY_FWD, + CEPHFS_FEATURE_MAX = CEPHFS_FEATURE_HAS_OWNER_UIDGID, }; #define CEPHFS_FEATURES_CLIENT_SUPPORTED { \ @@ -49,6 +51,7 @@ enum ceph_feature_type { CEPHFS_FEATURE_NOTIFY_SESSION_STATE, \ CEPHFS_FEATURE_OP_GETVXATTR, \ CEPHFS_FEATURE_32BITS_RETRY_FWD, \ + CEPHFS_FEATURE_HAS_OWNER_UIDGID, \ } /* diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h index 5f2301ee88bc..6eb83a51341c 100644 --- a/include/linux/ceph/ceph_fs.h +++ b/include/linux/ceph/ceph_fs.h @@ -499,7 +499,7 @@ struct ceph_mds_request_head_legacy { union ceph_mds_request_args args; } __attribute__ ((packed)); -#define CEPH_MDS_REQUEST_HEAD_VERSION 2 +#define CEPH_MDS_REQUEST_HEAD_VERSION 3 struct ceph_mds_request_head_old { __le16 version; /* struct version */ @@ -530,6 +530,8 @@ struct ceph_mds_request_head { __le32 ext_num_retry; /* new count retry attempts */ __le32 ext_num_fwd; /* new count fwd attempts */ + + __le32 owner_uid, owner_gid; /* used for OPs which create inodes */ } __attribute__ ((packed)); /* cap/lease release record */ From patchwork Wed Jul 26 14:10:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 126413 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp446454vqo; Wed, 26 Jul 2023 07:35:05 -0700 (PDT) X-Google-Smtp-Source: APBJJlEZsjkgOt8Ml6unMk4Xifj7ZzEvz+Mp7ORslhvqeg+cg7KJPO1IpF+gonRkuYXzY0SXjWh5 X-Received: by 2002:a17:902:b104:b0:1b9:c68f:91a5 with SMTP id q4-20020a170902b10400b001b9c68f91a5mr1823031plr.6.1690382105296; Wed, 26 Jul 2023 07:35:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690382105; cv=none; d=google.com; s=arc-20160816; b=ZQcV7pBB0pWLnMcGSolBFkZ6HiY/XxghqIkm2AXHlzD09KBPZqKjFomJxz7JaM6HoW M+iFbmKtpf6CD3I3YAtGXYQgkUuLVhRpoIN7TcEfls2c+w4fyavBz/itWFcDBB8O5eaN UM+aK24DqREUkLSInYdZlnzi/zsVEUvMa8+0xhFSal7zcPoHJoTHnzp2ZiJCelwTvT5B ezVM35ttCO2reZAwhwvC5536yGXuWes8N2JEWPIEKY8TV4gZDP/E7xzXbXQKt97V/Y4F QNA76hNCZlsGlzANvbQKBq+vM/d9JFl/0gscSUj9+vitoT046iGG7FsYH1pjrnSU27zW I6xA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2wRsV5VoJJC+a/Nnh0k6h5YuKsT02FRfB/wC7z4rT6w=; fh=4TkUEkUtkmMzuUVnw4jjBfLQ2m58OJnBJO1eZJpOGII=; b=jmdhyXjNnHNQVVyr55kLuHS51lT1Zudk/mLqp+lersiHIqiu1nfCPbhWNtOMryIFGT ZJwgF3hUmnC5kSf+Vh1G+agmLDK7JJx5CyYYMZCkdo8jXUwO5yRt7khSIz3L3fxFU9bP qwjDlVxjKwpGix6I7L15zCjF6K6+6b6G657jZbFvf6JFPLdblrAu4RNS18AoosC30knZ Bgu9AY0Y7C6iOKKZRfcEL+BZkFClbxMg1wVSY5FOrhp4kPi3VremRYZRiZjq7SIY0Tvu 0LVQ67q+SXKEFAR5wlM7jDx/9fXrO7Ev05IWEH0rdYS67M/jV8uq3GDmL3mGWDGmbG+k WUGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=Kjjcj98V; 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=canonical.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c8-20020a170902b68800b001b7f9862cdfsi12489813pls.257.2023.07.26.07.34.51; Wed, 26 Jul 2023 07:35:05 -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=@canonical.com header.s=20210705 header.b=Kjjcj98V; 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=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230229AbjGZOMU (ORCPT + 99 others); Wed, 26 Jul 2023 10:12:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232394AbjGZOLu (ORCPT ); Wed, 26 Jul 2023 10:11:50 -0400 Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CAEC3C04 for ; Wed, 26 Jul 2023 07:11:18 -0700 (PDT) Received: from mail-lj1-f199.google.com (mail-lj1-f199.google.com [209.85.208.199]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 35E38413CA for ; Wed, 26 Jul 2023 14:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380646; bh=2wRsV5VoJJC+a/Nnh0k6h5YuKsT02FRfB/wC7z4rT6w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Kjjcj98Vp7IomFtovs4tRoVg3h59bs03gNLQSbAPRC5b1OqeHqF9U4ChtBdj0STcb wcWj9ZpdVfu67EQEtjO3OoK/kywcyiuQa8Of07myiY1bBLo2TeN05y/IYBoY9bbjHU DP2nlco9Ri9RPiPa+2bOKXQKgyLlkvL5sMSX1pLBSZ9EXSOBS6adobhY0jMFLBm0rF LPGaRgPRm6ztX1dvsh9F8c9HD6JIqPEVtDeJ6LcPDz6Fax9F6IeJXq1hhnEGXJ9lJ2 XpcsmISNZDTMCHujYN3caKNkQzqrfAtWQtashYeJ8Ybt1kkylQWg8wX5ZoKH9Xe0K9 WDcuj5dnBV58g== Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2b9bb2d0b1bso4086471fa.0 for ; Wed, 26 Jul 2023 07:10:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380643; x=1690985443; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2wRsV5VoJJC+a/Nnh0k6h5YuKsT02FRfB/wC7z4rT6w=; b=EhvoxOq328O0bqYOhRHXwDvhSCq5/W+9GLs80RKJKwN7zSZ7fYrKClXQidcoC/JdIN bQ0zZmRjtJ8bYRi/qUkNRH9a8b0eTLvF9+VdYE8nsWakgfAhSzy8sWz9Nh0X2T3PJjZQ scmt7E5oHBUiP11ujPlSIiqF0ZF3hPO93WVTqoTK8hZO6aiwW+Losryjbq+VW4hGhe2J F1P0sB3BcmJbjdeMJEkKTXe9UULJ3y/vVQYFiE+BjvmTExYqF5TuSp7fyFVmWfUl+vBS tlJXMEERcSZOUn1ueW83ZGE1Ta79JuvrB/yu6Vu72euCU8C4zv3n/o2QBDG/Xrr+wiQa t/eA== X-Gm-Message-State: ABy/qLacU3xTtCBG6ozc5mOeR7tNeTkyl3fIm3b9aUEq0t7JgQVCngZU OKzNLRSbtMPOGybX37DJ1BiupmRU3ltc/DFMXq0cbdyjxpm9/OXryu1Bd7BZs12L3VU4HsyMwZ4 UJM2+ygy3onJKD9m/wpOqpG+JsVFkTX7B6H21TO4CuA== X-Received: by 2002:a2e:984b:0:b0:2b6:decf:5cbd with SMTP id e11-20020a2e984b000000b002b6decf5cbdmr1578254ljj.36.1690380643777; Wed, 26 Jul 2023 07:10:43 -0700 (PDT) X-Received: by 2002:a2e:984b:0:b0:2b6:decf:5cbd with SMTP id e11-20020a2e984b000000b002b6decf5cbdmr1578241ljj.36.1690380643620; Wed, 26 Jul 2023 07:10:43 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-066-182-192.088.066.pools.vodafone-ip.de. [88.66.182.192]) by smtp.gmail.com with ESMTPSA id k14-20020a7bc30e000000b003fc02219081sm2099714wmj.33.2023.07.26.07.10.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:10:43 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Christian Brauner , Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v7 04/11] ceph: pass an idmapping to mknod/symlink/mkdir Date: Wed, 26 Jul 2023 16:10:19 +0200 Message-Id: <20230726141026.307690-5-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772494106410010556 X-GMAIL-MSGID: 1772494106410010556 From: Christian Brauner Enable mknod/symlink/mkdir iops to handle idmapped mounts. This is just a matter of passing down the mount's idmapping. Cc: Xiubo Li Cc: Jeff Layton Cc: Ilya Dryomov Cc: ceph-devel@vger.kernel.org Signed-off-by: Christian Brauner Signed-off-by: Alexander Mikhalitsyn --- v4: - call mnt_idmap_get v7: - don't pass idmapping for ceph_rename (no need) --- fs/ceph/dir.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index b752ed3ccdf0..397656ae7787 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c @@ -952,6 +952,7 @@ static int ceph_mknod(struct mnt_idmap *idmap, struct inode *dir, req->r_parent = dir; ihold(dir); set_bit(CEPH_MDS_R_PARENT_LOCKED, &req->r_req_flags); + req->r_mnt_idmap = mnt_idmap_get(idmap); req->r_args.mknod.mode = cpu_to_le32(mode); req->r_args.mknod.rdev = cpu_to_le32(rdev); req->r_dentry_drop = CEPH_CAP_FILE_SHARED | CEPH_CAP_AUTH_EXCL | @@ -1067,6 +1068,7 @@ static int ceph_symlink(struct mnt_idmap *idmap, struct inode *dir, } set_bit(CEPH_MDS_R_PARENT_LOCKED, &req->r_req_flags); + req->r_mnt_idmap = mnt_idmap_get(idmap); req->r_dentry = dget(dentry); req->r_num_caps = 2; req->r_dentry_drop = CEPH_CAP_FILE_SHARED | CEPH_CAP_AUTH_EXCL | @@ -1146,6 +1148,7 @@ static int ceph_mkdir(struct mnt_idmap *idmap, struct inode *dir, req->r_parent = dir; ihold(dir); set_bit(CEPH_MDS_R_PARENT_LOCKED, &req->r_req_flags); + req->r_mnt_idmap = mnt_idmap_get(idmap); req->r_args.mkdir.mode = cpu_to_le32(mode); req->r_dentry_drop = CEPH_CAP_FILE_SHARED | CEPH_CAP_AUTH_EXCL | CEPH_CAP_XATTR_EXCL; From patchwork Wed Jul 26 14:10:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 126443 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp478036vqo; Wed, 26 Jul 2023 08:24:40 -0700 (PDT) X-Google-Smtp-Source: APBJJlGMoL9B5UWk4Uv480Ve2aVD8RM/EPLadkZTH+/9VueQXXy2Ms1fEodzxB3RMPEwIlO032vU X-Received: by 2002:a05:6a20:3c90:b0:138:1980:1dd3 with SMTP id b16-20020a056a203c9000b0013819801dd3mr2262752pzj.14.1690385080286; Wed, 26 Jul 2023 08:24:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690385080; cv=none; d=google.com; s=arc-20160816; b=ugwSAPNKLnh+IjHW+v9azyskSgf9NjBY5mkK42rHm07a25b/1U/Q7DsT9cuyS9BugR RiFz74vzu2wzxj9KdscblgdoMjVEgzoRK8yRjbBry5xW5IiYGqCFzeSXS0FV0He8nqxs vutwNCkEpcpskpF7mxY4BMkaQpckoeZVGH9POtIT1IHYQVhwslJvIDXq/DWu/w6gce07 1n8GSNKtfVDDR8RfflhseS7ImuxqKqGgd0/X/oxVo7diMiMR01sWFVYtX8HMiAyv0jZF vEbjTFKrGTfye3X3eChjzEmirCyU09pclN/YpDU85BBA79EoLgv2qta2AH3FmX47YG6O ToUg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ohgjgBD3cKcnIyJjD+KXey+VVqMnSRq4bkvBBBDC3os=; fh=4TkUEkUtkmMzuUVnw4jjBfLQ2m58OJnBJO1eZJpOGII=; b=OeFRZowV//tqhYc0Ir/a4as8ca70ProqK0SklE/ot00t1p5XOJom7RM88TOQS9vPRJ vQoQfOeH42KsAYLrnpJEQ7s+NgfqaSQWqlErEd6B5qI9Bwmeb9HZv0SvqhXAwo40EKFP E9WYVStMqt06kOtiJ4974YpYNRZgh3ddz9X8TNmd2a0x5GNi4CKuVV417rUnYJGRVpFV 3+lizrq/vsCeb8tYfkgHkiyZCyIpK7EDk6lt6C2mhoTg66BmAgiUb6CZ0TCyX0CZevpf kcjyIYo8rG0SQZtUY1Jf5wLeVZENJ+jGTo6su9uDDZ/zjKBvaM6GnKrB4XchO8EvrCrL fHew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=njUYy2BK; 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=canonical.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k184-20020a636fc1000000b0053b928deb7asi11388459pgc.344.2023.07.26.08.24.26; Wed, 26 Jul 2023 08:24:40 -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=@canonical.com header.s=20210705 header.b=njUYy2BK; 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=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229959AbjGZOM2 (ORCPT + 99 others); Wed, 26 Jul 2023 10:12:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232529AbjGZOLy (ORCPT ); Wed, 26 Jul 2023 10:11:54 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E3052D42 for ; Wed, 26 Jul 2023 07:11:19 -0700 (PDT) Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 0CEE0423E9 for ; Wed, 26 Jul 2023 14:10:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380651; bh=ohgjgBD3cKcnIyJjD+KXey+VVqMnSRq4bkvBBBDC3os=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=njUYy2BKrX7GRjJ8+ItwOGZqi+B0RJYA85xz1oEW1Ik/5FczinJI6pFknjzVp8TZ2 ocRTdn9qxYcA0oDWDLW3ratUwRMWxiiQQdub7lhebiJDRAcs0tAdbsN9B9BfWTBxnn N+FRZB4oVkCCKEGORRZh8JyNnuFtotJISvjruRbb5QAkYnfETPk2FUuRir+LhLDOlP Z3FSCF3UKE5YhkybQHrSrrmIqgT8r4Q6xlSyHtWHqVQJU8FKIiYfGTwSjh0+XOgwIn b7AKyRpw9QaA8v+zywXDoGg4IR5Yfc8OGp7z7k++m9H1qzuDM4uav4ef6Dy9KuZCFI 2Xb5gGppNBUnQ== Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2b9aa4db031so19708941fa.3 for ; Wed, 26 Jul 2023 07:10:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380646; x=1690985446; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ohgjgBD3cKcnIyJjD+KXey+VVqMnSRq4bkvBBBDC3os=; b=CWndGZho5ps5mIhKQTkTHLUCF+AKYMNDRY70T1HyYdASKnwjPuibwAPXa4XjJ8e3Vu ILN+eZKLKfW8x9TrJH8Vd+cFHyLAtCVKVx7tKmU2mv/eo+JCWFT/Ks5+kgc0UD21xESP p7WIMBwpyJRK9iTzKCnzrYxeTrivJNR7p+Gewv69ia+lxmw/2TT4twwg29DeYzv2H+op Ic914XIds9kV1jY2Y1ST5LuOy/eJpnMAlbWomzDC85ZNRKfUrOhYXQOPGeUIr09otYRs /yZQVDyfZesp9l+dK7TnozA51Nq/LMAO2rVmMWqDUZQxH8uO/yX7zAXV3AV5ki+FgR3E YL5w== X-Gm-Message-State: ABy/qLYIRmBLoWsDKykLw0xPuXnifp9CQqfX7rpzNfYtcCONzb/O2xzk 05OJnOSE6iwnXOlivpfVUphe1yI1xyrsALsU5wah+6gNdkzXJZ7Uothd/32UeGX+hks0dxOz17O iFN10oy6nrpYAs3jq+zKPLJciNxj7qs9pMQcK6Oycow== X-Received: by 2002:a2e:b04c:0:b0:2b6:e292:85ab with SMTP id d12-20020a2eb04c000000b002b6e29285abmr1537997ljl.25.1690380645932; Wed, 26 Jul 2023 07:10:45 -0700 (PDT) X-Received: by 2002:a2e:b04c:0:b0:2b6:e292:85ab with SMTP id d12-20020a2eb04c000000b002b6e29285abmr1537979ljl.25.1690380645680; Wed, 26 Jul 2023 07:10:45 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-066-182-192.088.066.pools.vodafone-ip.de. [88.66.182.192]) by smtp.gmail.com with ESMTPSA id k14-20020a7bc30e000000b003fc02219081sm2099714wmj.33.2023.07.26.07.10.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:10:45 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Christian Brauner , Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v7 05/11] ceph: allow idmapped getattr inode op Date: Wed, 26 Jul 2023 16:10:20 +0200 Message-Id: <20230726141026.307690-6-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772497225480214900 X-GMAIL-MSGID: 1772497225480214900 From: Christian Brauner Enable ceph_getattr() to handle idmapped mounts. This is just a matter of passing down the mount's idmapping. Cc: Xiubo Li Cc: Jeff Layton Cc: Ilya Dryomov Cc: ceph-devel@vger.kernel.org Signed-off-by: Christian Brauner Signed-off-by: Alexander Mikhalitsyn --- fs/ceph/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 3ff4f57f223f..136b68ccdbef 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -3034,7 +3034,7 @@ int ceph_getattr(struct mnt_idmap *idmap, const struct path *path, return err; } - generic_fillattr(&nop_mnt_idmap, inode, stat); + generic_fillattr(idmap, inode, stat); stat->ino = ceph_present_inode(inode); /* From patchwork Wed Jul 26 14:10:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 126403 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp436137vqo; Wed, 26 Jul 2023 07:18:24 -0700 (PDT) X-Google-Smtp-Source: APBJJlFHyPhtDpf1jnVOqfirx6VPd7UEw56x5zJjG8QWW20pkSbQ0RnJFcdIl9yPRGwINDqMldSa X-Received: by 2002:a17:902:efd3:b0:1bb:b855:db3c with SMTP id ja19-20020a170902efd300b001bbb855db3cmr1617969plb.41.1690381104490; Wed, 26 Jul 2023 07:18:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690381104; cv=none; d=google.com; s=arc-20160816; b=f37Xv7U4Hr9cJzMBzTa0v9y5vXYyseMglH8/SSqpslf39NbmfBrZMBbZ7ceYnuKL7G yyHniD5ZYHSQLhV2GpZXnauqj6zQVDfacB4+wT7weU0zSu92OpGEv3mX2EXFB96jlW14 yPt6Em7nJ+OLLoKTZ6n23UK4E8Io1CxAaBB92yt/w66299mYFhRqGp2BJQigmcuKOZ1r BchUouFHdAonlksB7k6dnTcW3u6XF4Z3evGr66ES3mARzpSUWB7hAlo7vJlpBUZ6Uize UwztqwZgy/6/ACi5rAX+EVFvan3QIRytFC58giCp9k2SwDwTL4prbIKnAEMqod3lHSda zKOA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Srcpafr6A4NJGaRIaUNnfkHMnBPsuuDlnOMtOvEnSSA=; fh=4TkUEkUtkmMzuUVnw4jjBfLQ2m58OJnBJO1eZJpOGII=; b=T+7Fp/JxDZ/HkPG4Ft0ZHjcWfLJSGfo9JZwMcqzjN2z5iM+RnwkP8qWMj4ODiHnhz5 sakMmznrPNfdTm36cYso42xi82WzlrICjT4cCJtFK5VbadUqjtQRwS4e2yRIIR61AeX7 HokXbGTF91GsylpOWwQpM5tjA6ks5oXzlu1d7IQ3o7Jc7eJi14cEORcy1StT/CoiIjJJ +ysHL2snobZe2Wt1H3BV1ttq53cSskZKKXE7mwS+xH0sqT5rdGVKaa9by/Asbl1SRJTl AJi/h0Go335xLz02PMiEOBTx3CG1iM5KT5wwmUb20E7Iz6RDhHWG39mJBfQiZwAs+CB4 RfLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b="VroLM/VD"; 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=canonical.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n14-20020a170903110e00b001b80643d64dsi14137932plh.145.2023.07.26.07.18.09; Wed, 26 Jul 2023 07:18:24 -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=@canonical.com header.s=20210705 header.b="VroLM/VD"; 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=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234447AbjGZOMh (ORCPT + 99 others); Wed, 26 Jul 2023 10:12:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232715AbjGZOLz (ORCPT ); Wed, 26 Jul 2023 10:11:55 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E41E72D44 for ; Wed, 26 Jul 2023 07:11:19 -0700 (PDT) Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 7D17842416 for ; Wed, 26 Jul 2023 14:10:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380652; bh=Srcpafr6A4NJGaRIaUNnfkHMnBPsuuDlnOMtOvEnSSA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=VroLM/VDKpFBzq2NIcOMgB+OsP1eNXYMNbRvwNBQ1XZ+W+lAmdtyqjkFs/DbfdCm9 bSirK4avHoinjKXO8U5/6IQWR9X/pmCiizU1y9AKbL8L+8RjLeYi+WHwAQqQrq86rF RZwMhu+4Ytp275mmuVC4SbPjsV8rSI8sRKq0mC8cFrUpz06nUc3v3g9p4VyGBYM+mI mJncxvuikfpk72hG/c6hHeuYHhXYq3UC/aCZ8p7jjiUrH16bcHyhgZ1Id+AFxoLxnu KP04P1WlFw+Iq44/NkdnuKlqipUqxPtZis6eogOu2Pdh1ztMLaprfpAurCYCnaMDlW 1E6a5L3T3T6yw== Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2b70cabc656so64079191fa.0 for ; Wed, 26 Jul 2023 07:10:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380648; x=1690985448; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Srcpafr6A4NJGaRIaUNnfkHMnBPsuuDlnOMtOvEnSSA=; b=Hfk4ctG9PVIEoit4hos7YeLi4dl2XUlFPbxctp1V2l8vC52dz0ydfPu7g2jhTz8LZx GiFrSO8l746n7qSW3fJW1aWv0OZ/EGBxCpv+uGKNkSTNZmO83Ausov98kdUXtnRbE/1O MOyhmb9ILAZpCJhxAPAAdijlSWpc7U47YNY/Fg2R8QATx5WS9X5ekCnW6wux2xZX1jp+ wzNbMF56MQWvTTDr3LQjTJ5/auKhQjwaAIlhAwPLB4OGuEc6KwP0J7D9olHNvi48yYdN Z5p6dcCkaONYNNFJX1aFF5Pc044TwoImYyDF4/+LXEJxmLSU5jmB4g6khOms+GCOVT4e hzWw== X-Gm-Message-State: ABy/qLZmIH5w66L7WZI36eQTaesalaqh/pC2X16o+8aIdB+OWLz1zio0 u5ZMSKOlz7N+qVQJ1FKgcoCHxM/xlHIAbVLtyUr+8E0sI8fS2ZcqropQMHyPRpyCvAHCUtmRkIt rhvhXEekvcO2O0aBFw6+g0WfELXGNp2SKjioYM2/8TQ== X-Received: by 2002:a2e:86d7:0:b0:2b6:a7dd:e22 with SMTP id n23-20020a2e86d7000000b002b6a7dd0e22mr1518808ljj.48.1690380647891; Wed, 26 Jul 2023 07:10:47 -0700 (PDT) X-Received: by 2002:a2e:86d7:0:b0:2b6:a7dd:e22 with SMTP id n23-20020a2e86d7000000b002b6a7dd0e22mr1518793ljj.48.1690380647707; Wed, 26 Jul 2023 07:10:47 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-066-182-192.088.066.pools.vodafone-ip.de. [88.66.182.192]) by smtp.gmail.com with ESMTPSA id k14-20020a7bc30e000000b003fc02219081sm2099714wmj.33.2023.07.26.07.10.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:10:47 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Christian Brauner , Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v7 06/11] ceph: allow idmapped permission inode op Date: Wed, 26 Jul 2023 16:10:21 +0200 Message-Id: <20230726141026.307690-7-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772493057090440756 X-GMAIL-MSGID: 1772493057090440756 From: Christian Brauner Enable ceph_permission() to handle idmapped mounts. This is just a matter of passing down the mount's idmapping. Cc: Xiubo Li Cc: Jeff Layton Cc: Ilya Dryomov Cc: ceph-devel@vger.kernel.org Signed-off-by: Christian Brauner Signed-off-by: Alexander Mikhalitsyn --- fs/ceph/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 136b68ccdbef..9b50861bd2b5 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -2977,7 +2977,7 @@ int ceph_permission(struct mnt_idmap *idmap, struct inode *inode, err = ceph_do_getattr(inode, CEPH_CAP_AUTH_SHARED, false); if (!err) - err = generic_permission(&nop_mnt_idmap, inode, mask); + err = generic_permission(idmap, inode, mask); return err; } From patchwork Wed Jul 26 14:10:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 126405 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp437001vqo; Wed, 26 Jul 2023 07:19:41 -0700 (PDT) X-Google-Smtp-Source: APBJJlGNNVudO+MQB0vGFYKVPJRszMFtt8O4hz3J2BwC9igatLcw6wQCEtyEuGv2LL2zRQIYjB3G X-Received: by 2002:a05:6a21:339c:b0:110:9210:f6ac with SMTP id yy28-20020a056a21339c00b001109210f6acmr2133185pzb.37.1690381181450; Wed, 26 Jul 2023 07:19:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690381181; cv=none; d=google.com; s=arc-20160816; b=JfuSm1kDMYsH05pE5Wlpci/Eh4HY8klHrJ/lFgTeBdu0dJmAtu0yqBEFkDLJ+kOzZs SvPuCIwAgHbO9yHwA3IFfBchIvCqksFsjKON9EELdktZdf5rc2E88t0LcU3UE7lgU5kt gO6ncmlasv98ufYKiLQYlvRUy32Apnd9lZOc/q2N/EkVobfUhZWI4579cxygNkx4pXKu CcSf0ncP9b7kv3PgKbG9ZR5JNg6eoD98X1Q2jj1sJ5Zcau8Ozv4xTWLak9I/h/7uWiXL MoC4c9Z+tC9hdM839FbbR8nls4DT+79YPChfcM3qptbbA4KfMm4SSJBGsN0HYrrZp6bk GYDQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nLZMqtT0BTuD0r3ld9T+VcVOIz8LP+RVDN6gyhT7tPs=; fh=Z2mkFIQPI1atT1PXylFFs5aXkUtGzwkgwqJaEftWDsI=; b=kyLhYzz3q+4g3oH0GmjDKZN5UCzhg5icmPQmJ8V0BT82klLGt2Kv8mileYGEOxt7Jh odS4xfm36w/gV8n3+mW17rjd3HqOK8bcLfgRhDLnXCkgIzVedAneOk3jj5c/74H6usQ/ 3MAG3IsubV2rvctY1C0wNGGQxB8i8WH4cndQtwJoKRSsXS3O4o2D4IvM4l97QSpJzTzB mdKKnUIkh382QVJQs2Ez7lauFdr0e1p6EAhEJtw0YtJm8VNUlE5T9//zQW8D6TWA1Tf9 bdz0rlonULv0jg6Hu5tVjcx888SVe49pyBJSGc9C8r4tR6FyR6ag6jY1TPWcNgLuIBAG BzBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=djrM7BUO; 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=canonical.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a6-20020a056a000c8600b0068240c29150si13920006pfv.227.2023.07.26.07.19.27; Wed, 26 Jul 2023 07:19:41 -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=@canonical.com header.s=20210705 header.b=djrM7BUO; 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=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234474AbjGZOMm (ORCPT + 99 others); Wed, 26 Jul 2023 10:12:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232924AbjGZOL5 (ORCPT ); Wed, 26 Jul 2023 10:11:57 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E431E3C0D for ; Wed, 26 Jul 2023 07:11:19 -0700 (PDT) Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 8077242481 for ; Wed, 26 Jul 2023 14:10:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380654; bh=nLZMqtT0BTuD0r3ld9T+VcVOIz8LP+RVDN6gyhT7tPs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=djrM7BUOB5QN8syjbKZkb7GeZo7d0coGbLOVwG0furKKiUUYF+Y4gsCfig7cABDwe 2DhZIMLAhpJ0hibGnz2aaOmSed7ojA1R9PEJTnDDzQVWBt3xPAhNdlWfTyV+h3pq8e t7dclQsUy/aWdzBHp/ngplKkkqBTsRYJ8CdfPSPYV/zyT81mfUs2h2Ej7Qyuz4odOH TTEXUU9LIXNgG6OBIx8wC7UrEeWw5nrTUaLLwXyIYclhAfNOjAk0Q5UHBIFEc0R8Mz 4hs+o1zKPVLfuUt58TrzHSEqknHJ6ZsK4TLxS4GLLr148NHpFTXv27fU0x0PRbxR7c YypvQc7mjH4LQ== Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-3fd2778f5e4so5913775e9.1 for ; Wed, 26 Jul 2023 07:10:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380650; x=1690985450; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nLZMqtT0BTuD0r3ld9T+VcVOIz8LP+RVDN6gyhT7tPs=; b=QPctOeuHHU5/2vVRLlihtJ9asU4SdfyS1uYHWO4UdEqNZ9s6TuGx/HzKq7jDTJsEhi iuSJeBGNwxmuE+nTRJpSX378xJjsGKQgPT6o6ML62JZCkIOSCIV9oh32bC9gu2weGSOy GQaJWHPJ+ioiH2eTQfSZg8o1AWv1JsXJHWilRHE3D3EDNptKnPrt/3lYsu7Ekx7MJFwP 67h5YZZYvDOK8KJ7fZar2zpV5MRZHQ6B9ieNt5jJinRBb/SA4ou+JDvP7YWA9OLyjsVS 3WjLSpIMRLfNHRbmFSSTOhEGa/GK2dHwMpaTwfgmi2y5fOq0cyWA0ivyaxtjSdB+HQxw +8kg== X-Gm-Message-State: ABy/qLZg/DJk46GaW4Bi0iLU+oXP6i0YgSUIQ0B4sqYEAJxHy+R9sGLO GkKchxGaL9rP84LwwbgmR7d9iG0UjzA27mspZ0Jp7wpcSD2F4rrrrk4noItHEULYpWk1Z4famoQ Ej21Ihi4WClfPmRqrLgRKUXB/gQREF1LQxLB1LJCcCw== X-Received: by 2002:a05:600c:5187:b0:3fa:821e:1fb5 with SMTP id fa7-20020a05600c518700b003fa821e1fb5mr5126477wmb.5.1690380650031; Wed, 26 Jul 2023 07:10:50 -0700 (PDT) X-Received: by 2002:a05:600c:5187:b0:3fa:821e:1fb5 with SMTP id fa7-20020a05600c518700b003fa821e1fb5mr5126454wmb.5.1690380649765; Wed, 26 Jul 2023 07:10:49 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-066-182-192.088.066.pools.vodafone-ip.de. [88.66.182.192]) by smtp.gmail.com with ESMTPSA id k14-20020a7bc30e000000b003fc02219081sm2099714wmj.33.2023.07.26.07.10.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:10:49 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v7 07/11] ceph: pass idmap to __ceph_setattr Date: Wed, 26 Jul 2023 16:10:22 +0200 Message-Id: <20230726141026.307690-8-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772493137372401483 X-GMAIL-MSGID: 1772493137372401483 Just pass down the mount's idmapping to __ceph_setattr, because we will need it later. Cc: Xiubo Li Cc: Jeff Layton Cc: Ilya Dryomov Cc: brauner@kernel.org Cc: ceph-devel@vger.kernel.org Signed-off-by: Alexander Mikhalitsyn --- fs/ceph/acl.c | 4 ++-- fs/ceph/crypto.c | 2 +- fs/ceph/inode.c | 5 +++-- fs/ceph/super.h | 3 ++- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/fs/ceph/acl.c b/fs/ceph/acl.c index 32b26deb1741..89280c168acb 100644 --- a/fs/ceph/acl.c +++ b/fs/ceph/acl.c @@ -142,7 +142,7 @@ int ceph_set_acl(struct mnt_idmap *idmap, struct dentry *dentry, newattrs.ia_ctime = current_time(inode); newattrs.ia_mode = new_mode; newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; - ret = __ceph_setattr(inode, &newattrs, NULL); + ret = __ceph_setattr(idmap, inode, &newattrs, NULL); if (ret) goto out_free; } @@ -153,7 +153,7 @@ int ceph_set_acl(struct mnt_idmap *idmap, struct dentry *dentry, newattrs.ia_ctime = old_ctime; newattrs.ia_mode = old_mode; newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; - __ceph_setattr(inode, &newattrs, NULL); + __ceph_setattr(idmap, inode, &newattrs, NULL); } goto out_free; } diff --git a/fs/ceph/crypto.c b/fs/ceph/crypto.c index b9071bba3b08..8cf32e7f59bf 100644 --- a/fs/ceph/crypto.c +++ b/fs/ceph/crypto.c @@ -112,7 +112,7 @@ static int ceph_crypt_set_context(struct inode *inode, const void *ctx, size_t l cia.fscrypt_auth = cfa; - ret = __ceph_setattr(inode, &attr, &cia); + ret = __ceph_setattr(&nop_mnt_idmap, inode, &attr, &cia); if (ret == 0) inode_set_flags(inode, S_ENCRYPTED, S_ENCRYPTED); kfree(cia.fscrypt_auth); diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 9b50861bd2b5..6c4cc009d819 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -2466,7 +2466,8 @@ static int fill_fscrypt_truncate(struct inode *inode, return ret; } -int __ceph_setattr(struct inode *inode, struct iattr *attr, struct ceph_iattr *cia) +int __ceph_setattr(struct mnt_idmap *idmap, struct inode *inode, + struct iattr *attr, struct ceph_iattr *cia) { struct ceph_inode_info *ci = ceph_inode(inode); unsigned int ia_valid = attr->ia_valid; @@ -2818,7 +2819,7 @@ int ceph_setattr(struct mnt_idmap *idmap, struct dentry *dentry, ceph_quota_is_max_bytes_exceeded(inode, attr->ia_size)) return -EDQUOT; - err = __ceph_setattr(inode, attr, NULL); + err = __ceph_setattr(idmap, inode, attr, NULL); if (err >= 0 && (attr->ia_valid & ATTR_MODE)) err = posix_acl_chmod(&nop_mnt_idmap, dentry, attr->ia_mode); diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 4e78de1be23e..e729cde7b4a0 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -1101,7 +1101,8 @@ struct ceph_iattr { struct ceph_fscrypt_auth *fscrypt_auth; }; -extern int __ceph_setattr(struct inode *inode, struct iattr *attr, struct ceph_iattr *cia); +extern int __ceph_setattr(struct mnt_idmap *idmap, struct inode *inode, + struct iattr *attr, struct ceph_iattr *cia); extern int ceph_setattr(struct mnt_idmap *idmap, struct dentry *dentry, struct iattr *attr); extern int ceph_getattr(struct mnt_idmap *idmap, From patchwork Wed Jul 26 14:10:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 126440 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp476266vqo; Wed, 26 Jul 2023 08:21:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlFzLFoL9pcKg48HKONru2ccnrG7dKHqACbG8FcW4jKwE5ezDq3WC9eZqvzp5Xb8VwssN1m8 X-Received: by 2002:a05:6a21:9986:b0:133:bbe0:312f with SMTP id ve6-20020a056a21998600b00133bbe0312fmr2530270pzb.50.1690384895983; Wed, 26 Jul 2023 08:21:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690384895; cv=none; d=google.com; s=arc-20160816; b=EOcPK0DNc6HaCaqLBW5xT+gW3qmMSaFLvXPJ1vJt2S2eegcopn5NPmJjIzgGLw19rA DK55W5FSFKpMh3mnmqwB9zJuDNysmuVk7TDr1daGsrT+jLQrtTvs6m6ca9lQTIyG+xfa RJD0cJ898w7hgE5sky8kbtMxFm42G1K9l2yuVzFamZLn08v152kMc2hQ3JOBiKZOTlhQ iaTtH5XSILpRVpwT6lwG8kmiMbAl7f+XQUBoHz9GQoz2J/A9d6gkVlaFBNruGj+4Od4m GqTK4MBzICalneqHJKu1RNznK4rlJzXY7VgRIenieTyc/I6jSk6rrqt8ykbqVYu5uTi1 hswQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5Jek2ao2Gg23mz8Y2ufU3Ts9QQq34R72Sad2dO2kfLI=; fh=4TkUEkUtkmMzuUVnw4jjBfLQ2m58OJnBJO1eZJpOGII=; b=RdnktdhhFhY0WXcJj3qUUis3V1atSVlDwPqCbXtlmJDUCNMgc2pdWuF0alvNhXTLkw ssj4Jg5gZw/nwrrG0aPAlopjBLG6/E9U8Rc41lQgX/LjTEE6x2GLo7xIdMBJuRSuXFUK fylqets69K4iLPJ49G56wbV7i8k5uN4BdKCYWiUym0xcM05wbHEelVH/3Ma+8OyjzEN0 Ob6M9JUxlQE2e+mPb/qaKt87qN7gEzJlgsY8Ldx6ykOsnazojTzTw3o7eidjAAVMLQQX jOEh/nSLyprv4ecHqt5wVHbACxEeJeUdVEhSTBG//9GWhaJNFijsjK/AA2zjI1CcACpn Nl6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=Huw+yv96; 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=canonical.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bw16-20020a056a00409000b00686b62a6dc4si2213378pfb.145.2023.07.26.08.21.21; Wed, 26 Jul 2023 08:21:35 -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=@canonical.com header.s=20210705 header.b=Huw+yv96; 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=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234500AbjGZOMy (ORCPT + 99 others); Wed, 26 Jul 2023 10:12:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232756AbjGZOL6 (ORCPT ); Wed, 26 Jul 2023 10:11:58 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC06D19BE for ; Wed, 26 Jul 2023 07:11:25 -0700 (PDT) Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 49F7542483 for ; Wed, 26 Jul 2023 14:10:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380655; bh=5Jek2ao2Gg23mz8Y2ufU3Ts9QQq34R72Sad2dO2kfLI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Huw+yv96Q6JnUXQUHGSgOuuUwJu0mXq2UHfgU2SpUvA+5QrXdUHTwtzhTJ8wZsdRq t6FE4aa8kil3d5Clce6Cwpljm6fncxn+4CdZ/ci2YeMrPZLYdP2aiIQJ9djntqZjZl s6JXA/9FyJeTO0ORIBTI3As4eVpvamYCNt27JPVAWZ+ac2Qm+L020757LvbThTc2tt uXeSJcR4VT783Zde79w3RHiJluz3iPgezRIAfLkMv+U1bpAaph8RWUWbCkV87A5BRP t7vPkl6jU683jNz61vtdudloWbbtepHJKDVeI2PBEEs/et1UQ5f5ANYFEnRO6RIfwS E2rgmaJHac1Xw== Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-3fc00d7d62cso40675215e9.2 for ; Wed, 26 Jul 2023 07:10:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380652; x=1690985452; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5Jek2ao2Gg23mz8Y2ufU3Ts9QQq34R72Sad2dO2kfLI=; b=jQRnW30kqLpL5a9d8LVVgr7rAq21ZozV4CfngGFtivVLiBXbNlevFgOx7KxrZDJvvs gab+QM7DWVFW6m8nEvTKcxqwaovT3TEsxNp+WSc5FWXnmi9VcUrpmsZgV00nOQDeaXdo 7RYBWunFPLgqO2MRwkT8p6ufPiE4BLOZ99+hpIVOtNxDairsEA2OnEgGXaS+/nMhLOSU wtO+3hXAEnXxteHOk3d//yxwGgsuscGC3HTe2SgOCJpSjkVZxcAFTlcRfMijEhoVfvMx CzTHqlvTuCMIdgD+0S1Mr5zNn/M1syVF6h6o823J8xubvlXg4/ZQ2yzphIrCSShB2OJX azTA== X-Gm-Message-State: ABy/qLY0/sRyM3xG0jW/ivD8vKBGUBQeQx8/dH+YfO4bKTlcNOv2siif AvnZdlMla49HpGonVfaeTXQnlYEkG4gisVNo1DIv+qar4WX1a09m5FS5g56QwCn261/gLNqCa/u TgGXhv9KPTt0HO/NLxbUrTUmjpemOccMKzZaaJMrmrw== X-Received: by 2002:a7b:c319:0:b0:3fb:e206:ca5f with SMTP id k25-20020a7bc319000000b003fbe206ca5fmr1487597wmj.31.1690380652184; Wed, 26 Jul 2023 07:10:52 -0700 (PDT) X-Received: by 2002:a7b:c319:0:b0:3fb:e206:ca5f with SMTP id k25-20020a7bc319000000b003fbe206ca5fmr1487585wmj.31.1690380651969; Wed, 26 Jul 2023 07:10:51 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-066-182-192.088.066.pools.vodafone-ip.de. [88.66.182.192]) by smtp.gmail.com with ESMTPSA id k14-20020a7bc30e000000b003fc02219081sm2099714wmj.33.2023.07.26.07.10.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:10:51 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Christian Brauner , Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v7 08/11] ceph: allow idmapped setattr inode op Date: Wed, 26 Jul 2023 16:10:23 +0200 Message-Id: <20230726141026.307690-9-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772497032405993694 X-GMAIL-MSGID: 1772497032405993694 From: Christian Brauner Enable __ceph_setattr() to handle idmapped mounts. This is just a matter of passing down the mount's idmapping. Cc: Xiubo Li Cc: Jeff Layton Cc: Ilya Dryomov Cc: ceph-devel@vger.kernel.org Signed-off-by: Christian Brauner [ adapted to b27c82e12965 ("attr: port attribute changes to new types") ] Signed-off-by: Alexander Mikhalitsyn --- v4: - introduced fsuid/fsgid local variables v3: - reworked as Christian suggested here: https://lore.kernel.org/lkml/20230602-vorzeichen-praktikum-f17931692301@brauner/ --- fs/ceph/inode.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 6c4cc009d819..0a8cc0327f85 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -2553,33 +2553,37 @@ int __ceph_setattr(struct mnt_idmap *idmap, struct inode *inode, #endif /* CONFIG_FS_ENCRYPTION */ if (ia_valid & ATTR_UID) { + kuid_t fsuid = from_vfsuid(idmap, i_user_ns(inode), attr->ia_vfsuid); + doutc(cl, "%p %llx.%llx uid %d -> %d\n", inode, ceph_vinop(inode), from_kuid(&init_user_ns, inode->i_uid), from_kuid(&init_user_ns, attr->ia_uid)); if (issued & CEPH_CAP_AUTH_EXCL) { - inode->i_uid = attr->ia_uid; + inode->i_uid = fsuid; dirtied |= CEPH_CAP_AUTH_EXCL; } else if ((issued & CEPH_CAP_AUTH_SHARED) == 0 || - !uid_eq(attr->ia_uid, inode->i_uid)) { + !uid_eq(fsuid, inode->i_uid)) { req->r_args.setattr.uid = cpu_to_le32( - from_kuid(&init_user_ns, attr->ia_uid)); + from_kuid(&init_user_ns, fsuid)); mask |= CEPH_SETATTR_UID; release |= CEPH_CAP_AUTH_SHARED; } } if (ia_valid & ATTR_GID) { + kgid_t fsgid = from_vfsgid(idmap, i_user_ns(inode), attr->ia_vfsgid); + doutc(cl, "%p %llx.%llx gid %d -> %d\n", inode, ceph_vinop(inode), from_kgid(&init_user_ns, inode->i_gid), from_kgid(&init_user_ns, attr->ia_gid)); if (issued & CEPH_CAP_AUTH_EXCL) { - inode->i_gid = attr->ia_gid; + inode->i_gid = fsgid; dirtied |= CEPH_CAP_AUTH_EXCL; } else if ((issued & CEPH_CAP_AUTH_SHARED) == 0 || - !gid_eq(attr->ia_gid, inode->i_gid)) { + !gid_eq(fsgid, inode->i_gid)) { req->r_args.setattr.gid = cpu_to_le32( - from_kgid(&init_user_ns, attr->ia_gid)); + from_kgid(&init_user_ns, fsgid)); mask |= CEPH_SETATTR_GID; release |= CEPH_CAP_AUTH_SHARED; } @@ -2807,7 +2811,7 @@ int ceph_setattr(struct mnt_idmap *idmap, struct dentry *dentry, if (err) return err; - err = setattr_prepare(&nop_mnt_idmap, dentry, attr); + err = setattr_prepare(idmap, dentry, attr); if (err != 0) return err; @@ -2822,7 +2826,7 @@ int ceph_setattr(struct mnt_idmap *idmap, struct dentry *dentry, err = __ceph_setattr(idmap, inode, attr, NULL); if (err >= 0 && (attr->ia_valid & ATTR_MODE)) - err = posix_acl_chmod(&nop_mnt_idmap, dentry, attr->ia_mode); + err = posix_acl_chmod(idmap, dentry, attr->ia_mode); return err; } From patchwork Wed Jul 26 14:10:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 126418 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp447286vqo; Wed, 26 Jul 2023 07:36:31 -0700 (PDT) X-Google-Smtp-Source: APBJJlFgnlGMGkrJtHIRw/wH5VvVEcBk8vDec2SgwMekVluYCU+xe1ZAiAyzBwq+IZVSsQ0jutxW X-Received: by 2002:a17:90b:38cd:b0:263:d249:9b7 with SMTP id nn13-20020a17090b38cd00b00263d24909b7mr2258292pjb.25.1690382191231; Wed, 26 Jul 2023 07:36:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690382191; cv=none; d=google.com; s=arc-20160816; b=iAewhN7kKAPVPWIH9ooOMtjchFTjtEFkCFsls30PuK/Z+xbS4sYsM+WBqz3VnNYIR7 XeWWeS2QzI2n1ytP3Mkr+IH6RKecKsEBteoFSylM/en4unvIPNdZfdBWxgcLMghNOUjZ 2Jciz/SvJSP8mXMhU21oAwHY4P4F6uxsWqqpig5A2Qf2ozII1iNJLLeYiBPBjMHb3oT1 Qpo2u/ic/QRjQr8bhHPKVACUO2V8xAaSo/c3KjdPHpV4Bl0jIlboP208q8fuPVbMw9Ul ZT5+5HKq/8OwtBZRvSm8wgnijwaNOijrmnl8AfSS0SAw9s3vecyMSoO+C04iN13beKq2 FIwQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=btgWKV3yveDSttvNeYwkzRRCd2/ECqsGtpVUjkBAwbI=; fh=4TkUEkUtkmMzuUVnw4jjBfLQ2m58OJnBJO1eZJpOGII=; b=gT4n6thdkzK/a0F4OID8cgxBeEwhoEZoEn2+m8alt+VfKwcq3aSbvvEgnB/YaZzchz 3fLz2f1fDZ/zryaUpG4HH/309Oxp//4FZ0bVj7kc35XjDaIJnL5QNcEs+xfk2cNyuYqI jGku9Kdig8XtwTZtrPgPg7nqfihNu9Vws1DwLBFfKhwgRFCd60nYdNbuV6Z079LyV+v9 Et0VMtf/ISEh1jPuKn+KKduAAXTPGy69Tol/pxq6vqvFD08oeBfZFNfRZ6uhgPycnxkK +juKVs6poTM7Ra6IZyIRwTa+ECQ6bNSPCrwRgOZOxA/z9T26klycwujo1NWtmvvUvkkO nWZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=S0a+yz8s; 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=canonical.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x35-20020a17090a6c2600b00265ca1c461asi1154899pjj.175.2023.07.26.07.36.17; Wed, 26 Jul 2023 07:36:31 -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=@canonical.com header.s=20210705 header.b=S0a+yz8s; 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=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232537AbjGZONb (ORCPT + 99 others); Wed, 26 Jul 2023 10:13:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233232AbjGZOL7 (ORCPT ); Wed, 26 Jul 2023 10:11:59 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A22D2696 for ; Wed, 26 Jul 2023 07:11:26 -0700 (PDT) Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id BB5C642489 for ; Wed, 26 Jul 2023 14:10:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380655; bh=btgWKV3yveDSttvNeYwkzRRCd2/ECqsGtpVUjkBAwbI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=S0a+yz8sIcNtK0ZXpiRQfpxq9kIgspctVB6TV73YCV8mw+Qw2pstbwcWgesvCcweF uCrxcVjJR10rhTYJFK/YoeauhkeI6Ht997wkqy2DjN5UYbf2ZcooyeTaEhJ0ekGvZt w4dt5MEDvOkDsYAb7+TJ9YMFgshgaNisPhJbDqLIkzNbqBd/DO6ZVFkJwEhFBRn1xB BSplGh07/jiThrHbga1ZsVOnUPS1UmHWa5I1hMCc2ynE3indjG+DB9JaDPk5duU6ri 3/XT9/2pkdFSVWMiT8ycLp/nJt1MULYB5MwXF6R7dEUJ+xz7lOJeBj1mqg1SlLUIfs rUdSt27IekmdQ== Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-3f41a04a297so33911635e9.3 for ; Wed, 26 Jul 2023 07:10:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380654; x=1690985454; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=btgWKV3yveDSttvNeYwkzRRCd2/ECqsGtpVUjkBAwbI=; b=MVcHjlQQM8jHq1geaGEYD97TkdUMy6z5SJvQ66JXjgaQxPTU9ONo65KomqrS9S6kVO Q7rboRUr+w9vX/E+5fRCJUe/y53MO5wgAGI6+FkzyxnX/MhFWUBGy3GYH76qamWnelmo +QhcTSay3xNNyap3XORc99vczRjjKdaEPsCdBpWioDCINqfGGBbABXS98x3vr56D9KhJ UZKp1LGFtemHR/3+LB7RXTFb7GtIl09YZLrZ20AQtfaG3cqCiiZcpjxesKsDzZPmu/zw fziJnz08KvU591u3LZHbk7m/6yRK96y21LmK9f7qREkIyMywKrbYX4wJfL8DMCWpZDc+ stpg== X-Gm-Message-State: ABy/qLYy+00d/eX6//+UD8J/62m5HTUM25RBC8l2PVVndFkYMbxlvmQa Xgzgadst2e1MGZRw8OmhBrKkc+ifUf8qh1eYcrl6VTBe4GJA7F/shRStrJIusphLsHsVU9NLfCZ op0NK9er/1H/uxid9WQl8ALdh1ZSUev1lZwpx7UsGIQ== X-Received: by 2002:a1c:f30b:0:b0:3fa:9823:407 with SMTP id q11-20020a1cf30b000000b003fa98230407mr1492374wmq.18.1690380654470; Wed, 26 Jul 2023 07:10:54 -0700 (PDT) X-Received: by 2002:a1c:f30b:0:b0:3fa:9823:407 with SMTP id q11-20020a1cf30b000000b003fa98230407mr1492359wmq.18.1690380654250; Wed, 26 Jul 2023 07:10:54 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-066-182-192.088.066.pools.vodafone-ip.de. [88.66.182.192]) by smtp.gmail.com with ESMTPSA id k14-20020a7bc30e000000b003fc02219081sm2099714wmj.33.2023.07.26.07.10.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:10:53 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Christian Brauner , Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v7 09/11] ceph/acl: allow idmapped set_acl inode op Date: Wed, 26 Jul 2023 16:10:24 +0200 Message-Id: <20230726141026.307690-10-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772494196906835890 X-GMAIL-MSGID: 1772494196906835890 From: Christian Brauner Enable ceph_set_acl() to handle idmapped mounts. This is just a matter of passing down the mount's idmapping. Cc: Xiubo Li Cc: Jeff Layton Cc: Ilya Dryomov Cc: ceph-devel@vger.kernel.org Signed-off-by: Christian Brauner Signed-off-by: Alexander Mikhalitsyn --- fs/ceph/acl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ceph/acl.c b/fs/ceph/acl.c index 89280c168acb..ffc6a1c02388 100644 --- a/fs/ceph/acl.c +++ b/fs/ceph/acl.c @@ -107,7 +107,7 @@ int ceph_set_acl(struct mnt_idmap *idmap, struct dentry *dentry, case ACL_TYPE_ACCESS: name = XATTR_NAME_POSIX_ACL_ACCESS; if (acl) { - ret = posix_acl_update_mode(&nop_mnt_idmap, inode, + ret = posix_acl_update_mode(idmap, inode, &new_mode, &acl); if (ret) goto out; From patchwork Wed Jul 26 14:10:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 126411 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp445773vqo; Wed, 26 Jul 2023 07:33:56 -0700 (PDT) X-Google-Smtp-Source: APBJJlGHyl/XGtE9eAGGsQT8UcEWD7jSuchuCLk/TvmOBdvGn5QKI2t4YGn4qoTTkjYf4kSiOD7/ X-Received: by 2002:a17:90a:734b:b0:268:281d:64f0 with SMTP id j11-20020a17090a734b00b00268281d64f0mr1844840pjs.8.1690382035420; Wed, 26 Jul 2023 07:33:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690382035; cv=none; d=google.com; s=arc-20160816; b=TQtsdvqONUJ1vl5KNGfq50AdCEzoicyKAozDnZiMsYjMQ+L94yD8iLHmhW7AQ5jtyV NOJLboU1/GP2Cxqdc/mzu4BDVX00EUX0kIE7SFirQoK3nSyFpOrKixfRWGUDWXFz3FoB v1qKbAlhy9DEvOmwi2wxBJOS66jkUw1E4s7E3RTCCvTEvkUYkLTzkNU3oBN48Pc4ezVN 2RS5985L+fddYUs8B1xjDY4aV4Eg8/M/uiTMkGFJFuLa1BYI7ggRbr1GNAVs3vpCzlTC 2Z924pxpLSdHznAz5H6Qf5mrsOEY1ULjrBtoL+IEoDigtEPM874p9nRBFkT1oxZzNv7k cE8g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dyH4eLS/ZCdAMtA+4CRaXqW6UBtXDh7SsBX0oiAwXGM=; fh=4TkUEkUtkmMzuUVnw4jjBfLQ2m58OJnBJO1eZJpOGII=; b=WYfjZ4hkfohSdOpIZr/wgwl8MykeIdYf+3uo+cmho1xtsyl0lnCTTHGe/rfYm+lkoF cD7KMH4pTNZoXWDrqmTBMHdZqbLc+RvLmr1tZf12cbMbdW3B3uTTEyBFirJb6zcplLum cYTFMqQxeHI0mzSFSa9N8+C14/CvOvXE0ubCmhuxGr2oiY6jOSdHKVdVESaGuUN1r7yM n6KnNqyYXfPY9zHjWEqZLgKzKC1cMJhlO/srKBJ89ZBAE8z4nsToyvdm/9UmEUuw3EFR dLmftK/wEZAMGCVfeg5r2hyqZJBvPnGphKAmAYmQX5zk6yYKhkpigjZ9JMLV09IAc6S2 32mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=uzUnLwoq; 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=canonical.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b1-20020a17090a6e0100b00268307ac3cfsi1135116pjk.185.2023.07.26.07.33.41; Wed, 26 Jul 2023 07:33:55 -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=@canonical.com header.s=20210705 header.b=uzUnLwoq; 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=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233595AbjGZONf (ORCPT + 99 others); Wed, 26 Jul 2023 10:13:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233272AbjGZOL7 (ORCPT ); Wed, 26 Jul 2023 10:11:59 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DC6B2704 for ; Wed, 26 Jul 2023 07:11:26 -0700 (PDT) Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 15E5142479 for ; Wed, 26 Jul 2023 14:10:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380658; bh=dyH4eLS/ZCdAMtA+4CRaXqW6UBtXDh7SsBX0oiAwXGM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uzUnLwoq8VJYmmEbeMrpUxaq3Zfz5TsanBPbw4eug/TWexfBrJw+XNoMHEmwRI6eC dBAuGn1ZF8ZKg9wDSL3ATbW4XzjKD1/T24CIQ8imZknw5/Fy1k84bTF59A2EPluO2e nTODKJuQZBQDly13NB0vU9UG/hr8lxGDzVXOo+MXComlR/5GZcZHbLI7K/vm+5+IRx ZA551k1KF3E34Acjil1ql+etItIatlC9xTxcBB1n08rAsW7gjmVd2Jn1ISBq2L3bzr fNFhEIT6L94LPSR1AgJwWTbtfAXmTrNg6Tdc7OoOP6nmhoejngnHzfbMUHjtxE07FF 3uIB/Ai17EhwQ== Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-3fbe590234aso40283395e9.1 for ; Wed, 26 Jul 2023 07:10:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380656; x=1690985456; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dyH4eLS/ZCdAMtA+4CRaXqW6UBtXDh7SsBX0oiAwXGM=; b=P+ORP975R42l4pG9Dy+kaIoNj5Ow+pS+L5JxCgdy6NXvdCVxA4wXzywji+y0au6qCZ 0Y2Dbmg1itiTu1s3VsoIlc/ho/aIrtuSQVQffVMrKZngshNDdsMWaSxL0XaKL4onsr5y DE2HkQFlxndmbRGmwblFi2wTlR5/on09Nnd8e0LOqT37Zeq+TYz6MhRikaYsoh7qqmUB eiJjSdJDB3Jbyxnybru+Fbz7sus6Oyut70Y1je8/wjV3Gm00rOOMAEU5x+j8Gr4pCYxf jtMqtATw+G1YdadEEs/TrJ1S/nBHx/o08pGdRbnv7Mi7QQiTO3/UpFtoVtgEFurkahU6 Fkug== X-Gm-Message-State: ABy/qLaZ2OrPYG9KpHTK0IEd3frt7f788CvdkOjehd0lK+5GLzVBxob9 K60/0mKuTL6mL4/SBpbMHj8zy6vo7KGNNah7wFA3YFGKnxdKdphaJIxm6NTxO9btfa8xjO8gGp4 g1dO7uG8RqAw6Eoq9Wzk0ERFH5Gngal0D4qAGP3wMWQ== X-Received: by 2002:a7b:c3d9:0:b0:3fc:855:db42 with SMTP id t25-20020a7bc3d9000000b003fc0855db42mr1517995wmj.34.1690380656674; Wed, 26 Jul 2023 07:10:56 -0700 (PDT) X-Received: by 2002:a7b:c3d9:0:b0:3fc:855:db42 with SMTP id t25-20020a7bc3d9000000b003fc0855db42mr1517986wmj.34.1690380656489; Wed, 26 Jul 2023 07:10:56 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-066-182-192.088.066.pools.vodafone-ip.de. [88.66.182.192]) by smtp.gmail.com with ESMTPSA id k14-20020a7bc30e000000b003fc02219081sm2099714wmj.33.2023.07.26.07.10.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:10:56 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Christian Brauner , Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v7 10/11] ceph/file: allow idmapped atomic_open inode op Date: Wed, 26 Jul 2023 16:10:25 +0200 Message-Id: <20230726141026.307690-11-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772494032984367614 X-GMAIL-MSGID: 1772494032984367614 From: Christian Brauner Enable ceph_atomic_open() to handle idmapped mounts. This is just a matter of passing down the mount's idmapping. Cc: Xiubo Li Cc: Jeff Layton Cc: Ilya Dryomov Cc: ceph-devel@vger.kernel.org Signed-off-by: Christian Brauner [ adapted to 5fadbd9929 ("ceph: rely on vfs for setgid stripping") ] Signed-off-by: Alexander Mikhalitsyn --- v4: - call mnt_idmap_get --- fs/ceph/file.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 7470daafe595..f73d8b760682 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -668,7 +668,9 @@ static int ceph_finish_async_create(struct inode *dir, struct inode *inode, in.truncate_seq = cpu_to_le32(1); in.truncate_size = cpu_to_le64(-1ULL); in.xattr_version = cpu_to_le64(1); - in.uid = cpu_to_le32(from_kuid(&init_user_ns, current_fsuid())); + in.uid = cpu_to_le32(from_kuid(&init_user_ns, + mapped_fsuid(req->r_mnt_idmap, + &init_user_ns))); if (dir->i_mode & S_ISGID) { in.gid = cpu_to_le32(from_kgid(&init_user_ns, dir->i_gid)); @@ -676,7 +678,9 @@ static int ceph_finish_async_create(struct inode *dir, struct inode *inode, if (S_ISDIR(mode)) mode |= S_ISGID; } else { - in.gid = cpu_to_le32(from_kgid(&init_user_ns, current_fsgid())); + in.gid = cpu_to_le32(from_kgid(&init_user_ns, + mapped_fsgid(req->r_mnt_idmap, + &init_user_ns))); } in.mode = cpu_to_le32((u32)mode); @@ -743,6 +747,7 @@ static int ceph_finish_async_create(struct inode *dir, struct inode *inode, int ceph_atomic_open(struct inode *dir, struct dentry *dentry, struct file *file, unsigned flags, umode_t mode) { + struct mnt_idmap *idmap = file_mnt_idmap(file); struct ceph_fs_client *fsc = ceph_sb_to_fs_client(dir->i_sb); struct ceph_client *cl = fsc->client; struct ceph_mds_client *mdsc = fsc->mdsc; @@ -802,6 +807,7 @@ int ceph_atomic_open(struct inode *dir, struct dentry *dentry, mask |= CEPH_CAP_XATTR_SHARED; req->r_args.open.mask = cpu_to_le32(mask); req->r_parent = dir; + req->r_mnt_idmap = mnt_idmap_get(idmap); ihold(dir); if (IS_ENCRYPTED(dir)) { set_bit(CEPH_MDS_R_FSCRYPT_FILE, &req->r_req_flags); From patchwork Wed Jul 26 14:10:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 126421 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp452043vqo; Wed, 26 Jul 2023 07:44:53 -0700 (PDT) X-Google-Smtp-Source: APBJJlEOoXViidOYpuiX7ydHlcxZaR8g8vKa04NJzP7lI0p6mfz7OTMSouURodPlRjDODWAe5w2t X-Received: by 2002:a05:6870:d2a0:b0:1bb:6b9b:bc78 with SMTP id d32-20020a056870d2a000b001bb6b9bbc78mr2389955oae.42.1690382693286; Wed, 26 Jul 2023 07:44:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690382693; cv=none; d=google.com; s=arc-20160816; b=ixFcBXuEyDkMNg5VaUiNBOwicOgyOlmBBSHyv/EYocXNKh2OvYViM1/xaVQdgD7Irs FLQ0HnXqk6ON9JuEVYDB3xqDaVVE+q9aV7Y8OhrmWKCGVc+s+7fQWHCTfjQ6STkZaYqs k03CyYHbfQaZddWsvNLOYGZv1LfjiHDakhhvuaqvdchoW+pbaWhHrWsZVA+fXZa01fm7 WCAzzP08nE/7/4BClmYAUomY5r6TgvSb6eRDfw/QAjztzOrrFZTOFIvoexyFD5V14UoI 82cDTupiQvkyFpScLAaFN1yWgatN4smp5OqvR+dbWMhkndX7KkbcDPsD/ePmGpuPEVPT GdiQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=V+geJeK43HRcagd4RPosGF8b069CSl1zVYPfJFF5DgU=; fh=4TkUEkUtkmMzuUVnw4jjBfLQ2m58OJnBJO1eZJpOGII=; b=YusRXOYEqhJV3jgm3vF8wu2DZd4XqBUZF8mwIUN5EetwDbUvsP97qM70rm+iALFSGM jTmlDQgMTKG97NIRxNrp8pwFyfW7QPF19nRFTgZfz67MSFfURLvjbbwdUY7zKVxp08RP sV8q+c5nlOaWf8imdo3F/MTQVmL1Z3lpwK93btHbLNQ6Es3UWT2B5HsHtp9n435n2AuD CceBq/MLT8JjQ6S//AsHxMMG5iUgWtMGnoUVmjYqB3XnXazJrpEydLogVy6yk4ut0Q5W VeckiPW+KM9PiCnpo6YIQJ6N/kQytVgmHbb7h8nhtGT2kSKfmoPeWwsNR2SVj80uJDNS wcrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=eJq6wrru; 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=canonical.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p18-20020a170902ebd200b001b81fe65fa3si6480986plg.569.2023.07.26.07.44.39; Wed, 26 Jul 2023 07:44:53 -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=@canonical.com header.s=20210705 header.b=eJq6wrru; 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=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233039AbjGZOMe (ORCPT + 99 others); Wed, 26 Jul 2023 10:12:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230477AbjGZOLy (ORCPT ); Wed, 26 Jul 2023 10:11:54 -0400 Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CB54271C for ; Wed, 26 Jul 2023 07:11:19 -0700 (PDT) Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id BB9BD413D2 for ; Wed, 26 Jul 2023 14:10:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380659; bh=V+geJeK43HRcagd4RPosGF8b069CSl1zVYPfJFF5DgU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eJq6wrruPzn9weL7+AIH2e8i/jQYOM+TuP0puNOlo+4qQgY5/KxDgHxfXHJWMHQrC 1SHyHtRzvy1qH92UmvAYXPPLeY2mvfTFMS0OKgayK5tevnI6LW9cLeX+/t8JpciiFG /5U1uMNYGK3wto4Y1h0KwrrRpTbJkOdu80DE3iz1fgWt2Wi1iOi6VJS9fI3tREuDvk 8p6WUoAtMMNOhIqb6HlgkeVNXO9Rm08BvTF2bf3JjWk+K3TD9NZkqwXFWBYIzWSi4K W7SDQwOy2+FhdWtLebk01uKP0CZn7k+03iLgtQ8ejzIjlC/vXSiwM3kHDqsdeAGAtM t9daEuBSXQdGg== Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-3fbfc766a78so34241555e9.3 for ; Wed, 26 Jul 2023 07:10:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380659; x=1690985459; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=V+geJeK43HRcagd4RPosGF8b069CSl1zVYPfJFF5DgU=; b=IrGCHw8l7NQl5m6rJ8+Fbx2rmJFSY5Rw6BWyBaue1hP7yauN8MIqinZC4Xvq4czpei Xk2aUs9Hncv6FvGRUrbeAdiILmf7HQPm8cD9RxoQAqwFW3m/Q7+QAFTpUEA/kcTcv9JM cojNRXhTA7IimXLb5pp4XMqUN3MQUxeEseocH88CD1+OndrYjn6OOZZBDYZYGuvz+IpL 3WcK+WPQQxi+K1AVC6RQ2okACmMpNs6boJgrN64RUCtk4T4755olCd0v3rFS6BdSdW+M 1/OKtNCir8JI3qUC+2hIoFOczrYhcnBpZgrecUaujBNQ3syAe8ZNdQNwBZ0IlcXA50P+ YDSg== X-Gm-Message-State: ABy/qLYXCZzeo7s+rKU57OiawK5en0uGj6sCc2NgygCe5/vPBi+uXICC zf7ArKRiQDDVhlK9MsjCeTdiNBoCgOt2uuh8SvtV7l/YdOfh9QAdinyVTk0fBUFtOLY88OxBHq5 fqq6pqk8a0utFiRgmbsOnBc1ol7CLritwGmsV8SCkQixL6i1FwA== X-Received: by 2002:a1c:cc08:0:b0:3fb:dbd0:a7ea with SMTP id h8-20020a1ccc08000000b003fbdbd0a7eamr1439452wmb.37.1690380658870; Wed, 26 Jul 2023 07:10:58 -0700 (PDT) X-Received: by 2002:a1c:cc08:0:b0:3fb:dbd0:a7ea with SMTP id h8-20020a1ccc08000000b003fbdbd0a7eamr1439440wmb.37.1690380658568; Wed, 26 Jul 2023 07:10:58 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-066-182-192.088.066.pools.vodafone-ip.de. [88.66.182.192]) by smtp.gmail.com with ESMTPSA id k14-20020a7bc30e000000b003fc02219081sm2099714wmj.33.2023.07.26.07.10.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:10:58 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Christian Brauner , Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v7 11/11] ceph: allow idmapped mounts Date: Wed, 26 Jul 2023 16:10:26 +0200 Message-Id: <20230726141026.307690-12-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772494723008625935 X-GMAIL-MSGID: 1772494723008625935 From: Christian Brauner Now that we converted cephfs internally to account for idmapped mounts allow the creation of idmapped mounts on by setting the FS_ALLOW_IDMAP flag. Cc: Xiubo Li Cc: Jeff Layton Cc: Ilya Dryomov Cc: ceph-devel@vger.kernel.org Signed-off-by: Christian Brauner Signed-off-by: Alexander Mikhalitsyn --- fs/ceph/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 49fd17fbba9f..6326ab32e7b3 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -1581,7 +1581,7 @@ static struct file_system_type ceph_fs_type = { .name = "ceph", .init_fs_context = ceph_init_fs_context, .kill_sb = ceph_kill_sb, - .fs_flags = FS_RENAME_DOES_D_MOVE, + .fs_flags = FS_RENAME_DOES_D_MOVE | FS_ALLOW_IDMAP, }; MODULE_ALIAS_FS("ceph");