From nobody Mon Feb 9 01:50:36 2026 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 F14F4C77B7C for ; Wed, 24 May 2023 15:34:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236278AbjEXPeo (ORCPT ); Wed, 24 May 2023 11:34:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230473AbjEXPeh (ORCPT ); Wed, 24 May 2023 11:34:37 -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 C9FFA132 for ; Wed, 24 May 2023 08:34:14 -0700 (PDT) Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.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 791D341BEE for ; Wed, 24 May 2023 15:33:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1684942434; bh=tSdP/T4XpDdXngtRP7H8sm4qPchKBIP/6AL5g4/r8eE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZFEibrrs1Nnz5kOOIBZnvBF8KoK5LBTfbZsgtvKt4XoZSeOgyCkk9ycKpvBDGlY95 NFsB99I2LkS9cajNZkDI4peX7wk1aXWKsdqHZA2IsmYY4OAU1EkGGpfEmRUy7jne+Z US+tBeemyUK6DbJ7Sa8GLUYb0zRs4zOmYoU8aJ8htsgWXobnYsTkvOg2iJJdyOdkwM UsoRfiM/FzJLxNozdpH1T23PXIvVyoPOcB5vhBKEskbj1ZBRP1Bp4OtTOr26v+U/as UvBe9P09xeJHRj5/7fZ2zIIgkXscnGBryoj6WfqnvK+QIpj414GXdHS9HfYF1SYC7P BM+cN3duKVlDQ== Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-94a355c9028so120251666b.3 for ; Wed, 24 May 2023 08:33:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684942431; x=1687534431; 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=tSdP/T4XpDdXngtRP7H8sm4qPchKBIP/6AL5g4/r8eE=; b=fe8WTPNWtClmBJpW2dj5f6GwbWBYFvzZeqPiv8vbTf3drsIpfJSprRFHry/9VQt1Sh mdqzSgqhit7HrvG9F/s4SRuBhS6GjZEytaExp4QFwfV585P3ScPAQA9mfWdXuMz9WgLz u/0/FAQmGZHBjpWcw/Q3h2q/nfzwDuBSxfPZHPQNY70LTcowEWUTG+nUrCsFvBwgd14e XwMIi5YP888bpl/GFZ4niqgDGXzlSmc1zExwEjsho65SkxBm9pRb2/rRgK7slnKZ4Q38 IQ/+8w0N6NRuU4go7LhcLsgjo2Nn8e6Bbz5xvyZqV0FrQ1ebmlyzovYnVKb8bCAn/3Yd K8IA== X-Gm-Message-State: AC+VfDzds6kwACfWHD6sClOiCqGeF+gb7dFuKwLJi/D40Lva8mpNeep/ 5CK54OOFV/mZNZtzW+BIcLQ7/MJcArnkbgu/aQKECPkXunZURsPOEy8MmRQb5NRUX8/U4ZXKeVc /0sT2j+PQYQKYz02qHLU6d8y5K3cbZqIaj73MB4gO/9GU+x1G8A== X-Received: by 2002:a17:907:1606:b0:96f:d154:54f7 with SMTP id hb6-20020a170907160600b0096fd15454f7mr12266658ejc.42.1684942431690; Wed, 24 May 2023 08:33:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5owA1z5kBY01k6fQMnJ+aOqpvSenWRt3xIxcA2Af18CPctBSVmxRFbXwpWIr+T1mt2M3MY8w== X-Received: by 2002:a17:907:1606:b0:96f:d154:54f7 with SMTP id hb6-20020a170907160600b0096fd15454f7mr12266633ejc.42.1684942431448; Wed, 24 May 2023 08:33:51 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-074-206-207.088.074.pools.vodafone-ip.de. [88.74.206.207]) by smtp.gmail.com with ESMTPSA id p26-20020a17090664da00b0096f7105b3a6sm5986979ejn.189.2023.05.24.08.33.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 May 2023 08:33:50 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Alexander Mikhalitsyn , Ilya Dryomov , Jeff Layton , Alexander Viro , Seth Forshee , ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 01/13] fs: export mnt_idmap_get/mnt_idmap_put Date: Wed, 24 May 2023 17:33:03 +0200 Message-Id: <20230524153316.476973-2-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230524153316.476973-1-aleksandr.mikhalitsyn@canonical.com> References: <20230524153316.476973-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" These helpers are required to support idmapped mounts in the Cephfs. Signed-off-by: Alexander Mikhalitsyn Reviewed-by: Christian Brauner --- 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..5a579e809bcf 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) =20 return idmap; } +EXPORT_SYMBOL(mnt_idmap_get); =20 /** * 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(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) =20 int vfsgid_in_group_p(vfsgid_t vfsgid); =20 +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); =20 --=20 2.34.1 From nobody Mon Feb 9 01:50:36 2026 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 99148C7EE2D for ; Wed, 24 May 2023 15:35:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236292AbjEXPfB (ORCPT ); Wed, 24 May 2023 11:35:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233455AbjEXPej (ORCPT ); Wed, 24 May 2023 11:34:39 -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 B0B0A189 for ; Wed, 24 May 2023 08:34:19 -0700 (PDT) Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.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 1CF8F41BF1 for ; Wed, 24 May 2023 15:33:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1684942435; bh=XgKnpq4bIvhR7eBTR7Q+NdjpFwn1XJ2nSq/DTgjo3dY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZTpzhbY38OV8QVISl9OcxFMQ7ML1kqinI9MnsOr1aJ07v1DqQAdstoYAEnv988FWa ZFrTA0XOYOCQQsYbcIYs+ld1iA2vx4DkTa69yj7wawcVyHU5IvcWh21Jpz4ISSt6gr g5Wy3vSBoGbWolsYr7s0CCEwgsF1iVxh5zQ54PvLSzRR0uuqwXOD079YYEMIgDWh9c jlAI5GyyL4szARH2NxEGIZ0S1K6iLGPnnJA54ou6sKthqSLapBLh8To4OzVTX/cMt5 KewaViTs4smF/J6FGTZy+xJtA1a2/oGHNM0Cd1+yo/+bSp5B5tx83X9mI3kwlNfnfE 68rjMxpguRWbA== Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-50de84a3861so1140630a12.3 for ; Wed, 24 May 2023 08:33:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684942434; x=1687534434; 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=XgKnpq4bIvhR7eBTR7Q+NdjpFwn1XJ2nSq/DTgjo3dY=; b=GSZrEtRu9TEo4iRtOe4jehG9qGdvS80HaND1jr8UHCjDyZfuheRFFM6WlCY1sYkdcf X/wRaGdD5kTF9ZBk91oza0IPiugI4GkkoUMAon/QN/bx5vQNQPvJvqwpwNMkWJVvc9Dh Rsz3MrF+yWnUrBj9rsu69Alt6un1DxUmrpo7uIFdM0AITfnMiI7iI4uEHh2bAuix/MWo P+CWhhTKMw91BNbUTXbFgQaIBTPjP2DkBxUAxq88pmKFirEL1zb8MwaBS/s0yrYCKSHI 7piti3I3H3tZzlecugXIs11FVOyLRCWPIbtvDmdU7VlquLB8BpfHFrDGLvV/vOTFiQT7 QC+A== X-Gm-Message-State: AC+VfDyXaULbujbLA2wrSUZ6aplSTkzZw6RKfwKnbNDpJoITbvhnWgA7 EBZBR39G97xfSzSoL+yn0/XIbNcqxG7J6bnUk+WkUaX5rJb8UlJR/JiCfw7bJwlObDWHsXfix2F csG1AVwiRqXFvYr6z7CGHsjVooSENDqJuV8yQJWNyvg== X-Received: by 2002:a17:907:7f8c:b0:96a:5e38:ba49 with SMTP id qk12-20020a1709077f8c00b0096a5e38ba49mr19196161ejc.2.1684942434315; Wed, 24 May 2023 08:33:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Mffvochh5YQEn/DHlzCnAsBqpPKJ0HvpBj7yTSc8OSsGh1dOxxL29MY1dSL/HnDP8qeW35A== X-Received: by 2002:a17:907:7f8c:b0:96a:5e38:ba49 with SMTP id qk12-20020a1709077f8c00b0096a5e38ba49mr19196142ejc.2.1684942434005; Wed, 24 May 2023 08:33:54 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-074-206-207.088.074.pools.vodafone-ip.de. [88.74.206.207]) by smtp.gmail.com with ESMTPSA id p26-20020a17090664da00b0096f7105b3a6sm5986979ejn.189.2023.05.24.08.33.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 May 2023 08:33:53 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Christian Brauner , Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v2 02/13] ceph: stash idmapping in mdsc request Date: Wed, 24 May 2023 17:33:04 +0200 Message-Id: <20230524153316.476973-3-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230524153316.476973-1-aleksandr.mikhalitsyn@canonical.com> References: <20230524153316.476973-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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: Jeff Layton Cc: Ilya Dryomov Cc: ceph-devel@vger.kernel.org Signed-off-by: Christian Brauner Signed-off-by: Alexander Mikhalitsyn --- v2: - added "r_" prefix to the field name to make it consistent with others --- fs/ceph/mds_client.c | 7 +++++++ fs/ceph/mds_client.h | 1 + 2 files changed, 8 insertions(+) diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 4c0f22acf53d..810c3db2e369 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -12,6 +12,7 @@ #include #include #include +#include =20 #include "super.h" #include "mds_client.h" @@ -962,6 +963,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 !=3D &nop_mnt_idmap) + mnt_idmap_put(req->r_mnt_idmap); if (req->r_pagelist) ceph_pagelist_release(req->r_pagelist); put_request_session(req); @@ -1018,6 +1021,10 @@ static void __register_request(struct ceph_mds_clien= t *mdsc, insert_request(&mdsc->request_tree, req); =20 req->r_cred =3D get_current_cred(); + if (!req->r_mnt_idmap) + req->r_mnt_idmap =3D &nop_mnt_idmap; + else + mnt_idmap_get(req->r_mnt_idmap); =20 if (mdsc->oldest_tid =3D=3D 0 && req->r_op !=3D CEPH_MDS_OP_SETFILELOCK) mdsc->oldest_tid =3D req->r_tid; diff --git a/fs/ceph/mds_client.h b/fs/ceph/mds_client.h index 724307ff89cd..32001ade1ea7 100644 --- a/fs/ceph/mds_client.h +++ b/fs/ceph/mds_client.h @@ -280,6 +280,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; =20 /* for choosing which mds to send this request to */ --=20 2.34.1 From nobody Mon Feb 9 01:50:36 2026 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 EB9A8C7EE2D for ; Wed, 24 May 2023 15:35:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236774AbjEXPfh (ORCPT ); Wed, 24 May 2023 11:35:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236372AbjEXPfF (ORCPT ); Wed, 24 May 2023 11:35:05 -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 94DF0E6E for ; Wed, 24 May 2023 08:34:44 -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 C527C4186D for ; Wed, 24 May 2023 15:33:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1684942437; bh=7MPRaaS/wfFyMaJukilLcDQaABE/d326C6SUb3pM724=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZlixQUAyDH4K8g8S8h8nxQZWVG6nDfqWv2AX2FmnKjDHUda3Gc2nGsS4+N09/HbgU +zC+rmdQZTyON6HFuG5ZxhbLHCOUSV9ZzPIZvclBfKevkwbE9KgTKtk3O8Xq511UOU kMoSnhzzmuk9ylyWO3REVic27wshhdOObuI3xZIo6p/35vALcyGOO5un06yPyW/x8G AM5rXEgrlM7E7+5yczVblLnOM8iWgLqpj0o4yAoS2cyejfeCC8qU/Ka/5scD+PghNY 9G+5i1scJFN6dHQKbnHyz2NG/wnE5bsO2xRuoyhCZN2V9qm7zxHwHUkvArWJ+Seid3 Qdjoc5+1EY1mQ== Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-96fe603151eso121933866b.0 for ; Wed, 24 May 2023 08:33:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684942437; x=1687534437; 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=7MPRaaS/wfFyMaJukilLcDQaABE/d326C6SUb3pM724=; b=d9CVzzZSbtYf90IDh8a2J3QK+ZygWZgYb7Pu+4rPgcnA1FTvGubYD0ebKAtDQE8EPy khntpX9BZxPOxjO5wVnhxeysD7wLn2+tgE0O4Jhv/pKRzohUupqgc41/OhBNJuIhW8a3 tOvW81tS8JRuVKvSX+LhP0NGP04eBljNXbGzaI+jxLUJy20eavmkNvKdHM223NamsEZN VRmJpm8Ea+CQ1h5JBL5bSmHU/b6cpqHHCAYx1W/i/kpGq2yH+WuPpwnTI9YbJu2D4G+1 n2JInkL3ZE17ufnurXPjC6IYwskAVCIlSGP2LRpfZTPqArhJY3E1SSsPnG1s7zWBK9xx aynQ== X-Gm-Message-State: AC+VfDwCWDxuHLVz1KQeApz8d7n51RBWnmmbGS0gOSSBiP/CSQrAp8eR cOHhLGRMPQe6JuyakQB37fq291iNTY+CUoYNr8EyQPugLfH8SkJDWCOqBN2jCrEt4/qeIAka6GD F/UzmGdV3D5b/2fSrQuOMLoa2PlNOzaii5fcZlElbwQ== X-Received: by 2002:a17:907:6d0a:b0:94e:afa6:299f with SMTP id sa10-20020a1709076d0a00b0094eafa6299fmr16453131ejc.22.1684942437536; Wed, 24 May 2023 08:33:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ75DBcDr80x3nJRZUtCnJIz0VU1HD43GtaQtz8dKn2NTdPmSfiM3FsRTA9p2vEEfIPqJc7rNg== X-Received: by 2002:a17:907:6d0a:b0:94e:afa6:299f with SMTP id sa10-20020a1709076d0a00b0094eafa6299fmr16453103ejc.22.1684942437096; Wed, 24 May 2023 08:33:57 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-074-206-207.088.074.pools.vodafone-ip.de. [88.74.206.207]) by smtp.gmail.com with ESMTPSA id p26-20020a17090664da00b0096f7105b3a6sm5986979ejn.189.2023.05.24.08.33.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 May 2023 08:33:56 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Christian Brauner , Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v2 03/13] ceph: handle idmapped mounts in create_request_message() Date: Wed, 24 May 2023 17:33:05 +0200 Message-Id: <20230524153316.476973-4-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230524153316.476973-1-aleksandr.mikhalitsyn@canonical.com> References: <20230524153316.476973-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christian Brauner 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. Cephfs mds creation request argument structures mirror this filesystem behavior. They don't encode a {g,u}id explicitly. Instead the caller's fs{g,u}id that is always sent as part of any mds request is used by the servers to set 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 and thus is guaranteed to leave the caller's fs{g,u}id unchanged.,u}id is sent. The last few weeks before Christmas 2021 I have spent time not just reading and poking the cephfs kernel code but also took a look at the ceph mds server userspace to ensure I didn't miss some subtlety. This made me aware of one complication to solve. All requests send the caller's fs{g,u}id over the wire. The caller's fs{g,u}id matters for the server in exactly two cases: 1. to set the ownership for creation requests 2. to determine whether this client is allowed access on this server Case 1. we already covered and explained. Case 2. is only relevant for servers where an explicit uid access restriction has been set. That is to say the mds server restricts access to requests coming from a specific uid. Servers without uid restrictions will grant access to requests from any uid by setting MDS_AUTH_UID_ANY. Case 2. introduces the complication because the caller's fs{g,u}id is not just used to record ownership but also serves as the {g,u}id used when checking access to the server. Consider a user mounting a cephfs client and creating an idmapped mount from it that maps files owned by uid 1000 to be owned uid 0: mount -t cephfs -o [...] /unmapped mount-idmapped --map-mount 1000:0:1 /idmapped That is to say if the mounted cephfs filesystem contains a file "file1" which is owned by uid 1000: - looking at it via /unmapped/file1 will report it as owned by uid 1000 (One can think of this as the on-disk value.) - looking at it via /idmapped/file1 will report it as owned by uid 0 Now, consider creating new files via the idmapped mount at /idmapped. When a caller with fs{g,u}id 1000 creates a file "file2" by going through the idmapped mount mounted at /idmapped it will create a file that is owned by uid 1000 on-disk, i.e.: - looking at it via /unmapped/file2 will report it as owned by uid 1000 - looking at it via /idmapped/file2 will report it as owned by uid 0 Now consider an mds server that has a uid access restriction set and only grants access to requests from uid 0. If the client sends a creation request for a file e.g. /idmapped/file2 it will send the caller's fs{g,u}id idmapped according to the idmapped mount. So if the caller has fs{g,u}id 1000 it will be mapped to {g,u}id 0 in the idmapped mount and will be sent over the wire allowing the caller access to the mds server. However, if the caller is not issuing a creation request the caller's fs{g,u}id will be send without the mount's idmapping applied. So if the caller that just successfully created a new file on the restricted mds server sends a request as fs{g,u}id 1000 access will be refused. This however is inconsistent. From my perspective the root of the problem lies in the fact that creation requests implicitly infer the ownership from the {g,u}id that gets sent along with every mds request. I have thought of multiple ways of addressing this problem but the one I prefer is to give all mds requests that create a filesystem object a proper, separate {g,u}id field entry in the argument struct. This is, for example how ->setattr mds requests work. This way the caller's fs{g,u}id can be used consistenly for server access checks and is separated from the ownership for new filesystem objects. Servers could then be updated to refuse creation requests whenever the {g,u}id used for access checking doesn't match the {g,u}id used for creating the filesystem object just as is done for setattr requests on a uid restricted server. But I am, of course, open to other suggestions. Cc: Jeff Layton Cc: Ilya Dryomov Cc: ceph-devel@vger.kernel.org Signed-off-by: Christian Brauner Signed-off-by: Alexander Mikhalitsyn --- fs/ceph/mds_client.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 810c3db2e369..e4265843b838 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -2583,6 +2583,8 @@ static struct ceph_msg *create_request_message(struct= ceph_mds_session *session, void *p, *end; int ret; bool legacy =3D !(session->s_con.peer_features & CEPH_FEATURE_FS_BTIME); + kuid_t caller_fsuid; + kgid_t caller_fsgid; =20 ret =3D set_request_path_attr(req->r_inode, req->r_dentry, req->r_parent, req->r_path1, req->r_ino1.ino, @@ -2651,10 +2653,22 @@ static struct ceph_msg *create_request_message(stru= ct ceph_mds_session *session, =20 head->mdsmap_epoch =3D cpu_to_le32(mdsc->mdsmap->m_epoch); head->op =3D cpu_to_le32(req->r_op); - head->caller_uid =3D cpu_to_le32(from_kuid(&init_user_ns, - req->r_cred->fsuid)); - head->caller_gid =3D cpu_to_le32(from_kgid(&init_user_ns, - req->r_cred->fsgid)); + /* + * Inode operations that create filesystem objects based on the + * caller's fs{g,u}id like ->mknod(), ->create(), ->mkdir() etc. don't + * have separate {g,u}id fields in their respective structs in the + * ceph_mds_request_args union. Instead the caller_{g,u}id field is + * used to set ownership of the newly created inode by the mds server. + * For these inode operations we need to send the mapped fs{g,u}id over + * the wire. For other cases we simple set req->r_mnt_idmap to the + * initial idmapping meaning the unmapped fs{g,u}id is sent. + */ + caller_fsuid =3D from_vfsuid(req->r_mnt_idmap, &init_user_ns, + VFSUIDT_INIT(req->r_cred->fsuid)); + caller_fsgid =3D from_vfsgid(req->r_mnt_idmap, &init_user_ns, + VFSGIDT_INIT(req->r_cred->fsgid)); + head->caller_uid =3D cpu_to_le32(from_kuid(&init_user_ns, caller_fsuid)); + head->caller_gid =3D cpu_to_le32(from_kgid(&init_user_ns, caller_fsgid)); head->ino =3D cpu_to_le64(req->r_deleg_ino); head->args =3D req->r_args; =20 --=20 2.34.1 From nobody Mon Feb 9 01:50:36 2026 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 1C1A4C77B73 for ; Wed, 24 May 2023 15:35:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236237AbjEXPfa (ORCPT ); Wed, 24 May 2023 11:35:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236329AbjEXPfD (ORCPT ); Wed, 24 May 2023 11:35:03 -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 BEED2E46 for ; Wed, 24 May 2023 08:34:43 -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 57F033F187 for ; Wed, 24 May 2023 15:34:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1684942442; bh=xxg/uwnVyZOP2Ay/FSpDiOkYB17FXWwEBwZ7vkk162A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=X081nxL6/uAvTf2GM0fAkg8hm+G7OTDi0PWioMjaajqKZHjRAKxUP4cCZ/oKIqwlG uFS7bbJB1dhdpf+tkNJMm4dp1s/33I+SxqKO1NEebND+/Yhvgupqj5F8lqnZSrTbuQ hsbX0jBhx/ndP3lB4Qj9OSf+V77UppjdvQdwbRFIFBugcNQYcAfOP/7VwivG2mjBla JbkuxgTgOMuclgZNX2uHmuwPpKGu646r3pnEqW5w421xvZ1AQlusnpZGDOMAMP53tL 8cx/XzBY1gSkhr9EJU3f36T7dze9oBLG4f3/AFYqcVBWtY6sVrV7v6fYxI/FPSw9Ws ReknYqyKkVo5A== Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-510d8e4416cso1503891a12.3 for ; Wed, 24 May 2023 08:34:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684942441; x=1687534441; 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=xxg/uwnVyZOP2Ay/FSpDiOkYB17FXWwEBwZ7vkk162A=; b=dYdolCj+4GIv95tE0kofD7riFAbizLo39brC2p8I03HlioyQK/70nrqP9TvEQqLyC5 LKwXxRyF6LZP0KRIrAaDIKrXd31Q5TbS/nUQqI488N5tZUNORLPOxpmP0y8yLWUpOIFn MFdc/u7qL4PuZvfeDpw8cPbvNN4UjdZBNXb2ZdgaNStt/kpdVxmxENbTXTBgGoV/IDCe 3TJ1cwoWn6e9hg9iZbtgHw/79b2DtcxpHj36Yw2+GQuAKDO12v9BzDEmb1ELs10pggU7 IoyAXwpULqxyt5VBixG2ZwA7n1/UpSQxfAD8IP1eojZfi67kOiBE9hgCJr6mwc+o9Rs5 T+KA== X-Gm-Message-State: AC+VfDytsBTaIPzWIsxm9Ti6XQ+dvDqp/ibbtb+NqN5RD7EERRvfjHRE ikHmNakLIOCQ2rDJPVDLktDwfZSCbU/f3xl+6BWqRdMNNcdCJiiBvw+ra6WkxUT7txYxcW89H6E pG2GNIj5O2JzHDdWQq76v6nM8LkKHVKmOjU9bDBwKRA== X-Received: by 2002:a17:907:728c:b0:96f:f6a6:58cc with SMTP id dt12-20020a170907728c00b0096ff6a658ccmr9115839ejc.15.1684942441741; Wed, 24 May 2023 08:34:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Q7Lsu20tS8hE/7FwlwR1NjZ7p+guAstMYuytSVHgRos67j/I/Z+zrmEJ9DtP+ZasFoivgRg== X-Received: by 2002:a17:907:728c:b0:96f:f6a6:58cc with SMTP id dt12-20020a170907728c00b0096ff6a658ccmr9115823ejc.15.1684942441514; Wed, 24 May 2023 08:34:01 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-074-206-207.088.074.pools.vodafone-ip.de. [88.74.206.207]) by smtp.gmail.com with ESMTPSA id p26-20020a17090664da00b0096f7105b3a6sm5986979ejn.189.2023.05.24.08.34.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 May 2023 08:34:01 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Christian Brauner , Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v2 04/13] ceph: allow idmapped mknod inode op Date: Wed, 24 May 2023 17:33:06 +0200 Message-Id: <20230524153316.476973-5-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230524153316.476973-1-aleksandr.mikhalitsyn@canonical.com> References: <20230524153316.476973-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christian Brauner Enable ceph_mknod() to handle idmapped mounts. This is just a matter of passing down the mount's idmapping. Cc: Jeff Layton Cc: Ilya Dryomov Cc: ceph-devel@vger.kernel.org Signed-off-by: Christian Brauner Signed-off-by: Alexander Mikhalitsyn --- fs/ceph/dir.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index cb67ac821f0e..8d3fedb3629b 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c @@ -884,6 +884,7 @@ static int ceph_mknod(struct mnt_idmap *idmap, struct i= node *dir, req->r_parent =3D dir; ihold(dir); set_bit(CEPH_MDS_R_PARENT_LOCKED, &req->r_req_flags); + req->r_mnt_idmap =3D idmap; req->r_args.mknod.mode =3D cpu_to_le32(mode); req->r_args.mknod.rdev =3D cpu_to_le32(rdev); req->r_dentry_drop =3D CEPH_CAP_FILE_SHARED | CEPH_CAP_AUTH_EXCL; --=20 2.34.1 From nobody Mon Feb 9 01:50:36 2026 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 76417C77B7A for ; Wed, 24 May 2023 15:36:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236915AbjEXPf6 (ORCPT ); Wed, 24 May 2023 11:35:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236556AbjEXPfH (ORCPT ); Wed, 24 May 2023 11:35:07 -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 6A203E7B for ; Wed, 24 May 2023 08:34:45 -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 E29F53F196 for ; Wed, 24 May 2023 15:34:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1684942444; bh=VOsvDeo72Li4A+MGz8y/FXCiDvmbWTjb5uUMq09Z+GE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gWZurhxT3fpyDMIpY77JZvx4PwqkyY55Hc00DdcdOYztydiLIGYoifVtCs4mY8MIa ZcsHOyJkkF4TImSP8JTVQ3o6LuOPpT0l/y/hlaf2s6QXPAF8bYWqmKwHHGkR9hBBrL JR6JDvFZ0j4k16Kq91Cdd1QRvMd8AkU+++VHZYxiz7PphVXcvGAeUk6s5gz7ZKO95E MZjGao1DtzPoAPe/70t/3FmgTniZj6iDRtIIa5gkSpOrdewvRvZFvhEcR0sGwe6GXC OvbqVUp0s9LIjXIjkFb1hlcl+6PnYJ3DK/lKKIpsqy8ze78clGszML8MEKIdxJeMn3 TG10RXmVv5ceQ== Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-50bf847b267so1341538a12.3 for ; Wed, 24 May 2023 08:34:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684942444; x=1687534444; 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=VOsvDeo72Li4A+MGz8y/FXCiDvmbWTjb5uUMq09Z+GE=; b=YPvSggpxBidgzZplnj7Edj9esrO7Qg4pctSpQ4aU5FfzcMEaKQAnDGXrP/Bq6LlfeQ BkYkBAXM2bV2jRymuVlXV0xOPzdaEv/knGGPPiv4TFHkkvnjTr0epcvvmekml/20Eyoe eQSkBIgIFPqjlRQW2XY0vEGU8iQQ+JYZSnJ3aCFd0GBQDp8oq9gcAZHRBoIJ1te3sgTh MAOLpWZjxicRS11dM7ShSDmMnk+Sz9gjL66aoMucDl/yNXRy4ITRSwlwfIQKHRniAfbA nwGfbVZqLZpIdCGRz0vNACSoMFdy7V2elGIPwt4Pg4jhBbQ2tu4ngNWLQLGToFCBSMy/ nDbw== X-Gm-Message-State: AC+VfDwaEvWMgMNOZ+bWkP6b/UY3J79QqBbPZSBuxUuPbPWlVhmxzvTb lqBIuCykcDsCyVNX7jtiHR95wDxoqxE9zQnzYisB0Ss/0/Fdb1GSiiHkmNXjX+hSNEVU64rqaXu xeiB/ZXtfiVcfLqCVF2DCx9MOT1drJVTlk9wGqgZTXw== X-Received: by 2002:a17:906:5044:b0:96a:63d4:24c5 with SMTP id e4-20020a170906504400b0096a63d424c5mr16834948ejk.77.1684942444420; Wed, 24 May 2023 08:34:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7gBpqHitu+lLhIckipr6Iw+ZMNPeoZej+/zA1KHtSCkxGa9OwcqI2J/tv0ifrYtmEPsQMuyg== X-Received: by 2002:a17:906:5044:b0:96a:63d4:24c5 with SMTP id e4-20020a170906504400b0096a63d424c5mr16834933ejk.77.1684942444258; Wed, 24 May 2023 08:34:04 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-074-206-207.088.074.pools.vodafone-ip.de. [88.74.206.207]) by smtp.gmail.com with ESMTPSA id p26-20020a17090664da00b0096f7105b3a6sm5986979ejn.189.2023.05.24.08.34.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 May 2023 08:34:03 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Christian Brauner , Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v2 05/13] ceph: allow idmapped symlink inode op Date: Wed, 24 May 2023 17:33:07 +0200 Message-Id: <20230524153316.476973-6-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230524153316.476973-1-aleksandr.mikhalitsyn@canonical.com> References: <20230524153316.476973-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christian Brauner Enable ceph_symlink() to handle idmapped mounts. This is just a matter of passing down the mount's idmapping. Cc: Jeff Layton Cc: Ilya Dryomov Cc: ceph-devel@vger.kernel.org Signed-off-by: Christian Brauner Signed-off-by: Alexander Mikhalitsyn --- fs/ceph/dir.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 8d3fedb3629b..3996572060da 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c @@ -956,6 +956,7 @@ static int ceph_symlink(struct mnt_idmap *idmap, struct= inode *dir, req->r_num_caps =3D 2; req->r_dentry_drop =3D CEPH_CAP_FILE_SHARED | CEPH_CAP_AUTH_EXCL; req->r_dentry_unless =3D CEPH_CAP_FILE_EXCL; + req->r_mnt_idmap =3D idmap; if (as_ctx.pagelist) { req->r_pagelist =3D as_ctx.pagelist; as_ctx.pagelist =3D NULL; --=20 2.34.1 From nobody Mon Feb 9 01:50:36 2026 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 2EBF3C7EE2D for ; Wed, 24 May 2023 15:35:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235926AbjEXPf4 (ORCPT ); Wed, 24 May 2023 11:35:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236548AbjEXPfH (ORCPT ); Wed, 24 May 2023 11:35:07 -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 A1C2A10C6 for ; Wed, 24 May 2023 08:34:45 -0700 (PDT) Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.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 4B0BC3F4A6 for ; Wed, 24 May 2023 15:34:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1684942449; bh=H9xVyVFm2J6DXYIa+xt6L2ldHLbh9SntsfJpFosG5pA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=S5F22vKuFFc/ja968PcyvVkGDGKhe4UDdSTVSh0hk+eqbeg6aXOS8gRodker4iG33 6anRuTteIdc00/D6cuAVixT2p57EZiTwmcd/T5V+vFo7mJCPTyM0K7YLgM7veroOfg SYgqKcVeslJqDuYSAa1EGPIjiXe6u835kqFvitJHRqM+2AvfmXNhZBLUEaAxbgcgAo oRf649MgMWq/MncpFsjuoxsa8a9hDbzup4G1EPGvdWSLvnNpF6tdpcOBZ0ntnn0CXd WA+GtXNfwpAxToFr8FD6Q1tJdY1sYrsbsgOsv4vHG3Hw5HdjihJH1GigXaGTRlsv8O I/j8cDXagwlbA== Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-506a7b4f141so1336971a12.2 for ; Wed, 24 May 2023 08:34:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684942446; x=1687534446; 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=H9xVyVFm2J6DXYIa+xt6L2ldHLbh9SntsfJpFosG5pA=; b=ljW61kFmyJY4WkdVwAoQfh1hn/ZBX9CKvaibww4IWWdV4nbRRDTk9aBYMzfjQl4jrY /ge+UpyMvDNoq8mztxEtUxLF38feWeVpfOPGtmI4XPJfAm6U4bewH9kVDYxXW5Hwl8xa SlzexBsw95ptxCAYefvMbFZ0kNo2nEDSInCsnN5aad6EHa950L7/y16hRLH/3wOnLeNb 9V58ubD5+ufzd7GEaoaDoLGJu5R3iqQq9oc5uwyz9CahPG5CNPfAdzjE4RaQAvA5QHOa GfAaZQ/KGG5+GdRq3yV2kFkE7xXFgMJdZKH8OkB7fC8lsNZWwZP6CEII7O72NqmG4nFc Q7Ig== X-Gm-Message-State: AC+VfDzCJh2SgdlUnThli3pW+TgA1GUEMZ7ikeeexcVs4oIZyL0o6wj9 b/RM7SbcDeVy6rgQtoCTS5KZduZ0+DNzlC46CEPmsrDqzJ0GBladZggxaWnl4aDVV4gi6jv44Xf cGsGuwiMaDGvLZrTz24gRheS75B3IMFzAO+xv4k8R4Q== X-Received: by 2002:a17:907:c07:b0:96a:c661:fa1 with SMTP id ga7-20020a1709070c0700b0096ac6610fa1mr20640395ejc.46.1684942446756; Wed, 24 May 2023 08:34:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4XpCjIcxhdoliupK6KKdEUY8jcq27fFWoCooizfqJ+xFZsiS/Txtj9EH8UgEqevhz9hzz8ew== X-Received: by 2002:a17:907:c07:b0:96a:c661:fa1 with SMTP id ga7-20020a1709070c0700b0096ac6610fa1mr20640376ejc.46.1684942446551; Wed, 24 May 2023 08:34:06 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-074-206-207.088.074.pools.vodafone-ip.de. [88.74.206.207]) by smtp.gmail.com with ESMTPSA id p26-20020a17090664da00b0096f7105b3a6sm5986979ejn.189.2023.05.24.08.34.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 May 2023 08:34:06 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Christian Brauner , Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v2 06/13] ceph: allow idmapped mkdir inode op Date: Wed, 24 May 2023 17:33:08 +0200 Message-Id: <20230524153316.476973-7-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230524153316.476973-1-aleksandr.mikhalitsyn@canonical.com> References: <20230524153316.476973-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christian Brauner Enable ceph_mkdir() to handle idmapped mounts. This is just a matter of passing down the mount's idmapping. Cc: Jeff Layton Cc: Ilya Dryomov Cc: ceph-devel@vger.kernel.org Signed-off-by: Christian Brauner Signed-off-by: Alexander Mikhalitsyn --- fs/ceph/dir.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 3996572060da..a4b1ee5ce6b6 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c @@ -1024,6 +1024,7 @@ static int ceph_mkdir(struct mnt_idmap *idmap, struct= inode *dir, ihold(dir); set_bit(CEPH_MDS_R_PARENT_LOCKED, &req->r_req_flags); req->r_args.mkdir.mode =3D cpu_to_le32(mode); + req->r_mnt_idmap =3D idmap; req->r_dentry_drop =3D CEPH_CAP_FILE_SHARED | CEPH_CAP_AUTH_EXCL; req->r_dentry_unless =3D CEPH_CAP_FILE_EXCL; if (as_ctx.pagelist) { --=20 2.34.1 From nobody Mon Feb 9 01:50:36 2026 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 C5E55C77B7C for ; Wed, 24 May 2023 15:36:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236953AbjEXPgB (ORCPT ); Wed, 24 May 2023 11:36:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235905AbjEXPfI (ORCPT ); Wed, 24 May 2023 11:35:08 -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 7AF6210CC for ; Wed, 24 May 2023 08:34:46 -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 9651D40750 for ; Wed, 24 May 2023 15:34:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1684942449; bh=lZbP4iiEH03HfqTDqSU+Hv1fOneGFOzGKwUObj1rpGo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=I3E0jdM/pfErHRIphNzhKnsh5L9WeN7ntnBbe9vwyWYIhBgjK9M7V8W5GmfbCHuYf 2iSxLj5n5ypyNfkq1knJTgqipGUdqqaqkMZCia2l+K4qZkdo9IqT2Q6szRoapQqByU JdqFbBz8/bIvkMZx/K8tlUiq3rGAoR/B90qoB3hoFa9IgaXtO3K3c0/vfpD3iE194o XZR8KUpCoDBU0XlCrcZ2qscSVND+UXv5TqpHUdIWNIbp0szuToqEMzg3PP51Vg95dc RNd4XpzPvsAHZ54gPH5feRO9PGsQOBT3kMuIRKvWQlC6nIinfGGHRTMlP4YJMRSTWL qJIF15ScYVJtQ== Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-96f4f1bb838so105782366b.3 for ; Wed, 24 May 2023 08:34:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684942449; x=1687534449; 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=lZbP4iiEH03HfqTDqSU+Hv1fOneGFOzGKwUObj1rpGo=; b=gVepCgn5XVVWkjbBVsInH5MXHsksssEFqLDiuhKH9MTlSr1w0QQPokwe3jD1LSkq5p lReEMrEYmEDW07k1rKCHTR0N8L1IkZgB+kYNaRgCI9fYQNzLtcFbl64GtN6KBAo4ai6h yxdnMaIhDlgdFxj80v6GkV1/n+tSirXk02lTNAsfbx1BsI9aP4qLqWiUNyZ/W793sY4L c8FK/JqrAI64mO3OPE0P6RA3EG4LOWmd4ozQZkbx2b8U0YXh2Z97xvxDUSc7+jAkeWwr 5TqyHwjApE1Q1d8ZB4Y4lC4NRJvXhmpQNfM+u10vRu31WF06G3NzhXfnlMu72c6rpw+f vPIA== X-Gm-Message-State: AC+VfDxiVMFRCQGB0FdJf7xID7TiMdzO4JX0OtYtlNYoLWWccq1tPj5v ixAm2tn5AmK4KRqrG0YZOJrPv21CmDZOK3bCrG8TpkFo1VRmVyEedO0hDRsihVSZTS1Z0mkm2ah z5lVkujO2tF8zsSNFYexYRwTqxZ8ecP3s1tFiacEI6A== X-Received: by 2002:a17:907:26c6:b0:969:f677:11b4 with SMTP id bp6-20020a17090726c600b00969f67711b4mr16979973ejc.37.1684942448869; Wed, 24 May 2023 08:34:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6GkqD2mx9edhZF+fiZhPW/iOs1zLB2TI7gEZMH8nbEv37OBHOLISYOfgzS57PLOIkRd9L02g== X-Received: by 2002:a17:907:26c6:b0:969:f677:11b4 with SMTP id bp6-20020a17090726c600b00969f67711b4mr16979950ejc.37.1684942448627; Wed, 24 May 2023 08:34:08 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-074-206-207.088.074.pools.vodafone-ip.de. [88.74.206.207]) by smtp.gmail.com with ESMTPSA id p26-20020a17090664da00b0096f7105b3a6sm5986979ejn.189.2023.05.24.08.34.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 May 2023 08:34:08 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Christian Brauner , Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v2 07/13] ceph: allow idmapped rename inode op Date: Wed, 24 May 2023 17:33:09 +0200 Message-Id: <20230524153316.476973-8-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230524153316.476973-1-aleksandr.mikhalitsyn@canonical.com> References: <20230524153316.476973-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christian Brauner Enable ceph_rename() to handle idmapped mounts. This is just a matter of passing down the mount's idmapping. Cc: Jeff Layton Cc: Ilya Dryomov Cc: ceph-devel@vger.kernel.org Signed-off-by: Christian Brauner Signed-off-by: Alexander Mikhalitsyn --- fs/ceph/dir.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index a4b1ee5ce6b6..7ae02a690464 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c @@ -1327,6 +1327,7 @@ static int ceph_rename(struct mnt_idmap *idmap, struc= t inode *old_dir, req->r_old_dentry_unless =3D CEPH_CAP_FILE_EXCL; req->r_dentry_drop =3D CEPH_CAP_FILE_SHARED; req->r_dentry_unless =3D CEPH_CAP_FILE_EXCL; + req->r_mnt_idmap =3D idmap; /* release LINK_RDCACHE on source inode (mds will lock it) */ req->r_old_inode_drop =3D CEPH_CAP_LINK_SHARED | CEPH_CAP_LINK_EXCL; if (d_really_is_positive(new_dentry)) { --=20 2.34.1 From nobody Mon Feb 9 01:50:36 2026 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 BE5A2C77B7C for ; Wed, 24 May 2023 15:36:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237016AbjEXPgF (ORCPT ); Wed, 24 May 2023 11:36:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236653AbjEXPfK (ORCPT ); Wed, 24 May 2023 11:35:10 -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 85A8B10DB for ; Wed, 24 May 2023 08:34:48 -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 9EE4841FC0 for ; Wed, 24 May 2023 15:34:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1684942454; bh=nUbgNVx3j+EjvX/3B5psKLPL9iW2vvt56NMjhT4BQS4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=GENC9nrZs514N7RENTdYuLTzPV0u0z/B+/1AX7oZ2XYOZ6ZYrV6EvPIxi7W3q8TwY lXtSHPVuOF+lrLfgLjuuCi/sXUA2D/1bzYmrBuyfzl3S4HH9TK63/QY5pUzzQQs3Wn OcyKnSgin4jiiTIglZ+1b5S5k5dZtyS6w7VUsnnAWkMQMc6PSu2dq0v9r5iE89uffu wzreTVSXmABNcKHVorXCCXsTdjoogCsdd0QI4CUImOTkdUkoTafF0RGFBre5U8GIXj 7+PWYYVyumP9C1FmDgzwU68eNhyodDg0Vj48Q5Ac5ny5IsKR4gFb8P4s8LnBC5pvg3 1TrBBfVLL+peA== Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-96f9996fb3dso97888866b.2 for ; Wed, 24 May 2023 08:34:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684942451; x=1687534451; 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=nUbgNVx3j+EjvX/3B5psKLPL9iW2vvt56NMjhT4BQS4=; b=RLANRxstChXURsYfuCG7TdO0czqFbg81XcUgjIhHLQp2FXizM6NH6XU1QNmpC1zlGg OSkHcIrIHH2Bd0JANe2WwGeOJbKd+j6EJNEkYNIEdxoZDLbqCc75sts9pKQOPGi3x0JI YR6z2y9bymdhpQc9kqF9WCV8ZKyg7ahfsXB4sqpqXYlPHrakWbXgbx3G5kLKFscxyGRY tK0DgUsmww0Ve0EwDh3vOYK06HUSsrpPqj9Oxj05id3DCFz9VTeh0rebQqwrb1o/8fJE ZeT5cNPntSvzdcFgwbkGT4RG6vJFAkORMU9JtiWcF5a4XSZJfEt+Sk/USAoRyFRM6dWF Xy1A== X-Gm-Message-State: AC+VfDwB1g7yyH2oJDP7Om7iqXm5uo2gC4S2vRK/4BR7DovjGAZ1JDwr AYo2HGBT+yaUsfdTMpy7wN0u4C3w+wq+EIqwfMDfiS2iqwMgn8gHNeuGZE1N2VUd3iYmueP49bP gy3UhKrnR9Ncea48hvY2yS+JnhHW9aR5CVocyXE2mKg== X-Received: by 2002:a17:907:2cc7:b0:959:18b2:454a with SMTP id hg7-20020a1709072cc700b0095918b2454amr16847493ejc.76.1684942451055; Wed, 24 May 2023 08:34:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4agyA0tH+R6Uc7Qz229nwHWOixIWfcCKeLBdwkSFRUhR2KeRm98taylnAcoCXZTrZXUluskw== X-Received: by 2002:a17:907:2cc7:b0:959:18b2:454a with SMTP id hg7-20020a1709072cc700b0095918b2454amr16847484ejc.76.1684942450831; Wed, 24 May 2023 08:34:10 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-074-206-207.088.074.pools.vodafone-ip.de. [88.74.206.207]) by smtp.gmail.com with ESMTPSA id p26-20020a17090664da00b0096f7105b3a6sm5986979ejn.189.2023.05.24.08.34.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 May 2023 08:34:10 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Christian Brauner , Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v2 08/13] ceph: allow idmapped getattr inode op Date: Wed, 24 May 2023 17:33:10 +0200 Message-Id: <20230524153316.476973-9-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230524153316.476973-1-aleksandr.mikhalitsyn@canonical.com> References: <20230524153316.476973-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christian Brauner Enable ceph_getattr() to handle idmapped mounts. This is just a matter of passing down the mount's idmapping. 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 8e5f41d45283..2e988612ed6c 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -2465,7 +2465,7 @@ int ceph_getattr(struct mnt_idmap *idmap, const struc= t path *path, return err; } =20 - generic_fillattr(&nop_mnt_idmap, inode, stat); + generic_fillattr(idmap, inode, stat); stat->ino =3D ceph_present_inode(inode); =20 /* --=20 2.34.1 From nobody Mon Feb 9 01:50:36 2026 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 B7545C77B7A for ; Wed, 24 May 2023 15:36:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237038AbjEXPgJ (ORCPT ); Wed, 24 May 2023 11:36:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236308AbjEXPfL (ORCPT ); Wed, 24 May 2023 11:35:11 -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 850E7E63 for ; Wed, 24 May 2023 08:34:48 -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 2B1C741FBB for ; Wed, 24 May 2023 15:34:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1684942453; bh=nR9/+ewIyyw/jy6drOGZEF0QPlfa9Zf5mm9/nFwa0HI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lLSZB1MLefikaTBugXnexNAbwJsg3wzvKCqyR0eF/6I9SfCTH2bvwl+ygZV4Hm5yr bsiQHIbOoKVZbNyOn/In4C8hn8SdqJjsauXQX/b84H4nc99TmHwXzi4I1o0c3NTrRS HAw0wNH04XnVeA2ngKLCczOLhoEPKgpVkexlD7H4X5ONAbqspIegejn4K3B38MCtfV Ft7/moXeSsB6qyXWBwXahJrwlC4a2FRgEXIsjdLxoSUsZvvzYnFhE/usO7ij14l3xZ xSESqEW8LD36xA/z38ECMjWoQ6UTPSRnsuQzi7jj+cHP1fXFyuBlSpoKfjIUYlp0c8 tDBK1sg6uPuZg== Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-96faa650a3fso134084366b.0 for ; Wed, 24 May 2023 08:34:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684942453; x=1687534453; 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=nR9/+ewIyyw/jy6drOGZEF0QPlfa9Zf5mm9/nFwa0HI=; b=UJihUrMtb9aZiTSNs6Q1dEj/gTpnDdQXOSh5p8kLK/0GEay/k4joU6zAhaZ8T7Oz5f vM96xBcv9q2nMor0VGUy4qsPvLPRhivMcbRR7qtpiuS+ZesUU+0fVQzlnqAVZthX/AyC K7bjFkxyq5trLbwhCNtJk6sKvZSfhH82zJGseCEJLoukRWz5fbGeTJYjL2VLoIN+gQli gjfFvESTFX9/s6VkFOaPiHkpmgM3o3O6D18maAUUAPK6RBKUqOJus8+wz0ot6qAfYtz4 72IQF588NZEbCWO3o8kEZOY10fIB+7jl16bm3iqCKJdHWZnJasOAjrZcIHYiBx63Vzek /eeg== X-Gm-Message-State: AC+VfDyJ6MzgDHutk1zGKEVLZMb0KIIBJyEXURW3KGWk+Y+hQs8IEdkA F7dT2VXTMxXDo4rQjK4k+fvksMf7ppBQ317tW+t71EpPMaR1Un8MhOLijMiEtEWcAte0DZjKqJT 8pvRC9om3bTJ/7yD+Kxs55WUnG1qE2l1F/p8arjL/gw== X-Received: by 2002:a17:907:928c:b0:94a:7da2:d339 with SMTP id bw12-20020a170907928c00b0094a7da2d339mr19734522ejc.26.1684942452946; Wed, 24 May 2023 08:34:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4VrLveeCMu2ys0lUPF7qZva7g6gOB0NcoxUq6lKjQX0cOjszplX5lU3+A9k/0AIpZbnoUuKA== X-Received: by 2002:a17:907:928c:b0:94a:7da2:d339 with SMTP id bw12-20020a170907928c00b0094a7da2d339mr19734509ejc.26.1684942452777; Wed, 24 May 2023 08:34:12 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-074-206-207.088.074.pools.vodafone-ip.de. [88.74.206.207]) by smtp.gmail.com with ESMTPSA id p26-20020a17090664da00b0096f7105b3a6sm5986979ejn.189.2023.05.24.08.34.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 May 2023 08:34:12 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Christian Brauner , Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v2 09/13] ceph: allow idmapped permission inode op Date: Wed, 24 May 2023 17:33:11 +0200 Message-Id: <20230524153316.476973-10-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230524153316.476973-1-aleksandr.mikhalitsyn@canonical.com> References: <20230524153316.476973-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christian Brauner Enable ceph_permission() to handle idmapped mounts. This is just a matter of passing down the mount's idmapping. 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 2e988612ed6c..37e1cbfc7c89 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -2408,7 +2408,7 @@ int ceph_permission(struct mnt_idmap *idmap, struct i= node *inode, err =3D ceph_do_getattr(inode, CEPH_CAP_AUTH_SHARED, false); =20 if (!err) - err =3D generic_permission(&nop_mnt_idmap, inode, mask); + err =3D generic_permission(idmap, inode, mask); return err; } =20 --=20 2.34.1 From nobody Mon Feb 9 01:50:36 2026 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 5ED33C77B73 for ; Wed, 24 May 2023 15:36:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236706AbjEXPgM (ORCPT ); Wed, 24 May 2023 11:36:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236670AbjEXPfL (ORCPT ); Wed, 24 May 2023 11:35:11 -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 A59C818C for ; Wed, 24 May 2023 08:34:48 -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 9D09C41FC2 for ; Wed, 24 May 2023 15:34:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1684942455; bh=Md8TLnFONebgQ4vC2/VtTKzXRXy8hQu8U3It9LdXrRE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bhC4YNeX35pSUHBPzJjqkYN07y71/FMuAMbEZfHv/nPaZqFTyAJm99sS2ujhe4vqo izO895S+AMYV8mlb5BQCYvN24FlHMIc4ChdUBPuxYIy6WC5O0MyjhUyNChh8UK88BL 4DtYmjQmpUyJ1II2mbLgAwd2gpm4V/3xKVlQGtSZKiQpykWLdyQRKgxt1d5gJGTPDo ev7ObDM/R9sRgwLz+G/d+hd8GvDQAhAT1eI4oMgIjjIGDI1C0Sxj3RUQGw/E2ck9YE rpqHY9iCystR7jUm9xjCfl30DJ5YNKMh3npXB69yeaSMPAvBPK5VIE37Q6gQuMr2vG HE74JZEpPQneQ== Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-96fb396ee3dso106879866b.1 for ; Wed, 24 May 2023 08:34:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684942455; x=1687534455; 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=Md8TLnFONebgQ4vC2/VtTKzXRXy8hQu8U3It9LdXrRE=; b=Tf957n7vCf4qQHJsxSrcaynNF4ET4JvdND3h3KO37wQyKKkWNCR2wCEjXzvaYhiS8p leWwgSd89dcJrVCoZvbA48zlQdDTRsQpV2W/s17g6PR4wThSBOrOtUjQpwi4gEed0CWg mSJs+pBCppjVABvFkPRoi5IcKLP6GI9OMoArMG8iku0FncKwKs6n5cEcmi7rrBYuiV8k xG7FOPk91WliZmpobFrJ1WKMckI0kGBkAYO1P7z7AP9Mu8Nc8JMUxH+1EByQ+w6F6PRe xjtv2aK5CpxvSeYHjB6zHY81NvvncQ2VDDR2Lel+ZKllfZiray3TEFanVljRCEgbWAOF lW2Q== X-Gm-Message-State: AC+VfDx2096GcglzM5XJkm4F3A9qs+0mEMck1evwHY6H40ZZi1RbGbxq spbq8nzZoOsxm9ZPPuA/bYVuOvRm1aoW+3ESV9hce6Uh6O1PANJV89VtZcYEUJKEa7n62wGz8dw +9B4r3qtMqoDriD8nSf3UjEtU+vJ1TDae6sE/WuQo8Q== X-Received: by 2002:a17:907:a42b:b0:96f:9cea:a346 with SMTP id sg43-20020a170907a42b00b0096f9ceaa346mr12483837ejc.1.1684942455182; Wed, 24 May 2023 08:34:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4wBfGopEZ/PbcB7gaSEiXxq8R0KVY7IbTh7GgeLo03JonIsvQba/f+t+zD7HunE0mybct/6w== X-Received: by 2002:a17:907:a42b:b0:96f:9cea:a346 with SMTP id sg43-20020a170907a42b00b0096f9ceaa346mr12483820ejc.1.1684942454952; Wed, 24 May 2023 08:34:14 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-074-206-207.088.074.pools.vodafone-ip.de. [88.74.206.207]) by smtp.gmail.com with ESMTPSA id p26-20020a17090664da00b0096f7105b3a6sm5986979ejn.189.2023.05.24.08.34.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 May 2023 08:34:14 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Christian Brauner , Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v2 10/13] ceph: allow idmapped setattr inode op Date: Wed, 24 May 2023 17:33:12 +0200 Message-Id: <20230524153316.476973-11-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230524153316.476973-1-aleksandr.mikhalitsyn@canonical.com> References: <20230524153316.476973-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christian Brauner Enable __ceph_setattr() to handle idmapped mounts. This is just a matter of passing down the mount's idmapping. 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 | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 37e1cbfc7c89..f1f934439be0 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -2050,6 +2050,13 @@ int __ceph_setattr(struct inode *inode, struct iattr= *attr) =20 dout("setattr %p issued %s\n", inode, ceph_cap_string(issued)); =20 + /* + * The attr->ia_{g,u}id members contain the target {g,u}id we're + * sending over the wire. The mount idmapping only matters when we + * create new filesystem objects based on the caller's mapped + * fs{g,u}id. + */ + req->r_mnt_idmap =3D &nop_mnt_idmap; if (ia_valid & ATTR_UID) { dout("setattr %p uid %d -> %d\n", inode, from_kuid(&init_user_ns, inode->i_uid), @@ -2240,7 +2247,7 @@ int ceph_setattr(struct mnt_idmap *idmap, struct dent= ry *dentry, if (ceph_inode_is_shutdown(inode)) return -ESTALE; =20 - err =3D setattr_prepare(&nop_mnt_idmap, dentry, attr); + err =3D setattr_prepare(idmap, dentry, attr); if (err !=3D 0) return err; =20 @@ -2255,7 +2262,7 @@ int ceph_setattr(struct mnt_idmap *idmap, struct dent= ry *dentry, err =3D __ceph_setattr(inode, attr); =20 if (err >=3D 0 && (attr->ia_valid & ATTR_MODE)) - err =3D posix_acl_chmod(&nop_mnt_idmap, dentry, attr->ia_mode); + err =3D posix_acl_chmod(idmap, dentry, attr->ia_mode); =20 return err; } --=20 2.34.1 From nobody Mon Feb 9 01:50:36 2026 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 BD33CC77B73 for ; Wed, 24 May 2023 15:37:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236389AbjEXPhX (ORCPT ); Wed, 24 May 2023 11:37:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237227AbjEXPgn (ORCPT ); Wed, 24 May 2023 11:36:43 -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 B85FA10F8 for ; Wed, 24 May 2023 08:35:17 -0700 (PDT) Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.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 1A73E41D5E for ; Wed, 24 May 2023 15:34:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1684942461; bh=iDvGWD+26D2Z+S1TMox8zoqslkMySxbj4ujfm+xfm2I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=O2RnG/NqRTB/VKC6XnLngYd8oftmjIqd/4j10bZx2aHZ2ehKpGHKYnvSxUjElydvW iF8rf4b0z6Jl4ZBbZGR23FZpU95HW4+EBWipmQ+aEUTQQLoSAQrRx3ZrN1bl3xDaIu vuepfkjDUmf5Xlssly9pT+WwTVtbc1c0qrav3HxVTDx4Mak3zlcE3Osk/EYQpVxLnR Gq6g1rk4nLk9PYav5AKOQNUhaBVS4l/tmdtLX+x5/zIcOyHa8G18ZnNT0Hk2GwCl55 bL4e2S4Mwp5gJgPSgOYHIX8SvQL5kW9JueZsdlQnXFOLAASKn/7snk4u/i6o9Gs18+ dyHUn54TSRS0A== Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-51392d645d5so1411476a12.1 for ; Wed, 24 May 2023 08:34:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684942457; x=1687534457; 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=iDvGWD+26D2Z+S1TMox8zoqslkMySxbj4ujfm+xfm2I=; b=EzBccQ7EW7rh7e2rud+FzdR2W6eRSR/Jh1l4/9/vusc0sYcISGHV0Qv+uBpF3aKnlE gSKKpLzWQLzSxxVRtDPEIMVl5sTa3Q54xGMyHN+Ym0h67Arsm2yWlDtfRCgWpzqrl/Kx T/2pAKi/lNFpXSRxbpiAUQ/XOs2k8fiMBBIscckfXIJAfP7pfbw+KM90lsZmNHVjzBk2 fXy3qW2kHAISxUil9HoTYZibZMNYEGXUMXdbWGsqb5B9KzxVTRJe6S525uyAgvV9IQ93 v3E2ZjZy/9EDceiTFA6Hf0uPm+HiaPl4os+S8pzrvTbaQJM7JlZWUoNKZv0huSW3w7OI jMUg== X-Gm-Message-State: AC+VfDzMkLMq1hKGSVYpuktGVXVfolaHpR0bhNxeUJNlz5iw6whQ7V/W IuS96fpN7hDsAvqxW05tnq7pco7cwHIDvxp0jjSKntiL/XHeSYSizawVuFriO5PkzSlIWx30iKp JSN56iw1DYUbjUQsgqXeSGNOh+bIYdf/B/RAzR7Vbjg== X-Received: by 2002:a17:906:dac1:b0:966:471c:2565 with SMTP id xi1-20020a170906dac100b00966471c2565mr15855325ejb.48.1684942457338; Wed, 24 May 2023 08:34:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7DVPnmHEEXyH6/S3ZdnkASC78MliSVSX6eChUtaO68Ytw9hQ0oJ2rkgjtW+JQ8P1CYQhOU4w== X-Received: by 2002:a17:906:dac1:b0:966:471c:2565 with SMTP id xi1-20020a170906dac100b00966471c2565mr15855304ejb.48.1684942457080; Wed, 24 May 2023 08:34:17 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-074-206-207.088.074.pools.vodafone-ip.de. [88.74.206.207]) by smtp.gmail.com with ESMTPSA id p26-20020a17090664da00b0096f7105b3a6sm5986979ejn.189.2023.05.24.08.34.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 May 2023 08:34:16 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Christian Brauner , Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v2 11/13] ceph/acl: allow idmapped set_acl inode op Date: Wed, 24 May 2023 17:33:13 +0200 Message-Id: <20230524153316.476973-12-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230524153316.476973-1-aleksandr.mikhalitsyn@canonical.com> References: <20230524153316.476973-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christian Brauner Enable ceph_set_acl() to handle idmapped mounts. This is just a matter of passing down the mount's idmapping. 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 6945a938d396..4291c890e324 100644 --- a/fs/ceph/acl.c +++ b/fs/ceph/acl.c @@ -105,7 +105,7 @@ int ceph_set_acl(struct mnt_idmap *idmap, struct dentry= *dentry, case ACL_TYPE_ACCESS: name =3D XATTR_NAME_POSIX_ACL_ACCESS; if (acl) { - ret =3D posix_acl_update_mode(&nop_mnt_idmap, inode, + ret =3D posix_acl_update_mode(idmap, inode, &new_mode, &acl); if (ret) goto out; --=20 2.34.1 From nobody Mon Feb 9 01:50:36 2026 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 15C03C77B7A for ; Wed, 24 May 2023 15:37:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237358AbjEXPhT (ORCPT ); Wed, 24 May 2023 11:37:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237197AbjEXPge (ORCPT ); Wed, 24 May 2023 11:36:34 -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 C74B710E7 for ; Wed, 24 May 2023 08:35:13 -0700 (PDT) Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.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 4E7C63F452 for ; Wed, 24 May 2023 15:34:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1684942460; bh=j/vZphe6iawzwC+GAFA6qRSN3lvkZ4mAE+bgyLQQZEQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=imXshkHuCw3/YUan0IJiKbujCfMF+5vkS7QhmvJJg1R3yQIkewLDUKGjaXPTUiami cDqpNs3ctWg5EVmqcMZskEWrJPpR9hArStgk5SsqJlSdzJnlELz+7N/mbcmMrj+q7D Zb9GtZLgmf22NXdBYgNzY6opF2ywxkMKZ8mfJTJ9t69Nz5Y75Yr4sfvfsMc5Ey8hop sbdaL19jbL19dCbpXERe/52AjcIwwlJ+JKvUi+jz74g04oAJk0Irt0wkQsP0riXUkU HEauFkKME9pG+sRn2AirER6O9IPaDWO2c11lU2D++tSo545jqyEsEsUfEgYekyjdfa WGcodyCVO+n+w== Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-50dfa390825so1411617a12.3 for ; Wed, 24 May 2023 08:34:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684942459; x=1687534459; 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=j/vZphe6iawzwC+GAFA6qRSN3lvkZ4mAE+bgyLQQZEQ=; b=deGwzFks+KglQxPQtSFs5+chXRYV4TOVHpqDZOpOKpTJ+5YUwnEh+deuUFkHrURh+X Yr8uiMWfxMEJoOZ5fciGp2izoXxHugtkOIXCiH83868hsFWJMNRiB05a0j8elOyeqRit lRA9olwFmHvKgAh3b1ZeWwz96NlipsLPO6G2lfFmTGpmL1Vsopj3mpcN3n3uzQiobPjf zaqv4bggvHvufz2809cVM+2NECwOgFcN1iYSIjvNhK+PcMAk1BkpGhdZ/IhPOApK5rS/ rVAe/dJvvGwBzJIQzjSG4oAI1p504sPdJ6cFD0VncpLWBnazHsCfjMhG5gv285iwLsyf +KIw== X-Gm-Message-State: AC+VfDyGfchNM2P3diQBNvqPV54bNX4gBKnLTrqaxUygMWQn4qrmqLJa Xp9749otU04JBXCud4c3UfvizowGYvwbT3/6AsFbvX6RgnKWBh9RzgTpzk2Fc/A+FUqyfKOGBel MGM3QbiAxV1CSmbPfzXOFPktoOk4egPO2+GC2Z5cfQg== X-Received: by 2002:a17:907:c26:b0:94e:e859:7b07 with SMTP id ga38-20020a1709070c2600b0094ee8597b07mr22066650ejc.32.1684942459656; Wed, 24 May 2023 08:34:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ70ze+kK5xwEjLwX+w5pYZq2/22Y+g7DXsfrlfW78Xsf0MHGqqXeUaXUY3B25KagsieuVK90w== X-Received: by 2002:a17:907:c26:b0:94e:e859:7b07 with SMTP id ga38-20020a1709070c2600b0094ee8597b07mr22066628ejc.32.1684942459495; Wed, 24 May 2023 08:34:19 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-074-206-207.088.074.pools.vodafone-ip.de. [88.74.206.207]) by smtp.gmail.com with ESMTPSA id p26-20020a17090664da00b0096f7105b3a6sm5986979ejn.189.2023.05.24.08.34.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 May 2023 08:34:19 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Christian Brauner , Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v2 12/13] ceph/file: allow idmapped atomic_open inode op Date: Wed, 24 May 2023 17:33:14 +0200 Message-Id: <20230524153316.476973-13-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230524153316.476973-1-aleksandr.mikhalitsyn@canonical.com> References: <20230524153316.476973-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christian Brauner Enable ceph_atomic_open() to handle idmapped mounts. This is just a matter of passing down the mount's idmapping. Cc: Jeff Layton Cc: Ilya Dryomov Cc: ceph-devel@vger.kernel.org Signed-off-by: Christian Brauner Signed-off-by: Alexander Mikhalitsyn --- v2: - rebased, see also 5fadbd9929 ("ceph: rely on vfs for setgid stripping") --- 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 f4d8bf7dec88..f00bfda4b1d2 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -654,7 +654,9 @@ static int ceph_finish_async_create(struct inode *dir, = struct dentry *dentry, in.truncate_seq =3D cpu_to_le32(1); in.truncate_size =3D cpu_to_le64(-1ULL); in.xattr_version =3D cpu_to_le64(1); - in.uid =3D cpu_to_le32(from_kuid(&init_user_ns, current_fsuid())); + in.uid =3D 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 =3D cpu_to_le32(from_kgid(&init_user_ns, dir->i_gid)); =20 @@ -662,7 +664,9 @@ static int ceph_finish_async_create(struct inode *dir, = struct dentry *dentry, if (S_ISDIR(mode)) mode |=3D S_ISGID; } else { - in.gid =3D cpu_to_le32(from_kgid(&init_user_ns, current_fsgid())); + in.gid =3D cpu_to_le32(from_kgid(&init_user_ns, + mapped_fsgid(req->r_mnt_idmap, + &init_user_ns))); } in.mode =3D cpu_to_le32((u32)mode); =20 @@ -731,6 +735,7 @@ int ceph_atomic_open(struct inode *dir, struct dentry *= dentry, struct file *file, unsigned flags, umode_t mode) { struct ceph_fs_client *fsc =3D ceph_sb_to_client(dir->i_sb); + struct mnt_idmap *idmap =3D file_mnt_idmap(file); struct ceph_mds_client *mdsc =3D fsc->mdsc; struct ceph_mds_request *req; struct dentry *dn; @@ -786,6 +791,7 @@ int ceph_atomic_open(struct inode *dir, struct dentry *= dentry, mask |=3D CEPH_CAP_XATTR_SHARED; req->r_args.open.mask =3D cpu_to_le32(mask); req->r_parent =3D dir; + req->r_mnt_idmap =3D idmap; ihold(dir); =20 if (flags & O_CREAT) { --=20 2.34.1 From nobody Mon Feb 9 01:50:36 2026 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 27219C77B73 for ; Wed, 24 May 2023 15:37:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237370AbjEXPh3 (ORCPT ); Wed, 24 May 2023 11:37:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236597AbjEXPg4 (ORCPT ); Wed, 24 May 2023 11:36:56 -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 C605D10FE for ; Wed, 24 May 2023 08:35:20 -0700 (PDT) Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.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 A439C41D51 for ; Wed, 24 May 2023 15:34:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1684942462; bh=MmBaaHI8VpALzyIfbDDcm88Bn4QWndtQOfQJ2qpYUhg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=t8Y7bPxuj5p0Dqm3r2khDAY4TO10Uhs6uLwzpMXCJLWnQsXob+3l7PP8RUt5Ln8Z8 IYTy6zV8cUPJRdr/qzNYV4BJvwnhgGHxcB4EvCyVoOcUHYr8OpvUoB3Ov3aF+kz1+c yzAccG7xpyLbsqDe0rQZ7K+VjkmdAzkrJDpjoFRaF7Orbms/EnqvI/lO5IYfaANyBr uJxUJ4t5P1PQ9ZxuAoLPGTF/neiF5O1KbwPP39Bm95Jr5tRoHO9y8mCiC+j6xeJTzM lJUlC78TEvTx7RNtGRE9gtEGwnzbr2iVr2KOaC9T1a5/vU+L6FxRUqj3pIvYWnXpCC lLKe9+OedQP4w== Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-94a355c9028so120340566b.3 for ; Wed, 24 May 2023 08:34:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684942462; x=1687534462; 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=MmBaaHI8VpALzyIfbDDcm88Bn4QWndtQOfQJ2qpYUhg=; b=SbveEgz02j5KUplHcO5v3ug9yPksadzV0UVgWUHIjygGET/ldWQU6yCKl0Gg/GSjyN vG8ljG6KegcsRmqMYlRVjDMZOcqul7k2NpvXcZxeoiOlMuIRwBFcr7s7uJZcK1+G8Iqr rUZ42gCGOGRL0TggtkMODAUtw2ZEKpJB/jkyyIaLw7F99OZmYnF+0WFOxE8uHh4GWLKQ rVFAgFNMTDWi+EOgzbU2RG6tNzG/pkBn01wYV1gwCbqw+c1twmHryK/Bk2V3jbRPOy5J 0kv61yw0lXfits4zm0YB74oiTL1uIf/oS7OcsKhjppbSJACvwYhgrUDossGwYhtcYbQ4 lHsw== X-Gm-Message-State: AC+VfDxYI2HiGfLXijNkwoQ7sd9yaaZ/avLDyZ3QjkthgSmLEEgghj2K pa3zHKXG3F6pqVq1o5f4B1uchpEH09cgq4GiVfQa67KF+cwNQpCoHdYFO8ArkMpYd/FhEOR6sMD viuZULbAUUE4mNwwtJAtI3ZGVYp3MvVmfKMaAxVIQAQ== X-Received: by 2002:a17:907:2d90:b0:96f:a935:8998 with SMTP id gt16-20020a1709072d9000b0096fa9358998mr15705807ejc.39.1684942462503; Wed, 24 May 2023 08:34:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ44n45ezB0KardR5KNvgVnID6UZeZRJn1zaN+1xQ4m7BE5LFwiKYKe0ULefNGmTnlmYv5+ifQ== X-Received: by 2002:a17:907:2d90:b0:96f:a935:8998 with SMTP id gt16-20020a1709072d9000b0096fa9358998mr15705780ejc.39.1684942462292; Wed, 24 May 2023 08:34:22 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-074-206-207.088.074.pools.vodafone-ip.de. [88.74.206.207]) by smtp.gmail.com with ESMTPSA id p26-20020a17090664da00b0096f7105b3a6sm5986979ejn.189.2023.05.24.08.34.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 May 2023 08:34:21 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Christian Brauner , Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v2 13/13] ceph: allow idmapped mounts Date: Wed, 24 May 2023 17:33:15 +0200 Message-Id: <20230524153316.476973-14-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230524153316.476973-1-aleksandr.mikhalitsyn@canonical.com> References: <20230524153316.476973-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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: 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 3fc48b43cab0..4f6e6d57f3f1 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -1389,7 +1389,7 @@ static struct file_system_type ceph_fs_type =3D { .name =3D "ceph", .init_fs_context =3D ceph_init_fs_context, .kill_sb =3D ceph_kill_sb, - .fs_flags =3D FS_RENAME_DOES_D_MOVE, + .fs_flags =3D FS_RENAME_DOES_D_MOVE | FS_ALLOW_IDMAP, }; MODULE_ALIAS_FS("ceph"); =20 --=20 2.34.1