From patchwork Wed Jun 7 18:09:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13271056 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 D0A00C7EE25 for ; Wed, 7 Jun 2023 18:10:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231449AbjFGSKn (ORCPT ); Wed, 7 Jun 2023 14:10:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232506AbjFGSKj (ORCPT ); Wed, 7 Jun 2023 14:10:39 -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 54FB0E46 for ; Wed, 7 Jun 2023 11:10:37 -0700 (PDT) Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id C1DDD3F15E for ; Wed, 7 Jun 2023 18:10:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686161434; bh=GFNwWvhavDkNrI4eqwez7OWrv+w+Iw1WNhnwQW/Fw7E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=V4RoLqLpvWvRyWgMExg463FdE3RI+uBASD38HHg6uwrA7ZOgY4+k2MKMtWkoFM7jN cSkLtK3ODl8CWpP4Mr3QXzoU5z+/nVym7KPavg71pBWIfj8lFwZPd5H6dz+tg1+2vU wTqB5M4H3VMeX6CVOicdGZytrlqmSffbXUmM0YpHJRNU7mzNxIDR+RMVezGdG6fIJg 3k+7Jnppkxl/h1Du8fmHsDE050x4N2bn5THvM7IuL3Duk2dr/mzzNR9xxQSsSDJD/6 1SBmjN2LRWrP1HSV8vn6dmoggqtEEJEuTLoBIjX1/8LXnOEK7yHRrqJPCMgnVW+ocl EeCz2ypbdKCTA== Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-977d4b0d9e3so333719466b.0 for ; Wed, 07 Jun 2023 11:10:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686161432; x=1688753432; 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=Ub0htR/+vWKAqnYxIJrP7z7q4Lc2ViZTvto9MieRPWL0TGJzf5kv2GJV6IUHPytPJa aIF6LH9sMCW3MlduyR6vhdaZfJqyiEQ22MxDdoZMlBtl6yMA/lts4Wk5KlztarDLgTXf ub1ynPXGOYVVeECjj96VP4Rag+qCoirsN3BNimjyXfCJuLqHZGn5UE6tnNIPTYAmnewH x7/H2VzN/JckHa5P+NyZyKsnZtKpyEhUEkS6PjhU9x79ge9r0aIOSkqJGkg/m3KwhCSW n23mCOQDXayjoNI+2HUrPTtyUAR+Yj1FBzTM3UfLLhp4LpruVzC6PMNkyW5BLqpfbc7d hIHw== X-Gm-Message-State: AC+VfDyjYRkkfF5xyRTyx4d1HdMa2w9rP0R9xYt7r7dpS9/RZIxhvl5A PTWIFoGcsC0DPUUIQKm6qSRPBQMsyBDo3d7VK5C/oONwqlqOcwUCZ0MY5zGzxSUCCZAPLP6ys1A ZQZEWcpOgYDonSxsZxdObuHtmAL3xoswuLV8gj/eZLVs= X-Received: by 2002:a17:907:7288:b0:978:780e:4520 with SMTP id dt8-20020a170907728800b00978780e4520mr4046875ejc.20.1686161432028; Wed, 07 Jun 2023 11:10:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ZP9o3lv7ue/D0pMtDWVMAHHrN0ZyVe2Ne6ODfTagyU0HLTQrviPvgnMgxn+cGqcxvHciHTA== X-Received: by 2002:a17:907:7288:b0:978:780e:4520 with SMTP id dt8-20020a170907728800b00978780e4520mr4046862ejc.20.1686161431822; Wed, 07 Jun 2023 11:10:31 -0700 (PDT) Received: from amikhalitsyn.local (dslb-002-205-064-187.002.205.pools.vodafone-ip.de. [2.205.64.187]) by smtp.gmail.com with ESMTPSA id oz17-20020a170906cd1100b009745edfb7cbsm7170494ejb.45.2023.06.07.11.10.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 11:10:31 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Alexander Mikhalitsyn , Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Alexander Viro , Seth Forshee , linux-kernel@vger.kernel.org Subject: [PATCH v4 01/14] fs: export mnt_idmap_get/mnt_idmap_put Date: Wed, 7 Jun 2023 20:09:44 +0200 Message-Id: <20230607180958.645115-2-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607180958.645115-1-aleksandr.mikhalitsyn@canonical.com> References: <20230607180958.645115-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 Jun 7 18:09:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13271058 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 DDD5EC7EE2E for ; Wed, 7 Jun 2023 18:10:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232554AbjFGSKp (ORCPT ); Wed, 7 Jun 2023 14:10:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232514AbjFGSKk (ORCPT ); Wed, 7 Jun 2023 14:10:40 -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 B480C101 for ; Wed, 7 Jun 2023 11:10:39 -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-0.canonical.com (Postfix) with ESMTPS id 9476A3F15C for ; Wed, 7 Jun 2023 18:10:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686161437; bh=PnimYtsU8L1wziru+PbLo9AAv92Qytxkfm0LOSGrer8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=OzrtS96FjLX+WxVt+JELE740HiCAXqMfMEgLkWCnxnuTMxDdoEXVPUDDGHnRL02N1 2soXrgtQR1XD74mnYHomNhYuOliYDCYLJrwGZXaz0KzULJQpkyxr7yrgkhhA0ec428 LrwmqIYK8GSUIW0atO8bkUT8Vzw9m6lq0Jak1fVYTWGZVrAmUplKruMIyo3D3Ugl3/ cOhKAR/c3BNzdTn/sK4kFiBa0zh6V0RhSSyWlZpP9+6RhadYI7pntwQmHThqWJp0M9 MTbX9m6Xg8KJrDak3AyuIXp0N3PC/YCBhBJmPYWv5Pck8xW2ijD++dCXT8zTbQduPU X5NqL/i9RB8iw== Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-970e0152da7so690897066b.2 for ; Wed, 07 Jun 2023 11:10:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686161435; x=1688753435; 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=PnimYtsU8L1wziru+PbLo9AAv92Qytxkfm0LOSGrer8=; b=cNUzG1BsAhZNRN2bpbhShOrKAN3FhGH1/JwIEDwg6JxBCauv0zhH3S3ZlPSBDHR1E0 fwCchi37ZuHXRgZYto20r8+eHrNtuXoJ62M3hUCfLgNWge+WiPI75xCIZqeXBOS43TuP 3iXAqoPO5fklbeK8x23VrDBJ76NkUB/BVH9+8LN6poc/1qhU/YuPy3Ph3GHYCL6ce/aM jLUZ57x6hH647OQlUf32ZF1uyKwBpmhBgavWwf1KNA+6dyko3Sfokx81V97yNcd0LAdO nPoYap6rDWaFSMm3QG67ra79SdPSxNO0i01Ue1njYnfNEA8IXIkWaBcmPfFRQrtDKRZU olTw== X-Gm-Message-State: AC+VfDxjVtDJoP4/1u5N5hhpb/K69iT/tp8W5SMPe7cQNFPGSWxflYiB KwNG+IBRw6Rx3g4kCfZXe3deGzg5tQ1fDkxW/0LYNyi+PTbvCZE3ocOKjkcGwixSEJTF5/JeWYV hrgtDMe55VGv/AlYwXASOmiMraAMaLz6ieArjR/j82xQ= X-Received: by 2002:a17:907:8a08:b0:973:d1cd:933d with SMTP id sc8-20020a1709078a0800b00973d1cd933dmr7874772ejc.47.1686161435289; Wed, 07 Jun 2023 11:10:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6noxHTypAyjkYYgzACU+3pomO8jr2HnNRQ/wBTwDkTdyTqSLpcYw7tUbeaV5I0WXpNEgp9uA== X-Received: by 2002:a17:907:8a08:b0:973:d1cd:933d with SMTP id sc8-20020a1709078a0800b00973d1cd933dmr7874752ejc.47.1686161435119; Wed, 07 Jun 2023 11:10:35 -0700 (PDT) Received: from amikhalitsyn.local (dslb-002-205-064-187.002.205.pools.vodafone-ip.de. [2.205.64.187]) by smtp.gmail.com with ESMTPSA id oz17-20020a170906cd1100b009745edfb7cbsm7170494ejb.45.2023.06.07.11.10.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 11:10:34 -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 v4 02/14] ceph: stash idmapping in mdsc request Date: Wed, 7 Jun 2023 20:09:45 +0200 Message-Id: <20230607180958.645115-3-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607180958.645115-1-aleksandr.mikhalitsyn@canonical.com> References: <20230607180958.645115-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 4c0f22acf53d..05a99a8eb292 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 "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) + mnt_idmap_put(req->r_mnt_idmap); if (req->r_pagelist) ceph_pagelist_release(req->r_pagelist); put_request_session(req); @@ -1018,6 +1021,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 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; /* for choosing which mds to send this request to */ From patchwork Wed Jun 7 18:09:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13271059 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 71992C83003 for ; Wed, 7 Jun 2023 18:10:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232504AbjFGSKu (ORCPT ); Wed, 7 Jun 2023 14:10:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232505AbjFGSKn (ORCPT ); Wed, 7 Jun 2023 14:10: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 84B4D101 for ; Wed, 7 Jun 2023 11:10:41 -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 C6B703F19A for ; Wed, 7 Jun 2023 18:10:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686161439; bh=MVopSiFXJtuCZDFmw4k6EoX9EHPj+DJ/m9lrNV/HJJI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hk/Ii+UacLExekwR0a+UCvbKPJ5yBaUs3obtOJlndTVO0oCP6wv+JVDnAic2HPG+1 9ZoTF2ArOIqWesvvz1fVJ8MA+dXuxIK9XEynUCoojf//EBrpsJmWT5gjbH0lebgJAm qjLIFOjOKLmPEQxM3Jq1jSEXeyc/3FY2/NKaeggk+kITmbwf8ptci7xhDb18mNkSkX mX7y6k9j/jt8sQ2dak1dMtsRmoG4rwYvNMUKbk2yqsVanMjYEu+C/yG4QTlN7CrVyG WYMjWGQTPzlmN0WVIiwz86xSiwxGHbGXmEY3399HeaqMyz9rf9EGKzcYXXwOK4VQ/C b2UGIH8bFtnmQ== Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-9775f04de56so457480566b.2 for ; Wed, 07 Jun 2023 11:10:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686161437; x=1688753437; 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=MVopSiFXJtuCZDFmw4k6EoX9EHPj+DJ/m9lrNV/HJJI=; b=cJ/PbAdC3GXf9S2jdm15+PB0DWEwEe4Efi75Qh3mCn6vDZV6bBWERW2ELq8Ai7dlrV J/hZJP4J0qp2qdRJAIk474t/2rAPpjPbIRlU7ErYAgNzcwpkPGOi4JiYBKyOJUUld44m +FsiHDrVhE69uXT+1Zqw2AZVb0gkIXYuW9ceNVCBnBlXqTwKsA4w/BAyu/FC+UP75zSd RJKlgXa73GwB9F0S+tvHT3gxDNWDS5HvzrLG6nhDI0ke/KgjfEVqzzKFbublMeb9kz/A A1uWn1qchOS43lsHDiymcCWT2C9gjCpa2IUEfc9Wjzi3u3xar7x8L1Y76OKomulWqowg D+NA== X-Gm-Message-State: AC+VfDynt2RwNKodKBGGOS9tdqJ45DrxJA0LUb7VvdIbm9JnROoUTBWn MlzQwEEKVE+KGxK72dGNR1KZTrWB+NqYz9Gk7T0Kdx+ho57xQfEs9BAQHI6puuMJDAw0JA673Jn 221Z4rqQj9vOsn8s5C5e1OQ91QT0to6qbC9JeMmxu8wY= X-Received: by 2002:a17:907:1ca5:b0:974:55a2:cb0b with SMTP id nb37-20020a1709071ca500b0097455a2cb0bmr7864122ejc.55.1686161437456; Wed, 07 Jun 2023 11:10:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Hx4Sj502mBi2ESaQSMhiznhaLxn+viNpDBQOVxcQyv8UIFv7FEc8wYeZfqKJStff6NYVuAA== X-Received: by 2002:a17:907:1ca5:b0:974:55a2:cb0b with SMTP id nb37-20020a1709071ca500b0097455a2cb0bmr7864098ejc.55.1686161437145; Wed, 07 Jun 2023 11:10:37 -0700 (PDT) Received: from amikhalitsyn.local (dslb-002-205-064-187.002.205.pools.vodafone-ip.de. [2.205.64.187]) by smtp.gmail.com with ESMTPSA id oz17-20020a170906cd1100b009745edfb7cbsm7170494ejb.45.2023.06.07.11.10.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 11:10:36 -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 v4 03/14] ceph: handle idmapped mounts in create_request_message() Date: Wed, 7 Jun 2023 20:09:46 +0200 Message-Id: <20230607180958.645115-4-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607180958.645115-1-aleksandr.mikhalitsyn@canonical.com> References: <20230607180958.645115-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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: 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/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 05a99a8eb292..8826be3c209f 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -2581,6 +2581,8 @@ static struct ceph_msg *create_request_message(struct ceph_mds_session *session, void *p, *end; int ret; bool legacy = !(session->s_con.peer_features & CEPH_FEATURE_FS_BTIME); + kuid_t caller_fsuid; + kgid_t caller_fsgid; ret = set_request_path_attr(req->r_inode, req->r_dentry, req->r_parent, req->r_path1, req->r_ino1.ino, @@ -2649,10 +2651,22 @@ static struct ceph_msg *create_request_message(struct ceph_mds_session *session, head->mdsmap_epoch = cpu_to_le32(mdsc->mdsmap->m_epoch); head->op = cpu_to_le32(req->r_op); - head->caller_uid = cpu_to_le32(from_kuid(&init_user_ns, - req->r_cred->fsuid)); - head->caller_gid = 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 = from_vfsuid(req->r_mnt_idmap, &init_user_ns, + VFSUIDT_INIT(req->r_cred->fsuid)); + caller_fsgid = from_vfsgid(req->r_mnt_idmap, &init_user_ns, + VFSGIDT_INIT(req->r_cred->fsgid)); + head->caller_uid = cpu_to_le32(from_kuid(&init_user_ns, caller_fsuid)); + head->caller_gid = cpu_to_le32(from_kgid(&init_user_ns, caller_fsgid)); head->ino = cpu_to_le64(req->r_deleg_ino); head->args = req->r_args; From patchwork Wed Jun 7 18:09:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13271060 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 815C9C7EE25 for ; Wed, 7 Jun 2023 18:11:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232596AbjFGSLB (ORCPT ); Wed, 7 Jun 2023 14:11:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232547AbjFGSKo (ORCPT ); Wed, 7 Jun 2023 14:10:44 -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 12E71198B for ; Wed, 7 Jun 2023 11:10:43 -0700 (PDT) Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 212C83F15F for ; Wed, 7 Jun 2023 18:10:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686161441; bh=iEnhNZXEpvf6z44xxB3rnp1IhVt5v+qShuvQ8nza8PQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=udW0A+gZPXbkTsyzbB/o2dZvkt+MYjxoHwrdL2QvgXbFK6uCHaL7uKfN9TgYq5b54 oPTQXBzs3eayGfueSvGO6Fxx8iHz8DEtYl9zyWkf3pUlkhz7yVe8O7KDemAdrWGGHw IrDspX4yl4oUptkYl7YvyQaPlsN3wEBVlSIz5IMkJmTff+AUAU9ldSDp947uVT6xDA B2bRfxQ4x/YRZw9pa4ZAwnsiJ2RTG3TxqHI0QZfoglnv9kYZwXNvBYzhOv0wJqN0NI cLUlwkmeQ6tHArQuy1/bK2G6hSxxfBNdogYSjRdOTASfGd3Cndnrs7/7+myrIWF0qP r/8W4+d/rUS2w== Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-9744659b7b5so692098166b.3 for ; Wed, 07 Jun 2023 11:10:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686161440; x=1688753440; 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=iEnhNZXEpvf6z44xxB3rnp1IhVt5v+qShuvQ8nza8PQ=; b=PfBAlIiGQfYkHK3SC6BNOKqUwKrraDPMgqqnUzbJgXxebitBaX66pE2D8EfUupTJcP /Ygqsu2KgTPQEvcur0gYfuoGketkIKp7k5a08TxSkIuLU2OidKeyDNoR6GYuz1h6eEZa opAJhxoD9Sj3ERrpNEbLX7sIZR8VeU1COQzpkKzVLLZ/1zvQaU9+I8kmixhNZF+q6zre cHQ038MQBm/oY3g/0Ym3FWBeP9p52yK3HxvusqZ8Pma3O3ja6Mpfm/VpxVI/4sBjUj5x Z20uetM9Uxpu1WDq6IukInhiiiItY4XMaSfmcOvZNjQhjzE4tRYvRxRTXxQjUkPeEdPB 1EZQ== X-Gm-Message-State: AC+VfDzsOxdt25MR77GrNyAR53WT3ghiF0fuu+fW3glZNEHuboa9P43r RF4GAZAC+DTScUI2mQlw1vAG1COsz/hAJT7pCkBKqYtCnic3RJ8uBkI8c3CWEGmmeNmQK7sxSnh jDbBAJO8Bl/loc2Pl98QrhkRr3+aTlt/MuwU4wm5Zqw0= X-Received: by 2002:a17:907:6d98:b0:96f:ea85:3ef6 with SMTP id sb24-20020a1709076d9800b0096fea853ef6mr7344056ejc.62.1686161440261; Wed, 07 Jun 2023 11:10:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5kN0yD5UKteqOZCdE8d2DUc0BogNgwOVnzz8+4Qovf99098TrosTx+jldMHixGqT6jVCGfZQ== X-Received: by 2002:a17:907:6d98:b0:96f:ea85:3ef6 with SMTP id sb24-20020a1709076d9800b0096fea853ef6mr7344043ejc.62.1686161440120; Wed, 07 Jun 2023 11:10:40 -0700 (PDT) Received: from amikhalitsyn.local (dslb-002-205-064-187.002.205.pools.vodafone-ip.de. [2.205.64.187]) by smtp.gmail.com with ESMTPSA id oz17-20020a170906cd1100b009745edfb7cbsm7170494ejb.45.2023.06.07.11.10.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 11:10:39 -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 v4 04/14] ceph: allow idmapped mknod inode op Date: Wed, 7 Jun 2023 20:09:47 +0200 Message-Id: <20230607180958.645115-5-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607180958.645115-1-aleksandr.mikhalitsyn@canonical.com> References: <20230607180958.645115-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_mknod() 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 --- fs/ceph/dir.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index cb67ac821f0e..aaae586de4de 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c @@ -884,6 +884,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; From patchwork Wed Jun 7 18:09:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13271061 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 F3C9EC7EE2E for ; Wed, 7 Jun 2023 18:11:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232594AbjFGSLH (ORCPT ); Wed, 7 Jun 2023 14:11:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232600AbjFGSLB (ORCPT ); Wed, 7 Jun 2023 14:11:01 -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 15FD51FFD for ; Wed, 7 Jun 2023 11:10:49 -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 1A63B3F1B1 for ; Wed, 7 Jun 2023 18:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686161446; bh=NiXISWdTTKqrASGu11LnECL/5NzVPnT3d4irPieP8Oo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XgN5B1Yiztgj/t8rhRPu7wr9p24BT0ycwiU4Fv6q/7o+wjeVQ+ru5OxuywL+V+hzZ Ps6DpXslqTkcWqqW8YE+Uhw78i7GKD1fJA+5HZA2FDK+euyKXXYdKUuMtOLzaE2XhR 9SeN647CY4KGzkJUror9bW7kmIBGydACngrs8hnmMgjbXDNdxNpd6JfsRFEqE9SSBo NQHorrkNoOtMpsElLXTXLvJjdYDOTcsOV//7Sg0w6rgL/X2xT8xgsLWO5Iv37TrLnq PRz94ST5Ch0AyYTh3Ic/WvFZzOX4Tq/uDJ9DC7rv31e0KlwdpErwhWLnIN7hKlVZEI r+VLcLjNSZyxA== Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-977e6c94186so304173766b.1 for ; Wed, 07 Jun 2023 11:10:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686161443; x=1688753443; 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=NiXISWdTTKqrASGu11LnECL/5NzVPnT3d4irPieP8Oo=; b=fQsn3iCn0ztdkRLYxgUi+Lb8+V1A8x2epAMZNtL4gVun1ZrQkIC+Qkdgg2ORCnOw8k vezu669fUoRgbNspaxMRMfx8NDBW22bg4X4Yus3zJRU2XX9yeJEjCKGz5FruT+jL27yK C102WhT3ACVxSPTOlH/dZLyJx9QLqYCZVXQd0dJYOUJ561SlzBk3V1H5MG51cZ5aEwKx Y/jmVKvIzmXj/pUzEnYDeEz/UgCOy25gpkhoW1e54yllbBmecghbzoTLNC+vM17dpApm Fvuy6Eq8kPjIJngIjKqouEZ5q8zuYIVzXmcN/8Vm4qgpLLdsKJIYgG0JwXjdBrkogDhH LC4Q== X-Gm-Message-State: AC+VfDwIr1viSXhmSvOv67CKCSeDh/uI0UJb1JEPwiS32V5NSiVTPttX LNSckH/7AFGBuSVfsSrblCbEXDhagAGJSzG+PcIDObb6EJxlXRYkmlcB2WJnU0QckpCr7PQwZhV claoPG0uOhpYOnwOX1ZRz5myaXXbpsqLraOqz4WImObU= X-Received: by 2002:a17:907:7203:b0:971:9364:f8cd with SMTP id dr3-20020a170907720300b009719364f8cdmr7198744ejc.44.1686161443500; Wed, 07 Jun 2023 11:10:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6v6uUPJK8+xV3dSA9zftqoqH4Sl5IhvWY6O86BBmABFIFnOcXD46uWK9jOFmxZDQRLCE5RZg== X-Received: by 2002:a17:907:7203:b0:971:9364:f8cd with SMTP id dr3-20020a170907720300b009719364f8cdmr7198723ejc.44.1686161443215; Wed, 07 Jun 2023 11:10:43 -0700 (PDT) Received: from amikhalitsyn.local (dslb-002-205-064-187.002.205.pools.vodafone-ip.de. [2.205.64.187]) by smtp.gmail.com with ESMTPSA id oz17-20020a170906cd1100b009745edfb7cbsm7170494ejb.45.2023.06.07.11.10.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 11:10:42 -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 v4 05/14] ceph: allow idmapped symlink inode op Date: Wed, 7 Jun 2023 20:09:48 +0200 Message-Id: <20230607180958.645115-6-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607180958.645115-1-aleksandr.mikhalitsyn@canonical.com> References: <20230607180958.645115-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_symlink() 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 --- fs/ceph/dir.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index aaae586de4de..5025b570683d 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 = 2; req->r_dentry_drop = CEPH_CAP_FILE_SHARED | CEPH_CAP_AUTH_EXCL; req->r_dentry_unless = CEPH_CAP_FILE_EXCL; + req->r_mnt_idmap = mnt_idmap_get(idmap); if (as_ctx.pagelist) { req->r_pagelist = as_ctx.pagelist; as_ctx.pagelist = NULL; From patchwork Wed Jun 7 18:09:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13271062 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 2321BC83003 for ; Wed, 7 Jun 2023 18:11:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232463AbjFGSLE (ORCPT ); Wed, 7 Jun 2023 14:11:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232587AbjFGSLA (ORCPT ); Wed, 7 Jun 2023 14:11:00 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97C811FFA for ; Wed, 7 Jun 2023 11:10:47 -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 23F033F15A for ; Wed, 7 Jun 2023 18:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686161446; bh=6uQHZNltQASHUIIPvj6JLa2X5jqdjHd99JgtiW/BGQk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=h3W7GllYcOrBm4yfYbz4BcQL+3CI72qW+DWDt5eiX/jgVzlcDYpnDhLFmaFWXvKyJ 64mc+j2uyHUk7AlfwIWode4+eGsXfjd2LKKzhE6E3viq+oq3s3ZU3UTy0I6P0YpoSe tnudjz1uui3/92exROfVCJqAUMnOoE5mqP1kwU+h2qIkPVT1cs67n4kGcvDAxujktF UF6pKCa3pn/XVyJLLpzQBpTg6bG0tBQnWqIW7DH1VOZR/V4gGuBFbhZiBeobCw9jK8 11irsLs13jHxic2ARpkbELtyKP+zA0nWf1kI3sYSe8rP432RyjeoDdm2oXyuYYOPhM DjwMcO6xl2VcA== Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-977d0333523so459070266b.0 for ; Wed, 07 Jun 2023 11:10:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686161446; x=1688753446; 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=6uQHZNltQASHUIIPvj6JLa2X5jqdjHd99JgtiW/BGQk=; b=aqdFDBhJ39ID9GkJ5Xe0XdatDcuTsQ3CTLZ1/OGGffROIvciKtTyF9U8lBAyruJniG eo7itdSrSpPyva5QxAtUGjWPy30HRtnvKA7niiD4REuTttUGR/FfghdoIllrIrdtOJYz ZkcHqsFl+SGzWqKsuuW48R/w66hCAiX6KJy4kVnLE4FKJdXr+EMoLFxLJjTpAfgtdMRM 8rjd0EoVtqX0K+bpJ6nO/WhKOerIKFlAzLkZfF5Xv/alSefuV8GU6Jq5Lp0k2pafuc07 MMYyyZ//hEVx2Pk6MP9B0VP9GXmhMfHGfGh0VEyAbJ8nuxmXb6ubgfQ2287AYiZ1+bp7 i5Mw== X-Gm-Message-State: AC+VfDwxYrbFoKa/PSwgZTvXzGNw8JG2ij/3pZq8Dey8rbvZg46kW2zW KSLzaO2DTztR7Fj0YSsFotU0jCeL9P43MmS/jVlZ3ZiNzY8l5Dx+PX/eUqiMRCH7eFhe5JhFs4r M12pCNznoQrXNO39QpAGs6nDStjD0qzwfejY6Xu0t/k8= X-Received: by 2002:a17:907:3e99:b0:96a:29c0:8515 with SMTP id hs25-20020a1709073e9900b0096a29c08515mr7106336ejc.58.1686161445977; Wed, 07 Jun 2023 11:10:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7AWxbyPvcXlQw3axgBfuZq1pyMG2G2W86d1AY82qx9seAOayCbRG2bCQML7fs+V7QljuN2tw== X-Received: by 2002:a17:907:3e99:b0:96a:29c0:8515 with SMTP id hs25-20020a1709073e9900b0096a29c08515mr7106326ejc.58.1686161445803; Wed, 07 Jun 2023 11:10:45 -0700 (PDT) Received: from amikhalitsyn.local (dslb-002-205-064-187.002.205.pools.vodafone-ip.de. [2.205.64.187]) by smtp.gmail.com with ESMTPSA id oz17-20020a170906cd1100b009745edfb7cbsm7170494ejb.45.2023.06.07.11.10.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 11:10:45 -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 v4 06/14] ceph: allow idmapped mkdir inode op Date: Wed, 7 Jun 2023 20:09:49 +0200 Message-Id: <20230607180958.645115-7-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607180958.645115-1-aleksandr.mikhalitsyn@canonical.com> References: <20230607180958.645115-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_mkdir() 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 --- fs/ceph/dir.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 5025b570683d..5ef90a49b156 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 = cpu_to_le32(mode); + req->r_mnt_idmap = mnt_idmap_get(idmap); req->r_dentry_drop = CEPH_CAP_FILE_SHARED | CEPH_CAP_AUTH_EXCL; req->r_dentry_unless = CEPH_CAP_FILE_EXCL; if (as_ctx.pagelist) { From patchwork Wed Jun 7 18:09:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13271064 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 ADD5FC7EE2E for ; Wed, 7 Jun 2023 18:11:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232501AbjFGSLY (ORCPT ); Wed, 7 Jun 2023 14:11:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232625AbjFGSLC (ORCPT ); Wed, 7 Jun 2023 14:11:02 -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 E968B2107 for ; Wed, 7 Jun 2023 11:10:50 -0700 (PDT) Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 5D02B3F160 for ; Wed, 7 Jun 2023 18:10:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686161448; bh=U0wDd5vU5m4d9k8unybyLOfQsgHlr2098zatHuE7IuM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ldL169xNMQ6eUQugy7Hh/gSYwpxyZaEYgmX3W+adg73fYV2m3fOMVZVaIdS5EdF7Y Fo63hseefReNeLCKUyKTxeuXPxUu+eb8mppxjz832753rR5DzEAU3YOXmXbCU16/wb ncgO058JVfcxMikZ931K7sIOGJsPmEJGFdOLOPXSIUvRXqGsaTvZKqP0au7AVdGqLg oaivhcrJ/buzI6CaynR01IdW6rKBmwEonxUG8wzGgS474UUzCMzbxKuO1unRpR8BKN fTtI8STnpaTFUY75gX+ZxCqnsdvCMfCdFEpp7JVLTQxGP4KWggVCs+C7LTshxqNHFv NHG9ipxTbPgtA== Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-977cb78acfcso377576166b.3 for ; Wed, 07 Jun 2023 11:10:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686161448; x=1688753448; 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=U0wDd5vU5m4d9k8unybyLOfQsgHlr2098zatHuE7IuM=; b=K5DB9kwDHXWqrHlgXrdq/of+ptIcSeuvpH5ZHcFlNC/IErWXj2lgNggNZYCAh82hPS JgnpCIADTtDVxZ1Tbj+kwHKo2etIF7dRvBUWPwiwFNvkft8LkglzsF1fHqxp5dxQCb22 xi0TEJgzI1ykfqxIHxl5BGluMbXtO0q9K83WTHuqZh6c6Au/VxrEOZJNn5Lg9n2k3euj Kypy8PTvNQWYi3SMkv5Z2vVo+Bj1A7wFuUE5KEfKdU4x+HbH/ahDWmqmy/figKBpOAMB CQvs/41DxclNG5flnjjGgX1O6jsqltpPx+/lNReaRw4Ozt23ZGv3PRPtXfpb3tBqLiiH H9fA== X-Gm-Message-State: AC+VfDxpkthwhMbJxwK2MWUHb4L6h3v+tPoRja13lHFHe3aWMyPol+Ac DPK1fuiECIBQS87yFistrEkrOVt8qOoL+9meBE3eZzCJxxeOccjwTTLFTfyBNuXKks0lMelxocC nw4stjFhktJp3XsiKibnEBUl3ALOu5lQ3ZHj5f0JPlNA= X-Received: by 2002:a17:906:dc8e:b0:965:6d21:48bc with SMTP id cs14-20020a170906dc8e00b009656d2148bcmr6951906ejc.75.1686161448211; Wed, 07 Jun 2023 11:10:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6ngknujcXmRZ3o/zUU3vPHCFz/0yZ08tou5UTAorufeNDslI9p+T/7P4VcApY0KYKUmADI6A== X-Received: by 2002:a17:906:dc8e:b0:965:6d21:48bc with SMTP id cs14-20020a170906dc8e00b009656d2148bcmr6951885ejc.75.1686161447977; Wed, 07 Jun 2023 11:10:47 -0700 (PDT) Received: from amikhalitsyn.local (dslb-002-205-064-187.002.205.pools.vodafone-ip.de. [2.205.64.187]) by smtp.gmail.com with ESMTPSA id oz17-20020a170906cd1100b009745edfb7cbsm7170494ejb.45.2023.06.07.11.10.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 11:10:47 -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 v4 07/14] ceph: allow idmapped rename inode op Date: Wed, 7 Jun 2023 20:09:50 +0200 Message-Id: <20230607180958.645115-8-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607180958.645115-1-aleksandr.mikhalitsyn@canonical.com> References: <20230607180958.645115-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_rename() 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 --- fs/ceph/dir.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 5ef90a49b156..355c5574ad27 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c @@ -1327,6 +1327,7 @@ static int ceph_rename(struct mnt_idmap *idmap, struct inode *old_dir, req->r_old_dentry_unless = CEPH_CAP_FILE_EXCL; req->r_dentry_drop = CEPH_CAP_FILE_SHARED; req->r_dentry_unless = CEPH_CAP_FILE_EXCL; + req->r_mnt_idmap = mnt_idmap_get(idmap); /* release LINK_RDCACHE on source inode (mds will lock it) */ req->r_old_inode_drop = CEPH_CAP_LINK_SHARED | CEPH_CAP_LINK_EXCL; if (d_really_is_positive(new_dentry)) { From patchwork Wed Jun 7 18:09:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13271065 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 0673BC83005 for ; Wed, 7 Jun 2023 18:11:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232625AbjFGSL0 (ORCPT ); Wed, 7 Jun 2023 14:11:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232661AbjFGSLD (ORCPT ); Wed, 7 Jun 2023 14:11: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 E70212113 for ; Wed, 7 Jun 2023 11:10:52 -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 93A8D3F15D for ; Wed, 7 Jun 2023 18:10:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686161451; bh=U9FNme5iBEpufhowdmn6D6u4P9E81AUlwyvYSH4GMyo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Tbzw2iEYOGaykfz+CHs4otX32ABoUa4aOXiNJWE/cvovRCndVcL3wgazA63ztKE3U OpFG23mG40xWCvrwVPbNiVlbId705nqEK9i2p/5h6QJvEE////AmyANhkrCwOdB2qt 1cbgTb9X8+n+gluZOsEAINFc9tvck6Q0kCyjbIstBPq//DsEKU8QuuDqHXNb1pxwYx ZgR64KWLHFCvywt4RsqZye06pbfX0kvyaMRzZin028c10Fq9Q9h+oS/MyIbjxxzKFq 8fZC2sYzwts9lPnwyw7w3uxiVsvSdwybtk7u/dTmjH2mqksCJRqVcRWidb3ZLhWl0D Pq1IxEpA7fuSg== Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-514a6909c35so1263889a12.3 for ; Wed, 07 Jun 2023 11:10:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686161451; x=1688753451; 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=U9FNme5iBEpufhowdmn6D6u4P9E81AUlwyvYSH4GMyo=; b=OYRn7AQIzVv1r/u56qEKPFBTnqBtROCwEjPkZOKLAwFOwwV1tL4m2Od4YRZq98jq9P RbdePZGazqd4gxEy7y4IFUqyz8TxTPCeMPPiJfKgDuOwqcv+gVvhNg/+j3AAqf6ja9WA FWoLOIDYDYH79RNRc9lO74nV0dR71zcjTk990OLbP1kn2B4jwv6BQWY3cWBiBwgAe7w8 z4H4eWtbMdAvci6+arYx/BcnrqzD0HFnwkv7PqlhKy550bvmx+AwUNk4l7HhaG8ES7w9 hdnuttltwcFUb3b3JrLDCCf6VOWNbJx/tRDtuuRvB6a2YVJ/CemJOgpNJ7yiBIT34BQ8 w15A== X-Gm-Message-State: AC+VfDz4aOqvDjzjRgMbVu3X0B4T7tHeYbVW7qc8PpAig7zSuif61neE /vr1rJlqF0yFfPxjHXMVuf7I+OYgcRVzYKvACPDuE3ORG4Cnn4XvfFTU0NTfCTEiqt1d3NweQ8/ Z82TPzwPS86UaAT84cbno2l+YPxTtxojbRK2Selfut4s= X-Received: by 2002:a17:906:6a16:b0:96f:9963:81ee with SMTP id qw22-20020a1709066a1600b0096f996381eemr7607927ejc.50.1686161451087; Wed, 07 Jun 2023 11:10:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7l7SHHgw+BU8rxXq08zQ4nhoIK2xRQlwDq8P8dpBDsOnwGZn+4CtqqsfCxYAnOQGLg07QwYA== X-Received: by 2002:a17:906:6a16:b0:96f:9963:81ee with SMTP id qw22-20020a1709066a1600b0096f996381eemr7607913ejc.50.1686161450893; Wed, 07 Jun 2023 11:10:50 -0700 (PDT) Received: from amikhalitsyn.local (dslb-002-205-064-187.002.205.pools.vodafone-ip.de. [2.205.64.187]) by smtp.gmail.com with ESMTPSA id oz17-20020a170906cd1100b009745edfb7cbsm7170494ejb.45.2023.06.07.11.10.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 11:10:50 -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 v4 08/14] ceph: allow idmapped getattr inode op Date: Wed, 7 Jun 2023 20:09:51 +0200 Message-Id: <20230607180958.645115-9-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607180958.645115-1-aleksandr.mikhalitsyn@canonical.com> References: <20230607180958.645115-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 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 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 Jun 7 18:09:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13271066 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 80E58C7EE23 for ; Wed, 7 Jun 2023 18:11:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232684AbjFGSL3 (ORCPT ); Wed, 7 Jun 2023 14:11:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231734AbjFGSLD (ORCPT ); Wed, 7 Jun 2023 14:11: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 650F32125 for ; Wed, 7 Jun 2023 11:10:55 -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-0.canonical.com (Postfix) with ESMTPS id 84C4F3F160 for ; Wed, 7 Jun 2023 18:10:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686161453; bh=Yx9DhBwZ0J2oRahK7SO/c3VRSYe4JEpen4id9pbwqa8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YWBfUtHa7qRlgcCQb+3PMmpH/RucR2nd/znRz5zYKeEQkF/XDMDfmWXuhTE2BBJcB SyrL+PfAhqDe1sKzZklRKAjRhR54BHdXkMk2ssC/x2Mgkg3ntW1YS3a3lBVGTK5TjL Haa6Wa0ZwNf09Yt9AM7/ZYJLOndSeSoV5LS0+8nfbSYIz286oMSmzN4HbCY+pWO0wS EVOP1L62LpyMklONjq80XxHNssxN+Ux5lHAXIgfnIha22Z9VkDxelXug7djwaBys2S 4ICaC4h4jrA5ZVgqzmZ39jqrHoEbnuZXXfbgT59gUnNW/dUBst4i0hX5KTs/wxLdja qbL9xnqGr5/qQ== Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-97467e06580so610487366b.1 for ; Wed, 07 Jun 2023 11:10:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686161453; x=1688753453; 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=Yx9DhBwZ0J2oRahK7SO/c3VRSYe4JEpen4id9pbwqa8=; b=F6nqiMK5KhZ+MRmzM7yvGMt+d/kFlMA9xvSIkJwwhjt3WWb+sZ+j8VcQ73ijJzcDtw Ot393asEd0pmgx0oVC8NArtbulzw9TJN711G1UjkUZM2kRj+DtmZE6FDCyOtRPg5/PLB jGlC0HvsB5CE5zTIDoUpOMrI30TSrUU6qKcLAocqY5pIIpKtyvpM4sKwBdFYBCPhze9N ShrkRAVtVsmDuS3h1xBZWpey0Sl6fXjOKqIhA8rQj7hbvJoUwFnra8TLySPYhJ2nHPSN 75QFcEcuFqAmWvJyca7Ywmm1iUIHW8ACBjRlqhqXe6lEYDitLVGZX5kw+2en00L21qYl LljA== X-Gm-Message-State: AC+VfDyOAQUmQJ6p5G+1ZBNsG0hzonOIdVWbkqInKxCXPUHTJYRuBzqY urdq+dOt2i/U+zzcT6uUeoPtd3cs9d/pPRfmLXK32kNrN3UFUXLApdGHdFEdKuve+phHTCRdyxc hMzd4TD7B4Ah6NkBAB4fMUDXkYTMmjuQmDu196kbOI9M= X-Received: by 2002:a17:907:3da2:b0:96a:3e39:f567 with SMTP id he34-20020a1709073da200b0096a3e39f567mr7202647ejc.47.1686161453352; Wed, 07 Jun 2023 11:10:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Y4EZF3oDO9KQHXjJRRbjW/E8b2iZk8j6UhQXdR4OzME2Ryqk98zEbdjZ4t0q/JTaCL8k8ZA== X-Received: by 2002:a17:907:3da2:b0:96a:3e39:f567 with SMTP id he34-20020a1709073da200b0096a3e39f567mr7202627ejc.47.1686161453170; Wed, 07 Jun 2023 11:10:53 -0700 (PDT) Received: from amikhalitsyn.local (dslb-002-205-064-187.002.205.pools.vodafone-ip.de. [2.205.64.187]) by smtp.gmail.com with ESMTPSA id oz17-20020a170906cd1100b009745edfb7cbsm7170494ejb.45.2023.06.07.11.10.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 11:10:52 -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 v4 09/14] ceph: allow idmapped permission inode op Date: Wed, 7 Jun 2023 20:09:52 +0200 Message-Id: <20230607180958.645115-10-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607180958.645115-1-aleksandr.mikhalitsyn@canonical.com> References: <20230607180958.645115-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 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 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 Jun 7 18:09:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13271070 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 6655AC83005 for ; Wed, 7 Jun 2023 18:11:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230183AbjFGSL1 (ORCPT ); Wed, 7 Jun 2023 14:11:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232729AbjFGSLH (ORCPT ); Wed, 7 Jun 2023 14:11:07 -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 D85CB2136 for ; Wed, 7 Jun 2023 11:10:57 -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 40C823F166 for ; Wed, 7 Jun 2023 18:10:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686161456; bh=UUJj01wMEQ1oyKBsNssb6jfIoqp09AUl4ugwx+FKVfQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Hq0kB59sRYMjrqNsRvWrTlHaLRcN3nDEXcmeD1l0p9mW1iKJzyFyX3M/qz1AZv7ub yLzYZSoMLPn55RAVtS9bM80D3Q9LClAXj7ndvig1KObXeEeZyZoXuRVCpcurYyxKAW 35FmF0Y9XOq4W09n0nvvkeXUuUyPxlCWHDmt7o/ncFPHnyPtxSRrKhQYcodDOkSyln GWLcuX+hjxVWMiIqICtmoOprS/KTu0DlxnPZmfy5CDWI8ZtIFZ1L7nGpDb44z/0GNN F8+8fyH+/z/XtVbZ35RT/yUAwneeTafwE29aRxZ0of3AyUQ/cWTh75guTQjji+2zeY qQpl1fiGK6UJA== Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-94a34d3e5ebso572095366b.3 for ; Wed, 07 Jun 2023 11:10:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686161455; x=1688753455; 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=UUJj01wMEQ1oyKBsNssb6jfIoqp09AUl4ugwx+FKVfQ=; b=hHehPBem4pcfAV27inyE4xabHCPSgWBx+nJahelZmoqmsNpPN9qPA6xMSt/urzAEm3 CvYS8yXZ4g7FxPAtOIfedoAptTsOFvae1q+i4v/ZTnjXgb/3WJyIe5kX2eMUdtCP4PUY 5AreG0XomzkgpirKFLYtwJXeCOWzaeysxnURPEXpi4wD9JkOP/olOpqa1gVLfBWnDlqF zY/+oqtGS1FVjdmAOIS81g3V1Pk1xnDkWMNqI8XbGGSpHTqwmoIY+yJZCiaOp8fmlcdj Xc0RHMdrXi8WMaf9WsU4EIMvkDbp9kKztbrG4+TwqKOv5YhPSfFAMftWA678OUx8+RE2 IsCg== X-Gm-Message-State: AC+VfDzegeQsDPg1Y5gc2Lyi6/U3oKtgFsvZWboCf07P2mrzdCBljkI+ 48hZ1rduTkOKAwvYUdzjqOulteGXCiuiNZn3kpnCLyWqxfbIZtZ6lV0BVbrX/yV7btVIkVBtXKU LSEIy5idqGWBZEMwnU7Wb9H5Oq12wDenAG6d5Niqk/y19nDZ5m5o= X-Received: by 2002:a17:907:7e9e:b0:974:52e6:93cb with SMTP id qb30-20020a1709077e9e00b0097452e693cbmr8404011ejc.50.1686161455769; Wed, 07 Jun 2023 11:10:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5QyWGLJ/fh/AxvEp9QlmkvfHipFfD/nqgbmvpynD+HDDoDC1eMF5jNtJoBqxoAcOKrhPegiA== X-Received: by 2002:a17:907:7e9e:b0:974:52e6:93cb with SMTP id qb30-20020a1709077e9e00b0097452e693cbmr8404003ejc.50.1686161455569; Wed, 07 Jun 2023 11:10:55 -0700 (PDT) Received: from amikhalitsyn.local (dslb-002-205-064-187.002.205.pools.vodafone-ip.de. [2.205.64.187]) by smtp.gmail.com with ESMTPSA id oz17-20020a170906cd1100b009745edfb7cbsm7170494ejb.45.2023.06.07.11.10.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 11:10:55 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Alexander Mikhalitsyn , Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 10/14] ceph: pass idmap to __ceph_setattr Date: Wed, 7 Jun 2023 20:09:53 +0200 Message-Id: <20230607180958.645115-11-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607180958.645115-1-aleksandr.mikhalitsyn@canonical.com> References: <20230607180958.645115-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/inode.c | 5 +++-- fs/ceph/super.h | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/fs/ceph/acl.c b/fs/ceph/acl.c index 6945a938d396..51ffef848429 100644 --- a/fs/ceph/acl.c +++ b/fs/ceph/acl.c @@ -140,7 +140,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); + ret = __ceph_setattr(idmap, inode, &newattrs); if (ret) goto out_free; } @@ -151,7 +151,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); + __ceph_setattr(idmap, inode, &newattrs); } goto out_free; } diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 37e1cbfc7c89..bcd9b506ec3b 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -2009,7 +2009,8 @@ static const struct inode_operations ceph_symlink_iops = { .listxattr = ceph_listxattr, }; -int __ceph_setattr(struct inode *inode, struct iattr *attr) +int __ceph_setattr(struct mnt_idmap *idmap, struct inode *inode, + struct iattr *attr) { struct ceph_inode_info *ci = ceph_inode(inode); unsigned int ia_valid = attr->ia_valid; @@ -2252,7 +2253,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); + err = __ceph_setattr(idmap, inode, attr); 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 d24bf0db5234..d9cc27307cb7 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -1052,7 +1052,8 @@ static inline int ceph_do_getattr(struct inode *inode, int mask, bool force) } extern int ceph_permission(struct mnt_idmap *idmap, struct inode *inode, int mask); -extern int __ceph_setattr(struct inode *inode, struct iattr *attr); +extern int __ceph_setattr(struct mnt_idmap *idmap, struct inode *inode, + struct iattr *attr); 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 Jun 7 18:09:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13271068 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 2BCE8C7EE25 for ; Wed, 7 Jun 2023 18:11:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232747AbjFGSLe (ORCPT ); Wed, 7 Jun 2023 14:11:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232782AbjFGSLI (ORCPT ); Wed, 7 Jun 2023 14:11:08 -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 1E94B10EA for ; Wed, 7 Jun 2023 11:11:01 -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 E35383F120 for ; Wed, 7 Jun 2023 18:10:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686161458; bh=upOvs6cNJRBF+ODdi690KD6aHJ8m7WaiezvTCZyfSFA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EXM9cTb2oIFgruKH3+yuFx/cTFCA67lrVeEVlg51dXgwDK0IFYmbB3wmVsojkEed/ jcQhWL5DwwIvwRH+fkpYUWh33npch8VQbxVr6BcEnE1Jj++Koc2Y87PoLdkUsQXFu/ UdGzJMW+CgoiB9NA28uxPk8fKnOiDxkYzkJGiHWXuNfF/XJoDVIQTDA5moME9s76BX 7Tpaox/UF5prRb0s9f8OCEPcGXrKEb96cD9uOPX5vitQ884h0FOQkZiqi7UavNrMlW mATnsOCh+KmUFsj7Ne6rAmXbSSdnGBVBM6+4uMJEd9EhIsgtDiDdkaMQBu+nNB6htg 6sxGiH9mGZW0g== Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-97542592eb9so455752166b.2 for ; Wed, 07 Jun 2023 11:10:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686161458; x=1688753458; 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=upOvs6cNJRBF+ODdi690KD6aHJ8m7WaiezvTCZyfSFA=; b=C0shwyGc6ha58bORc2UKgUvuHHDwjgQ3JQoa5WGHk2nTqsw5RWQNqq4upOW9NLoMrT WqHlU2UKI0AlvKbcaZP/fbWbKuo0xqlObwpkYqh1ATzszl7hZtPavTyO5/DCsZaPLSAX oJk0Glo+idteMJgzN4ih5h3RH7U6yrCvGELJuzSAtdacMkdLlmwfQHa3qgV9PFhv7nxH 0klS/Dqv6SbhqTfr1I/LmILR630Av8lSXX0whvrDOEXnNymqS1Gsv831NcgTNe+JoQcT s9Z5PvU1yMipAnJbqMosTsfvjHY31uDThfi7wRXRfAu2KIK7i9TkcaNblSF3a/iSik7i rbxQ== X-Gm-Message-State: AC+VfDyG2Xt5KLH6ULAwsPNtTjOHcXLKMRsBB2k5EKyetXzBunrwYq1R ZR5tlnPPWLT2e38k5iAcs/1+nbbY09ecejMfene64lalG/ev7jpoMu/qXL5y7IfghW1WJFB2xnk 2caD61W7xSw64g/yNbZgRTGXMhkqyjbQQQB80QWqwhV8= X-Received: by 2002:a17:907:1687:b0:96f:d345:d104 with SMTP id hc7-20020a170907168700b0096fd345d104mr8799384ejc.38.1686161458015; Wed, 07 Jun 2023 11:10:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6QoESNX2izdSFLKQWMWvnXZssKwKUI4czDAd1i3v2k99ChaC1wwq77PMB4DrAQyTJe7ndMPw== X-Received: by 2002:a17:907:1687:b0:96f:d345:d104 with SMTP id hc7-20020a170907168700b0096fd345d104mr8799368ejc.38.1686161457854; Wed, 07 Jun 2023 11:10:57 -0700 (PDT) Received: from amikhalitsyn.local (dslb-002-205-064-187.002.205.pools.vodafone-ip.de. [2.205.64.187]) by smtp.gmail.com with ESMTPSA id oz17-20020a170906cd1100b009745edfb7cbsm7170494ejb.45.2023.06.07.11.10.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 11:10:57 -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 v4 11/14] ceph: allow idmapped setattr inode op Date: Wed, 7 Jun 2023 20:09:54 +0200 Message-Id: <20230607180958.645115-12-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607180958.645115-1-aleksandr.mikhalitsyn@canonical.com> References: <20230607180958.645115-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 bcd9b506ec3b..ca438d1353b2 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -2052,31 +2052,35 @@ int __ceph_setattr(struct mnt_idmap *idmap, struct inode *inode, dout("setattr %p issued %s\n", inode, ceph_cap_string(issued)); if (ia_valid & ATTR_UID) { + kuid_t fsuid = from_vfsuid(idmap, i_user_ns(inode), attr->ia_vfsuid); + dout("setattr %p uid %d -> %d\n", 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); + dout("setattr %p gid %d -> %d\n", 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; } @@ -2241,7 +2245,7 @@ int ceph_setattr(struct mnt_idmap *idmap, struct dentry *dentry, if (ceph_inode_is_shutdown(inode)) return -ESTALE; - err = setattr_prepare(&nop_mnt_idmap, dentry, attr); + err = setattr_prepare(idmap, dentry, attr); if (err != 0) return err; @@ -2256,7 +2260,7 @@ int ceph_setattr(struct mnt_idmap *idmap, struct dentry *dentry, err = __ceph_setattr(idmap, inode, attr); 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 Jun 7 18:09:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13271063 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 0C043C7EE25 for ; Wed, 7 Jun 2023 18:11:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231214AbjFGSLX (ORCPT ); Wed, 7 Jun 2023 14:11:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232793AbjFGSLI (ORCPT ); Wed, 7 Jun 2023 14:11: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 663CD1FC2 for ; Wed, 7 Jun 2023 11:11:02 -0700 (PDT) Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id A7C923F12E for ; Wed, 7 Jun 2023 18:11:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686161460; bh=/It8VSgZDTEKktJxHTMOOJHpvqL0RXNtakCJDr6cWYA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Nf564hL3HighSIb53MZUbtQlmqRjV+eRENOiOgIVAY7A2mjoGJN93AKLatnzhf5T2 e0MlSLjS/vzjLVq0qApp3Hx9nw31e1ym3MnX1K9AUx98zi/BA2qInQxDzcWceQMsAX wkEp73eDf0cF2fRc8QQMUo50Z+dU41BR2gQxjSsKgzhQNXE/S252bWdce6jsSWhRqu qDGzovcY7iOtXu6izU1u+yDXOLzXgX6uMmYMu062MkLwf1sOnc8Hn88nnxFLUD1WWR V0DsQCWMZhvCm8TWjWrdJrkthNsDM9Wkq/gWbx16S15yq1JO7RrFsU3Jw2L3xMj6mN p8+3AnEW7+yyg== Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-970e0152da7so690940166b.2 for ; Wed, 07 Jun 2023 11:11:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686161460; x=1688753460; 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=/It8VSgZDTEKktJxHTMOOJHpvqL0RXNtakCJDr6cWYA=; b=MIzMUd/5sVFeFTeVScM78iKo0K5YUWbKN7atoi3NJjOiQTPvFjen/CAZ9ImvNsxNal 8iRfWkxoHMN/3O02Z2nOEsNOf1T9fvVKsnvKr3ZEgl2PnBWj88/aQ0FLmv9mvsrUc2X0 r44Nz4W2pAgvJ8/78UiQINICe9h7JzR7mSKvjf1LPVVNoaGzmTLqCKbloZFcecjNZuHa 6MSi2//YKyjGlWdQpdV0YVsqlvwwYsflmXEWfjUDqyXEjB4SwPUXoVKA9p0f1VPFFVtN F2ETNnOF8tIQepeciCAUbmKZtOXCxDE4cE0L4fcmukan/wHVBSoE8b4yqDe1gGzShZLw F2Dg== X-Gm-Message-State: AC+VfDwO8z54SE+LUVOQqKnVK/safpWQSR+6ACX3NP4j7iLzlQYKzlWG UC2J+Ul+JlW1oEfgDJy5uQrE9lPDKWg0gF3SW1PbOIrgke/0cCt4qIJdI3LAJSci5H0kzXFkXQd 3S50NZ0cDBUINUOmmI580UeDq1vRdGp/ZAY1VST8jMr4= X-Received: by 2002:a17:907:3e1e:b0:96f:b58e:7e21 with SMTP id hp30-20020a1709073e1e00b0096fb58e7e21mr7447661ejc.52.1686161460427; Wed, 07 Jun 2023 11:11:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6E8Zoczui2SA997DiFkrKyZP1txEaL4imA8LjlOgAING0rY1a/TfTWY9iSvaNKd09APPPgiw== X-Received: by 2002:a17:907:3e1e:b0:96f:b58e:7e21 with SMTP id hp30-20020a1709073e1e00b0096fb58e7e21mr7447637ejc.52.1686161460189; Wed, 07 Jun 2023 11:11:00 -0700 (PDT) Received: from amikhalitsyn.local (dslb-002-205-064-187.002.205.pools.vodafone-ip.de. [2.205.64.187]) by smtp.gmail.com with ESMTPSA id oz17-20020a170906cd1100b009745edfb7cbsm7170494ejb.45.2023.06.07.11.10.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 11:10:59 -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 v4 12/14] ceph/acl: allow idmapped set_acl inode op Date: Wed, 7 Jun 2023 20:09:55 +0200 Message-Id: <20230607180958.645115-13-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607180958.645115-1-aleksandr.mikhalitsyn@canonical.com> References: <20230607180958.645115-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 51ffef848429..d0ca5a0060d8 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 = 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 Jun 7 18:09:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13271069 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 40CDFC7EE2E for ; Wed, 7 Jun 2023 18:11:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232711AbjFGSLd (ORCPT ); Wed, 7 Jun 2023 14:11:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232830AbjFGSLK (ORCPT ); Wed, 7 Jun 2023 14:11:10 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AB881FDB for ; Wed, 7 Jun 2023 11:11:05 -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 CA5313F19B for ; Wed, 7 Jun 2023 18:11:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686161462; bh=Q8ymt4aVYk7+c3UhjbPSUCbNsUrFX+gS8T8907goBG0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tsLYUKSii5zxtQ5kKmxikcnkrgLlRShfTyUE6e61a+5VuR1S6Isp41BE4bTGGXazQ 8Vd0UkZU1An400qfxwlpaa8zwBLqlsF4D/uNkw6n/GAZtFGpFAp9DiTE0VK6SwPijF hkCLeJEXcgx+SUpb1JADnGsROAd81JELj4QfCvB2xl9djQPIaUQijsKHEHRumJDitk UO0ygbfHj9fRBJJsHCrBfPlVm1UsU8WEC3goJ6TPX/q3WG4iCynpNYC5X008sMaYCB 3eYEcrzbJawHtqyvhapRWd8/txOxG6OE0K7IRYXESVpj05rR7qjd6haNoQSR3Jj/dX AdANcN6QDyyaQ== Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-97467e06580so610507666b.1 for ; Wed, 07 Jun 2023 11:11:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686161462; x=1688753462; 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=Q8ymt4aVYk7+c3UhjbPSUCbNsUrFX+gS8T8907goBG0=; b=YA9r3asQW2vJRmjqdpTm5o2dHmhZ2qzc89UmtQw6IJXqNHlBGH574ceD1hRogTRDBO D1QW1pfiQLHTUXQNSkTSbro5ZxJ5hKCYSjPq4FMyxJVoSn6LmEOlKh6DYNVEeg6YYbON /Sql1sK3GJMX66ISr3XvrFG3mUY2YD4BWK9MhzqKPSfmiP7Wt8ZsZo+s5wtnjJpp3wtS lJIrks9nK9hvyKQz/OivCZUTiJG4w3Aug4+lvdv7L0JakDVRzYtt9KgMDYDEAOMy/BuB XlOy3T55KoHnyNegkMIjC2oHe2B2vh3C+37AfEPT4vyweaTgi6jRmffTkdVMoWEbbiOp YQ1A== X-Gm-Message-State: AC+VfDwlcfNcUGgfnzmdZCqLJ/0kw6E7xcwj2z3VRUxG2DRe9PwnDlCK f7bTsT1QDQ+YDYzad1hfM0954BsIoH79IX0vAvwsp0AdaHgHZxmRyLBe1fFI/KjsSrmWJN5bz9r L3j3HXFUtMFJhQoJ0kcFXb9dzSvqWwFyJ0ROKYOE98SA= X-Received: by 2002:a17:907:7f1f:b0:974:55ea:1ad8 with SMTP id qf31-20020a1709077f1f00b0097455ea1ad8mr7592629ejc.63.1686161462568; Wed, 07 Jun 2023 11:11:02 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5AO95yaH2w6TNG96NHW4iHdRlf1vZtWQEuXgXYJPWouo+o/lvalFHXgEOHSNKj0+5C3pDw1w== X-Received: by 2002:a17:907:7f1f:b0:974:55ea:1ad8 with SMTP id qf31-20020a1709077f1f00b0097455ea1ad8mr7592617ejc.63.1686161462384; Wed, 07 Jun 2023 11:11:02 -0700 (PDT) Received: from amikhalitsyn.local (dslb-002-205-064-187.002.205.pools.vodafone-ip.de. [2.205.64.187]) by smtp.gmail.com with ESMTPSA id oz17-20020a170906cd1100b009745edfb7cbsm7170494ejb.45.2023.06.07.11.11.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 11:11: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 v4 13/14] ceph/file: allow idmapped atomic_open inode op Date: Wed, 7 Jun 2023 20:09:56 +0200 Message-Id: <20230607180958.645115-14-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607180958.645115-1-aleksandr.mikhalitsyn@canonical.com> References: <20230607180958.645115-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 f4d8bf7dec88..d46b6b8b5fcb 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 = 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)); @@ -662,7 +664,9 @@ static int ceph_finish_async_create(struct inode *dir, struct dentry *dentry, 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); @@ -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 = ceph_sb_to_client(dir->i_sb); + struct mnt_idmap *idmap = file_mnt_idmap(file); struct ceph_mds_client *mdsc = 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 |= 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 (flags & O_CREAT) { From patchwork Wed Jun 7 18:09:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13271067 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 4A543C83005 for ; Wed, 7 Jun 2023 18:11:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231734AbjFGSLb (ORCPT ); Wed, 7 Jun 2023 14:11:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232841AbjFGSLK (ORCPT ); Wed, 7 Jun 2023 14:11: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 5BE341FE3 for ; Wed, 7 Jun 2023 11:11:07 -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 F17613F120 for ; Wed, 7 Jun 2023 18:11:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686161465; bh=sitF6aKufbc7DklTCjus/+uMnJoHcKEt7G8gHEJda3g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=N7NNSLDJ2nftMuH2rWNI4p0YhHM5oYWx8agupH1lFLGYd1MM3feMEGYucrtbpmvQa fTQhi9NB/mE/H2zLuCPHSIixNJHs4TXTQsQSbR9vQJQfoZVpDfSjkXAYEDVelxumT7 ONwT8AaBiW0WJpv0+SC1BATzfZV27zu6MQ4kRQv6EMX11w2bi2F0VG7MqRyJlo0W05 00AxeXQsSvyfzA2ptRduOjOtXSJGehDk1vH4v88Um6jY/TkTnLXpmx1w2wDibGk1/2 7tHTRlGqWuO6SAD77WBisl3TC2jn+wrKciiBJLx/p37o7TJYxOgvSRYw5XBz42QpuU oM3esVZOPQ6Ew== Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-9749b806f81so473005766b.1 for ; Wed, 07 Jun 2023 11:11:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686161464; x=1688753464; 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=sitF6aKufbc7DklTCjus/+uMnJoHcKEt7G8gHEJda3g=; b=YMpnaZ3/6LyTqI/9ZkOP4LmoPNgf3A1RQIbssQDlpogXVGLWBQWhw25wR7l+a4BEzl pbeCfgUX7BZ9oZOJWDsCrxn6SADtZsaDGs/ITv5ky+muutiFr4Yy6JwDI9iSzycyF/TS SVpa92ZLHevRqjO90Hw9xyz/0dAiahuDCuRtoBMOBp/1KGhZn97EoHN+Kn4JF2witEd+ bDkOMjQeEBY+pYqZ5P2j2xxb7ED8ETdxxY2G9KbpumxzzRQwt8/Glav6+IW3RYybvJVM KNTllqi9/IUq15Rwp43KqvaZjwupC/SWrsKqz0cJJWHqrvK0VPwMNS9M0wxEoQJqdTxO adIQ== X-Gm-Message-State: AC+VfDy9HSz2zvn83lFUwFwXfuJVMq8P1gaATtSewImllrtMa2RuGGqW lCQU0VXNzpG0nmmpiWEwd+BapZHTe9rVoZ0JPf2tvfAupaLSwio1PUZmWNbpyuXNtjshtY8ICoy igQ+//91dzhEA0oHTrRBkQS/+gApLJUEDONROSVLftg4= X-Received: by 2002:a17:907:3f9a:b0:96f:8666:5fc4 with SMTP id hr26-20020a1709073f9a00b0096f86665fc4mr8344020ejc.50.1686161464803; Wed, 07 Jun 2023 11:11:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7nkVS7ZYAZ2Uqeu+xxXRJBqJNHMUbuyQOiZzF6LyCbvyOJsxfiv60u5P1yL7Rjjj7ZaBQFEg== X-Received: by 2002:a17:907:3f9a:b0:96f:8666:5fc4 with SMTP id hr26-20020a1709073f9a00b0096f86665fc4mr8344006ejc.50.1686161464604; Wed, 07 Jun 2023 11:11:04 -0700 (PDT) Received: from amikhalitsyn.local (dslb-002-205-064-187.002.205.pools.vodafone-ip.de. [2.205.64.187]) by smtp.gmail.com with ESMTPSA id oz17-20020a170906cd1100b009745edfb7cbsm7170494ejb.45.2023.06.07.11.11.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 11:11:04 -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 v4 14/14] ceph: allow idmapped mounts Date: Wed, 7 Jun 2023 20:09:57 +0200 Message-Id: <20230607180958.645115-15-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607180958.645115-1-aleksandr.mikhalitsyn@canonical.com> References: <20230607180958.645115-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 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 = { .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");