From patchwork Wed Jul 26 14:10:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13328123 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 3DCA3C00528 for ; Wed, 26 Jul 2023 14:12:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234348AbjGZOMG (ORCPT ); Wed, 26 Jul 2023 10:12:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233756AbjGZOLo (ORCPT ); Wed, 26 Jul 2023 10:11:44 -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 5988746A0 for ; Wed, 26 Jul 2023 07:10:59 -0700 (PDT) Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 46704413C9 for ; Wed, 26 Jul 2023 14:10:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380637; bh=GFNwWvhavDkNrI4eqwez7OWrv+w+Iw1WNhnwQW/Fw7E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Mgrx7z6yozfoTxgYHpGQiGQPM71+PsK2RzMgfb8SNzC7G9O2EttikVb8iicd917Rh FCUDWAlcs3ns7vp9dvC/LsCpMgtC+6KyA7pDL/3VVgrAztkRmeZ84MgGFgpm6H+m+E 0QtHQCzVFgRpe6FlWvnP1fT6MS7+e/11P4fl61pGMuuFrkYobc93DGKZ63KkGyi0OQ Q8hARDkrUJiBpQdGzSkWWp1sHOQUOkHcYJvripPwF6wFk+SKAOwyCVGEgJEMuyTV+s SvElTwRQ6Wu8I+qhRBCSbejshJPMAnC9jsOO5ClCT9cQTuptVr1Hvbxxdm6KBVx+xB TBfwipjVyRfcw== Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-3fbab56aac7so34008135e9.1 for ; Wed, 26 Jul 2023 07:10:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380637; x=1690985437; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GFNwWvhavDkNrI4eqwez7OWrv+w+Iw1WNhnwQW/Fw7E=; b=B0i/yDUiByiWICFnNnkaWyKw7q/13G1KxRln+WqMhCSQxdmdbB7ntDR4BdJhWRLk14 utAwUlh1Kp69FnO135v6OHt4fwqJUruSaqpejTEor3SUbdFZU3Y6m2A3xbm9uvOd19nM TL2X1iil1xgY398yNsi/INLogtRrfrApqu9ZfFL8N6Ym/cUfiXuK4wquvwh65nF2CWMJ EDpuRKdjFEHhtUbcKXtfqbVJtlZfrNOiywRvUWiEHg+LOSoubmfA3SRSlbMnBNPD8UtO 8W0SrPwZCL+b87BzE/Gs2urBUMQkIun7yE9Jh6U1dKDq/BibtgUwQPZu674nxIZUvral 9iQQ== X-Gm-Message-State: ABy/qLa37nNrJQBi0pNHkRHCggYJdf1L/s+HF25yeUwTI5D2pZWgmJHO 1Xcb/DedxDlHqwkfx5fxshDMKEB41PBk5gy0mm4TkL1dzmHga8P5DNb4RDzWBO+cQsnmBX7mAjL nHw20oQJIRiLEEEBMJZYZj71Yw9j4hby8IKHRcbm+wOY= X-Received: by 2002:a05:600c:2299:b0:3fc:1f8:41f1 with SMTP id 25-20020a05600c229900b003fc01f841f1mr1600056wmf.1.1690380636978; Wed, 26 Jul 2023 07:10:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlHkSbP3XBm9fWMpi6nYgn/mk46VMT6r5l6RNjjt4RVJ4wv9+LR91oDtZmjBkGfw247vQ0xNpg== X-Received: by 2002:a05:600c:2299:b0:3fc:1f8:41f1 with SMTP id 25-20020a05600c229900b003fc01f841f1mr1600034wmf.1.1690380636714; Wed, 26 Jul 2023 07:10:36 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-066-182-192.088.066.pools.vodafone-ip.de. [88.66.182.192]) by smtp.gmail.com with ESMTPSA id k14-20020a7bc30e000000b003fc02219081sm2099714wmj.33.2023.07.26.07.10.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:10:36 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Alexander Mikhalitsyn , Alexander Viro , Seth Forshee , linux-kernel@vger.kernel.org Subject: [PATCH v7 01/11] fs: export mnt_idmap_get/mnt_idmap_put Date: Wed, 26 Jul 2023 16:10:16 +0200 Message-Id: <20230726141026.307690-2-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 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:10:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13328126 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 24CACC00528 for ; Wed, 26 Jul 2023 14:12:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234444AbjGZOMS (ORCPT ); Wed, 26 Jul 2023 10:12:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229959AbjGZOLq (ORCPT ); Wed, 26 Jul 2023 10:11:46 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3767B3AAD for ; Wed, 26 Jul 2023 07:11:02 -0700 (PDT) Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.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 7B9D23F078 for ; Wed, 26 Jul 2023 14:10:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380641; bh=1S1U/zjZd3rVIX0g7C71Py6TvgiMco2DPzTIrhllhdU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=k//FCegcf67zTG9QjoC689xkv6pn7qz3P5Nun5u7kQtbE2Gsrq4Dk7dnViCrld+MG Hu40Jv7Cr8ZE5Gm8PTH6llr+8WSQ9HAzuBl3CqU3eH/MOWA8ClMN7QXHWDhWiV3hOv fEYOm3/hWanTcR0BfjVxj5q7LNOJOxkaNU0Js+9VZ3pH9O0HzrWTToiAmcGcPdhlsZ 6jCbI6JeWbgMBqwHN2AT8zRgKgWWx5KkPG3Ymc/bw7+kfAW/FwWCvnEX4wfiglN0hm b3dwTuEs+WQE3C1/OXUCU8t9cnJ+E6khsstBb1XUfpnJrZAAYcDEV0errcpzSy9aSF vKVfWGgyADjvQ== Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-3fd2d331e1eso20264375e9.3 for ; Wed, 26 Jul 2023 07:10:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380639; x=1690985439; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1S1U/zjZd3rVIX0g7C71Py6TvgiMco2DPzTIrhllhdU=; b=blwyw/5gxaHV9WTQe7pxR3T5jkm89OA+XJ/TdKh7ckryHdjvPo+AgMKdJOqyHbg/b2 rp7/2u2oTEhI0jjD8zbnShaoqPZUHoaVx3+ZzORXW9z8Hl5HdAhHHC9F4EPQ43nla8DE W6svC3r7ilk/YkAo/PpyRYY9wXVdkZa+aB89v9gygTeW2jZdGXvWSB7nWFm0W3DTwk16 VeGDGqC1ev5Or666FC0m/S58zG4wE5RDWMRs95WMsuxTxrhMF7ncsW8TxjomwwSvmCyC osMK/mU1chG+Zt8lKW5JTIwSMq6am6Ly9lHnMcYB8jkDodYChbANNxdcKRwXu8Z3CiA7 IwvQ== X-Gm-Message-State: ABy/qLY3y7UpblI0THLVIJ6wfeMBHgbKInsuoUte1eNJglP2aL6O1ykO TV7JbCq84taUyPomsj9NARTbZr0tUvT7LVdhKq/3z+guTeHa/S9dDUo+RTF/eJMYl3UU2YcZIc8 JXzB3msl1VG6idEXzGz0GAwtWZxaEcNrVh4eRb1j9MFA= X-Received: by 2002:a05:600c:244:b0:3fb:cfe8:8d12 with SMTP id 4-20020a05600c024400b003fbcfe88d12mr1446349wmj.14.1690380639079; Wed, 26 Jul 2023 07:10:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlEzgaEB0z3LkeykLLNW2R5US/okV6KXf1+9oX3PnG0NxDJMH5Lmcd+ZcKK0yCyLfcKFYj8P/w== X-Received: by 2002:a05:600c:244:b0:3fb:cfe8:8d12 with SMTP id 4-20020a05600c024400b003fbcfe88d12mr1446334wmj.14.1690380638896; Wed, 26 Jul 2023 07:10:38 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-066-182-192.088.066.pools.vodafone-ip.de. [88.66.182.192]) by smtp.gmail.com with ESMTPSA id k14-20020a7bc30e000000b003fc02219081sm2099714wmj.33.2023.07.26.07.10.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:10:38 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Christian Brauner , Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v7 02/11] ceph: stash idmapping in mdsc request Date: Wed, 26 Jul 2023 16:10:17 +0200 Message-Id: <20230726141026.307690-3-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 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:10:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13328124 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 A5D46C0015E for ; Wed, 26 Jul 2023 14:12:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234376AbjGZOMJ (ORCPT ); Wed, 26 Jul 2023 10:12:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233843AbjGZOLq (ORCPT ); Wed, 26 Jul 2023 10:11:46 -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 242993A89 for ; Wed, 26 Jul 2023 07:11:01 -0700 (PDT) Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 55E3E413C3 for ; Wed, 26 Jul 2023 14:10:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380642; bh=ifNPKcEIq/Tv2vsoKX4zAa3gfholzjGLVEwPWVuZYK8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KnchRmlDTs1KiN/izXGpgRCki/d/1hYblcl7SKJiANjnVNkaNeWnKqqP7ftH0CJlo GXpMn6HRsmRuLdac9ExCAFn4krEElHIGreSpavTWHw5P1GQ326qN/b5viv6QWw9ihH o26T2xiduW5YwjSQmwiOj3oBtMBWXUEP8SXtiEXwsUp+v7HHRNwxk7vJel25N0IJeQ gNC48NxT020tXd78XQ1mVRXm0KFcr2zflKYwp99/uYWNpImXII+8DQothBJraJgTO9 eWZOTciV/1nkRJfa0UsMII6s8QZjA0L98tgxuearAXrg4BE99X0I5mT3pISlHyA40x pEAlD/pc/XoNA== Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-4fdf1798575so3555085e87.2 for ; Wed, 26 Jul 2023 07:10:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380641; x=1690985441; 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=jSmOdUgmvazMw4gOmrTIBChb1rlO8IPqGthh0O1qEKwCETohVHlH66XmOHQeyH4FsR iYrKRlznrY6nhY5+XW48oI0tUrHvo0lmavAUhtplcu/Jxg2NISawNzfvXuO9L3rqg/E5 MAa4tf7BIgdG/bVfc2uIEEUed6mTbnc9EIg26iXx5XiR/r5B7ZkzJiGy0NWOkyGm7cA4 C+icNOwl3RkANj52EQ4uuJpiyUCBY/KH0HKj+GEe5/Y8Pe0cWF+crbiStbIyy1tq37kr 0h5DXG2Py8+zypSFseU3aRo6S+V7l+9Nob4ZW8Kx9bfOJJ60cxao0ELg8E8Il6fSRl/W DwIQ== X-Gm-Message-State: ABy/qLYflIkkj+lsG+BAuWqTpWb5dtgoKfGEO7b0lLYO3OOvgOSccaDE Kz5JbNRglT1PM/Ak1iVSrhEXqx2T+Lr7n6fvbbmhqStJwq3LR6dM2GDhy4yhbMpvSBy5TDymiCc uyPlrs13BEtfC8eDA9/XvbFoBEJW+9tG5fFUaVjdsPVg= X-Received: by 2002:a19:500b:0:b0:4f8:78c9:4f00 with SMTP id e11-20020a19500b000000b004f878c94f00mr1362283lfb.20.1690380641773; Wed, 26 Jul 2023 07:10:41 -0700 (PDT) X-Google-Smtp-Source: APBJJlHOsfN9DOURtgnEN8jItCQbVwugH0zAkEFJPg2kq1n8HBsvjAAyJy3680KdLeYMx4tcM1GxEA== X-Received: by 2002:a19:500b:0:b0:4f8:78c9:4f00 with SMTP id e11-20020a19500b000000b004f878c94f00mr1362257lfb.20.1690380641324; Wed, 26 Jul 2023 07:10:41 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-066-182-192.088.066.pools.vodafone-ip.de. [88.66.182.192]) by smtp.gmail.com with ESMTPSA id k14-20020a7bc30e000000b003fc02219081sm2099714wmj.33.2023.07.26.07.10.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:10:40 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Alexander Mikhalitsyn , Christian Brauner , linux-kernel@vger.kernel.org Subject: [PATCH v7 03/11] ceph: handle idmapped mounts in create_request_message() Date: Wed, 26 Jul 2023 16:10:18 +0200 Message-Id: <20230726141026.307690-4-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 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:10:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13328128 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 86B4AC001DC for ; Wed, 26 Jul 2023 14:12:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232885AbjGZOMd (ORCPT ); Wed, 26 Jul 2023 10:12:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233039AbjGZOL5 (ORCPT ); Wed, 26 Jul 2023 10:11:57 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB1DC3C10 for ; Wed, 26 Jul 2023 07:11:19 -0700 (PDT) Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id E006940821 for ; Wed, 26 Jul 2023 14:10:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380651; bh=2wRsV5VoJJC+a/Nnh0k6h5YuKsT02FRfB/wC7z4rT6w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gHAO2qLRJ1GqQqXuFhKhEB9NlTY0x0uRAek5YoVEyJb7ntGRfuCnMV0n0ZD4QSVQT Cla+hmCcVN45ZZ3yvag8qCdS785zL62XK/TRGsUsFUxTPazVd8zgT0NiCvgyIkBb3Q q15NHsuSYhkPy2unGXSaBH20u6n6U5xqnKK0c1NSvp8GYoQFND6+U3OHtOwmrXA1f6 /GxHWSHMFvbebaxUmpqITSmnM1LJCEJtF8dj1kncJu0OImI4UT89iENhUsZLIu4x2T eaLMOE70qRymYmj8jeLfDK8OmwD73RwdYaASTIfzvMYzNN6m9N+c/SLMJzmW/qxYI9 bGx8ign7BA+Pg== Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2b9bb2d0b1bso4086721fa.0 for ; Wed, 26 Jul 2023 07:10:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380643; x=1690985443; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2wRsV5VoJJC+a/Nnh0k6h5YuKsT02FRfB/wC7z4rT6w=; b=KqEh8MrRdeuvGAOUP5QBOl8LsqenTBNcijEP5FpC6DcrKJYo95KmM2Pc+xdaIAHPVS AGfdl2953U0EizDJkqGTS12MSDAH9yCGjACGzUBqaL98Wu/68w/F/0XMOURFkNQaW6RD ay6DFI6NYA47YgpQQYNlhQDAhIiCapygOSqNm9kOZdtjsE6EdbQWPDlLu9RFN04nxED+ P8xkEwxUV5QdSQ0gwGcOJFds44QPzkLFmbPOgXiCtskMZJbRlXK41Nrw9pdG+GIl5rGy zwJhoGgQVZXqKmw7o2PlK2HSaiLn4MYPaLOotkwD4iUVhVJzqGk/fN1Q0ye6jR2t6L6w beyQ== X-Gm-Message-State: ABy/qLZ2Ne1i2w4GY7Pp/JFDEqiLrW2b868kVTnGjDru9el5O6Xm4aE6 WCBHW57/GdQ29VyXTSmMEM8I64dtFdcdH2m/nXjGVrdSebh5PmyFm/ibZHpEuNrxTp1fPwaJ7wk P5PpDSQ0tvpFmCeyXh82Fuoe802R/lJGkzjd/YOeRHTkQHizTCY8= X-Received: by 2002:a2e:984b:0:b0:2b6:decf:5cbd with SMTP id e11-20020a2e984b000000b002b6decf5cbdmr1578250ljj.36.1690380643776; Wed, 26 Jul 2023 07:10:43 -0700 (PDT) X-Google-Smtp-Source: APBJJlFzfOvSVHgN1R2U97B5NMYqDDnWYxKIdEobLA7c0AI/5Ct5RedFqzwWPJru7Kk1HPoq0AB4Rg== X-Received: by 2002:a2e:984b:0:b0:2b6:decf:5cbd with SMTP id e11-20020a2e984b000000b002b6decf5cbdmr1578241ljj.36.1690380643620; Wed, 26 Jul 2023 07:10:43 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-066-182-192.088.066.pools.vodafone-ip.de. [88.66.182.192]) by smtp.gmail.com with ESMTPSA id k14-20020a7bc30e000000b003fc02219081sm2099714wmj.33.2023.07.26.07.10.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:10:43 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Christian Brauner , Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v7 04/11] ceph: pass an idmapping to mknod/symlink/mkdir Date: Wed, 26 Jul 2023 16:10:19 +0200 Message-Id: <20230726141026.307690-5-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 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:10:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13328127 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 0960BC001B0 for ; Wed, 26 Jul 2023 14:12:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233580AbjGZOMY (ORCPT ); Wed, 26 Jul 2023 10:12:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232594AbjGZOLz (ORCPT ); Wed, 26 Jul 2023 10:11:55 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B37513C0C for ; Wed, 26 Jul 2023 07:11:19 -0700 (PDT) Received: from mail-lj1-f199.google.com (mail-lj1-f199.google.com [209.85.208.199]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 3946042476 for ; Wed, 26 Jul 2023 14:10:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380651; bh=ohgjgBD3cKcnIyJjD+KXey+VVqMnSRq4bkvBBBDC3os=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=njUYy2BKrX7GRjJ8+ItwOGZqi+B0RJYA85xz1oEW1Ik/5FczinJI6pFknjzVp8TZ2 ocRTdn9qxYcA0oDWDLW3ratUwRMWxiiQQdub7lhebiJDRAcs0tAdbsN9B9BfWTBxnn N+FRZB4oVkCCKEGORRZh8JyNnuFtotJISvjruRbb5QAkYnfETPk2FUuRir+LhLDOlP Z3FSCF3UKE5YhkybQHrSrrmIqgT8r4Q6xlSyHtWHqVQJU8FKIiYfGTwSjh0+XOgwIn b7AKyRpw9QaA8v+zywXDoGg4IR5Yfc8OGp7z7k++m9H1qzuDM4uav4ef6Dy9KuZCFI 2Xb5gGppNBUnQ== Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2b9aa4db031so19708891fa.3 for ; Wed, 26 Jul 2023 07:10:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380646; x=1690985446; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ohgjgBD3cKcnIyJjD+KXey+VVqMnSRq4bkvBBBDC3os=; b=jdyGyIqVLVKlfI3SoShT+1R8Trs+RFFCci0zgfNdlPqb+jWYzv4yJdCEAE0rp6x2jL Z2I8VTPZaf3dj/ATd5uqWmOyAQF+ZLzu2Y9HFHylTeCxwak25M3F7p/sCPzZWrvhjl4o NElXWLog0liaQfDBVQ92mANaTMpQ2/Q+LG2bmvSq7iGqVBz0XHdIuckKpJ6hEeFsmuhR ZvajLGf2aCaGIrqm1Mn4rpcue8i3gC+KMSdcDW+Kz82sdK/cv5fZKT+0rKIbSYyHBCbX UySSvXXVtEvm/YjLlH1gJqCJieupC2e3YaZhzrpG62qEhjGvSMA4cXytpITlmoxO8kEl +TqQ== X-Gm-Message-State: ABy/qLZAM6tJnkSPLZi6ExvIgQPV1A0x1xTU4lGfh7jufVxcjP7+3DLi Ef0WyLz1WaB39Hi86QfR/p8+nwy1b+PQ3OtdIvczk1UAldHteQi6i5FKiJwBNaSag5tKZ444U+h ldFVKDMGSBaSpd1h+NwETGxFNVO4uJ5pBCSEp+bbWvKI= X-Received: by 2002:a2e:b04c:0:b0:2b6:e292:85ab with SMTP id d12-20020a2eb04c000000b002b6e29285abmr1537994ljl.25.1690380645932; Wed, 26 Jul 2023 07:10:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlHjzzs2yes8HeiVNPDXX4N2hJrs8Ktc9SJJ6ywzY4b/f8BHmmRmZgH59CuUg0VsaN9+mCvkrA== X-Received: by 2002:a2e:b04c:0:b0:2b6:e292:85ab with SMTP id d12-20020a2eb04c000000b002b6e29285abmr1537979ljl.25.1690380645680; Wed, 26 Jul 2023 07:10:45 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-066-182-192.088.066.pools.vodafone-ip.de. [88.66.182.192]) by smtp.gmail.com with ESMTPSA id k14-20020a7bc30e000000b003fc02219081sm2099714wmj.33.2023.07.26.07.10.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:10:45 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Christian Brauner , Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v7 05/11] ceph: allow idmapped getattr inode op Date: Wed, 26 Jul 2023 16:10:20 +0200 Message-Id: <20230726141026.307690-6-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 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:10:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13328129 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 5322AC41513 for ; Wed, 26 Jul 2023 14:12:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234462AbjGZOMa (ORCPT ); Wed, 26 Jul 2023 10:12:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232640AbjGZOL4 (ORCPT ); Wed, 26 Jul 2023 10:11: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 67DF73C0A for ; Wed, 26 Jul 2023 07:11:19 -0700 (PDT) Received: from mail-lj1-f199.google.com (mail-lj1-f199.google.com [209.85.208.199]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id B91BB42478 for ; Wed, 26 Jul 2023 14:10:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380651; bh=Srcpafr6A4NJGaRIaUNnfkHMnBPsuuDlnOMtOvEnSSA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=U8V11imsGxfiCZwru6xJ48C6eDW1/YSEvKCitfGf79x+ICXFL1TbKBJJ2me/kMeTl oZ9mwPzEBxAeSzA+nkk+Q6SbX4hT+iCIG51SHD5oaGOEUoEEWtsEnA610OzpiJEje1 QHS186tIRHIvh2DPqYakl7nfCQFTDkEFNBLgiqtiCSt+QNkZvZmQVHgcgq6CnCT+OX egULFhquftgUTa9CIOwKai6jFRd1eSmnzfLGPaH9NGK4CMx+payjAC0rSXvm+NrBiL 5JHQTeLOEqk6GmKzvX4KK2IcUqIkGW9rbbtvTyf3rbhnVHP5g1qrjaYKd3fAIvH1MM WfAdtQupuraPQ== Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2b70c44b5fdso64071991fa.1 for ; Wed, 26 Jul 2023 07:10:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380648; x=1690985448; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Srcpafr6A4NJGaRIaUNnfkHMnBPsuuDlnOMtOvEnSSA=; b=c/KYvwlTtnRqbBAbg67ptFQP66fWXX4Gb3cglQ2aBLvAU9PWO6RcKVYMbhLQsRooMA Zl8RXaujheGS7x+3/sNOD+gGZ7JAGM8+8IWJytqRnj+dtLrI6foleXk7qrm3KCM+QQBq 2fA1UUrVXbKMunyw4nStevpDIND1VEq8ROef5XZk9NPSLkvUHAIYS/t9ZEWRFuVP2oO3 GMbLA1FDusQrjqHHs8jwzh/VufXNe2XwW/gAkhXzkSHx+jo+vnOd390jtn1kiIXkDhWn PVGRp7/iwnAmwKq3wFVfx5pmfttpNIT18iYs26DUWlLashH/kXUVBnW2TJVuctqS18/9 hH+Q== X-Gm-Message-State: ABy/qLbfzFxdnXEFrifxZ0nHLE/MXiq2fTB6yHRx7uuHm04VOifjXsbs W3EQVhgZRmFGJ7kKV6RQiEWzvRtuVFbbfXTdW7X3P923hQ3U10arIdCgjUapSpLswmOQX+AjASJ SxeDqjt4LvH5GNQqAhZpJmIOKFZOSeVsdxUDspx+TBvw= X-Received: by 2002:a2e:86d7:0:b0:2b6:a7dd:e22 with SMTP id n23-20020a2e86d7000000b002b6a7dd0e22mr1518815ljj.48.1690380647892; Wed, 26 Jul 2023 07:10:47 -0700 (PDT) X-Google-Smtp-Source: APBJJlGpYu9WEgj2snc3ZtgSt1ExxcGBa/VYSWFcXye2JQbmsYlosKcGQTknjlNkzD2mlntMHE7P5A== X-Received: by 2002:a2e:86d7:0:b0:2b6:a7dd:e22 with SMTP id n23-20020a2e86d7000000b002b6a7dd0e22mr1518793ljj.48.1690380647707; Wed, 26 Jul 2023 07:10:47 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-066-182-192.088.066.pools.vodafone-ip.de. [88.66.182.192]) by smtp.gmail.com with ESMTPSA id k14-20020a7bc30e000000b003fc02219081sm2099714wmj.33.2023.07.26.07.10.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:10:47 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Christian Brauner , Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v7 06/11] ceph: allow idmapped permission inode op Date: Wed, 26 Jul 2023 16:10:21 +0200 Message-Id: <20230726141026.307690-7-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 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:10:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13328131 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 39E0EC0015E for ; Wed, 26 Jul 2023 14:12:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233997AbjGZOMs (ORCPT ); Wed, 26 Jul 2023 10:12:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233567AbjGZOL5 (ORCPT ); Wed, 26 Jul 2023 10:11:57 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB0423C0F for ; Wed, 26 Jul 2023 07:11:19 -0700 (PDT) Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.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 EE81142419 for ; Wed, 26 Jul 2023 14:10:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380654; bh=nLZMqtT0BTuD0r3ld9T+VcVOIz8LP+RVDN6gyhT7tPs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=djrM7BUOB5QN8syjbKZkb7GeZo7d0coGbLOVwG0furKKiUUYF+Y4gsCfig7cABDwe 2DhZIMLAhpJ0hibGnz2aaOmSed7ojA1R9PEJTnDDzQVWBt3xPAhNdlWfTyV+h3pq8e t7dclQsUy/aWdzBHp/ngplKkkqBTsRYJ8CdfPSPYV/zyT81mfUs2h2Ej7Qyuz4odOH TTEXUU9LIXNgG6OBIx8wC7UrEeWw5nrTUaLLwXyIYclhAfNOjAk0Q5UHBIFEc0R8Mz 4hs+o1zKPVLfuUt58TrzHSEqknHJ6ZsK4TLxS4GLLr148NHpFTXv27fU0x0PRbxR7c YypvQc7mjH4LQ== Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-3fc08035926so5446175e9.0 for ; Wed, 26 Jul 2023 07:10:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380650; x=1690985450; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nLZMqtT0BTuD0r3ld9T+VcVOIz8LP+RVDN6gyhT7tPs=; b=IgHOolW3C2kaAB2IzFU0/lBfG3AdFyLeN4A91LYaylK8qvJQRGNzCsJq+x/fSBLUyI 1a+2fdgZjhD1rWz+iORm0Sd83yfcyDk8qxfOk2xDZNxCqFp8VBvvItE1YQ7M+UFSSh82 NBcyuoMEPWaCTv4e11AFVHOSu4rQGwXqmnqvIWGQcilO5fbdnhJWGFtbjhbo0WHabHUp EaOWYgDOu+hf+4qWBw9XsXOvjGUtRvGUHlLXTXNmL9+56g1WtjnAnzUkwGm+WzUQxp3s lQ1inR+zG3aWa4sJuU6izLhdMy6aanKxefWC+dGh0t04aW+uJoCX/ru+VZLLKNL924U4 4SsA== X-Gm-Message-State: ABy/qLbawFrExiV8Hxhcrvku0IjhmXn2mAO3jMqAx2NYN7N43raT173q +UseA+jJQZES1C5wSPBcgVoDfkSpciDmvVF3L3oCE3087oaPLzatIgtyKRGEI4JZ1UemrUeB4xB UCECsDr00+T8FuVNOoGxhvBbUDZyiLimAv5Ye0t36K64= X-Received: by 2002:a05:600c:5187:b0:3fa:821e:1fb5 with SMTP id fa7-20020a05600c518700b003fa821e1fb5mr5126471wmb.5.1690380650030; Wed, 26 Jul 2023 07:10:50 -0700 (PDT) X-Google-Smtp-Source: APBJJlH3vgh1vilw9HPtXuiXsfkEOE9dbE0ckzneQHHB2BWQmWcFwMl6ymv0AAvGdaSctcqacjEDiA== X-Received: by 2002:a05:600c:5187:b0:3fa:821e:1fb5 with SMTP id fa7-20020a05600c518700b003fa821e1fb5mr5126454wmb.5.1690380649765; Wed, 26 Jul 2023 07:10:49 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-066-182-192.088.066.pools.vodafone-ip.de. [88.66.182.192]) by smtp.gmail.com with ESMTPSA id k14-20020a7bc30e000000b003fc02219081sm2099714wmj.33.2023.07.26.07.10.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:10:49 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v7 07/11] ceph: pass idmap to __ceph_setattr Date: Wed, 26 Jul 2023 16:10:22 +0200 Message-Id: <20230726141026.307690-8-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 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:10:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13328130 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 A1266C001DC for ; Wed, 26 Jul 2023 14:12:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234477AbjGZOMq (ORCPT ); Wed, 26 Jul 2023 10:12:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232432AbjGZOL5 (ORCPT ); Wed, 26 Jul 2023 10:11:57 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3774C3C11 for ; Wed, 26 Jul 2023 07:11:20 -0700 (PDT) Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.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 089BC4246E for ; Wed, 26 Jul 2023 14:10:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380655; bh=5Jek2ao2Gg23mz8Y2ufU3Ts9QQq34R72Sad2dO2kfLI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Huw+yv96Q6JnUXQUHGSgOuuUwJu0mXq2UHfgU2SpUvA+5QrXdUHTwtzhTJ8wZsdRq t6FE4aa8kil3d5Clce6Cwpljm6fncxn+4CdZ/ci2YeMrPZLYdP2aiIQJ9djntqZjZl s6JXA/9FyJeTO0ORIBTI3As4eVpvamYCNt27JPVAWZ+ac2Qm+L020757LvbThTc2tt uXeSJcR4VT783Zde79w3RHiJluz3iPgezRIAfLkMv+U1bpAaph8RWUWbCkV87A5BRP t7vPkl6jU683jNz61vtdudloWbbtepHJKDVeI2PBEEs/et1UQ5f5ANYFEnRO6RIfwS E2rgmaJHac1Xw== Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-3fc00d7d62cso40675225e9.2 for ; Wed, 26 Jul 2023 07:10:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380652; x=1690985452; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5Jek2ao2Gg23mz8Y2ufU3Ts9QQq34R72Sad2dO2kfLI=; b=lF9CDSTOWvoNxwCd1KkRJy/hjYEQp7qwDFs5/2xLHwg1ewB22g0OHkrLd/Qszf1zsq G8eCnyDUegdoKYHbSQEGcC8KDhBeB6CxpBKYv+0GPeuJH8we1Nzl3NPyKXaA4EPseRDB oWQpnDmC/tGqgIwdA80eckev23uvC6IZJnvZqfgwaz54bY0HDwGqu0lvv7B375m8otYG 2UgA5vbx42myZnXdDybL31Uj2dBsMqkmlPdxlAps9w3U+wYOSQ4B2sKKCBmi6oYsoVeU lEfxc2zdaWUc4kSERrfv+vzDQsIzturpYCeE1zATD3mO/kSwMvTN8c6ULzS1gcu0W/fB 3jug== X-Gm-Message-State: ABy/qLZ4YFiK3g7l6ajdhz0oi3+i2eg1VaWh0Zgymr0ylXhHuh4TCWGi 98WH2atacXHDgYAMOlSKLDxqliytyvwOj9/KvGZiRv5SBxng+C/BbDGdJNIaTvLxswMmh++oyxw UyaxGZcBVDs3Wux7QnMUt0gMEIOh59o4oSyecunl9D+o= X-Received: by 2002:a7b:c319:0:b0:3fb:e206:ca5f with SMTP id k25-20020a7bc319000000b003fbe206ca5fmr1487594wmj.31.1690380652184; Wed, 26 Jul 2023 07:10:52 -0700 (PDT) X-Google-Smtp-Source: APBJJlEWv48lMUMQK7iTGEt9eWMLDMsQrSzRq0Pw33rkJh6iPkIcCj2xr9B5VzgjaUxTd/K5dKo2qA== X-Received: by 2002:a7b:c319:0:b0:3fb:e206:ca5f with SMTP id k25-20020a7bc319000000b003fbe206ca5fmr1487585wmj.31.1690380651969; Wed, 26 Jul 2023 07:10:51 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-066-182-192.088.066.pools.vodafone-ip.de. [88.66.182.192]) by smtp.gmail.com with ESMTPSA id k14-20020a7bc30e000000b003fc02219081sm2099714wmj.33.2023.07.26.07.10.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:10:51 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Christian Brauner , Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v7 08/11] ceph: allow idmapped setattr inode op Date: Wed, 26 Jul 2023 16:10:23 +0200 Message-Id: <20230726141026.307690-9-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 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:10:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13328132 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 3767DC41513 for ; Wed, 26 Jul 2023 14:13:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231673AbjGZONb (ORCPT ); Wed, 26 Jul 2023 10:13:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233017AbjGZOL6 (ORCPT ); Wed, 26 Jul 2023 10:11:58 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CFED2D49 for ; Wed, 26 Jul 2023 07:11:26 -0700 (PDT) Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.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 836874248D for ; Wed, 26 Jul 2023 14:10:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380656; bh=btgWKV3yveDSttvNeYwkzRRCd2/ECqsGtpVUjkBAwbI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uAOe9cWOwyPlPHwU1H0t+UP8PZvb9DTaJgtm960Hqw9sXWdMXckjC3WuDJ/qOecxS eNyhXDra92D0XskH3GvQ4g3Mi5NecJZ4uR2dRKHtfQ5UTWaJ+9AvVjGzv2y5Z355mb Bj2RQhYAxEzPmCrovKwUdPGANQivOEnSodj6dcH129pCIfJR8pUmV2NRKJJMxUEF7Q 1BOCA/lyYEKnN33SHpH7Vdt6tuUE0zZfG55jLHCYIuuSOd04G2n0D0rybHbMCoUYAc CuV81/2ZBMcTNk9/DS11KYaMZ/IptXy49MKaWjqNX23LQ0oUtlS+6Zf0xcEBz35H2+ 0slDNnrnG0+0w== Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-3fc08d6a40cso34050955e9.0 for ; Wed, 26 Jul 2023 07:10:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380655; x=1690985455; 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=GlRF0+Ye0c51yjwmcglFMwPN4r8/MsYiIa0ujOkggDOrrOikh52cAzMpxSGAWteHLN /NQGC9f/v+53UOhr2FSuUwzBt13PiN194ioSfBzWYuQeratPMJU7aX634KTzyUWl7qnb CCw9d/yQh+GGvsdXcm4XbmowkoE0HtlWPOjbcwBjAuSDMZbGHpsx2MzmDJ9H8cIvtt9p A6vivRq8R8Q/W2rgOq9lSOP73/7YPLDy501Kx9Er5BVo1rz43tU9XZKJKFREv7gj4bRS NQTNoNF/zlNzz9AlZTWRouXNFN/Vy7WXX7ZVJfWmbJKLGU3BqhA0P9+aMkTy6tzKl89O 8SyA== X-Gm-Message-State: ABy/qLZm7soiOQFoXt5SmcFHXTcLPcGwtuuCoefiHNIfRR9vJH3ikgRv YNcb5DvHOFvR5VS+LcLvqQE/D4G4sreToCv5WsEq4RwKXRfHzcdzgYKEJ91omzK2Kp6jEkUDtDT TIHHLYWfnAIErOQosIYEB70xruUJhTXSV+TO5C3AldbY= X-Received: by 2002:a1c:f30b:0:b0:3fa:9823:407 with SMTP id q11-20020a1cf30b000000b003fa98230407mr1492371wmq.18.1690380654469; Wed, 26 Jul 2023 07:10:54 -0700 (PDT) X-Google-Smtp-Source: APBJJlH0kgNfDOvl4L/e4bgCJhjnwtHxj/EJz2PT0QwAgmPUSl/Z/j/8mmxYQlHnk4PjjNZchfPvDw== X-Received: by 2002:a1c:f30b:0:b0:3fa:9823:407 with SMTP id q11-20020a1cf30b000000b003fa98230407mr1492359wmq.18.1690380654250; Wed, 26 Jul 2023 07:10:54 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-066-182-192.088.066.pools.vodafone-ip.de. [88.66.182.192]) by smtp.gmail.com with ESMTPSA id k14-20020a7bc30e000000b003fc02219081sm2099714wmj.33.2023.07.26.07.10.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:10:53 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Christian Brauner , Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v7 09/11] ceph/acl: allow idmapped set_acl inode op Date: Wed, 26 Jul 2023 16:10:24 +0200 Message-Id: <20230726141026.307690-10-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 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:10:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13328125 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 66021C001DF for ; Wed, 26 Jul 2023 14:12:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234441AbjGZOMP (ORCPT ); Wed, 26 Jul 2023 10:12:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232046AbjGZOLv (ORCPT ); Wed, 26 Jul 2023 10:11:51 -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 99B783C07 for ; Wed, 26 Jul 2023 07:11:18 -0700 (PDT) Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id F2A73413BF for ; Wed, 26 Jul 2023 14:10:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380656; bh=dyH4eLS/ZCdAMtA+4CRaXqW6UBtXDh7SsBX0oiAwXGM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Mz+nf9sqKWkRXDp9lDJT70LGL9iZNLWkOvfqiR1FwZPvLcR1xS+joOj7xBK/VRxlB A3f+U56vhJM+UqEXPQ55f/ZjkBZIoaEErVj1kere2vF21Al60uB6DKpT/Zd8kuioPN zZsYxzaISRb3/e8BL9C289bU5sToTJvMDChIlWV5XIQwJZ9o2/z64MPIoQ9WFmXzkY yZ3IJUWXMAwfqXmiipYyhOpvs0a5z0rdLHQppGptNemoZMcAF6RiK9mMVxgywJJQqT 7pMHAPtlr+qrN6exX5aIO4noMQ8IkOns0ItLXtbtorj6aIpJrsiX2tojhbQTGvJ84P 5pGDcRoO14Psg== Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-3fbe590234aso40283385e9.1 for ; Wed, 26 Jul 2023 07:10:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380656; x=1690985456; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dyH4eLS/ZCdAMtA+4CRaXqW6UBtXDh7SsBX0oiAwXGM=; b=YFzHZ0TloKDyQkDnrXvWe1UrwpXlP3gUfsC7XYzaBhXrc2epJsPe7UJGBbz6JLDjaH zFRyG5DRtproVxoKIt+K6B92OShLXQdCFNWu/eXRKSsZYlP/rX4EQF7JcgwYhSjuAWa8 XMG5HShhv8rTUsge775ZBYdwPCNyzKtq/LexOrjvy3XCbve2fN9N+WBKiuuWaRiyjzeH 5BwmvSgntrXJOxZiOfUIut6UWl4E7S9gHBIiRU/PirmUeipgUKl+YWjG6WfZOwI4bgMe vof9Ndx9dY4gw5d59sQ7qolCj1kVNlIUp/qEH9jGea9fq8N0uxS1x4z12j5qnUVi3EN+ 7qUw== X-Gm-Message-State: ABy/qLaqpGO6nMkS6GXhAFz+mYlZsyLkxSlZegKbKeRTcqVXK84r1Vep I8QM+EFcyFZGK2MrCBJIauHtLlBwrGrLIzaiWPsQs87FEDhoP7dZSLbvL/r5Wxae9ltVGpPzJyi wKetrzx8wvPowJQSTYyGXKCBzM9odpHb2sSeC22e8x6w= X-Received: by 2002:a7b:c3d9:0:b0:3fc:855:db42 with SMTP id t25-20020a7bc3d9000000b003fc0855db42mr1517997wmj.34.1690380656674; Wed, 26 Jul 2023 07:10:56 -0700 (PDT) X-Google-Smtp-Source: APBJJlH7igXsZCdDZ+9aNp4I+OUG6/RPWtxjCijXvhNNhLiLg/iak67y70pTTfQ0BN6X+GC66gvhgQ== X-Received: by 2002:a7b:c3d9:0:b0:3fc:855:db42 with SMTP id t25-20020a7bc3d9000000b003fc0855db42mr1517986wmj.34.1690380656489; Wed, 26 Jul 2023 07:10:56 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-066-182-192.088.066.pools.vodafone-ip.de. [88.66.182.192]) by smtp.gmail.com with ESMTPSA id k14-20020a7bc30e000000b003fc02219081sm2099714wmj.33.2023.07.26.07.10.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:10:56 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Christian Brauner , Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v7 10/11] ceph/file: allow idmapped atomic_open inode op Date: Wed, 26 Jul 2023 16:10:25 +0200 Message-Id: <20230726141026.307690-11-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 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:10:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13328133 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 CF46BC0015E for ; Wed, 26 Jul 2023 14:13:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232838AbjGZONc (ORCPT ); Wed, 26 Jul 2023 10:13:32 -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 S233373AbjGZOL7 (ORCPT ); Wed, 26 Jul 2023 10:11:59 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D961211F for ; Wed, 26 Jul 2023 07:11:26 -0700 (PDT) Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id F360B42477 for ; Wed, 26 Jul 2023 14:11:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1690380660; bh=V+geJeK43HRcagd4RPosGF8b069CSl1zVYPfJFF5DgU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NgqCGWkwlYWKRiG0nASc3s2hGyUolQ4i/wDuOGS0osHsb3D6dJHd+W617mJZiiOKT iTIZ4UdMdympZm0ggFUt+4R+gPmopYwBsXQEetUuj2y8PlsYdEtpn5nayAh4fXvtVP Z4HPBCIoZsDmd2n4yM7x8nwN/W36iUEMyeoOCisns2P31FcM1RrZWDBGCaiJN/rAdq sgC0xPYRIMx4EZ13wf8RgoASqkY4wgQmocB2jmhf4MyHXSPWfuoOflYqZcn8YBbcl3 9yIDgshV5maAfp537YkmS135iR2Xz1DOA5taXBgm9CHHT8bj+Vl7y8EZIrbP9JQz1J BqyirWWlknxbQ== Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-3fa9a282fffso34340625e9.1 for ; Wed, 26 Jul 2023 07:11:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690380659; x=1690985459; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=V+geJeK43HRcagd4RPosGF8b069CSl1zVYPfJFF5DgU=; b=CWoksmLHFWpywGU+uN/743Cv61N1R6TN/pH1UCRRIN/0vmK9ujacDNs6W62DCBKkCQ L7RTXYrfIayICF8ah8w/UxZDpU07dm1qfFZKO1LXLtLBWWyRAzzjbxe21Gjo+thz3Ptk Gy3X568c9+MC3PAEnB6m5pG7yjgqedJPNTMXUdFMcoQu0lMrjlsvZtritlkDbFhBE2uV CAf4SPxpUcWPPYhE/xlUcF390FV2C9yHN1Ohm64L/jzq1fB/8qY2uCPrvarPNLRyFchc gcS9ysNAF4zvDkZBrRKrcPI0tmvMhV34gm1SYz5HyHtZ1coNU4ZNk4eDlqEqMlG7XSHC Th2Q== X-Gm-Message-State: ABy/qLY8kolrBmFmVrQa4ayU7wng/XV04NMBtgrxpu7xDeKrhRm2N0G5 MwuIp9Euf4YupN2ZOUUK0dxcnMRmLO5rsyqN3l4GmwKIBoH1LkBdPsM0V4SAqcS6ke0/1IaX8jp hZmPHx+2HYKAxUgdy83pU/Ly8N7hC1lUX6xdaV9Cu+CY= X-Received: by 2002:a1c:cc08:0:b0:3fb:dbd0:a7ea with SMTP id h8-20020a1ccc08000000b003fbdbd0a7eamr1439457wmb.37.1690380658871; Wed, 26 Jul 2023 07:10:58 -0700 (PDT) X-Google-Smtp-Source: APBJJlEIWQs4zQ3W3/YfffTF9QwaQh3tob3Vdd0DEnPyLt818r49Fpkk08smHP7Awq3GxxXYqPpH8A== X-Received: by 2002:a1c:cc08:0:b0:3fb:dbd0:a7ea with SMTP id h8-20020a1ccc08000000b003fbdbd0a7eamr1439440wmb.37.1690380658568; Wed, 26 Jul 2023 07:10:58 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-066-182-192.088.066.pools.vodafone-ip.de. [88.66.182.192]) by smtp.gmail.com with ESMTPSA id k14-20020a7bc30e000000b003fc02219081sm2099714wmj.33.2023.07.26.07.10.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 07:10:58 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Christian Brauner , Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v7 11/11] ceph: allow idmapped mounts Date: Wed, 26 Jul 2023 16:10:26 +0200 Message-Id: <20230726141026.307690-12-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> References: <20230726141026.307690-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 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");