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: Aleksandr Mikhalitsyn X-Patchwork-Id: 13271072 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 9274CC7EE2E for ; Wed, 7 Jun 2023 18:10:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232484AbjFGSKl (ORCPT ); Wed, 7 Jun 2023 14:10:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232480AbjFGSKg (ORCPT ); Wed, 7 Jun 2023 14:10:36 -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 2C77D198B for ; Wed, 7 Jun 2023 11:10:34 -0700 (PDT) Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id CFB223F19A for ; Wed, 7 Jun 2023 18:10:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686161432; bh=GFNwWvhavDkNrI4eqwez7OWrv+w+Iw1WNhnwQW/Fw7E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QZsZNJMfAW/P0rvAl7554+mCWRe3HjI9fYa+LijJD7nGGZb9sYswTh5zXkIjAIbMT AzYuwc3CbUtCYIpONBHfVhVx4qbskX3udQu5S+lKQpqMzP8Us8mi6rcKR/NGJiJQFq 5UlSoroSqp6IfHEKoMRcgWALR+BBa8eF7zX9HNc9ZpJPKIye8XPlytfu+QYj+Pv5bx jzraMcNShJDbhCDisJJizXhn8HBidRyb4RVx9QdrSzOvZKStqxabHz3rlQeqQ5jSdI eplW8FiCA/i+ED3op46k5vvL7ngurizEndnHV0ZRWdmIhjprAbsz5N+i2iuLe1h7AE fKVmgSZXI0IPg== Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-94a34a0b75eso572878966b.1 for ; Wed, 07 Jun 2023 11:10:32 -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=KuTjfqKS5iR0YpcHEm+v6DDipwwXa8TABGOcjTLAVp1Oc+hmcEm4TMqbgZl0CiKGj+ XjMVeztyeHPC7EwkLFKsrxWRTm7OocKGM6pEmRMFSqsZyiClE2jX9UEmYmN4q2bN0MWF 7vpMUHDvVxlh9Ggr68vgTvaR2J4EEs9BP3ynxXj7NUXemW3gC8Fu7MWka5jNaq07vnsy ZJinHhMDcF4aCjvMPW4RMrUUmGo5K80DSkHzpDdQ1wHX1QiMc44wliVxnG0w1LQN+Ys/ la+zvDbLLn2K0/7WNCTwG1xAL/Ybz3Ykj9/oU6CNXXEI/tEHVSr5CohmhVcuRDttRjvG 8Fcg== X-Gm-Message-State: AC+VfDxMvoRQRaBp6LWj3XqUEP5kSIdmTjuhp2IePZ8hvsvCzcfS7DW4 ndyOCdfo7lDckAWRAIejW0qqsC44JFXKlk3JzO75t/UeVvbJjMtH5yCCZ027j4ukumFm9NCUiKU CnHCoa5HJ3y+oMABm4+oyS3vRn1TXNsvF9F3NKm9mdZgT99k= X-Received: by 2002:a17:907:7288:b0:978:780e:4520 with SMTP id dt8-20020a170907728800b00978780e4520mr4046883ejc.20.1686161432030; 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: ceph-devel@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: Aleksandr Mikhalitsyn X-Patchwork-Id: 13271073 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 7F212C7EE2E for ; Wed, 7 Jun 2023 18:10:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230488AbjFGSKn (ORCPT ); Wed, 7 Jun 2023 14:10:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232518AbjFGSKk (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 B717D1FC2 for ; Wed, 7 Jun 2023 11:10:39 -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 890123F160 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-f70.google.com with SMTP id a640c23a62f3a-977c516686aso503019966b.1 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=Fu1DpOCUMM65G6pFLwdAGRANqcm5atAoiwtZvsFTV/LbSvwCePoK8aAa6NBkOnmGzr qCNVkgd2Hb/WLdNcSihqjPUeEaNjDyrcC67G2coe79jtjaCXtQqkuJjFsX2lD6FeKxX1 z+ylvAw14Hn3ltayonrDoJXshAAZHzNCIxsqRYgielC/R0UUlwk8S35YtKgOI4LxKVHJ fcuU1CHbD5grOOrsbKI2NpwucJrnXeYNXKefQyB+xJHK7ACbSXXxo36Uy2O0EbQ5vKd1 llFwE/MaQTdOUGaMPvm+tprSypLbw1K8hjLEX2NJSYYnTy/Y6cOoNok0QjRI6nnbH0vC tnNA== X-Gm-Message-State: AC+VfDyMAsd1FHWCcFgRKWg1zvWlIKLYFNXSVemgZtXQ6O1wPmcyuf79 B6mksZcx4HqOls//W+Juu3vByV8889k3bKf8s0u9PV03vIz/edx5oVOgx3ukcC29vpMVqTAwaNi vMdac0X2tvMPEmTLG+XrW29m08xFhihWltE+XKzs= X-Received: by 2002:a17:907:8a08:b0:973:d1cd:933d with SMTP id sc8-20020a1709078a0800b00973d1cd933dmr7874769ejc.47.1686161435287; 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: ceph-devel@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: Aleksandr Mikhalitsyn X-Patchwork-Id: 13271074 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 A476AC7EE23 for ; Wed, 7 Jun 2023 18:10:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232560AbjFGSKp (ORCPT ); Wed, 7 Jun 2023 14:10:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232463AbjFGSKm (ORCPT ); Wed, 7 Jun 2023 14:10:42 -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 BA15E198B for ; Wed, 7 Jun 2023 11:10:40 -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 6FE003F168 for ; Wed, 7 Jun 2023 18:10:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686161438; bh=MVopSiFXJtuCZDFmw4k6EoX9EHPj+DJ/m9lrNV/HJJI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ocMF7JmjzVFNwrLuMxXmaa8JrJtb47Q6wq20lNpwtu4paVhR9//ALM0B2fkvmr+lm svOBAI9w9UUgcrP5Rk9N+aKGiCwpszqDjQEkAtfJ8BR2D1wYtQ0m+f3xuikIwGcd7s 9YpUqzvx0WNc06acVVisaVDv66aKv0lS5n4UAmJEgtMpHj3h8/SttYtuc8j6NuNhry hZFTqfoKaNbBykecwPG8uuqfJ9tYvnHrVW8iCGb7n3B20uUXLu0jND+S/j1WY3O36N KX2b46/4iM2mMBXXlbgUEmHBBUXixIpOOSYVFy5BLCgEhXO8XUQf6pxxvBVLzpLmow Gc9xW1opkUUMg== Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-977e50b0120so326131366b.0 for ; Wed, 07 Jun 2023 11:10:38 -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=M+8cDAyNRr7hcXwSYpLBTxZ5bBi0GaibwE/c8dUr4HX7sOE8jqqXN4budE10hvKt8v h6vci0wvHW0kSTIRicy70r3BGqLtp9LeV60zCv9HCGOH2WrqyAaViZH0eXCeozewbvrQ QsUtiwhnMmviyWeSDFCuRYCVn03WYoYp5MKXm3d/mSO+UyI4yg3IkgfcH4wg7zRlwt1+ uNLhBqR4j69N4fHKRd1CbfiVVEX6BRntrStAutRIusxZhuhROZTy4FBZK94b4BiJCI30 BSg8L9/awNNptJgyhaCIZIu4EvVkV5dB68o975oOEWFlhDFCVulz8+GxO4B0b1S5/1cR JdMQ== X-Gm-Message-State: AC+VfDwAC3saXSw1gQ5oJjYw20NkNFoY+XmtEpQ4IfIRJJbWQeSW1CHF NZ4S4vxSYAdZ3iHyLOERBch/RLIWtGokymvcGl4xfN1ZDSE3VsdgO4Z/PLbNozXhg1TOLn2Hidu dVZfoI84Sf020eegC3Oc0PQwAxfOgOnqe+48vMGI= X-Received: by 2002:a17:907:1ca5:b0:974:55a2:cb0b with SMTP id nb37-20020a1709071ca500b0097455a2cb0bmr7864119ejc.55.1686161437457; 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: ceph-devel@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: Aleksandr Mikhalitsyn X-Patchwork-Id: 13271075 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 D3B7CC7EE23 for ; Wed, 7 Jun 2023 18:11:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232673AbjFGSLD (ORCPT ); Wed, 7 Jun 2023 14:11:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232542AbjFGSLA (ORCPT ); Wed, 7 Jun 2023 14:11:00 -0400 Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C5E71FE3 for ; Wed, 7 Jun 2023 11:10:46 -0700 (PDT) Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 633C93F120 for ; Wed, 7 Jun 2023 18:10:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686161442; bh=iEnhNZXEpvf6z44xxB3rnp1IhVt5v+qShuvQ8nza8PQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YasmJgXZG3E0HmxlVrzH2xTR8xVIHtxJ80CKsS1O5uJR4aIRZmV3RdeDUXsfVr9zU 6KzWC2QcvkFYxoniG8Cky+ubEN9MX5uC75zL+bre7z5K1B3hoNkYOlwwaXxhRuBYuI zfnIBPL9u8fbjZXGHItEFVO3eL0OtGRtFdtSgf+1mWQcvBbUtTLClFRv/whM8SRTKB HMKBGgx9DpUSrPDh6+9Pn9GsNH6IWbqOVAJYSa9xox2aB75et/1ToAt3Oc6MbZeEyz 6/DQwCXEEVX42zgxezfqhAFrAYyL/0KkyV3ZvIZPB3M47dcmvw4JRJuL9CyEgjjeO8 vQiZKcpMa1UmQ== Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-94a341efd9aso692731666b.0 for ; Wed, 07 Jun 2023 11:10:42 -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=UY2L52vWBypNyKQy3wXBvLE4kjkUs8DOtjbLfk6rutD4p00SNdAAnzle9a7Q7Nihqv nnZgnh9Pb5DPktEhtRXNPj5Hhys4K1kKh+EfDMlKkOUw98GGNkXL64hwEQMicYBL4I56 7itX25Eb5zyBCgVrAv/mT4tZgxfkCBO4ldioVRcywa6fvGha6k+FE5btQqVPLOfduEWV xSTNH+Ao1bB7e39T/QvNj+i6kCShtwnKSIFQS/bZnVdWGpCkCXqd1zFLe2V5pd9Aoffz NLjArJGO/kUscwC4hPUshJTNgWlScQG2cmKQU6YqeDAThz4/ULLUA9IhjA4T21Hx+wC/ 1YOA== X-Gm-Message-State: AC+VfDwSYsJmJAyVrgNHh2b0sMv2k9VcJF43QCn/OcrShkCSXY4VNcj9 +oNgroC7oHAkgUS9sUomLfXtFooT+UKFl/rLTTvUsnqKgaBLy4OfqMq5LGzxRywmorJqrL1DgMy 3x+PB6dorJDISE0iL5NlZvVz6LRGEG2hN3duhwgE= X-Received: by 2002:a17:907:6d98:b0:96f:ea85:3ef6 with SMTP id sb24-20020a1709076d9800b0096fea853ef6mr7344058ejc.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: ceph-devel@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: Aleksandr Mikhalitsyn X-Patchwork-Id: 13271077 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 415CBC87FDC for ; Wed, 7 Jun 2023 18:11:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232776AbjFGSLI (ORCPT ); Wed, 7 Jun 2023 14:11:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232606AbjFGSLB (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 171011FFE for ; Wed, 7 Jun 2023 11:10:49 -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 7CFB73F199 for ; Wed, 7 Jun 2023 18:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686161445; bh=NiXISWdTTKqrASGu11LnECL/5NzVPnT3d4irPieP8Oo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qjYmZwqPLPnWJp3rp5Og5Ah3yN53lSjD1SE6FBm/6eowdok+jnD0RPwl+l0P92P2T LNoF+ESn2HPHv/0dJYeCepvyyOiyenDx/OJxK+wBgXPUL5a7sa+VnvkP35lg3YcQTY KDZcXzDyZxoRD01Vaoq90EZ+SGrzqCg6KJDud2zmhmBm4D0Z24FCIospMsljK0frB9 ItdbROs2pA3OoqyL0QboiRpOr5VoqJapBhx/bj4cVFnuNP5QTH4p8ulAjeSRdhD1vU FejnXDe98/lszO+jZPuIU7hCmntXQqSJZxtHXVCemDB5T00d6GjYz7W1hw1x8tmCiD LGwk+HmsBiJRg== Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-975942c2a29so463455766b.0 for ; Wed, 07 Jun 2023 11:10:45 -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=Kk9q7/pkSya5PO7JbqiPfwxflcxjcSqT4pSyt+XbvKPptSQdaIr2tHZbCN6mGb14+A LiMkSPEclWYQ1cGLtvdLKQDx7f1rD8NIPNnXCTIZaX7ocrGwLKLHCTuMRunxly5iwvu6 yTR9Squ7zwrhiPMV/Q/mOcvKIfExbCXbIG/K2eL5lQUqHaRVGNi7EaEz/uE4zozVBzmS PjowdQHOCdc5h52GHRiIgxZPUUml1ChaE7ZkG41YA2t2mXc2k0pLCtZjCuk6VwNi2pCN iKaadkohqin57vQtHzmWINI3Vw1IJFiQ1MahWVeBz4xbPtjvSumTSt74Raa2RmEwDWOZ SkHA== X-Gm-Message-State: AC+VfDzinZcmmDbb/Nbwc1oVFvTjSOVEtnsmUjLghxlnxYYvBbGzPvFy LTEOy4NoyoQbdUsxPfdWb3r54Y3y7Du5WV4WX9Zxz+9pxRyBZXYd4uiySKtKMN5FydkoNkMLdkn qWGrSW58rzmy42Mis3lozunW7D9XzRzqTvnHvHwU= X-Received: by 2002:a17:907:7203:b0:971:9364:f8cd with SMTP id dr3-20020a170907720300b009719364f8cdmr7198752ejc.44.1686161443503; 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: ceph-devel@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: Aleksandr Mikhalitsyn X-Patchwork-Id: 13271076 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 10CB0C83005 for ; Wed, 7 Jun 2023 18:11:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232691AbjFGSLF (ORCPT ); Wed, 7 Jun 2023 14:11:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232594AbjFGSLB (ORCPT ); Wed, 7 Jun 2023 14:11:01 -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 EF3111FFB 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 9AD663F16C 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-977d0333523so459071466b.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=a7/j7DTEGVgN953N1k1FGowE+bqIcKl9DylvConxwptCd0aUe6NK1nek4TBP19EnGV UtnhXzQwxRVTN5zdjzPIJeaN3tqZrMTYgVGYyoMyEdGLgdlxqo3qhbfSh0uFO3TYxOW/ VwEjW0RYBAmMogSjCIuegkz+c8EA56nkzggzps/kZcfrwOI0IKxcwEFzYA8IQqOhwIy+ fDN2t4oeTV6ILSB9iZjYnS3RSDNQyVE333UV/o/GfOOmr/jBI0N6WK1Smoab7CxcltGv 0RZGQe81GiNS01loJeGVl4kw6u/k+KuH5R257tSz+BREzk2SzmWLqtEvXQ+axTtU3WrO uRJQ== X-Gm-Message-State: AC+VfDwdgdJ/8yRUz+gxufsrNgVjJB9IaT7VwfCo4P7VtMyV+X/vZELJ HfR8qah/5VG7Kg5J0RHuViFoUTYlRFFXFEIgqJX7sQspga8Uas6HGA6/lFDu6TfKGKLkduzsdlX HVNC+jIW4U/VhvfcP5dhs6pqgrToUWm5fSvSm7CsJboIDQaM= X-Received: by 2002:a17:907:3e99:b0:96a:29c0:8515 with SMTP id hs25-20020a1709073e9900b0096a29c08515mr7106340ejc.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: ceph-devel@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: Aleksandr Mikhalitsyn X-Patchwork-Id: 13271080 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 35404C8300C for ; Wed, 7 Jun 2023 18:11:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232633AbjFGSL0 (ORCPT ); Wed, 7 Jun 2023 14:11:26 -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 S232631AbjFGSLC (ORCPT ); Wed, 7 Jun 2023 14:11:02 -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 8EA282109 for ; Wed, 7 Jun 2023 11:10:51 -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 6489B3F1E9 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-f71.google.com with SMTP id a640c23a62f3a-97455ea1c14so540469166b.2 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=COHdxoT2h0Kaz15dxClT52UwfUSuUOPTf42G5jDdnMN1LtUnxkrR2pVxEeA7V3z3FJ J++XanKt2xl42o+s+w/qD0J4HXTSisljHPd9MQpFeP+fmNjp7GxZ63EmZpYhFeYjfu1F 1Es2krbJTTNSo+IWDJd0pfl7jsu1Cv3Qm4tOAbX7IKI3RJRulowCbas8PKTbjK522PrH q71KRgTKSdrUpQU1Q1QpruAgWolA5DKndW1hC+NwFdQukbExtliRJ+vQBYsC1Hu4jUrn +IcM216LhPp2a8JR7q+QVii3vwV6FI5NaUQO1FiITzC+JplThznRP778mUvDFSihCsHb ppug== X-Gm-Message-State: AC+VfDy6Fc6Zk7uuEMDHPREgb9k7UEmITkb+n7L72f3dEwzYa41eHmX9 jd5td0QypvuBgDPKAOROTYW6cK7q6/O2y/WI6l+HmtQzW1ji7jLzoZrX4B1hFBacZ57ic+y4amv uvigKgwXbXWUtln4GVktU5whT9edNJtfB0wEMGiU= X-Received: by 2002:a17:906:dc8e:b0:965:6d21:48bc with SMTP id cs14-20020a170906dc8e00b009656d2148bcmr6951907ejc.75.1686161448212; 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: ceph-devel@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: Aleksandr Mikhalitsyn X-Patchwork-Id: 13271078 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 296F3C87FDD for ; Wed, 7 Jun 2023 18:11:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229742AbjFGSLW (ORCPT ); Wed, 7 Jun 2023 14:11:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232663AbjFGSLD (ORCPT ); Wed, 7 Jun 2023 14:11:03 -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 2AE082118 for ; Wed, 7 Jun 2023 11:10:54 -0700 (PDT) Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id BBAFD3F19A 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-f71.google.com with SMTP id 4fb4d7f45d1cf-50daa85e940so1276765a12.0 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=aF4pwF5adFqTtTq908jptOvCw++rKgrJ3jveUxKetoo1p0dafG4pFtir3i06CHrYXP 8F+xGJXpQg1U7Z/JWAqgHYXRkmMDDlFuYWlKb8H/lwkbu5XDmmQsGQJLMhP7kEvzIsDh m+ypkmV/nvXjaSmGNbaIjZ2APWCsSI1o0O25nrpmTfqH1U78mVcQ9xVvUKDItEYKdtyR daiCQ1zar01hH90gHymcXA/0+G3xk67BS9dbSajwEkroM2FJ0Pi2OYV4yeEGbG6loaRT JEfGO7Hg05Un/MSvCwmWrY8DJ/oiTxJzRD/WrsbrkOQ1VxMt6swTwE5gIjSmj/xGlouT ej5w== X-Gm-Message-State: AC+VfDxUi2KsBfnfUstAbsjwBX80rmVVxHyFHm1oOcR3PBBrh6d51GKa y0ED3KbeSIIx40i4JefZMnxChRzHb/IKaDMXOSfTxAGThfQFHTxPYTVW2LtpcmvpsNCQXz743mQ wHbDkMa4gJSCVQVtOX7pf0fdw73lGpyeHbJcZktc= X-Received: by 2002:a17:906:6a16:b0:96f:9963:81ee with SMTP id qw22-20020a1709066a1600b0096f996381eemr7607929ejc.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: ceph-devel@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: Aleksandr Mikhalitsyn X-Patchwork-Id: 13271079 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 F1511C83003 for ; Wed, 7 Jun 2023 18:11:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232547AbjFGSLY (ORCPT ); Wed, 7 Jun 2023 14:11:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232681AbjFGSLD (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 6361D2122 for ; Wed, 7 Jun 2023 11:10:55 -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 7ED423F15C 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-f69.google.com with SMTP id a640c23a62f3a-978876e43a7so93914266b.3 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=WOwGqSWmazAeQXLMh3V0SM7vxtsoWQqKTFFHcLsnPQjQwDV+AxggVuH7KyusKHVdH8 93QqV9W5ufRp3MdJN3e7L6voSiBomuRwnkKgcJgqNVubAl9+vwvHOvRR+HEHiuhgMVu1 +62IN8T3+lrXw6QyZo+Vg9+UIQ8uO8x7K0I57mpNLoEqtuqzeq4GJ+wLALJucQA2YunH FodZzX1zHi/kk3B4JUqzPApYZUsZe1VQSGtqlPuefTOPDf9kAaT/ARd/KtY5PPqDAf8l xW0wEwFLMnx/tapSt2+a7t9e0F3E25c3jpRjb7xC6fvvjqDCntETVxGbO8fjGiz1I/VV Qt4A== X-Gm-Message-State: AC+VfDwJmji4dIH2G6ejzhCyJoOZDtD+2ucCnP/X2J6OIFJstswOVt3n A8Nb8iAUzS8Hc8jp9UzgzfrT1seV6nmNptd4Z63zF2sGjPIJcAIsZKko9yAsE/5ZiG9WgOg6O8g 9eSAWVriIIHBAhTmcm+XMmlRzH2sWqyIp4BFkuFU= X-Received: by 2002:a17:907:3da2:b0:96a:3e39:f567 with SMTP id he34-20020a1709073da200b0096a3e39f567mr7202638ejc.47.1686161453349; 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: ceph-devel@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: Aleksandr Mikhalitsyn X-Patchwork-Id: 13271081 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 BB4BFC83003 for ; Wed, 7 Jun 2023 18:11:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232653AbjFGSL1 (ORCPT ); Wed, 7 Jun 2023 14:11:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232731AbjFGSLH (ORCPT ); Wed, 7 Jun 2023 14:11:07 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F7282139 for ; Wed, 7 Jun 2023 11:10:58 -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 E4C903F15A for ; Wed, 7 Jun 2023 18:10:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686161455; bh=UUJj01wMEQ1oyKBsNssb6jfIoqp09AUl4ugwx+FKVfQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PD2zrpH/96Hfsg5V9OVI4R/qDxJe9QzlcEt4+KK5b/p76cnGUZRN3DO568/+GmWKN VI7mHX6Ur7cq8Ytvr0dUoFGzxMHpKBrKN2ehm3Qm1Y/BVSStdYw97QXARvzuewcIO1 DE9jgbeheqF0Lc8hbVgT0EM8l8W7NCrMpgA25pg/tmj2e/2ZlRHOZyi6O6WzddEkhN jsmqqcn+tXZy/AtV+9L5MI7h9z7hCZKH9GgIrvjcDtEoRYRVWn9YK49zNf08PCpnlE U6N7O5ekdPzp0mKs1bEWPMOF3FaxA+g2af2p5LLqvgstjAOjo7fU8zUGKyaNP2OUlq 5dJjnrgV24+8Q== Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-94a34d3e5ebso572094766b.3 for ; Wed, 07 Jun 2023 11:10:55 -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=H8A/XOIan3LDxC+eiKu3aiOvkqSO1B5dnze5sSMJdkwgmeS81UZZGaB4vyAXeJdUqh mnNUVja/ykJecIrDj6SgDFPYEBExTKnTDW+G+xtgHBJ7x3HBKmBCSQTilLFpk9H6JLZI DXQKrGh1AjaKJYfEnRHnvCUU+ti5Xqrlw5FGyrFfIAVHdpxPdYouB5A5ABxvEw6rCbTs paCzFoHCwrW4w2d7fLE0LuUHwKpoYQKLc92SoMv8ArdwCjvmzK6mOOlVh6mxV3fItqvC Asif+t9Ec7YWX0FXnAj+igkaYG/ylN1umPsDqMXruEXw4XtkU4mT+n2CYRCTzboyzh8d QtQg== X-Gm-Message-State: AC+VfDwbBnIwaZtYyD0X79fhMLYCGm17uIYZa8WMge97qq8+A+S5N2sw IgEViaI8Nk9CLHVamVyV7TTyr6jK6bZ85zvV+Sc6hbkW7dlxFzYLiFScE8hjyENfu9QfFWVHTNP axmLEx+5H/snsKp2gz/AaqnXrIbI60okISMYWXj8= X-Received: by 2002:a17:907:7e9e:b0:974:52e6:93cb with SMTP id qb30-20020a1709077e9e00b0097452e693cbmr8404013ejc.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: ceph-devel@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: Aleksandr Mikhalitsyn X-Patchwork-Id: 13271082 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 37682C7EE25 for ; Wed, 7 Jun 2023 18:11:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232681AbjFGSL3 (ORCPT ); Wed, 7 Jun 2023 14:11:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232763AbjFGSLH (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 F1AEB2682 for ; Wed, 7 Jun 2023 11:10:59 -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 9FB2D3F0F8 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-f71.google.com with SMTP id a640c23a62f3a-97888a89775so74662166b.0 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=f3/hgKJcnRg4MZiByXIONWelvSaVM40YM1PwJQBe4YYfHbGUDxylH1Vchtkai3GX2n GNtsznLuaME9fDXeAevuNvnGcgwS1oCghXRVnxhRamejSvb17gm9JTLxuN1uOTyZNkFj xgAW48VuJza4Dj/eith8GPPS8HUOOtk6mj7LXhkKMOGDwuO9197jQM12r6hcMonxGaDK k0oYnQHncoU55F77XzHeeAeyp8aH6K8XnP0SCx5pYsvBBKOHklOxv2MxAdzVHNxblefy jikgCZV55kU/DPTHUtBNw5paZWJVUdd4/RUb9uhunu064Ajg+wkYiiH0ToEPgjBBNjXA Rf3Q== X-Gm-Message-State: AC+VfDyFYbAPmpWDv5YfO0scZeElWOpsXYpF8jfCD+wyhN+u8fEjbgxe fo2ma357ocvRCl5+rSu2ta+SHWsv7sjOQ13egdP6mMEBZjcYzCMAbYO1tfqA3/eTHMpgN3ySa6Y 8nWdk290tXOAwlZOBYX4gbqKy2Dom3gKo+kZ47NY= X-Received: by 2002:a17:907:1687:b0:96f:d345:d104 with SMTP id hc7-20020a170907168700b0096fd345d104mr8799377ejc.38.1686161458012; 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: ceph-devel@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: Aleksandr Mikhalitsyn X-Patchwork-Id: 13271083 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 857EBC7EE23 for ; Wed, 7 Jun 2023 18:11:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232696AbjFGSLb (ORCPT ); Wed, 7 Jun 2023 14:11:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232798AbjFGSLI (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 D004A1FD7 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-1.canonical.com (Postfix) with ESMTPS id E2DD93F19A 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=1686161461; bh=/It8VSgZDTEKktJxHTMOOJHpvqL0RXNtakCJDr6cWYA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nHsfOAM2JTgdYRXYMwvgVrNqXFmxcPJLy2hz/PsgwFP+vqTbNRiWAuWxhT3AGa87/ PF7aLiMkf2yCuUcKBGmXPky05NZJDv9EkbZI7YhigPg5czx0ZUmfdZJl3J3Kuqvb9z uv947aSvfsXGSD9ldetYGafHV1F6YUUr+uKY6Ca+EY1URK73oInKQK3FKubrMFLmMI HPo6KmmkispFyhTbK2NDCF/z4o5n6OMwJlBPmPreoiSr3JLcHbCCncyx7ZR6AGUwIW 1ttNVj7Uh8P29TY+k0esvUiH6kjiFZekSnGDfh4CWUr0p08q+z6e0kgXXl8LKpatkk 1EgmYOScgB/Fg== Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-977c516686aso503056866b.1 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=H1RNnjb7qHG0gPtrTDD3BHKzgLUN3KuZR3llPQBjOglkPVMTB3Vrqz4IS8QTbcPzeg FO7A7HMDqwMRKtysxNLWZGK9+PUZF4naTZPo35AUHNJX3Rdioz5OZBskbsuphZHpAxv3 OI/pv5Q/8IMfTcla7JgskS/fJUOM9DqhCMUJ4LZVbfYlUVB4pJKjj2lzkzYzru3mTUx0 6zKHEFsyZBJyoi/64NX1XAJnnUGlMZUpNKF1O3rV0OVcFQkVtRZ1+yw6gZxxAHnKbs99 OYw77ZsUS+VxXCiOdzu/Z3xtca0vVCKMS2g1k2TQWpuQmcYW5meGnrnB/wAbh8S1dchd dOJg== X-Gm-Message-State: AC+VfDznDUlkWkMatPbAFYZFuOMyYEV2tnySNsvnV/aYrZDBfIgtXm4x LcvR0VPLAt3pJhxvAceRPtWZV6X1iY8f3ZMfV5kvkKGfU+Y+93lMUPMF1UEZTfPbEcILMaDRwhO cdyoOCpSe98SHQ02Ff1d7Ur861lrI5OPpjNZK1VkYH6WYeJ8= X-Received: by 2002:a17:907:3e1e:b0:96f:b58e:7e21 with SMTP id hp30-20020a1709073e1e00b0096fb58e7e21mr7447667ejc.52.1686161460433; 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: ceph-devel@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: Aleksandr Mikhalitsyn X-Patchwork-Id: 13271084 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 DD551C83003 for ; Wed, 7 Jun 2023 18:11:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230151AbjFGSLd (ORCPT ); Wed, 7 Jun 2023 14:11:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232818AbjFGSLK (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 389251FD8 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 B29CC3F15F 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-977d0333523so459108466b.0 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=f75SkqTRelh+uM9ts6XaqJ+oEgCFXBCqGFZCdfRWh+OOUo0PaHf6sb/mCX14YW+/7J 0/t4OfP8IEhzr3hG7+0Qi+5uXy4wasfhYFQuqO1/tWuI4Q9gikJpKYtrUwOJYekWnkct mSzCzDZT7vyGQGUU9WQzRF/eQ+IMJEE6x1q/3JpSK2RxRb+bLQ0b5b5bVmQSaIz0UIJ5 gN6Hxo62NtKCmxKcGgNwxD3XSC0/fiBwuXGeBmJp4mOutSf79JISXNLJWMiG0pt/pwrs cm4C0CvduaLLJIh/K0STTYbCOifgkBsG1+bk7m4QBISQwuIpjwFXP31jR96K6YNzLGod 6RSQ== X-Gm-Message-State: AC+VfDw9acoqOROkvt2WzRhoNoUEUVEPOrrjbNfSA9MitNt1LGlxw8YB tqpU2FxItSkXBGEERMF2sxOevo4VZ8geT9iaxvL6UFRHvP1zz288POudr4yUThnig0RNiwM6c4U gHdn1CQH+YUTwp4Mjo1dGRZjDY+uVbZXZkbhQLb0= X-Received: by 2002:a17:907:7f1f:b0:974:55ea:1ad8 with SMTP id qf31-20020a1709077f1f00b0097455ea1ad8mr7592636ejc.63.1686161462572; 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: ceph-devel@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: Aleksandr Mikhalitsyn X-Patchwork-Id: 13271085 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 7561FC83003 for ; Wed, 7 Jun 2023 18:11:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230376AbjFGSLf (ORCPT ); Wed, 7 Jun 2023 14:11:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232847AbjFGSLL (ORCPT ); Wed, 7 Jun 2023 14:11:11 -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 04B391FE9 for ; Wed, 7 Jun 2023 11:11:08 -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 EA0FD3F15C 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-f72.google.com with SMTP id a640c23a62f3a-94a34e35f57so577183466b.3 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=VXXu3NPu0qrg+/T4YLWpPatkfrytEm3KhlJdjfNdsK6bMC5HLa0oGXeJuLkl3G0Wn5 mi4FQ+YEdW0VvK01KP4nvh+PonNDeq5edeNItXPQqxcI5+komLW5rZHQ13qlbJ4Xa7FO GS+bpf5Iff8YB3pVGLFFbEnWbR7aSS5bTQIGH9lT+lBQGv4VKIOj5zWsHIUVQm7Tf+d2 6ePSWMUAbZasJYi6tptF8MRDNSIjgUFf9g4A3qzpcjZaIhY4KqEtsllyY/yupabm7Fbc MI2pbBeg/JCCGH3dilZET8wD2LkOrlQa2exvk3GY8DUbWTy1C3JmAgQzRX0fEJYW7EIV EjlA== X-Gm-Message-State: AC+VfDx8NtvJ0fgLX5o75KHDxM00q8BsYLgU8BTlYDJJdtAJgiW3WDd7 yHsSeGw+vB5lb8BLspgJKxHv+8OrrfkhfkRBQWnK4uX+GkRnLmuD9nArytvrYdEf6bTbrb3w08V xoOBOmC6UARmGhCxdfbWqgmK2O4wvLQgzLbpNuLA= X-Received: by 2002:a17:907:3f9a:b0:96f:8666:5fc4 with SMTP id hr26-20020a1709073f9a00b0096f86665fc4mr8344026ejc.50.1686161464804; 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: ceph-devel@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");