From patchwork Wed Jun 7 15:20:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 13270855 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 1AD83C7EE23 for ; Wed, 7 Jun 2023 15:21:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241323AbjFGPVW (ORCPT ); Wed, 7 Jun 2023 11:21:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241308AbjFGPVR (ORCPT ); Wed, 7 Jun 2023 11:21:17 -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 520FB1BE5 for ; Wed, 7 Jun 2023 08:21:16 -0700 (PDT) Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 2E29A3F15F for ; Wed, 7 Jun 2023 15:21:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686151273; bh=GFNwWvhavDkNrI4eqwez7OWrv+w+Iw1WNhnwQW/Fw7E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pJT5VSzQ4Jc8ISxu9rRfZUr2TH9gC3qGbNGviNkm3IYTUg3WY4rifXg0xDnHGyp91 /d8zeFr9rb5P0tnIKOThMvlus0dIeLzQm46Pwl4a/Uc9BmDqorw00U9Sto29CPLs9E kwht5ZOTocrpQXeh5/Mt91sJoV4ysaBu4c4OTMoiSTZxxcpmSHujmBALbEeib+KJK9 cDJRrBsTCiQIQlVg2n1qbFtWhlJwLE1T362Z4v82hryTUCpSr7UHnKXb/woBikd7ii gsot7ALTVlR25/6QBmkJoA3wLMsVWwv+CuyfIA3ovtLTEssbl5nRHBsJkhx0ZoaB7a JGI0EShK+fmCw== Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-514b3b99882so910853a12.2 for ; Wed, 07 Jun 2023 08:21:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686151272; x=1688743272; 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=D2+T/Ky5f2Et4pN86JlDU3FSLY56uJXIpgmzO2dPAlktfLRUqplH/vpKvBcz2YNJOa 0tQjPler07rPfq7irL9BimgS+r46cD7NYwQ0Ur06u4f77n+axW6yXafAl8Koz/TPLpRD Bm8KI4pEKHgQyT8w1K4MCEPq35sXbKMBBvnw0enKoq+SRlFbCciY/pMzkRtwGM9DNB9Z SZRnZAjf2DAhdcIWiXvb8sKVHqa62d+bH9HiiyEaTj6ZfycnjmfxnY8/xs2R6XuqB16P vb/6DhpxOvdVkfGNLiwitTWsIrt7J1hjRIXtzfi1bKFCz96wloRHeeGpIOOK4pT3L6IJ ZqAA== X-Gm-Message-State: AC+VfDwB5MmDP3AnThtCc6L9xZMCE1Aaac1EspxCLRoYhagq7wCZZ0A4 9K4Ui9A4++I3qk34YsyT7Borvr3VJRZc+bWL8uLHCWrs+QMA1kKHda9cerKKbCE83994PnMgRkY 1gNID2ryrWjRqR5xmiIYTKyL4g0WM0NShPOROPNzxBms= X-Received: by 2002:aa7:cd7c:0:b0:516:6779:263e with SMTP id ca28-20020aa7cd7c000000b005166779263emr4537591edb.22.1686151272830; Wed, 07 Jun 2023 08:21:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4dpYMt3JYto9yLks+ZG+I130K/g+WZgRN6Y3XMwqISsXKgnAW6IDB6O05RQhUDAHLrifqk2Q== X-Received: by 2002:aa7:cd7c:0:b0:516:6779:263e with SMTP id ca28-20020aa7cd7c000000b005166779263emr4537575edb.22.1686151272576; Wed, 07 Jun 2023 08:21:12 -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 w17-20020a056402129100b005147503a238sm6263441edv.17.2023.06.07.08.21.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 08:21:12 -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 v3 01/14] fs: export mnt_idmap_get/mnt_idmap_put Date: Wed, 7 Jun 2023 17:20:25 +0200 Message-Id: <20230607152038.469739-2-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607152038.469739-1-aleksandr.mikhalitsyn@canonical.com> References: <20230607152038.469739-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 15:20:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 13270856 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 6EA2EC77B7A for ; Wed, 7 Jun 2023 15:21:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241311AbjFGPV0 (ORCPT ); Wed, 7 Jun 2023 11:21:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241314AbjFGPVV (ORCPT ); Wed, 7 Jun 2023 11:21:21 -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 925FA1FC4 for ; Wed, 7 Jun 2023 08:21:18 -0700 (PDT) Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 1B2F23F15C for ; Wed, 7 Jun 2023 15:21:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686151277; bh=fRWJ/KMFF26C36Dkjhg/LzbtMqzlyKNGjI+Q2GqWstI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=V1Ff3BPEV8KTqjZ3lC12iPMVUr4IGgFNa6yBvib0AM4JrEfyxLvHN75YKU1hS3Kdy lMcZgnxfw78+7vd/C2J7DPd3N4QOoZJ9wcpxOl10/KBTJGEGHOtRPHGsuu24K6yv4M 7a+tfmQkY+kjq6sP+EI0mtF9tXJppeOgWyAX9TFAszNn+FlHrx+aUnUsjVY1lT8/en M4Azyfq/TiwD5v5YT8TH8NTmDcwuqKbNhn9XESYDhSMmUX3JcNDdiKPIu1KkWii3IO 7rjnt5s7is+ZbiuoX4zsYpuwgoQoPgaaY6hWjnKwwhC5EIbSrnJUuJpoLu7PlxY5SQ QPIO9hWFH5n3g== Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-516a17e29efso286138a12.1 for ; Wed, 07 Jun 2023 08:21:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686151276; x=1688743276; 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=fRWJ/KMFF26C36Dkjhg/LzbtMqzlyKNGjI+Q2GqWstI=; b=aM8jsNMqapuCSrKZCcgVeZOfid9jvB/dOPe88xlavSA8nzcHnh0VUvEkWbiryC4TyK Dae/+vzJA/NV2XfkUU+Qk1LeGVL2Ou0dO5REiXrJ+LZVAhlDmOthvthz95oMZagVT0N5 C38T5P/TFEUiLeM1BeA2nIszVX50Pjp4SOJC+FAMVlOd4XDAQlcmq+93JAsEtw/Oiscu tOmI3VIHcJx+jsod0S9nExVp0eg5Ptw1NNbIIywSEjww2YwUJCsfxS9HBcLFyeeJgyS/ coSAFnKd83vTY77MF3RPZSJIS6qBKltMwmzAkumc6Evavjm81pKPOgKaig3+pkjWLSEK Dqng== X-Gm-Message-State: AC+VfDz8sh8NrsJ56tZV+idrU1lUVLNbTn2Ey/sZxvrbe8Uja6FWodw/ onrgyw7hbmK2J+2pbRuvmXp1ZsiICEZxQ5CqrKTHxYSkZRVnt+L26iQigQM3wOKcr63hwr4V1hS 6C/fe51q0Og7hdFW0iULMaZaBP29aLhPQ3kzF1GIAgXI= X-Received: by 2002:a50:fb08:0:b0:50d:fba2:7265 with SMTP id d8-20020a50fb08000000b0050dfba27265mr4999122edq.16.1686151276215; Wed, 07 Jun 2023 08:21:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7NG1+7oNUL070e5Y2tOTLH7AP6HsR/R6XA9VHEAuvdEg/ihuA+9d3lvLxkxs+GGdNzAysGQQ== X-Received: by 2002:a50:fb08:0:b0:50d:fba2:7265 with SMTP id d8-20020a50fb08000000b0050dfba27265mr4999105edq.16.1686151275926; Wed, 07 Jun 2023 08:21:15 -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 w17-20020a056402129100b005147503a238sm6263441edv.17.2023.06.07.08.21.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 08:21:15 -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 v3 02/14] ceph: stash idmapping in mdsc request Date: Wed, 7 Jun 2023 17:20:26 +0200 Message-Id: <20230607152038.469739-3-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607152038.469739-1-aleksandr.mikhalitsyn@canonical.com> References: <20230607152038.469739-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 --- fs/ceph/mds_client.c | 7 +++++++ fs/ceph/mds_client.h | 1 + 2 files changed, 8 insertions(+) diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 4c0f22acf53d..810c3db2e369 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -12,6 +12,7 @@ #include #include #include +#include #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 != &nop_mnt_idmap) + mnt_idmap_put(req->r_mnt_idmap); if (req->r_pagelist) ceph_pagelist_release(req->r_pagelist); put_request_session(req); @@ -1018,6 +1021,10 @@ static void __register_request(struct ceph_mds_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; + else + mnt_idmap_get(req->r_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 15:20:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 13270857 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 36427C77B7A for ; Wed, 7 Jun 2023 15:21:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241355AbjFGPVk (ORCPT ); Wed, 7 Jun 2023 11:21:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241331AbjFGPV2 (ORCPT ); Wed, 7 Jun 2023 11:21:28 -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 A70971FC4 for ; Wed, 7 Jun 2023 08:21:23 -0700 (PDT) Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 1CBDD3F15A for ; Wed, 7 Jun 2023 15:21:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686151281; bh=klosnYawm7HKpMeQ+EKOPzDFx/5FP0DO9dizuv+SUyg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cvXakYT3DJW76iEinDk+bcoOidbem8lUTbWLAiBfXmLLn6YYjk6DPAmyfxMwxNdOp YksQlMnMeWomvxmwzI3P89A8+h/yhOVFsG4MWEe2Bq6+AaYGZVMflXkoPoeWwmeShN ipbHnVCDDBK1cNBUUAN+HC4QYVv2yLb/U9q9brXOJYgT5u0jyQhUSgZaCrYy5zWXsV uQX/VKAV5C1LfwVJpB4z2vxDTxmTAp0wJRx3FGiVhDzGIW8eCrKXfVHDjut6y+Cpt+ r8p2m32lWH0d0usu805QhFt1ladNNUHRv0rLv5hNUFY4UtaHNoSlzB8ljSWGMuNywV PCiGzsSZCW5Qg== Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-51496307313so917779a12.1 for ; Wed, 07 Jun 2023 08:21:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686151279; x=1688743279; 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=klosnYawm7HKpMeQ+EKOPzDFx/5FP0DO9dizuv+SUyg=; b=chNvOVi3onJaLO5HhdzRoZfc/qVOec7MKLvBvLLi97ASCp5oCpdv6+4bTH8c4kgmTO cQQqzLMBH3JdcjjpmnpI/8tr+Uzu7F8E+LAVn9uiMyd9CvLp5kRMxoUIkmy3pxGttlZT VlGdVnGy74+eRagwpJktfTDzVZOnrHgE/prawDA4ML7WCNkkmYnspaztc1fhh+5IPbxB A92o2wc7AVe7QKNLpoqtb3Nm5t/832EF1iQl1YCswdOb5mCGA/l+C/id3SBEMvXQybRD 3ZFb6hu8URX1CG8RkVR6kk0hz7b8eCjT2Wv3UBzYVrHmcExY/wvoP6KamkhD9I4d2kcy yqsw== X-Gm-Message-State: AC+VfDxBSwpqA/YQLrUi1RDcS/IzMno3ut3LRHW87LnM2gt3SdO1gmSs rJ1Ct6t704Nhn6r1wCTkeEDZfqqmoqb4Ngf+gHcbUTppPWAQgbvY1GaPHmPaA6XlESntkaYKI4e jqNGDc6peY3bzhb3ImAMk7BdxwldXfTQkyXoT2wfyxXE= X-Received: by 2002:aa7:d0ca:0:b0:516:7b3f:43b8 with SMTP id u10-20020aa7d0ca000000b005167b3f43b8mr3986960edo.17.1686151279495; Wed, 07 Jun 2023 08:21:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7nS//Wt3yIATHM6xOPzdKXnYlXVcN0fHo6eChXhR5TgAPDZZndGsW763XTZ8TkOawkJiIxtA== X-Received: by 2002:aa7:d0ca:0:b0:516:7b3f:43b8 with SMTP id u10-20020aa7d0ca000000b005167b3f43b8mr3986940edo.17.1686151279268; Wed, 07 Jun 2023 08:21:19 -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 w17-20020a056402129100b005147503a238sm6263441edv.17.2023.06.07.08.21.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 08:21:18 -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 v3 03/14] ceph: handle idmapped mounts in create_request_message() Date: Wed, 7 Jun 2023 17:20:27 +0200 Message-Id: <20230607152038.469739-4-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607152038.469739-1-aleksandr.mikhalitsyn@canonical.com> References: <20230607152038.469739-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 810c3db2e369..e4265843b838 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -2583,6 +2583,8 @@ static struct ceph_msg *create_request_message(struct ceph_mds_session *session, void *p, *end; int ret; bool legacy = !(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, @@ -2651,10 +2653,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 15:20:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 13270858 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 A0DD1C7EE2F for ; Wed, 7 Jun 2023 15:21:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241315AbjFGPVn (ORCPT ); Wed, 7 Jun 2023 11:21:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240107AbjFGPVd (ORCPT ); Wed, 7 Jun 2023 11:21:33 -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 146441FD7 for ; Wed, 7 Jun 2023 08:21:24 -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 9CD9A3F0F8 for ; Wed, 7 Jun 2023 15:21:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686151281; bh=61DFfawCj3HGFJsReurDN7P2vYgJDYyfahDHmmx8fag=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JSAZiIXwxfBpViPn/OF2KPke7uOrQ34kzcSDmQd/IudYehaMnEFGfkTOqu7hMF4sX bUj9CtL+wBDBPFon80qDPmW9BS7OKqqyuqYhlaAb9L6UbZ3qwpges3Fl0m20arxg4b rhXQORo8BCiIbiq/nQiwmi29q8ZzJdYDi19b4aMxds2nYh6u8431w0aFPsY3p/9SPt 0nhWa2tYMMtMWTds22SkBO0oXbGGNq8fsi5PWZ+SktQ2Ljr7aVjzHJpwuALj+rKIl/ R8NTLkVf1bqFsf23GVLOrRlj3yhX4Uv8avTlxKh2Ja6BxZ99uimLdHbs3tdIq1iC1x u7Or6iTzG2SeQ== Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-977cb78acfcso361400666b.3 for ; Wed, 07 Jun 2023 08:21:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686151281; x=1688743281; 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=61DFfawCj3HGFJsReurDN7P2vYgJDYyfahDHmmx8fag=; b=JR8CE1zwEEEU6Lxl6pYXn2ghalcM12HKiowXpwLMiZVI7CphssvVGVSlJijduCEjAw INSA6llCqx594Ir3NndaTzL4LF7+rsaPBscZ8HwyUB4GfYD7ZR0ykQS7CWAF33rPyOl6 eYqKdETHULBfHI7UOSqN3VbNch3caH9QGedWY1tr6LNJuX1Y3wzAsbv5vMM0dZUBS+D6 rZeC6XitvbELVfABtoiSWjCMUgfhyLCrQCSUu7wbbqdgwAimFzON5nHBdFNToFeRK1s2 /7TKsWKNoECGkM76aLOZKix0hjcPTNDwuvqWpMIw5aZ4J1WXfELeNssRpJDmp9DV6H4m WuNA== X-Gm-Message-State: AC+VfDy5/cJUAMZ/ADz6wauuuAciCvAHI3eJ4hzgnSeLL9e7Vsr0UTEV iUsx5rHtfMMXHM6QiRbrDkVUbE/+qKtkZbDwtzQo9muZyxhbS8e4uxpq1XV6PC4coXVcNYl2JJ4 AKKe0Rqjx3GLbodbjDpcPiG0l3cBCfxr7QCjtKhMxOWU= X-Received: by 2002:a17:907:97d6:b0:967:2abb:2cec with SMTP id js22-20020a17090797d600b009672abb2cecmr6488797ejc.64.1686151281357; Wed, 07 Jun 2023 08:21:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4NxqHb7zbbbgKKCIgUNRWQ9EnUGowkrrNsCgPXtuxOt7a7blhZ9JFrVyuZ5X4Fkx09tgkKtg== X-Received: by 2002:a17:907:97d6:b0:967:2abb:2cec with SMTP id js22-20020a17090797d600b009672abb2cecmr6488785ejc.64.1686151281197; Wed, 07 Jun 2023 08:21:21 -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 w17-20020a056402129100b005147503a238sm6263441edv.17.2023.06.07.08.21.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 08:21:20 -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 v3 04/14] ceph: allow idmapped mknod inode op Date: Wed, 7 Jun 2023 17:20:28 +0200 Message-Id: <20230607152038.469739-5-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607152038.469739-1-aleksandr.mikhalitsyn@canonical.com> References: <20230607152038.469739-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 --- fs/ceph/dir.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index cb67ac821f0e..8d3fedb3629b 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c @@ -884,6 +884,7 @@ static int ceph_mknod(struct mnt_idmap *idmap, struct inode *dir, req->r_parent = dir; ihold(dir); set_bit(CEPH_MDS_R_PARENT_LOCKED, &req->r_req_flags); + req->r_mnt_idmap = 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 15:20:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 13270860 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 66ECCC77B7A for ; Wed, 7 Jun 2023 15:22:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241416AbjFGPWC (ORCPT ); Wed, 7 Jun 2023 11:22:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241330AbjFGPVl (ORCPT ); Wed, 7 Jun 2023 11:21:41 -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 886432105 for ; Wed, 7 Jun 2023 08:21:28 -0700 (PDT) Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 5C8F33F15E for ; Wed, 7 Jun 2023 15:21:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686151285; bh=E1ad9bQ1aGlayjQkBmzknmBzpwDvRLF1iaTT0A2Zyj8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZwSXdLpL0mrWFzrQMp+z7rIb0KqAFx8thlU8sx8/lN4Dk9lPSXrhNjIXWhU1LrlCk +KFnpGBKovYgBJEpVnvSUe2N8ufeQCPJ1MofgT7jOp9f7hiyRFyW5hYyJOLaWRumZS AmxjYwjZvSJCsSrp+dWblaYEkDR1/ApznOtN+2oglt9SLGMH4HzYzI/ndIc1WZmVU7 sAUluamgc20ReUa3wmIWz6wrXXUky2y2OfnSs1ylsokw2osaX6GJOsWKB9H7lNrzoy yHjuoFKKG8WQaZvNdSke6y0URRTY7oilZXw1r4y3cyj8ni2iAJDoPc6Dk5/GbZHapu K7YOFd4NtcL8g== Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-5128dcbdfc1so919987a12.1 for ; Wed, 07 Jun 2023 08:21:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686151283; x=1688743283; 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=E1ad9bQ1aGlayjQkBmzknmBzpwDvRLF1iaTT0A2Zyj8=; b=YIMbKw+ME7gDe7b1SIXllOPvwcBATHaCcUAgybEqSKI7l29SgvjlrJd5yN7Vv0K696 d49QBgozASpaCbET8C0tRzp2qocx7Tbk9v0Xdzv/XTQjrTsn3gsa/eJJg1xa0CUFG9Tq 41HgwU7NMei92pq39nmzRmZ/aDo5ETSEjT/iyC+Rc63Ls6TfF82t+LlCpb5zGlFIhaOU B0Z591ZNn7Ii7JQb05IwvSzDE0J5mPPnizElQ8q+bmo7svy310DgCKfEHNPEWCFR4Yd3 YEC8s3GdGnlu+Jmt6+TSFMzmLfopbpmY3Waw+iLlwnq4ZrN2fTEpmdTfRcIaOTV0y+TG h/Wg== X-Gm-Message-State: AC+VfDzuxtGjdo1sxwfVhUsBKaAaahkyyZrXKXrQ64Adjxka7UDMbyCl muQhqb6/glYn6coM6Sp116REWdDeLM1s2a/zaD5r4+Tz1yNUyvkG3fh0acsp1E90uMKHEPRn3AA 5fY/svuS1De9RmPWJo7KNaIcbLY5klGfcolKmTvZHbcg= X-Received: by 2002:aa7:d450:0:b0:50d:dba8:c64a with SMTP id q16-20020aa7d450000000b0050ddba8c64amr4485734edr.18.1686151283817; Wed, 07 Jun 2023 08:21:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7FsbB/VMu7FXOSfXOBHP9tswUg4dyT9SVSoTyTpn3BCc8/hYEvTcd57G89c35Nc13dQtyncg== X-Received: by 2002:aa7:d450:0:b0:50d:dba8:c64a with SMTP id q16-20020aa7d450000000b0050ddba8c64amr4485727edr.18.1686151283632; Wed, 07 Jun 2023 08:21:23 -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 w17-20020a056402129100b005147503a238sm6263441edv.17.2023.06.07.08.21.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 08:21:23 -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 v3 05/14] ceph: allow idmapped symlink inode op Date: Wed, 7 Jun 2023 17:20:29 +0200 Message-Id: <20230607152038.469739-6-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607152038.469739-1-aleksandr.mikhalitsyn@canonical.com> References: <20230607152038.469739-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 --- fs/ceph/dir.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 8d3fedb3629b..3996572060da 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c @@ -956,6 +956,7 @@ static int ceph_symlink(struct mnt_idmap *idmap, struct inode *dir, req->r_num_caps = 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 = idmap; if (as_ctx.pagelist) { req->r_pagelist = as_ctx.pagelist; as_ctx.pagelist = NULL; From patchwork Wed Jun 7 15:20:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 13270859 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 775D3C7EE23 for ; Wed, 7 Jun 2023 15:22:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241360AbjFGPWB (ORCPT ); Wed, 7 Jun 2023 11:22:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241331AbjFGPVm (ORCPT ); Wed, 7 Jun 2023 11:21: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 B850A2109 for ; Wed, 7 Jun 2023 08:21:28 -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 2B2963F168 for ; Wed, 7 Jun 2023 15:21:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686151287; bh=Kha5urw9d/Gxl+fDAhQsj/xIrm9C8WieP3+ZFJ0DVAQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Z4nM2l6roavrRp7LNgZr74sYn1qoEcWSi+PYUkI5Jgn2QQxytOKgHrlBgsYnDyjeE j9732iKDmdj47bobcfV2m8X4a6EXmbGbIdkGO466CsApLxvRPHXyq/QPtePCvBXIow 0KzMTL0Pe1VjED/KJqT+75DAKSK7wjy37i3yrLkzsZKSIcMGahD4vqjbtasMXDN4nV bX0Us9H4+3m/4lnCtu0JFQmPlDNEzWkg6lLZqMtrOX2t8YkRpM+ogesOe16JGjIIPn k/v/NRAXS5epRxcRrN3CxM+uX90A+0fWmb7KKwGf2E3FKs4fqIaZomrSNYIna3mvlv C4En/QePT6G5g== Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-94a34d3e5ebso557958566b.3 for ; Wed, 07 Jun 2023 08:21:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686151287; x=1688743287; 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=Kha5urw9d/Gxl+fDAhQsj/xIrm9C8WieP3+ZFJ0DVAQ=; b=HiRpvjXuOiYqvvFuEoOU2DYGi5hz81laL6u/on1xem+owJF/fYl7D5aksoAs+0QEtm fHQy39m9/xJpylz7nEi3OCqHk5HDnuAlAN3pdLEOoHiGAED8435Q3g+xzQ7Fh/n315aw G1R6LdN00ZGG2ojUevJpZ2R/rIOPz5LG0cdTBce94jJnYSICNpICQxsYNOz8ldY47S6S eXaaIYR8kYVVVwwgKIvWXuwRM/W4cuHP7GFb5P5SxGW/sqfKinBmBL3J5JQ+rZ4UsCOz NMuphcKEp8i4Y3XoZHk9s/EvEdlIY37EyNhhRuUPmQ6uZByO5xqmmtA0hC/fdT0EEkr9 rFGQ== X-Gm-Message-State: AC+VfDzGWbL4C30Bu4Lf9ENyOcTfNVVfIqJDONQpDX65FG2TXbSqgqs7 PsT4UOHeIXpS8KJyvJHr9L4BYhQSyE2XkhyXMBgNFyWuYkshDyrEWczoQxZj+LEzQawyIO5+qq/ t89/eDeWyINoIpdRQOu4diPbfljBst+oKVzvLlbkrhXg= X-Received: by 2002:a17:907:a42c:b0:977:c406:f8cf with SMTP id sg44-20020a170907a42c00b00977c406f8cfmr6913168ejc.73.1686151286898; Wed, 07 Jun 2023 08:21:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4opZd+c+tXbZyIBoUugLdIZSxNDRO0vi7mdyAqK7TwwXhagKxrhh6oqHquRATGTLAT44fPPg== X-Received: by 2002:a17:907:a42c:b0:977:c406:f8cf with SMTP id sg44-20020a170907a42c00b00977c406f8cfmr6913155ejc.73.1686151286736; Wed, 07 Jun 2023 08:21:26 -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 w17-20020a056402129100b005147503a238sm6263441edv.17.2023.06.07.08.21.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 08:21:26 -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 v3 06/14] ceph: allow idmapped mkdir inode op Date: Wed, 7 Jun 2023 17:20:30 +0200 Message-Id: <20230607152038.469739-7-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607152038.469739-1-aleksandr.mikhalitsyn@canonical.com> References: <20230607152038.469739-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 --- fs/ceph/dir.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 3996572060da..a4b1ee5ce6b6 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c @@ -1024,6 +1024,7 @@ static int ceph_mkdir(struct mnt_idmap *idmap, struct inode *dir, ihold(dir); set_bit(CEPH_MDS_R_PARENT_LOCKED, &req->r_req_flags); req->r_args.mkdir.mode = cpu_to_le32(mode); + req->r_mnt_idmap = 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 15:20:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 13270861 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 710A4C7EE23 for ; Wed, 7 Jun 2023 15:22:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241369AbjFGPWG (ORCPT ); Wed, 7 Jun 2023 11:22:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234955AbjFGPVn (ORCPT ); Wed, 7 Jun 2023 11:21: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 4197F2121 for ; Wed, 7 Jun 2023 08:21:32 -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 786593F120 for ; Wed, 7 Jun 2023 15:21:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686151290; bh=MB2dlVGrYJEf0FHstDBST6Gse7KSG/9oFtyn7KqGZB0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YYsv9u0e1b+mPCkR3k9mK/3oE/Aox7728emkZ0lgzl4HUhJOHC5H//qMssRfX+W7+ diKZC8jWww2oTa1TbB15tCSs4Dy6Mi2VoeynFJ+jAbPP1X7tAobzpK44gv3fNnPsqL ZkLdm/G9NOJuJ8IH8DCufUgMdirUiaUiDMHj551XJVO2aZzh2NIwF4NfaFfoYiCKAM 5kAvWnX+/rFcaccsjpsDoLoHz/f0uE7nxnh8dAutAn5Y+It4iS099goUZ59Ga74cz6 pxyWAWraezt7kTzVmjsehNKPHGLc+8AfnY/VwbmtFgg0sqbBS5eVuQZgUTMhDKF3td GYC9ppNG9vXxA== Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-506b21104faso1054909a12.1 for ; Wed, 07 Jun 2023 08:21:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686151290; x=1688743290; 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=MB2dlVGrYJEf0FHstDBST6Gse7KSG/9oFtyn7KqGZB0=; b=dW86N569EmL2JTmCOl3IE7YAaxJi/e9f0FgfghVvUEHdgf/bLPLPRJNsWEGpV7UugJ sP16KP5qYcnMoQio5yWzwl7YXgH549CIX6b9GYK6JJ6E1rwhZREV45fftE+4Um338ljG ltequk2s2lbbciR2JLzwF2QoY5D7Vw1yH9tQlInGq2yvN+HbS3qopTUE9MIjetrMYBHq Yh3LEEKD3t/Emh4TfS9I/9z7xr7pAM/5VedLtXcKNDtCbC+opVAU5El30dNhOOOUX7CD n3fX6Bp4Oijj6DwWSuiSEuegx17fl6EDrotDLPTfkesc1SfcpjMZuvu6KFCc9NWxrHQ/ ay7g== X-Gm-Message-State: AC+VfDynfOe1blgQ3ymHmn/9NLa7nQ9TNiKS4kpvCyJuuekDIGiBWMxL qzYKhPeOoAN8+juxgcL7ybyXnBnM9hwvX9FAp6AuAXXaa/N01PJ4zpD9ET+/fnsrzRQ2RiUHBmH c7KyXKhjNUcaw2WVQP1/HbPGcwAvVa5T256h6CEkM/5s= X-Received: by 2002:a05:6402:2cd:b0:514:ae18:162e with SMTP id b13-20020a05640202cd00b00514ae18162emr4253310edx.35.1686151290090; Wed, 07 Jun 2023 08:21:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7jqqC9xVaRdu5/WUQNipAd3BmNtD1Mb5LzMQCfal+HfUkomm8HFG0027rulz8j1EMzFRM8XA== X-Received: by 2002:a05:6402:2cd:b0:514:ae18:162e with SMTP id b13-20020a05640202cd00b00514ae18162emr4253302edx.35.1686151289897; Wed, 07 Jun 2023 08:21:29 -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 w17-20020a056402129100b005147503a238sm6263441edv.17.2023.06.07.08.21.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 08:21:29 -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 v3 07/14] ceph: allow idmapped rename inode op Date: Wed, 7 Jun 2023 17:20:31 +0200 Message-Id: <20230607152038.469739-8-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607152038.469739-1-aleksandr.mikhalitsyn@canonical.com> References: <20230607152038.469739-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 --- fs/ceph/dir.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index a4b1ee5ce6b6..7ae02a690464 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c @@ -1327,6 +1327,7 @@ static int ceph_rename(struct mnt_idmap *idmap, 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 = 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 15:20:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 13270862 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 9CEC8C7EE2F for ; Wed, 7 Jun 2023 15:22:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241390AbjFGPWY (ORCPT ); Wed, 7 Jun 2023 11:22:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240445AbjFGPV7 (ORCPT ); Wed, 7 Jun 2023 11:21:59 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D194C2680 for ; Wed, 7 Jun 2023 08:21:37 -0700 (PDT) Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 2A31F3F12E for ; Wed, 7 Jun 2023 15:21:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686151295; bh=U9FNme5iBEpufhowdmn6D6u4P9E81AUlwyvYSH4GMyo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=f8gOeAMbpivqBg6h1yLIG7COpwwpv67J0yyCwDGQQ7NabqIaP0/EADlDgtif0P8OU pQXNxnhRoUIsCzaSXeKNRX3mw6l6GrQqm8P6uGw+Jxptk9kfGGNqsLRUzEjKss/R1W l/UQzs1XwnHD6dyBebdR4+wNB/uhf2SCsehfjsmXnZTgsO4sKqJW5GmintPQHAr5vy J3SN/FoUTN3ilcQGmX3JDjJnuS/yODrzmwIczpSel9ClteBm0ScVGU6WIg8QY9tRqb LTL3qyiYzE6Jx9In25GVMaLGorpEC0vuF2676o5JgUF/I40eY7QhsvnqglnzO0ek0y RR+jKaPhQ8uZg== Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-514b3b99882so911215a12.2 for ; Wed, 07 Jun 2023 08:21:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686151293; x=1688743293; 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=UX3n0o12wRwm/kDzYlV2Ccv375x0OGzHYyM30k//5mLANBA1O1P1F8w0a/RVp8uw99 1eHKjwfHLcDYA5kOsdvx6/ZB8iJxwZ1sJ25qjNTdHG+fvkh6Tsv/pC7tJt8hvYUBpTpB Je6XO2P5wnexn2RfH2BMBhB8wkIvB3ObH5zStIm3EWJQjDeTkvVkR0ARD0gMA6MOrzn6 gQg391yxNawjlBSP3GCmt4BCfkIjvCA0IPZ29SJVzIcoRG48pThm+iRl8pE0A3c/1Iit PplJmbZqZj2c9uVOzTwH5tsXSdK9UApRlNRqSBq6fwVvkCfQl/g2o7PWjaoqQF1Fdh97 T6BQ== X-Gm-Message-State: AC+VfDxlfjsIPzdndrbnTQbjicO56GNhxrZYQo5qxYzIcuHW7MXfGRTb /NVAaFYAW7EzQMvgc7QJcdEvymUXmeuAs9zWcI/QyutQOrqe92Zq/JsMBy2aqTfhN+I2EpFHPa6 E/A+e+9qm/DzDw3aqgL+XBwDf6Wc4O6Q8Z1RKxWH1B8s= X-Received: by 2002:a05:6402:405:b0:50b:d34c:4710 with SMTP id q5-20020a056402040500b0050bd34c4710mr5279762edv.5.1686151292771; Wed, 07 Jun 2023 08:21:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ukjxBPm2/4MAaMIFZIp/LfzmkwbPJlVYLJ2Ii9P7Wv40lR8G8Bfa9qw0g+oYTEKKG+D6Ssg== X-Received: by 2002:a05:6402:405:b0:50b:d34c:4710 with SMTP id q5-20020a056402040500b0050bd34c4710mr5279746edv.5.1686151292630; Wed, 07 Jun 2023 08:21:32 -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 w17-20020a056402129100b005147503a238sm6263441edv.17.2023.06.07.08.21.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 08:21:32 -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 v3 08/14] ceph: allow idmapped getattr inode op Date: Wed, 7 Jun 2023 17:20:32 +0200 Message-Id: <20230607152038.469739-9-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607152038.469739-1-aleksandr.mikhalitsyn@canonical.com> References: <20230607152038.469739-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 15:20:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 13270863 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 E6313C83003 for ; Wed, 7 Jun 2023 15:22:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240512AbjFGPW0 (ORCPT ); Wed, 7 Jun 2023 11:22:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241392AbjFGPV7 (ORCPT ); Wed, 7 Jun 2023 11:21:59 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C1842689 for ; Wed, 7 Jun 2023 08:21:38 -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 F11E03F15F for ; Wed, 7 Jun 2023 15:21:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686151295; bh=Yx9DhBwZ0J2oRahK7SO/c3VRSYe4JEpen4id9pbwqa8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=X9R0mgs06C1Gk2+anYw8kNZDpb5tRPWIghtL4PrsomqyLbHxWqU1194+mHRvi7T/k Iu0suS19pA22bYmPvt/KPPSi9CKE/R3aDYyGTYfyvOjbmY8SFmGnh/A2oEdx1Mj3Ue 6UVUMo+JxNYy19cRt/lV6FEfcureUVPiElJay9oCyT6jfS2Di2Mr8N4vJj6cVsbDJd 2JxtmpSvrXAUS0d2SoWjaqVVacA2thOsSAAUg27AmuMpURk+wywG3GhZvG1s3C0B59 Y1KDNMuEgi85234LflbxZ5mZ1vR1RMv6kRUTtENu/HKYDbBT797pw3JWmqxU+/AJOk 9BqRqAwy7KTYw== Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-970e0152da7so672998866b.2 for ; Wed, 07 Jun 2023 08:21:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686151295; x=1688743295; 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=RUQ3VGwcH4IajvW063ZJ0QwharFMwoWkMIyQc9YjeyJ3auSpFf02Nwkv479N3khGfn GMjA0zL+IPlcF4zybyTk8D1mSCP1kIuCO0+ffSEMX+bjICK742dZB/k1agRQF9LVB+eO lit2g9hro8PF7dziWWPsVosKaqjcQgbVvNs6LP6wuzzkTscr/YK7tv29LmdiXe4csN+V 4aaGSl/c9QceRLU5sZ/K9ANTTUFN8cL1lvhtqqgfaJshUTR1tocVsvf97+gIv+xdu9yu c1tKqeUClcNZV9e0Qa434mSSGEXoslkLRkLkLnrnf1MYpa3yaQ5KLGiQbVwkvMHBBKoh QJCQ== X-Gm-Message-State: AC+VfDxGpLrRZgVbr/xt/Cz9rVkGpuk22iFyzOTKEWV7/j40c4HxOwZK 5CWd6bjEjU9cPETOwlTE1bu9KJNU71c0DZn7tcigurVq81zyiEJNTj160x7F1isiO8t8jx0jqnG 0fV+firxiUa038CuOfuWPJ2LMkK0b0aJJW7n/hMIMI8g= X-Received: by 2002:a17:907:6e0d:b0:974:c32c:b485 with SMTP id sd13-20020a1709076e0d00b00974c32cb485mr5976948ejc.45.1686151295589; Wed, 07 Jun 2023 08:21:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Gb+vPiTJYMK/PKy7sRlG+qMD2Drcvffo1BNqJTZGhd9gTAGPZVitdUPSJ4nHcuH8eYNfmdA== X-Received: by 2002:a17:907:6e0d:b0:974:c32c:b485 with SMTP id sd13-20020a1709076e0d00b00974c32cb485mr5976932ejc.45.1686151295416; Wed, 07 Jun 2023 08:21: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 w17-20020a056402129100b005147503a238sm6263441edv.17.2023.06.07.08.21.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 08:21:35 -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 v3 09/14] ceph: allow idmapped permission inode op Date: Wed, 7 Jun 2023 17:20:33 +0200 Message-Id: <20230607152038.469739-10-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607152038.469739-1-aleksandr.mikhalitsyn@canonical.com> References: <20230607152038.469739-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 15:20:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 13270864 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 18B3FC7EE23 for ; Wed, 7 Jun 2023 15:22:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241340AbjFGPW2 (ORCPT ); Wed, 7 Jun 2023 11:22:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241405AbjFGPWA (ORCPT ); Wed, 7 Jun 2023 11:22: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 17AD2269A for ; Wed, 7 Jun 2023 08:21:40 -0700 (PDT) Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id B10763F16C for ; Wed, 7 Jun 2023 15:21:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686151298; bh=UUJj01wMEQ1oyKBsNssb6jfIoqp09AUl4ugwx+FKVfQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=TIw6UWtnr1SLhxTjMs49RToBvNaTUkQRCMvoPMPcFRbFlIJx0STyIwzHfUBWMjNqr 0PMkD1hiBoSyaWOuwjIS8zMsp+gpScDAltaC82h2QbdkuWADNkEwlPK/tUdRGZWMkY OzQtkhsjbOv+2AZdS43uYVvo92AfUXJmW9WeDG71x/K+R/0zRHVDK+6ZlgbGDQswRC peM5rG23FWikxBeOglvDspXh/ROdWbwvaQvnKE2OlZfRTCOF4T2z4bp/u3N49MGX08 90R0dqeETJHL8jiwwewGt8GQ65iAXuhLOZUvdRTGLOGXH6oPaI3kNlaBncn40OmxLs CVdKJCwL9u7mg== Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-5147d242f01so1014799a12.0 for ; Wed, 07 Jun 2023 08:21:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686151298; x=1688743298; 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=aMhZQZulg1GjOmKpvJ7STUJGWGlmQUBWhW/OG6yr/pZZRErv6FgdBJGwIn4UL2I5Vr zsL8uOIeS3hkijxhRBNM7NfIOaaMQGo61hcaXfbIPo76mtvO9mETMnlcj8u20o6Vtyxd 8yNGqkIzzyT8SV5wzXqVDu2J0f3kJj7Ai0fMhb1QuZvm4AgS01jcW7BZ0pckKiUE7iMP esmVYlqz6tuH2PduPJodOSQZ1/rEUMn/e1loRlBIlQwftRKEMimxcue6uEEdlkxO3Im7 eDOA18ipn1kOLkDMoN0W+6TbwdSxfP+0p4YnLWZ1e1fW9ObZ1iOLnXfiintPvLXF2A/7 SIdQ== X-Gm-Message-State: AC+VfDyGq/mwpgMIqJTd/CLBcSMwWufsM4gUwgJVGly7vh32S/VBo0o2 XMIO7zGIq1WleHMVcbIc0QVOZZfme9DiMd4qn9jShbb/AYmGxbafmc1xKjdTbVGSXLjssmg21gz o10uVv64FjiCnA0cIQxQtZ0F5pGBASg+3RZHAN8Qnie8= X-Received: by 2002:a05:6402:40d5:b0:514:387c:930 with SMTP id z21-20020a05640240d500b00514387c0930mr17584294edb.5.1686151298005; Wed, 07 Jun 2023 08:21:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7l6JO7AWSlX/GunI0jDchwoV1/AcewroDVdILxl58nOntYmpe+COF6muPeK4aR5QqY6js67A== X-Received: by 2002:a05:6402:40d5:b0:514:387c:930 with SMTP id z21-20020a05640240d500b00514387c0930mr17584281edb.5.1686151297801; Wed, 07 Jun 2023 08:21: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 w17-20020a056402129100b005147503a238sm6263441edv.17.2023.06.07.08.21.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 08:21:37 -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 v3 10/14] ceph: pass idmap to __ceph_setattr Date: Wed, 7 Jun 2023 17:20:34 +0200 Message-Id: <20230607152038.469739-11-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607152038.469739-1-aleksandr.mikhalitsyn@canonical.com> References: <20230607152038.469739-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 15:20:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 13270865 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 3D6D4C7EE23 for ; Wed, 7 Jun 2023 15:22:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241410AbjFGPWr (ORCPT ); Wed, 7 Jun 2023 11:22:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241426AbjFGPWG (ORCPT ); Wed, 7 Jun 2023 11:22:06 -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 25FA1FC for ; Wed, 7 Jun 2023 08:21:43 -0700 (PDT) Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 93DF63F1E3 for ; Wed, 7 Jun 2023 15:21:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686151301; bh=aP80D7IJtF5T0WH6ImgNwtx1y7/GP3UA0si/dTzxF1Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mRi3m18Q76CrGvI81VPbZaBnwTFBqw3xeNS+sziZs+jRKr4zbJ/dNH9XmkaXAMMRw 9LjNuNMSbx5DqsqGjx+scbr3Vu/YHYwKCCMua5R4vGIZcYxTaaWuuMpDkBeRVTnUYn ZtjwnLY4PTDl9j2GaC4HcHekM3KMJD7iB3x5x8/q/eZs0UjvpW4iSp4l/CxJZvtz3c FPRYgYzr5ikCpaaVs1sPksb4+LvGaRJV95tHOvd3DwrHJ1XSupltQd78AUI8Imvq3D 26CcemUj6SzYj5jS6P2qs2hRIF9Rmz+Qf6rwJ1B3jJwnP1SLgcak3iTz8hlp78CNg/ olkJe8tt0w8Qg== Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-506b21104faso1055030a12.1 for ; Wed, 07 Jun 2023 08:21:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686151301; x=1688743301; 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=aP80D7IJtF5T0WH6ImgNwtx1y7/GP3UA0si/dTzxF1Q=; b=O+Kd32FfflOhTlBTiBesgdYSs09nXwsDNO4NQxH/Pf3ng2EG4cUHlUqFyZlhIKqGm6 87EtRQs+Ur/zlDTuW56ftX5Qzp67d8FbpLN3ZaDuJ2T0V6x8pfqchu4EBkCrt9opQ2Lb K/+4AAhVDUYLWrow363i0SFIlCS+gUINGN9Q77erab/EB9U8beK3yQp+ncmxLdup+DD9 okFF1UTuGk3fDqFjMCi8BCexK5rJ786749NXy4B7Ubiaas4NhayakurI+G+ls3qyaorI n2GZRi3gXop8HYumI1OKnL4CNfyu/knlrgrc6W/9SMFoHiZdvHzrH/9N0Mk1SiLu/iYc AfDA== X-Gm-Message-State: AC+VfDwUxR2dQjTQin5sxPZq0YuajJQ6ZJX1ZddbY2Zye9gS/e/h+TCk F9ZOuD9geDQ5EGNVDQRtUc/TTQBf4VNcbDOWuTkCsOTJ1C2S1cFDBfewKUwkkdDqKRJaWt+dvIw /s8Aj77htV/Xdk5Z5Mynb3J99VshuiC1wakEZih6QbS4= X-Received: by 2002:a05:6402:1207:b0:514:9c7c:8a30 with SMTP id c7-20020a056402120700b005149c7c8a30mr4752013edw.30.1686151301141; Wed, 07 Jun 2023 08:21:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5C/ocYU2yAPeNH8/65GFlsb1gg0GKVtLLnbC2OVeYGiRDh0YawOOodw8SZ7Vyn3ao+X9HziA== X-Received: by 2002:a05:6402:1207:b0:514:9c7c:8a30 with SMTP id c7-20020a056402120700b005149c7c8a30mr4751993edw.30.1686151300822; Wed, 07 Jun 2023 08:21: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 w17-20020a056402129100b005147503a238sm6263441edv.17.2023.06.07.08.21.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 08:21:40 -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 v3 11/14] ceph: allow idmapped setattr inode op Date: Wed, 7 Jun 2023 17:20:35 +0200 Message-Id: <20230607152038.469739-12-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607152038.469739-1-aleksandr.mikhalitsyn@canonical.com> References: <20230607152038.469739-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 --- v3: - reworked as Christian suggested here: https://lore.kernel.org/lkml/20230602-vorzeichen-praktikum-f17931692301@brauner/ --- fs/ceph/inode.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index bcd9b506ec3b..09c78a67738b 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -2051,17 +2051,27 @@ int __ceph_setattr(struct mnt_idmap *idmap, struct inode *inode, dout("setattr %p issued %s\n", inode, ceph_cap_string(issued)); + /* + * The attr->ia_{g,u}id members contain the target {g,u}id we're + * sending over the wire. The mount idmapping only matters when we + * create new filesystem objects based on the caller's mapped + * fs{g,u}id. + */ + req->r_mnt_idmap = &nop_mnt_idmap; if (ia_valid & ATTR_UID) { 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 = from_vfsuid(idmap, i_user_ns(inode), + attr->ia_vfsuid); dirtied |= CEPH_CAP_AUTH_EXCL; } else if ((issued & CEPH_CAP_AUTH_SHARED) == 0 || - !uid_eq(attr->ia_uid, inode->i_uid)) { + !uid_eq(from_vfsuid(idmap, i_user_ns(inode), attr->ia_vfsuid), + inode->i_uid)) { + kuid_t fsuid = from_vfsuid(idmap, i_user_ns(inode), attr->ia_vfsuid); 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; } @@ -2071,12 +2081,15 @@ int __ceph_setattr(struct mnt_idmap *idmap, struct inode *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 = from_vfsgid(idmap, i_user_ns(inode), + attr->ia_vfsgid); dirtied |= CEPH_CAP_AUTH_EXCL; } else if ((issued & CEPH_CAP_AUTH_SHARED) == 0 || - !gid_eq(attr->ia_gid, inode->i_gid)) { + !gid_eq(from_vfsgid(idmap, i_user_ns(inode), attr->ia_vfsgid), + inode->i_gid)) { + kgid_t fsgid = from_vfsgid(idmap, i_user_ns(inode), attr->ia_vfsgid); 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 +2254,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 +2269,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 15:20:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 13270866 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 AAA71C7EE2F for ; Wed, 7 Jun 2023 15:22:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241430AbjFGPWx (ORCPT ); Wed, 7 Jun 2023 11:22:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241351AbjFGPWW (ORCPT ); Wed, 7 Jun 2023 11:22:22 -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 E283126BC for ; Wed, 7 Jun 2023 08:21:47 -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-0.canonical.com (Postfix) with ESMTPS id 6EA883F22F for ; Wed, 7 Jun 2023 15:21:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686151304; bh=/It8VSgZDTEKktJxHTMOOJHpvqL0RXNtakCJDr6cWYA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hCeDkvYGU6xRGsrOc4Ic18ox0BtMFY8zZe5WlDqxyG8GcVMxhi/WdLlGCyQYSFXuy cId2c7agbk7mt2yV5m+NNOwSInC92Q8WNq2ba+phoXgtslBYEJYqYupNrhpxlpRPFP NMdi0FXAc+bfwg/3ygoxRaOZuEMAWmNZerSYNU5XR8VDpw8eJ0W2FJEivtCj70zHoA 5CfemDq4047lYEZhgsna1e/z3A+ZTN5WZ0E0aROmXw+b6qk+VlphcoyYlv9SARgGHO vFi04VDsSY8lPSHEN6IqKyfeqUgwZtm6jYpI18YHfOS6bAEqLyKT1nRO/urWWx/DjE 794s8gBfbOJjw== Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-514a1501b0eso834566a12.2 for ; Wed, 07 Jun 2023 08:21:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686151303; x=1688743303; 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=I+iWSSeeDqtGXy3fXKvgWxshiLk1E1MiTY7hJnX08MwQ+vK2Ug2tQdYQhwGKRJye8R u6b3L8HyN3QoC8c88hk1jm42gfcTMedzF2SWDHtV/UgnDzWUBHdnxTQCPXrQKPOcNYvJ m3kpp/IMW2fivF8CWvLmokMcWGsMWCVXddUI05LscCd+hbv25GDN1wDlQd+uqraWr1lB qNDEi+0LXQfUPp48ZzI9vDwGbH4A7BErpPefQLVitEQ9J/ohPVhxuFVbWhg2aguk3s+F FOUingTxZfW2F3ijWVQYuDVNQ8p1uuasfo4AomLt3HdMuBfMvVSSC6AX9Pqo0dTPAjcj XISg== X-Gm-Message-State: AC+VfDz3Vbl2RHNYt3C5HXrgGZim6iQ3Jxz7FKGS6S5wwD0QEh00ciGO YOJFDRs/JEp6zMGW74Xg/yUFLAVyKjdE6O+l2GLs0E1HM/MoglI9suPU6mTB8eU4L37dF3VsKJX vUkDYffLezNZHoWqEOvtpNPASk++IlQp9yRRajrUcH84= X-Received: by 2002:aa7:d6d1:0:b0:514:9b64:e16b with SMTP id x17-20020aa7d6d1000000b005149b64e16bmr4291081edr.35.1686151303273; Wed, 07 Jun 2023 08:21:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ549H6QwL6/dPEtGgtxmi5qPiQgs+YkY6irYHiRo8gsOZQw2QXXW6qBLDYK5KPmgsOY3/heBg== X-Received: by 2002:aa7:d6d1:0:b0:514:9b64:e16b with SMTP id x17-20020aa7d6d1000000b005149b64e16bmr4291070edr.35.1686151303150; Wed, 07 Jun 2023 08:21: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 w17-20020a056402129100b005147503a238sm6263441edv.17.2023.06.07.08.21.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 08:21: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 v3 12/14] ceph/acl: allow idmapped set_acl inode op Date: Wed, 7 Jun 2023 17:20:36 +0200 Message-Id: <20230607152038.469739-13-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607152038.469739-1-aleksandr.mikhalitsyn@canonical.com> References: <20230607152038.469739-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 15:20:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 13270867 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 558BDC7EE23 for ; Wed, 7 Jun 2023 15:23:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241391AbjFGPXG (ORCPT ); Wed, 7 Jun 2023 11:23:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241313AbjFGPWZ (ORCPT ); Wed, 7 Jun 2023 11:22:25 -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 148092713 for ; Wed, 7 Jun 2023 08:21:52 -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 E06153F15E for ; Wed, 7 Jun 2023 15:21:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686151309; bh=8yrq/kS6S1HbL22xkrZbDKXNe0OGSicmb8/p7/WTma4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Tr82GG5907vuuuZ+W26PJMKEM5TISV5bFvafEacdXcQemivJKlCUYkVA2lb8R4wnM sWu87Jx1GU8CRf5ng7U9ZrjcnD8DWhWpz/QqEbVUHjrZa12VCn1/5s12ys5pQvphb3 iKNl9eFV39S6XpNOmaOesJNxcm/DyPwbnfDhrut1neHi+NNUpCMg/X/kUbZAzurfIJ HBoIylF1KVmTlqSJYNorPST5+8B5LbNznMckE1y9kQj/HS7/9uinnxzCZmPXEur6s+ wgAxYa9fwQwv85OkyJQjhrOk9TVEEseYzkUb1lerBD0wflg0I/Ypks5JJetw6f167s DOeKZQXPoEuUQ== Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-97542592eb9so437022966b.2 for ; Wed, 07 Jun 2023 08:21:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686151305; x=1688743305; 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=8yrq/kS6S1HbL22xkrZbDKXNe0OGSicmb8/p7/WTma4=; b=Wa4Ez0pJ15zGII25nS4fS0JOOysKghJUp05PrRLfdNuBsXyQCubx7aNjL/U3vu9FJA Do54qWPWNS3j9BHSAW/wTwAQIo5PIqQz27jBXuN+c62KI15Dc/4Q638uTZz0PbGZnrrQ nvcanuuDp/bcQnxOweJfdTAxBqMs2itu4gL1nXnRsnSIxiefmT6A5najTE4npbsz7Fkx p76BwsVI7WCNu58UpWP+zyQeoQQrrLUh7RZpALup3MfokJIgBNEbhL1cA5q7VwmbiQV+ QFG1jqQB5XvMmyXtssJz4fMpF23HvTe46PHN787Kquncv128xWXcsTdPAcPkv+tADiN4 bCNw== X-Gm-Message-State: AC+VfDxkcWux+nj31sVFxl+fh63PuRGYUkFTKnsVE+ZaCj69fGosgou4 XBKYj+QgTjKyzF5A0w54PouWLQMRbWBfKFhQXoS/PYljo4j+GoQKilBQ/OX0bEEfpLftnNzx2jl 1thIb1WR/idBV68YY/wIUOt4cKYdU0ccppMkdpb0G734= X-Received: by 2002:a17:907:96a5:b0:973:d7cd:44ac with SMTP id hd37-20020a17090796a500b00973d7cd44acmr8178826ejc.54.1686151305694; Wed, 07 Jun 2023 08:21:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ggVe7wDE5SOQqDg+vq57il5KB0EjAQDxZT8QD29c6P56wPDpWnjzO86HAqhF3eNRy/maJKA== X-Received: by 2002:a17:907:96a5:b0:973:d7cd:44ac with SMTP id hd37-20020a17090796a500b00973d7cd44acmr8178808ejc.54.1686151305491; Wed, 07 Jun 2023 08:21: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 w17-20020a056402129100b005147503a238sm6263441edv.17.2023.06.07.08.21.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 08:21: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 v3 13/14] ceph/file: allow idmapped atomic_open inode op Date: Wed, 7 Jun 2023 17:20:37 +0200 Message-Id: <20230607152038.469739-14-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607152038.469739-1-aleksandr.mikhalitsyn@canonical.com> References: <20230607152038.469739-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 --- fs/ceph/file.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/ceph/file.c b/fs/ceph/file.c index f4d8bf7dec88..f00bfda4b1d2 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -654,7 +654,9 @@ static int ceph_finish_async_create(struct inode *dir, struct dentry *dentry, in.truncate_seq = 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 = idmap; ihold(dir); if (flags & O_CREAT) { From patchwork Wed Jun 7 15:20:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 13270868 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 52E0FC7EE23 for ; Wed, 7 Jun 2023 15:23:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241352AbjFGPXM (ORCPT ); Wed, 7 Jun 2023 11:23:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241077AbjFGPWm (ORCPT ); Wed, 7 Jun 2023 11:22:42 -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 D27AA2724 for ; Wed, 7 Jun 2023 08:21:54 -0700 (PDT) Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 96BF13F160 for ; Wed, 7 Jun 2023 15:21:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686151311; bh=sitF6aKufbc7DklTCjus/+uMnJoHcKEt7G8gHEJda3g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gXxaEYo9XDdXvT0eOneywVFsSzrWPGAD1iO6HtSMLBInRX8i0rldTOPC9DMygDJFE j1R2b+s4EO48DB8gcXDKo7fm1DeZCiY/MCtnrnIMqGOpEbuCx9uOFO/AgscFZm6yw7 GOa/Glu4kzrdgqWjgH3Ul8Mz3EjFfENi38Eq3GAXvO6+AnVbSDEIcWw6qqunYxG5yc 609SXo5AvfPCV2Uk4wB+yE4ExFZp+D16IJcMIO+rHXVPuThyuid1VdSviD8wIBhhiQ Hh1gcCGJkQUNWLDhfqOiAFyCjOei9FXsz673kEZGVxURKFp0od1F785NvKCKqL9k6m Gtu7LWRHx1b8A== Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-50daa85e940so1121290a12.0 for ; Wed, 07 Jun 2023 08:21:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686151308; x=1688743308; 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=kWBvisKZRI6P7YHap+FelRaDdnGP982bpAf3NTKkHpSgQQTFHJh7fCNKINbqNLPhWL TG8Nl/eYT/8ZYNmRKiqeYZicZJwA0Lhg1bX2LN2gVskXjeRD/ETiTkbXqjuPvkUnSAij rDy2onBl+H0LH1Zg7rIZL/41lV7/rMKu92/3d53CnAU03quypiCPBMq5j08CQ0Pe4rO2 DlgLCQQFtqqTA64UoCrzywRNpjaFoJEQJXXNV8DGR7NAVtHDDFPMziNwoufDFxzKk6aM maG+8TWb0+eREQyr+MsdySvZ5UE5fk7pxcQS9MvH5kSzIPsOYNplpom3moI9pExrVFPe 19Bg== X-Gm-Message-State: AC+VfDwGo4U9cVHUZxLllnZ6AL810Yu6im39HmkHl1R3Rp1EfId+z4LN RG7v7zWKsJDhA3oF6QJedYVSnPXTGnABRTOW+RB6+q2jEfCJkmF0Opz35m2TUDaHge6vaptuneg zoXgGKg4/d0r7E2VfgMVNXmFJMdabUUf4sizN1v2t620= X-Received: by 2002:a05:6402:31e5:b0:514:9422:37dc with SMTP id dy5-20020a05640231e500b00514942237dcmr4479647edb.6.1686151308084; Wed, 07 Jun 2023 08:21:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6RVi6/fukZeNZcvZRzUwSUGXDPAwHYX90ZNHPzdh9z1jOlvF2lCQ3DOS9NFUQhNAtgVCXjxQ== X-Received: by 2002:a05:6402:31e5:b0:514:9422:37dc with SMTP id dy5-20020a05640231e500b00514942237dcmr4479639edb.6.1686151307933; Wed, 07 Jun 2023 08:21: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 w17-20020a056402129100b005147503a238sm6263441edv.17.2023.06.07.08.21.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 08:21: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 v3 14/14] ceph: allow idmapped mounts Date: Wed, 7 Jun 2023 17:20:38 +0200 Message-Id: <20230607152038.469739-15-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607152038.469739-1-aleksandr.mikhalitsyn@canonical.com> References: <20230607152038.469739-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");