From patchwork Wed Jul 26 14:06:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13328089 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2417FC001DF for ; Wed, 26 Jul 2023 14:08:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232022AbjGZOIR (ORCPT ); Wed, 26 Jul 2023 10:08:17 -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 S231942AbjGZOHi (ORCPT ); Wed, 26 Jul 2023 10:07:38 -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 A45BF2D64 for ; Wed, 26 Jul 2023 07:07:06 -0700 (PDT) Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.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-1.canonical.com (Postfix) with ESMTPS id 47F86413C2 for ; Wed, 26 Jul 2023 14:07:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380425; bh=GFNwWvhavDkNrI4eqwez7OWrv+w+Iw1WNhnwQW/Fw7E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SfqbKCoZBGx2wtCacLq9In3u95LPdD5N54Wb+HuezuzetTVRqfMMJj0tDHWSuNYKS GEV1uK6bxCVBo0WvDKTczaLmFIAziUJZq9uiuKRnGCekTPusOeW+4K59N0FEgeStkq 4Ofz2mxkzfCD5BSsxFMhJbs6VYrGxVWyHa5TTJ+DUAndlgEeLn9RRiFl6+5bblH/53 +7QF7FKGTZo9UupUuuG/9AGjJj57GJxDbMHfQLfYg9oq6vTV/B4Yk5slZJXxGgFBbl UPmy98sVvbXWu0SrUJ9Z8+TBHpYvuEfqHJBUf6iCAquZ6LGkvD+wT0mHCUNuDFB9ae c2Ai4UeBhqInQ== Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-99bcfdaaa52so13448266b.0 for ; Wed, 26 Jul 2023 07:07:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380424; x=1690985224; 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=b/FAmlk68Ic8Vh7iD44X2KIJ5gOz80Yt3InUDO5M9pkxT5S4SHf9M5MyBhmaTFU7e8 Ck1Gy5ixzVBKQc96atk6nqNIs8y+xnoPXjqPdJWTib4cTeiXalXyMaPk21FE2teYmJSx j1VqvaYE6ckuIYMgr43RfCYt5ddKZNGDTjrKPv5vPtGxrtaXvr2jR+EEKRNZvcg8VeF0 V0Egi1RJQA8yPI3TnXGTwi2yfqbDtEkEU7rPc6vjYRxJk5RzkkdKY0GE1K5UrY28Q9jW 7lmWU4DcNvVewPtPi47jZhMPy0tgByQxCg38KwJeXCHXrynHKo2+SviWFcyJDbvbliS3 ZZkQ== X-Gm-Message-State: ABy/qLbemnzuhQtVs2QqMfT80X6LmbUvTvsjjaiQ2NWXbgrzXFhQP2ST DXUL9U0eDC3GGLCck9OoUm6l1kjU04fVCWG4uQ3EG3hHl0gAR7i5nudP8/kwkjCglyyq8lRdaRX pUJst2eqErRKVS9e23a38ZgJZeuT9gix0sXaq6mkYg+yvWufrDzI= X-Received: by 2002:a17:906:51d3:b0:992:b020:ce4 with SMTP id v19-20020a17090651d300b00992b0200ce4mr1873458ejk.51.1690380424304; Wed, 26 Jul 2023 07:07:04 -0700 (PDT) X-Google-Smtp-Source: APBJJlEcZbZZ8IAVaxjty3/XyPES0bnaQmHePqNUvQ/jsj9yQpTL4uAh2EOFetDdFCwm/b+xOa38zA== X-Received: by 2002:a17:906:51d3:b0:992:b020:ce4 with SMTP id v19-20020a17090651d300b00992b0200ce4mr1873437ejk.51.1690380424044; Wed, 26 Jul 2023 07:07:04 -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 o22-20020a170906289600b00977c7566ccbsm9572931ejd.164.2023.07.26.07.07.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:07:03 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org Subject: [PATCH v7 01/11] fs: export mnt_idmap_get/mnt_idmap_put Date: Wed, 26 Jul 2023 16:06:39 +0200 Message-Id: <20230726140649.307158-2-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726140649.307158-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726140649.307158-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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:06:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13328092 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECDA6C001DF for ; Wed, 26 Jul 2023 14:08:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234047AbjGZOIV (ORCPT ); Wed, 26 Jul 2023 10:08:21 -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 S233397AbjGZOHy (ORCPT ); Wed, 26 Jul 2023 10:07: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 91E342D60 for ; Wed, 26 Jul 2023 07:07:10 -0700 (PDT) Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.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 0D13D3F078 for ; Wed, 26 Jul 2023 14:07:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380427; bh=1S1U/zjZd3rVIX0g7C71Py6TvgiMco2DPzTIrhllhdU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cdaHVTWXg1x7w8X7K5A5/tz3sldhnQ4Bsg1RlDGZuXKobhyb4hKRH9Vj+jrgA2m24 zNr2HJj5/PGOQhtp1agzwi4AmQuVcCyWh4vRE7OEhGLxE9tRmogDYyBSq+w4a3ypZv tOTxgYwdTt6pa3zgO6Gz2kt6uChGqsyOQAc5o9X1PQY+wcy1rrHdFQ+djsi+7je4DW BUXT8xeiIG2yFjus0YrR4kuaVbZWgVI+3qJYTc6oASn4Bq4K1pVMk/6rFbnIN92VGy 1BTE0fmvcxFJhDQA6VnCd9Qxc2nOaUP1O3WShCNnA6pNNHnA4cdl5rZGim3+PTVrTE bY/6b2o/u7JQQ== Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-993eeb3a950so29174566b.2 for ; Wed, 26 Jul 2023 07:07:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380426; x=1690985226; 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=ZQeUphY9z8EQu4gsG4RrP1PFzmDROCFiRu+1JdYch5uufbutnHOYN0ZKht3dhs0P18 pkVJyEKbg4sDenmTXgi2IpA5wNpq9Qh6Wy3kn8Za+d5gFDL4t1Or5cpqYkPhShulYMeW XqR8LXFNbmUczt/bN27/daH6HE0wV2HNeWhgKeVUIGrNlNHH5kfXw9O87zPIvGHi9zk9 ryizRQ/f2++Gn5i+sayL4kffAwfQAhmemuNprgzuL8NhYkWtHcJEe9DSy9xripujqqMF //Mft4OR9lpItmAsk5qaFauD/o6UR7o91laWhWUBeq4QdUdEx+2CfHzcBe4YKSvytFsv +dqQ== X-Gm-Message-State: ABy/qLZ2wF02ifXDENgt1XpltPRTpLOC4zHdfMyyKlW7hye4rW0vgsxd 5FMnQvp5+7iwL4AacT4xWXR64XLtzhlx+y8gNDKEP59ORi77sc4yNgnDwXC4HNVRZXW2uQrpm10 83eQajYU7fbzW5fwQ8gKltz1jwHsaniegPN2zHYS+yf4= X-Received: by 2002:a17:906:32ca:b0:99b:cf4f:909a with SMTP id k10-20020a17090632ca00b0099bcf4f909amr478124ejk.37.1690380426600; Wed, 26 Jul 2023 07:07:06 -0700 (PDT) X-Google-Smtp-Source: APBJJlHdO9RMS5YiYtYtrxPBtrqWXq2pdOocz6Pc1y3mPKGm7kUZVGh/P2KJyIGVyp7VS0xvzWmGKQ== X-Received: by 2002:a17:906:32ca:b0:99b:cf4f:909a with SMTP id k10-20020a17090632ca00b0099bcf4f909amr478114ejk.37.1690380426405; Wed, 26 Jul 2023 07:07:06 -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 o22-20020a170906289600b00977c7566ccbsm9572931ejd.164.2023.07.26.07.07.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:07:06 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org Subject: [PATCH v7 02/11] ceph: stash idmapping in mdsc request Date: Wed, 26 Jul 2023 16:06:40 +0200 Message-Id: <20230726140649.307158-3-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726140649.307158-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726140649.307158-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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:06:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13328091 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20499C0015E for ; Wed, 26 Jul 2023 14:08:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232997AbjGZOIT (ORCPT ); Wed, 26 Jul 2023 10:08:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234147AbjGZOHz (ORCPT ); Wed, 26 Jul 2023 10:07: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 3EFAD2D78 for ; Wed, 26 Jul 2023 07:07:11 -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 5E996420BE for ; Wed, 26 Jul 2023 14:07:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380429; bh=ifNPKcEIq/Tv2vsoKX4zAa3gfholzjGLVEwPWVuZYK8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tYnz2I1ccQZ6h2XspujbLNxcEjfBACm/xeR1lEEmhIDh15YHU3THg6vnXLvJ1SV6F jo6AlEMMs4WgUMmv4gADUOfOwimW7pfa1arofUDFk4su8vaytlvs0htBTz7Dr0qlUa FWqNWptL3/2M/dT0bP5z6YVBhBVkhSFOfj9B6cEavAG8LvqBzBkvFoz/BpB29BNoXm e2CHD4bmZfN5aDHW5HWbMyJVBhhwQSfNdXeVQGhQRPvhZ9j3nYXPk1BGIQLcVzUX8o MJeHVrX2nSACazA+kEf+wr8GMPWDAo6p75REZIhr3EunrKD7rJWbrdnEJvkhvHqb0f G8hXE8bnoiDkQ== Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2b708d79112so61783351fa.1 for ; Wed, 26 Jul 2023 07:07:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380429; x=1690985229; 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=SoUJYQLWknfFBLVG86bjIMPwIQU6g4oO9m91BjDwn6Uu5OD84w/h+X9u04uQhxtHNj hJltGhhUD2IO2kNihODCIdRGyJQlThwPRcaxdbu9PcTAyg5ItVnHM2E9ZQanUopZ9RA3 jEOY6qs1SwuLyk+gXNoOdkMJrNjYxPev6hRqfvYpI0Lc/MwO8xtgdJYNONj7MNZp1Y9Q rpE0wdAmUO/ro910Htz1VkP+WhD2T4+32WOwo4QxagWJYEmjsmTxM3su/It0qc/gfDI+ OOk0MarXdFnEd9Tu556AddtYXFhPZkPg7xLS6jJ4UOoOkMh+8Z7MAwXK8IHydaskAC08 TzSA== X-Gm-Message-State: ABy/qLbVWix3Di2lnQoIWpGg+sMPxM1QFc7OCC3T4IO+6NQyspLOb7vR 3OnOFEZlUS5+p5yuvGDt9rHAoWxQhk7+Cl+PijEXPKWdYGC32TyqbwRezpDLk6XM0vs0pQZRj7q 17HVQlpXnlUFBj3CEP58yyNV3aii7pFMs2DkuvBirNDI= X-Received: by 2002:a2e:9556:0:b0:2b9:344c:a214 with SMTP id t22-20020a2e9556000000b002b9344ca214mr1564433ljh.42.1690380428840; Wed, 26 Jul 2023 07:07:08 -0700 (PDT) X-Google-Smtp-Source: APBJJlFECc8D6LZpee+Vcumz09/vLajMwMjm4GI72wcxAUrTie1a80vqAXBygVzN56hWSlHMd6q1fw== X-Received: by 2002:a2e:9556:0:b0:2b9:344c:a214 with SMTP id t22-20020a2e9556000000b002b9344ca214mr1564414ljh.42.1690380428549; Wed, 26 Jul 2023 07:07:08 -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 o22-20020a170906289600b00977c7566ccbsm9572931ejd.164.2023.07.26.07.07.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:07:08 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org Subject: [PATCH v7 03/11] ceph: handle idmapped mounts in create_request_message() Date: Wed, 26 Jul 2023 16:06:41 +0200 Message-Id: <20230726140649.307158-4-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726140649.307158-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726140649.307158-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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:06:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13328093 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85884C04E69 for ; Wed, 26 Jul 2023 14:08:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234385AbjGZOIW (ORCPT ); Wed, 26 Jul 2023 10:08:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234421AbjGZOHz (ORCPT ); Wed, 26 Jul 2023 10:07: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 AFA3130C5 for ; Wed, 26 Jul 2023 07:07:12 -0700 (PDT) Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.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 617653F71D for ; Wed, 26 Jul 2023 14:07:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380431; bh=2wRsV5VoJJC+a/Nnh0k6h5YuKsT02FRfB/wC7z4rT6w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Fp0W4RVXekWuD8zlOzeL2hTXYQxQEpu6bEcFPMmFVp9ATuJk/ZIQVy0xbE4quNrgQ LthcAkmNli3T+uNvRuPpZIE3dqCwz/byCwiiuCY8hxBCI+w2NkGW8pGYeiYQO4xe8Q MeJDDRO+zXoyte04+UF0A2T0P5kmCWlarK99Fl1Gbgz/3BH6b1zpl+T4cNWnT6Ssi5 EVRyoaTZ5TLrLgWmzOwnn1SwV6s6nRKABNhyI3YLFN3imaDNyl98mXJeySM+m885Uw KVSdkpgIbeRnQzHntfWiEABm4g6G8EFXfq7xe6oMPbiAG2Hu0LaQtD0hZnw6TQV5ZM hV37rIM0OMFeQ== Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-94a35b0d4ceso446270266b.3 for ; Wed, 26 Jul 2023 07:07:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380431; x=1690985231; 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=I6SiNs47RNrzIKJ0PfIB5RN1YShbdzVkqKdVFqb57Vv/in9ipdlkREcyNQEEv2qW1z q7dgomLZaNp+BbTuJSXXc06EIC7tPXwFIA6PUBOheTePrS7b+OnzFU/loIOei6ZzvvYi 2Fm0cQ1vHhOn7aSJS/2/A8zEQoTNu0NwLOasnXHgg+d38P4sk5VDxwEFzCKAhrAUJuIo J0dDsclcBT+UntqY5QbKPMY/rRBRlyLW/KKq5xgr6uRKfwNDUCIYsvp3oJjX8FBCScKp G7seFBmmnLxyfSaSRLeI5zej6XoeIWEF/X6/kyupnzeicGvyD9iu0yjiKYNvMxkYrsKK jetw== X-Gm-Message-State: ABy/qLY30Q1jvCADSjbZIZ+igT28qoaKaTgxKI4IrSahi3G7YXgSXcIj rdr/E95iYu7pJiPUKe3Sn9BcVlfLUY8lVTvarpo5YcmARpMg/VEJrroR0s8nidCAqv4RBAZ+Dre gv2qhVF/rA99y+tvjJWyKkbHTFOB0cLY1oiOpFwrZGjs= X-Received: by 2002:a17:907:75f6:b0:99b:c845:791d with SMTP id jz22-20020a17090775f600b0099bc845791dmr1434430ejc.76.1690380431058; Wed, 26 Jul 2023 07:07:11 -0700 (PDT) X-Google-Smtp-Source: APBJJlEhdDccDulP51f0YoFndT67o/a/QXckCWhrmqiLKJI7lRzxtWwmVKfF+Whpzw+yT7Xf1d3qZQ== X-Received: by 2002:a17:907:75f6:b0:99b:c845:791d with SMTP id jz22-20020a17090775f600b0099bc845791dmr1434417ejc.76.1690380430795; Wed, 26 Jul 2023 07:07:10 -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 o22-20020a170906289600b00977c7566ccbsm9572931ejd.164.2023.07.26.07.07.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:07:10 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org Subject: [PATCH v7 04/11] ceph: pass an idmapping to mknod/symlink/mkdir Date: Wed, 26 Jul 2023 16:06:42 +0200 Message-Id: <20230726140649.307158-5-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726140649.307158-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726140649.307158-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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:06:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13328097 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CAAE0C001B0 for ; Wed, 26 Jul 2023 14:08:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233592AbjGZOIw (ORCPT ); Wed, 26 Jul 2023 10:08:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234426AbjGZOH4 (ORCPT ); Wed, 26 Jul 2023 10:07:56 -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 A5A412717 for ; Wed, 26 Jul 2023 07:07:15 -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-0.canonical.com (Postfix) with ESMTPS id 4A83F3F078 for ; Wed, 26 Jul 2023 14:07:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380434; bh=ohgjgBD3cKcnIyJjD+KXey+VVqMnSRq4bkvBBBDC3os=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qAQ+J82XwuV9FDdGMVdIuy8B1et7LvDT2Hm5kbLaNVGmdLZQ63ns35t8RQvkJWgpv v+ZPLIRPsJj0gjdA0bKkAcjM4d4WnZzeX0SFzr6zPIm+ipR7QP5mWj3E/p0PiR+5aF o7JrrqirXMJKTJhV8t2jeGwrB3R0+sfE3g6e0HIg5DvJtrSIeeh0AZsSgH1fSVon+C pA5h0FLE7F0wODErHE30mYvhIKPM0kQC8uqVdLTOaYdxFcG5aYdm8GmZKa5IQ3BsaE MT9KdVt/Z7/ifnT9UIh32tvvUhRPesuGcpxc/nJExkFemTYqYva4gZhkOueaxlGbv1 J6M2rCCNFF+eg== Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-4fb76659d54so5923215e87.1 for ; Wed, 26 Jul 2023 07:07:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380433; x=1690985233; 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=YsLKZjiH1+eVTSwOpS6kGj1UCBeLt2J1oxU7Rzg8owkxe6DRanQcgEF8ZfncQ87sLt xF/1gH1168Jrh/xOp9IdnFC7seYuhW+4n23/HMcK6y5V4U5trBp8jD2xZ6XhlKRThhuW 9J4Ch0vcSjnTL0UOPj/veUZhmJTyGQHmt/x1gq+skFKfLEMuwIQDBX9srOAq7APXAgS7 t9LLIpCFtyFAKRxKJBy+tTRxA0mDlutCrfM0foKg/IvQPYeeb2xndhgfbdVhftYQb8mj +54I0jzNpEwSA+K765o/gZmskV/DCK5psXlXEWSuqlfJuiYMzDhB89pMrph1y93eC3k1 sDRA== X-Gm-Message-State: ABy/qLbH1R73L0dAsCwks5MYlCnoE9yD+uQlsl3lwZ6K2QAePyEygVme MBk0EOt8o3HPyrsfNnJlJt4hCHiutR+Cv0T2FoLydrUtcc3R4YptV540oxYefD6dsqldCOgtaNA TzQraN1juavCE0zYpKVKmV/pfj8r6DrzpaKH/azQVCUNME1NeIJA= X-Received: by 2002:a19:9106:0:b0:4fc:6e21:ff50 with SMTP id t6-20020a199106000000b004fc6e21ff50mr1449858lfd.55.1690380433170; Wed, 26 Jul 2023 07:07:13 -0700 (PDT) X-Google-Smtp-Source: APBJJlFdJ7OYWoHTBaqKnosXcipdhiC3O5K9LGnu83OI+9Ye/T3iu/yoEjYD0YxZHw8dq89TPBBknw== X-Received: by 2002:a19:9106:0:b0:4fc:6e21:ff50 with SMTP id t6-20020a199106000000b004fc6e21ff50mr1449844lfd.55.1690380432890; Wed, 26 Jul 2023 07:07:12 -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 o22-20020a170906289600b00977c7566ccbsm9572931ejd.164.2023.07.26.07.07.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:07:12 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org Subject: [PATCH v7 05/11] ceph: allow idmapped getattr inode op Date: Wed, 26 Jul 2023 16:06:43 +0200 Message-Id: <20230726140649.307158-6-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726140649.307158-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726140649.307158-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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:06:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13328099 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83E49C001B0 for ; Wed, 26 Jul 2023 14:08:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232847AbjGZOIz (ORCPT ); Wed, 26 Jul 2023 10:08:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234452AbjGZOH6 (ORCPT ); Wed, 26 Jul 2023 10:07: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 90D9A30E2 for ; Wed, 26 Jul 2023 07:07:17 -0700 (PDT) Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) (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 7767E3F71D for ; Wed, 26 Jul 2023 14:07:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380435; bh=Srcpafr6A4NJGaRIaUNnfkHMnBPsuuDlnOMtOvEnSSA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=W9RafNjLtZHBshHNd8IwAz/rNKL3aviPaFpsmi+8p8w61DiMv2rqkjtKJ5TeHDBlK M5VVfVMNkak9KYzdtUbo3vvzbRPOUb8KtKsp/9oga3AgSTPTpiqGst9q3TI7FDKXUk uR5+WEJIL+3AbFy0W/mNs/ppkUO8xTjGrJUPjA5BFz8Ldfc6l94Qgzy9RSrQdEU7TX NHuZVPwIhhaTc1p5WWOnXeJ0lz5dptWTwsMRqlkQgYbe73/b7k0V+mygBh0vXziZ8R sixJ/P8ni8LVek28Td0RYKoAnC1zQ27QlYotDLjRagaWL3VqoPorHH6ehgrRb+BE/H Th3g7AW65olig== Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2b9b00a80e9so11011491fa.1 for ; Wed, 26 Jul 2023 07:07:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380435; x=1690985235; 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=UV6yskdiMBYe4C5OVnMAxGiQhGXpHH1vCvVO30I39KewE2FAKeoqZOVRfo/LnyZpwg 7a6ZX+uSBuut8Mn3YIz6gC5YPIzImw497N/8yVuA81TZRWQxBgZ/7jiMAu1IDvjhi8TI g1ja4PhWaFwBTzPwrmdobSAAlNlz7dHXyguH9gN4HNMVsF2j1iA+01d7vrLU6auoH6tu yYPGPrzcgO0grwqdvFvydQspnYELaMqQFMrDl7Pt4RbmD0xli24tVATYeNo/6MpgIcdH 0KVXnrHv8rht6Y7Tmxz3s/sgX5p/df2zeFa2z9UFvCoKyak4eQZAxcPM+ZpfdZt4JqRW mYNQ== X-Gm-Message-State: ABy/qLYSaxxSoK0hnn6fmSU96N4TVm+At2L/SLd9PQjwCur7pypR5Ziy hH6ndojHkARnGIArilbDdwu7L7YIAfHOXtbNy+fEysO2ShaV/TPzOFnVw5UrAZ+PFTt7F3zG8of n+pFsv2NbrEOsKX4romk4Av6ROYf86W/L1ldNQ2ZHogk= X-Received: by 2002:a2e:870c:0:b0:2b9:ad7d:a144 with SMTP id m12-20020a2e870c000000b002b9ad7da144mr1606212lji.11.1690380434952; Wed, 26 Jul 2023 07:07:14 -0700 (PDT) X-Google-Smtp-Source: APBJJlELN9wiOUFPtGodTSSZ6rvp1SSx3S8CKT0CLTUuKvw0zAiBuftUjg/Yc9M0F52IiPn2QiGo6w== X-Received: by 2002:a2e:870c:0:b0:2b9:ad7d:a144 with SMTP id m12-20020a2e870c000000b002b9ad7da144mr1606197lji.11.1690380434696; Wed, 26 Jul 2023 07:07:14 -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 o22-20020a170906289600b00977c7566ccbsm9572931ejd.164.2023.07.26.07.07.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:07:14 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org Subject: [PATCH v7 06/11] ceph: allow idmapped permission inode op Date: Wed, 26 Jul 2023 16:06:44 +0200 Message-Id: <20230726140649.307158-7-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726140649.307158-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726140649.307158-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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:06:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13328094 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85302C0015E for ; Wed, 26 Jul 2023 14:08:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234400AbjGZOIX (ORCPT ); Wed, 26 Jul 2023 10:08:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234459AbjGZOH7 (ORCPT ); Wed, 26 Jul 2023 10:07:59 -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 1F30530F9 for ; Wed, 26 Jul 2023 07:07:20 -0700 (PDT) Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.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-1.canonical.com (Postfix) with ESMTPS id 7E44E413BD for ; Wed, 26 Jul 2023 14:07:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380438; bh=nLZMqtT0BTuD0r3ld9T+VcVOIz8LP+RVDN6gyhT7tPs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Pnq/Katvc1gnKR+t6mx1XpPifBjdldj7wpxxXCf1tzaqu7L+Xz7KTrPHZiMuaMmtj pnj9B958nVe6L0lVWv9DUIcG7VfPxRrd1mPqc7IkQHCJ9ieHSGSQy7STAPtztn2C6D +IvRjdaujT5k1OcdnpsdxUaIp353wOtmzs97KdkLfoGkWRHrL2367eM+hgG5eq1MCA jIhAnyKVTSfda+6iHEIa2ArGuZ+z5MI7PDzaUowlStJi5vooQJ08VsvrMecoplPKJz K4mJqqrDdOgsos2GDi3h+IiUrJ87gBqy6fRSqL+1STAhj0DrF9PXIwCeB4i/GcoFPy NxcYRv0zxSOpg== Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-99388334de6so484194466b.0 for ; Wed, 26 Jul 2023 07:07:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380436; x=1690985236; 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=QPrnnOnoond/FQL4vjA+bdDHd/wg3PaXbKPkALm8kXswFOyugvwMtKuKQRvaEhKOGu VK9w0IdZnadbDvWUTmQTLgCkeqOGEaMap6283a6Mm+y41sdIXxPmUY9yDZVqtMBK3hbl rwyFHSErTz9rKNFMgYwoTId5/EqWoi1i6fZx6o2WvJ4aaY0oiK25NRKNZxxPdLC9KOVT WxUe8/5iZCfyYwO0zwgryUmCPoC7Cyw5Q7IT3xQcQ0e8MyO2g3zWS8D5l1g3v4xdKiow f957iQRGBFbgxxNd5NV8uXZPy+e/vvWBr6jFlXxTfhVffVkl4spDdNs+jN5MS84PXZO/ 4VTg== X-Gm-Message-State: ABy/qLZaUtslajP4467/cNK1SRafZdvQrPG3OIK5QZFX0AOBqST9+DAD cOxxXiZ92AQv7vf8L1yE1moiZkc1cigfFyOmHO3Dr7B9azZ5i/g4bXFru6uXyd9f9644JiUmnFJ C2zJAdeUKkzH0XWbSQEVod6wTReBQF6vJKzcko83AF87nMweL/Ns= X-Received: by 2002:a17:906:101b:b0:99b:4378:a5ab with SMTP id 27-20020a170906101b00b0099b4378a5abmr1898874ejm.74.1690380436708; Wed, 26 Jul 2023 07:07:16 -0700 (PDT) X-Google-Smtp-Source: APBJJlHIDZJRHC5/8M2FDMYcx7lLcJbaGOmJ8PaUO8A3SDvcgsdM/EDYNykFDABz3ys6IJ2EnQ2ixg== X-Received: by 2002:a17:906:101b:b0:99b:4378:a5ab with SMTP id 27-20020a170906101b00b0099b4378a5abmr1898861ejm.74.1690380436503; Wed, 26 Jul 2023 07:07:16 -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 o22-20020a170906289600b00977c7566ccbsm9572931ejd.164.2023.07.26.07.07.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:07:16 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org Subject: [PATCH v7 07/11] ceph: pass idmap to __ceph_setattr Date: Wed, 26 Jul 2023 16:06:45 +0200 Message-Id: <20230726140649.307158-8-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726140649.307158-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726140649.307158-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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:06:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13328096 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79B52C0015E for ; Wed, 26 Jul 2023 14:08:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234409AbjGZOI1 (ORCPT ); Wed, 26 Jul 2023 10:08:27 -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 S234480AbjGZOIA (ORCPT ); Wed, 26 Jul 2023 10:08:00 -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 E33A735A8 for ; Wed, 26 Jul 2023 07:07:23 -0700 (PDT) Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (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 608A840822 for ; Wed, 26 Jul 2023 14:07:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380440; bh=5Jek2ao2Gg23mz8Y2ufU3Ts9QQq34R72Sad2dO2kfLI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=OWW09cfCCnqHIH2Xpfn1l+9qgFiaIVwWEIVdJegZea1/fLJRYcsJV2qjz4biLTPaz 7mvK8XxP8eftrs9VFgCAMlrbMwtRaklMZVyHvRFKYmqxJ+kWQUJ5MZJ1RoctSfAhTY CjYs50tvgFVBsw3cCzsK6cWIKBBrmt1PTVpje4fZEr4X0UUXaqpAupYJsnaM9D1yox 3jC2ln1zgO+7JuH5kAB3XpAowEhkjxbDI7yTqNkC99/BV1jepTXwm9DlW+IZQJJ3/o mESStbuFZTFPy37kJwwdhjzJ373cNP5okIoVf8EwvqCzSrWshP6BK+LRY+EODGKMkE 4wYWVhHXya7uQ== Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-992e6840901so115543666b.0 for ; Wed, 26 Jul 2023 07:07:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380439; x=1690985239; 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=SSlt/AfpXz8VbvnusA8rixhyTKDeeEP/7fkV+VwNg/oxUBGcch/tDcZN1loEp3DzOD 6PIBiIdx1oe+zK/pMtED6aOiGScJPpo5pkW46MQolmLuVkWwT+RCBQWDEZ+PV/7L6cj4 gflrqdPrLWtytSGnQsPl2GxpynV7QGB/l/8IjXH+sXP0V7NPo/ccA6iN5Sqm/dvPdq54 /xD1kQC6XbEFSfu76JzHuFGaZ+ASpDs3oK720YXrLPkMww0b25ccIjHH38u+u5Mujce2 IzFmrqpbHrRpEYoNzlPN1eC0yaGQyTCyxTGOvnCv7Lx1Tw2+cxkeIl2UweEzNqNTQvDL s2hQ== X-Gm-Message-State: ABy/qLagcTEww4JVyaZsRUv35W/Ojdwy2B3XrDJEw4gEKEDK/x3NZXRJ HtKW/zBk9JN+G+IrIEjtaSmuYXzjvDFMLeu7Vp72qb6kpwOSBdgt6fbddXK0ciJFrss42cQdmuc ymEEV7PtvK2dl6EAH7FQeFJ6j0o494nVxxps0GvlZuXY= X-Received: by 2002:a17:906:ef0e:b0:974:fb94:8067 with SMTP id f14-20020a170906ef0e00b00974fb948067mr5498051ejs.23.1690380438854; Wed, 26 Jul 2023 07:07:18 -0700 (PDT) X-Google-Smtp-Source: APBJJlFGAZZdJ2VxStlZQEsuWXvxIePi0KL5JcxCe5ljTK+JmzoTN37r/TLz5Y4osgx4A1xiDgwsEQ== X-Received: by 2002:a17:906:ef0e:b0:974:fb94:8067 with SMTP id f14-20020a170906ef0e00b00974fb948067mr5498036ejs.23.1690380438638; Wed, 26 Jul 2023 07:07:18 -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 o22-20020a170906289600b00977c7566ccbsm9572931ejd.164.2023.07.26.07.07.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:07:18 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org Subject: [PATCH v7 08/11] ceph: allow idmapped setattr inode op Date: Wed, 26 Jul 2023 16:06:46 +0200 Message-Id: <20230726140649.307158-9-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726140649.307158-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726140649.307158-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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:06:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13328095 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BAD2C001DC for ; Wed, 26 Jul 2023 14:08:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234404AbjGZOIZ (ORCPT ); Wed, 26 Jul 2023 10:08:25 -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 S234476AbjGZOIA (ORCPT ); Wed, 26 Jul 2023 10:08:00 -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 EA3B42737 for ; Wed, 26 Jul 2023 07:07:22 -0700 (PDT) Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (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 7C5FC413C3 for ; Wed, 26 Jul 2023 14:07:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380441; bh=btgWKV3yveDSttvNeYwkzRRCd2/ECqsGtpVUjkBAwbI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=s/fAOXVu95yIJxY7ckyRZCn0IS2rBft7hIq/iNtznmy/Sp0/xeb313t0dDS7ZDbp1 fLqaLVGB47sSpah90m5SoASUVw2w7IbOOebvsK9oWvOkyCUFsu2mDyqMlD8Kij75qZ 9CLctDEvfcyFJOXCxz7naB7882wAhXUwcLfivVGaip/OdZN85np+7WEWY0ljZ/HTcv +OnrtuhWqxlhmIUe6CZUahSIH3J4exG9ZfYY9Cpx+uTagJLsBv2BEk94DsA43VGN7J DhLI26AkJgnlQrGxJtDWOga6LHO86aL9vpzC5cNd+pjksugX+xMNF6oc5s63yBw1OF 9dGI87p0X7dEQ== Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-997d069a914so450790766b.1 for ; Wed, 26 Jul 2023 07:07:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380440; x=1690985240; 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=NAuTSwx9QB7raKwPghgb2U/EYUXApHaS++B3ryeBSEhwzhb3a5GZ8IWVea+SR3EWhA fVF4+b9Ey23AzhFuxrt5GBG7QoTuth+nzijzBfLpNuze1TnXp0glegIGpHZVtXVpU4VW RHtz0JWTfgsuu9cy0XFuXecNY/dtw/lnXepAysvBjeUff3ToA92PKEgEMeibc56GIk7S ZZ2oHyvR1+O5yL5CBYnyGFYcFHSi0jhLc/fpf9ZVayi2hzp46YGu/vpbEssM24oXE1QM TQSLPH+PK+M28gvS87w/G0kS8xqrhwPEOKI7GX/v2KqUmbkbr7rJdb2jpQsYJYms1pUf F7Kw== X-Gm-Message-State: ABy/qLZ9Yct0uBzVyajQfflaX5WZEXPgZtUwksyKdiRgamSl6OmMr3Ea rEyicexHHnC/lxf/7P7QH+9IZOt1Wv2yFScAYamv6GoP2/wBsZbgdoHxtwDrgBiPZ2X13RlNKky VLBYoUBCsb3ZdffsHPhApiPfuCzEsZNhVWHXPJpviXJiKSry0hWE= X-Received: by 2002:a17:907:7605:b0:987:47b3:6e34 with SMTP id jx5-20020a170907760500b0098747b36e34mr1607088ejc.67.1690380440749; Wed, 26 Jul 2023 07:07:20 -0700 (PDT) X-Google-Smtp-Source: APBJJlExCsRDrvUbE3SRwLx3SHaLn/8M347jNtc5jx6rBEJusYvPVCFOhtNa3qqPgO43KcCUyK5xwA== X-Received: by 2002:a17:907:7605:b0:987:47b3:6e34 with SMTP id jx5-20020a170907760500b0098747b36e34mr1607080ejc.67.1690380440593; Wed, 26 Jul 2023 07:07:20 -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 o22-20020a170906289600b00977c7566ccbsm9572931ejd.164.2023.07.26.07.07.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:07:20 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org Subject: [PATCH v7 09/11] ceph/acl: allow idmapped set_acl inode op Date: Wed, 26 Jul 2023 16:06:47 +0200 Message-Id: <20230726140649.307158-10-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726140649.307158-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726140649.307158-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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:06:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13328100 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 177D9C0015E for ; Wed, 26 Jul 2023 14:09:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233972AbjGZOJN (ORCPT ); Wed, 26 Jul 2023 10:09:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234520AbjGZOIF (ORCPT ); Wed, 26 Jul 2023 10:08:05 -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 EAE8A3AAD for ; Wed, 26 Jul 2023 07:07:27 -0700 (PDT) Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (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 D39CA3F078 for ; Wed, 26 Jul 2023 14:07:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380444; bh=dyH4eLS/ZCdAMtA+4CRaXqW6UBtXDh7SsBX0oiAwXGM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=U6icKS4tOyNiNqHEAQ72at2ltw985YgsT0/rXyQRMSa76mPTr6N8CoQMKXM87mF8z +RI7lbxXXZQno3jTmGoxI17qo0z2F7qT7nKKcqPdhRVrxbtJ5XiDzzWCcoVyQUfwX8 UtSWc6Uk66Jyo7LU99uzQ5WhQF+tjD8kbSPODGLDeUWCLSOoj179JxsYmOWU0cg3ti n8OYWuHLQz0x95+lEizsNrIZXnDZF0HWt7IKYvqyT7iLdEvJtq3Gvwfln9lC+62YZX aHLQ8j1lp/71n9MqBpZHYu3Q7HhSqLMGYemLH451gEzCC8thxVh+sl/zdOMIM60Z1F wZ2sTsJYVoF1Q== Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-993d7ca4607so436750766b.1 for ; Wed, 26 Jul 2023 07:07:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380443; x=1690985243; 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=WChmrFFDHqc7YU4m+DNb2HSxCfVr5l9l/MHUtrnkQ3/NwnZYsroH2MrLQOmCI8LBXd yoll9NOBxiev8rRBIPT68ehzU/YYCpdweM375gazS4xU+LmCgyyBrWz9B1LJ4YfoHOod F+2vCvSx0neuoNMJOep3iLo8VmmP5ePjpmJBYnKQ0OBcK/IIfqCayDF16mcNOD7aLPnQ MKPAQx3m7cY+RNwBv/aSmU9ClXMos6NkhXmSUHAM6LfBF+VrnL+n4HpXRLz6vI6JJSFr wybAxg1njKw+1M/9mh3ZbPvVXZSOAfxyy6IgGGIENukh0eV/VXE1pn263D0idfBXmJHt L+Ag== X-Gm-Message-State: ABy/qLZhtA1X82vyMMwC0i9bpZKsYcCcx0hXNMf6mRB3SS4TcwyAgnoU /YKtacfjS2uBJ+C8kye5yKsZoCxL/cK+22qGNcgWCL4SIRiVKLUEN5f/rE7jb974uwjqU81BP3J uLlLiX+G/Lm0GQ9WMxRG48/T36P57+J8b9hXGoRO+LS8= X-Received: by 2002:a17:907:7803:b0:99b:5e5f:1667 with SMTP id la3-20020a170907780300b0099b5e5f1667mr1659826ejc.15.1690380443105; Wed, 26 Jul 2023 07:07:23 -0700 (PDT) X-Google-Smtp-Source: APBJJlHh8YN+258wCb8Iy0b4bIWppeUTBwY5IAn5eS8RgWR/WcDmxH4egNCEl6+02yAn/k0ZBIoKlQ== X-Received: by 2002:a17:907:7803:b0:99b:5e5f:1667 with SMTP id la3-20020a170907780300b0099b5e5f1667mr1659811ejc.15.1690380442913; Wed, 26 Jul 2023 07:07:22 -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 o22-20020a170906289600b00977c7566ccbsm9572931ejd.164.2023.07.26.07.07.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:07:22 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org Subject: [PATCH v7 10/11] ceph/file: allow idmapped atomic_open inode op Date: Wed, 26 Jul 2023 16:06:48 +0200 Message-Id: <20230726140649.307158-11-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726140649.307158-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726140649.307158-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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:06:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13328101 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38FBEC001B0 for ; Wed, 26 Jul 2023 14:09:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234453AbjGZOJ1 (ORCPT ); Wed, 26 Jul 2023 10:09:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234569AbjGZOIK (ORCPT ); Wed, 26 Jul 2023 10:08:10 -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 F385A3C0D for ; Wed, 26 Jul 2023 07:07:29 -0700 (PDT) Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.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 1DD1740821 for ; Wed, 26 Jul 2023 14:07:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380446; bh=V+geJeK43HRcagd4RPosGF8b069CSl1zVYPfJFF5DgU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=scXOCpM7mzEFDlX1tJCN+26CEVSlPEuEF70KwmerdIgi8IlyPiS5humZx/GLQpi7R atFSxCiX+uQJh3gpSIQvePoqvw5L4r9mMZSgMrTgl+WFxoQSdfqmBHgpQUWvXoNPyt J8CG5NcVcrmZ+m1oyHlx20R3KdXki05iKJbVnJ3dsOZPrPn24J6aj5fmDtxI/Z9tus 9P+a1EEYxNrzqnhK1MKxqRanKkt5WAkUVUi8IIvCmrVUIweRDbZ02OHzvoI/jRKXoR AljJll7Qcp6Zrv5f2ypooNLSNXyn4EjYq4vGm9Behkh1Yw2VWqagSaPj2Hbe5nJKsm 22eXw+IQby77w== Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-51e0fc38f16so5137239a12.2 for ; Wed, 26 Jul 2023 07:07:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380444; x=1690985244; 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=OJ3uy0khTZtCjJHBzZVb52q+CqrPEdVqvuE4Oeft2a3yJCZcZWee8b1OF//sGIIPeY 65X6y25G/0Dk7ovmTMKon6rfhk8M2I/bJY3CJbpl/FO6wBJ52dwEq8opgm6sxcoX88iX +SiPNP8UzFM4mMhujIV27gaIiR6lAhlXgKme+UH8AjqIKt+8Of1tphxHEIj0ZHSE5y2p sfDIEiYcl/sZMCRNg2FRCMv1s9Q6tVmUlCHeFKut9J4KXktpJfRItMoO7W+X7SYX0dPe OUzgFP4Q+uXpHo6aZGGu3/8FTM1AyOjhcNlEfoY7BpnKK9ZTPRF91Ar2at0bhL1MuQhJ HWMw== X-Gm-Message-State: ABy/qLZwLDUMHaAtCPHI+mmGLmD2HDI3zE19iYMhUoBGyXiP3zHAp85e RvVgQHsZPpsgVXT4EOdQHXvdiSQGfJWlDX3zlM2kuiaxvNDhlKvscUQD+2BpOk1MqqkVCY7evbK YysDJXZlgJbUMU901w8tkFndskR2pAnjyLoATO4GSUB0= X-Received: by 2002:a17:906:73d0:b0:99b:ca0b:90d0 with SMTP id n16-20020a17090673d000b0099bca0b90d0mr1105786ejl.37.1690380444811; Wed, 26 Jul 2023 07:07:24 -0700 (PDT) X-Google-Smtp-Source: APBJJlHYNS6ydWUDIz+KoX/Z+jXvAzODgkUoK/FFuM9v8E3tFW7PoARWjcrVOz79y+SQStlOKZvI2Q== X-Received: by 2002:a17:906:73d0:b0:99b:ca0b:90d0 with SMTP id n16-20020a17090673d000b0099bca0b90d0mr1105771ejl.37.1690380444512; Wed, 26 Jul 2023 07:07:24 -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 o22-20020a170906289600b00977c7566ccbsm9572931ejd.164.2023.07.26.07.07.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:07:24 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org Subject: [PATCH v7 11/11] ceph: allow idmapped mounts Date: Wed, 26 Jul 2023 16:06:49 +0200 Message-Id: <20230726140649.307158-12-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726140649.307158-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726140649.307158-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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");