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: Alexander Mikhalitsyn X-Patchwork-Id: 13270870 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 D94ACC7EE23 for ; Wed, 7 Jun 2023 15:21:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241302AbjFGPVR (ORCPT ); Wed, 7 Jun 2023 11:21:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241297AbjFGPVP (ORCPT ); Wed, 7 Jun 2023 11:21:15 -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 71ED31BE5 for ; Wed, 7 Jun 2023 08:21:14 -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 284B53F154 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-f69.google.com with SMTP id 4fb4d7f45d1cf-51496307313so917650a12.1 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=EWIwRrjaZS3PqFXw1cZDqZO9kyr+Y40jcR8WxJELatlrl2dhZlKTIIv5YXNBHMXeI5 5rAinxJ8FYFfD2oEKOL3U+xRXkcy2YTeDQIIqvohL51F8yU1E5yIiqF5JXTw/SNs8xox yilaLwPm/UG2XIXSiR08Hg8NX+FWe/4/xOJgcjhJVNHJhGTnO5kYBdbYp/bQZZ3/U4dZ K5zJtBB4w0hSAdtxBdJ++5yGpIzL9RS7z9YjYhsy4uUYILOCYcNhA+R4kPnQZm6PcL4E mHdyhgpahPPyZkHPuVwnxIJMC/jFm6MBo0PzqvAlxVOr701YT38e/L1u/4EB843xYDRV mMVQ== X-Gm-Message-State: AC+VfDx3FL7DIDjXmxlDpEg1F1V06ipHFEHjZKk1+dAEEdVUehJB2zDl G4wBzeGLDK26zd+Yr7Eg98LKTXECOqof3Qa9L7iuu69lUuWN0Lg/WFDKxCXog+3omm27qkbrr7v a4Ul6qFxB+xCgoAK6/u0107NOdMzpa43gOfllzoo= X-Received: by 2002:aa7:cd7c:0:b0:516:6779:263e with SMTP id ca28-20020aa7cd7c000000b005166779263emr4537588edb.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: 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 15:20:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13270871 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 11498C83005 for ; Wed, 7 Jun 2023 15:21:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240761AbjFGPVY (ORCPT ); Wed, 7 Jun 2023 11:21:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241313AbjFGPVV (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 929A81FC8 for ; Wed, 7 Jun 2023 08:21:18 -0700 (PDT) Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 26D9E3F160 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-f72.google.com with SMTP id 4fb4d7f45d1cf-5149ab05081so884563a12.2 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=DjmLrnkT7sJvZO5QXx34Cmy5Txgh6Mqkx99PzqYhhfrViOKr0paIhiCEjyUaFnoMuF Fw9ZjXg8Zh2WnHlxJsO4PaXpSyahxuSl1e4HEbbzbzO3eJGUIe+tBt7NrCc8TgWQsPXT AEirBvJOrI+bP1QUiBryXe2pRbvJ3D3LRiAn9f/YBWNueFXyzkhbscPaEEt/gBYwKThQ 6rL8mOG5VOT9oliq4ao0jxS0dcOCXJLs+Py+UMKBVLHb9GFjkrJM0IRDGF08vI3ywX5K edBFgLzjcJdOQVTV9roTiReJdS8sr9YpMWgaRoF8A8j//DauUFieDC+t2V2K2N5T+n1s 9YIA== X-Gm-Message-State: AC+VfDzMHKP+aQMGe1jgy7KEgAAJT4+2PL+xOmjN7LeIuZ9qe0RVyPww BT8rxMPdwSxFJCrNmMBbWF0DZAwJHEl/DX2AUd4uTaDy2Ow65CNqWCjxTwerJcys7vEigfqRlgl yj+se2VYmVm2wmIrHtFBiyJ6mYNTwdfunNKiXAsY= X-Received: by 2002:a50:fb08:0:b0:50d:fba2:7265 with SMTP id d8-20020a50fb08000000b0050dfba27265mr4999125edq.16.1686151276216; 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: 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 --- 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: Alexander Mikhalitsyn X-Patchwork-Id: 13270872 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 38467C7EE23 for ; Wed, 7 Jun 2023 15:21:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241317AbjFGPVh (ORCPT ); Wed, 7 Jun 2023 11:21:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241313AbjFGPV0 (ORCPT ); Wed, 7 Jun 2023 11:21:26 -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 A7BE21BF9 for ; Wed, 7 Jun 2023 08:21:22 -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 25D7B3F154 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-f71.google.com with SMTP id 4fb4d7f45d1cf-51496307313so917785a12.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=hC/64NYeXwPOnY5ihUDFeQ3R7hJtWhiqJPGgw4q3ztXdS5+UvWSKp+H8dEsRXDGhg/ sWai/7MGv10ZFDnh/tf/EOuQJquS90Fdb47dG0k1mK9KXe5p3oeDqlg/sIhE6W91h/D3 ueQPaB+Iyu3rhDslwOJzj5HjnVwAr9Z+kX8Pvhf8gdIg3HS1X2lVIkGDiUQ5yQGqAZq3 Y7cHT0UCdgrAg1peO+ZNW8s8r8Ci27PthUMtkbNMIX8ka1NNF7Ugyyk5vlWcD+5ULQ5F APbn+2Vy0gFBNNmerTH0pV8D57/N1eR2FWce/Jvp3mJkSb/wel8UKh7TOmwQ06JloKmM zMGA== X-Gm-Message-State: AC+VfDx2jrLk2ZGFBDKx6KuFLZ8UXCdz+Z5qfimR30nV1apdJlQ/c1xJ qjxluKH/9NhasZW5NVVmzJF9hQ+XTOn1mAAvYlVEIE4DOhGhG+MtxxZxab9ArAPNRIMa27nuYFU pSXddDTz/UYoHk00IkWJdxLO2rGd0TIH+UnAgOKUJhZAdZN8= X-Received: by 2002:aa7:d0ca:0:b0:516:7b3f:43b8 with SMTP id u10-20020aa7d0ca000000b005167b3f43b8mr3986959edo.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: 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 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: Alexander Mikhalitsyn X-Patchwork-Id: 13270873 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 C894AC77B7A for ; Wed, 7 Jun 2023 15:21:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241377AbjFGPVo (ORCPT ); Wed, 7 Jun 2023 11:21:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241333AbjFGPVe (ORCPT ); Wed, 7 Jun 2023 11:21:34 -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 2A3B31FEB 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 9FCA33F120 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-977e6c94186so288007366b.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=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=feEYJqEfoPcaJWt1UsF2V/XwAFJrjE08JJZh65xbpFarrSljscLX9rVD0jxBxgykYm 3pl2OmYaAsMfvrQwJTtt2t1aXGFJJ8kr6LPUHizlimT1MfLR8Zq7YwWztjNGjKEPN3Cy b+PJoN3BlCWwGozaHDpg1O/c5m0RZenU+4OsbbgCgTehuRKkKf3ZXfXEvXeioEVwF1XY aY4ufeBZ/ge0elIYv11gu+3qvw600podsD8nUDQMtkE9FCAuVZnNK0LiHGxvTfA54C+e cLiTSaDBZNv9rPRFPEXDPMwME4Q3jD1LTE68jT1nArOqkp7GP/ibD+guZh6oRrVCzkYZ S2CA== X-Gm-Message-State: AC+VfDwCW//SKOL+v3tj/6KqCRGNING56edjygeQjk3ydN3jLLYCrRF5 r0Kk4I5dwMz+BciVYRdxhRXB+xgU6J2QYArwdsuEqYb+FF0xWMcAdEeXV3qXTfKWE4FCAJMqZfo HKZ7EjQIKgY0io16iO5oh38iGhfTY3/eIPzqB7xg= X-Received: by 2002:a17:907:97d6:b0:967:2abb:2cec with SMTP id js22-20020a17090797d600b009672abb2cecmr6488799ejc.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: 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 --- 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: Alexander Mikhalitsyn X-Patchwork-Id: 13270874 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 B7124C7EE23 for ; Wed, 7 Jun 2023 15:21:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241337AbjFGPV5 (ORCPT ); Wed, 7 Jun 2023 11:21:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241340AbjFGPVf (ORCPT ); Wed, 7 Jun 2023 11:21:35 -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 B9EDC1FED for ; Wed, 7 Jun 2023 08:21:25 -0700 (PDT) Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 30C613F199 for ; Wed, 7 Jun 2023 15:21:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686151284; bh=E1ad9bQ1aGlayjQkBmzknmBzpwDvRLF1iaTT0A2Zyj8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UREi0LMh9jD2Q/M+ow2Q9XYCMqinW4XhTuGB8+ANSUD1+DHS+eOQmIT5s754VXiQd ZHqeGPK/9F4SkGWcpkRUX9iJy6VJPlFEnKIL/Yep/AGIVd5HbyKgFsBGiMxUTXGrf4 GACe3GGBS9/o8WD5NYmH/Mq4C8HlvkV72ojWzB4h5K875t1YLHcZ+rwo+Lb8KHhpp5 VzgvCWOV7x8tPkW16HfEXVZf8mbpRLZTvPwXI0RVtxHPqH2FCfPUlTTsQQ4TDaXkyX ftQuyrjmdOPQVnAlrkrr8Kf+h2mbAfypfQMlug68W5we4RXrSGPV6AgIDjmud81pHs MsDqc+rI99Qeg== Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-51495d51e0fso915455a12.2 for ; Wed, 07 Jun 2023 08:21:24 -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=DCp2Lm625ce4nlVeZe3gboMrMcqoMUuWRRu2qOn51RCn5GiWZTxnE+7qo/3CS7+9QJ MNAOksdj/nKaG1+z8IKE1Q3AlUcW46/QQe06c5cIwT+i3LAkR/YO/eiJSoScMaaY9vlh mh3MdpvfGnzICN1Uizci5wAHdnKOoAVWOSAJWcDmuXgdCFFSSr5uZatzjasaHwartNk1 6eHgWkHpWNXrpD9UlJQUfTFWRQdGTO39mR0jdkVLj9WVpe9OANC5e2XktmDqUZYgqe7I 5PAUs4bwndqQUf6qrjeoMpbFFmn+vtT3bfCk0Vumx0SeAR6rmUqDfUOcEiFch5ZVPL4Y sfuA== X-Gm-Message-State: AC+VfDzp0TkHJ6KUd06D+kYTfXw/CcLd38ampCOoWnodfqdjHVNQkBa0 JZqnf0uAx+BrZ6ylbhB/Uc9ExXB5BiNJ1gQO91NR1zJyZ88aLoA2dWubJ7LZS11d9t/PNeuvEoL Af6cUXDAFookd5LDkYHZMm1u6xeuZRZiWsJi9kLo= X-Received: by 2002:aa7:d450:0:b0:50d:dba8:c64a with SMTP id q16-20020aa7d450000000b0050ddba8c64amr4485736edr.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: 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 --- 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: Alexander Mikhalitsyn X-Patchwork-Id: 13270875 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 C010FC83003 for ; Wed, 7 Jun 2023 15:22:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241330AbjFGPWC (ORCPT ); Wed, 7 Jun 2023 11:22:02 -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 S241367AbjFGPVn (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 BCCBD2111 for ; Wed, 7 Jun 2023 08:21:29 -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 2C7EC3F194 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-f69.google.com with SMTP id a640c23a62f3a-977cf886f17so333816566b.2 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=VBCNaHIqX9FLwtljliULCtEazTpI/WH6lwjO0G5olyZb1dvgeqtCdbDNkqQid6Y7RF l1CCP4w6qYnZGeEGaInz4MVuQdtJdcmhboQOjyG9MRV07ij9D2fp1If7bbKN5J+ZxRay jgVuPOBB3fj8yzF9lQxcSxu42K9RPZK5YYiR89NMBOt7ZRR/jk9mR2qH8fBNflEOFYoC dxRFArHSZsy/P45e5kB5ZBXATXzlC+AizxdlJWjlkA9wknPjpuQ1JWiC1l3LMTq/l6Rf 2SJ9pK9XjTUBvN+Hofg3TQwFo4NXvTyhIjwvZKVRQpctuSMMuEt2gj+nhHQzG+QGSwO3 xhww== X-Gm-Message-State: AC+VfDzmTVySWFuGjO/5DRz9UpWeiNoS45VtkA1J+/MI27F1Rn9h6K50 mI5XuVG6r/0p0bHiW8uyJrDss9veAfFCMK8/Yn5Au9dMFNBCgJjbsvbb2Ti5cEZg8iG9HU3zF71 HYAU0V9qgz6YwN/fhUAhdOnfBwhIuuCX+9YfDLL0= X-Received: by 2002:a17:907:a42c:b0:977:c406:f8cf with SMTP id sg44-20020a170907a42c00b00977c406f8cfmr6913167ejc.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: 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 --- 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: Alexander Mikhalitsyn X-Patchwork-Id: 13270876 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 D5733C77B7A for ; Wed, 7 Jun 2023 15:22:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241243AbjFGPWE (ORCPT ); Wed, 7 Jun 2023 11:22:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241370AbjFGPVn (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 13F81211C for ; Wed, 7 Jun 2023 08:21:31 -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 84A383F154 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-f69.google.com with SMTP id 4fb4d7f45d1cf-514abe67064so1067155a12.0 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=ceeTX/KNLtCMP0cC8Yy5tcm29rf9mewdwY/b+tHwJEUH1Mok/XiyiwODs1iC2DWX6v cWAolRuVlyHggscz6GmhlUs0VZvAbIhY/yQPOyzy1yuCMNRxd5RYjHJl5mgfkJYP7UU4 K8bmpq5JftuUXQZHJ3jB2bEpMi79JEoEn7OjGElfTpiRQZQafl8PhHCzgUx4bGGV7aRI MQfDjhkH9qKKwOpiUGxS+Ox7PLaCnRoeA7vO0vEXaSfW4nqyiqq6nAZv44Zu1HVpgl5Q KDOxRKJtM8+lSYu2PjX+nihiK5AxgIkazVQ+TgwzvZF/+7zz+X7etRd3UTfayyggunsB /gQQ== X-Gm-Message-State: AC+VfDwPBVGjHKmdzpl3TY1W6CM46Lhkh4ndE7fgcbvW9pLu/vKsDep4 qKRwQhDtl+CWn3hiK0ogvYFbxu+AFgL1L22ZGG/wuQ2CsA7MPUrD6VA3uDqHjBPD+6KE/loyFWs Wj0+x3pau1JD0qQ5+WmQ1eNX2IdfrHbj4OXhL6XI= X-Received: by 2002:a05:6402:2cd:b0:514:ae18:162e with SMTP id b13-20020a05640202cd00b00514ae18162emr4253315edx.35.1686151290091; 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: 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 --- 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: Alexander Mikhalitsyn X-Patchwork-Id: 13270877 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 C3ABCC77B7A for ; Wed, 7 Jun 2023 15:22:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241134AbjFGPWR (ORCPT ); Wed, 7 Jun 2023 11:22:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241336AbjFGPV5 (ORCPT ); Wed, 7 Jun 2023 11:21:57 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA6232132 for ; Wed, 7 Jun 2023 08:21:35 -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 034993F15C for ; Wed, 7 Jun 2023 15:21:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686151294; bh=U9FNme5iBEpufhowdmn6D6u4P9E81AUlwyvYSH4GMyo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BXsPTrtadKMXVval/gv4PT6++jZgxV/obxdXIb1BnShCswl5NG+8fDAYE1AGqFGrc Ceg21dMvFm7nfFPps/EYzJvurxlW370PkhO+un34tGer0fUAijixka6ChlSBcp035Q S0858Z1nlq0efLjbKklGo032kVtpFc9Gs0ua5eeT/8k+CDKARMNaVJZlZhyNhKIIu/ bCibypOrnPR98P+7FSHql6kOuH3/rOAbtwVru6Jfwr2f4dmH66cKWhadrkd4DxmE5F DcR/7APEFuFplE/YHcsVrd0j2tMqP0jJkgsX3YY+FAebMj43PYSRhFSi8X89Wnmi84 +VjAYJ5A2Uy8w== Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-5149e1bd242so911456a12.3 for ; Wed, 07 Jun 2023 08:21:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686151292; x=1688743292; 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=kPmOzKAAta/D4Y82J0zrCzjf/jzfrYQF04KvYPcu0b9Ty6pNUbnyVkF8CwMOJpYcyK mby0BkzTOq56/QxZJHAx794z1f5zWKL7VSnH6Cd9yomqD4uch1Si12pl9yHo4JFktglB hvQrszN1vwz1DEkx32t60AFIqyU4BSs4AwSjFj5aT+5qCvLsC/UwFiCAmJky+j7EMn7C /IvopaZmxmnBP33qRiE1TJ69G/OGG2IHOsWzLoAYCbbfJkxcScMZuBTf0WuETwOiWWFi M6suQ8FLqe/+TwRu/L+bXiHGzauxBvznOm5gmyz6sPL9SJUtz/+avXGXI5P9ojXPqW5F nhLA== X-Gm-Message-State: AC+VfDxNOHyAAqA0ukFGkA0giLojkbVaYos7QTHGAD4dyBoAOm4GPQHD jpvx4yKGwUKBRZJcgoGTHSIpsHap1FkIfNBBojrupxiYlnJQJB2PvFOfyC7LfczqiPv2IF+me8O 6utOA9Uwf+DzPU32uDSTm6AbaPTO3Ww4rw53ZXZ8= X-Received: by 2002:a05:6402:405:b0:50b:d34c:4710 with SMTP id q5-20020a056402040500b0050bd34c4710mr5279756edv.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: 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 15:20:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13270878 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 97544C77B7A for ; Wed, 7 Jun 2023 15:22:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241388AbjFGPWY (ORCPT ); Wed, 7 Jun 2023 11:22:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241387AbjFGPV6 (ORCPT ); Wed, 7 Jun 2023 11:21:58 -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 42FEF2137 for ; Wed, 7 Jun 2023 08:21:37 -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 EAA463F1B1 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-977c8170b52so471138166b.0 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=JCUuyDYSKEAIMSUQ2EsyOS1GZ9q8U8kEVpSIh4XfKPzCWZ0d5BzdlTSlMQ+4Xr1Oep S8UBWRuEsMsEuT0mf3GD/geuMPGrLwVpOsKm2JCBpm1+asSgI0E6cl/DusegBNbYqy5z +fBR1e4dr1VK2HxhLwixXLCJUjN0qwJtt0/HlwxF/V14aidCTdJtyVmEXQaCPIiqtmmA X8qgzp3OPgkHu3yyLI/Lfuu9RF370cXPZUjw6zNZxnfGpYaiD29vm+CBGuUGpryAcYsK uPAPlihdoMqPgrt7OaRxjnMIfwR6g0VCtHckxvk6tAMOaX9slbL1sXsS3Zv5iaXMWJSv xThg== X-Gm-Message-State: AC+VfDy3vjvqJR+bSNSLciE2iUNIXVKoZPPmeFVC7PsO106jxlSX5KqA cKvRCB7M6gECXNPmjbrYGZcKufy2pITwOyNCpWwUrGzIO7fwUyq3xf2/EeNe0E1C5mgTzO4aRDC RmsgYHhlg21Nt/KibcaYreoekA2Cx0sVhDCrJxms= X-Received: by 2002:a17:907:6e0d:b0:974:c32c:b485 with SMTP id sd13-20020a1709076e0d00b00974c32cb485mr5976945ejc.45.1686151295586; 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: 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 15:20:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13270879 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 06845C7EE23 for ; Wed, 7 Jun 2023 15:22:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241115AbjFGPWo (ORCPT ); Wed, 7 Jun 2023 11:22:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241364AbjFGPWB (ORCPT ); Wed, 7 Jun 2023 11:22: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 841FC26A5 for ; Wed, 7 Jun 2023 08:21:41 -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 D046F3F0E8 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-f71.google.com with SMTP id 4fb4d7f45d1cf-5163c33e60bso1005167a12.1 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=QQV6Iu/I8VEe1Lk19a1OnPEw9cTEbA5OLJvHUl7O8r6sCLbFg4FV1gjcH/34iKbJ2n Oj8cSqiobXccbnyweA5z4yOqMn7PSSvQ6p+dBnfLAxlD7pK21fh16IeYlZvgZrOw1st6 xNALDEmYkpGNSSN+wXEdWYhA+Ue2h2aL7yOCJATtHoGPDov8iaAGatywP9+VFFWbW5Gg qpmJb7IEvaM48kg36D3MRVCkQalP8W8NLR9d5C7sjsYrTnfoMT1192ObhC5+rQz+619y yWaqNbQ/9/A4xl0pSMic3wtl/noCT/d1tAArp/0yYVozY4uZ9FZpPkeInjrV3NDiiJsQ h5dw== X-Gm-Message-State: AC+VfDynKefdUdadiRltRZq5ROLJvUJ2Uw2QmYB2D3xu92LGe9tnuVFd P1X7lok1yo6wZPlidYKfLTRKfboGVMnCi6kDezrVM3Q7+2c1J4NilFPZCgwbJpXgegO59M0szmZ 9gpuNsF4VxGL2xCi7SywafwRYmO0g3vU17nIHxjI= X-Received: by 2002:a05:6402:40d5:b0:514:387c:930 with SMTP id z21-20020a05640240d500b00514387c0930mr17584292edb.5.1686151298003; 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: 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 15:20:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13270880 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 265EBC7EE2F for ; Wed, 7 Jun 2023 15:22:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241402AbjFGPWq (ORCPT ); Wed, 7 Jun 2023 11:22:46 -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 S241419AbjFGPWD (ORCPT ); Wed, 7 Jun 2023 11:22: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 C79C026AD for ; Wed, 7 Jun 2023 08:21:42 -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 5DE003F19A 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-f71.google.com with SMTP id 4fb4d7f45d1cf-514a4c3ff90so1047238a12.2 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=VXaIuhF+AIczqYYkPerj0hxAYJe0LB2B849XrLUQo3SoqrSa6DF91lBqBom4V/2+lz YpQ6W7YvBw92lEioPCuSn+HLBGcnUH6HlIedZ4Wwae6rtUHwyblcyitet8Wdo4q8NOrq FxahVzrr0XtzIbk2ACohda7CrxvjWcV72+8nfeiPHctlr9dPlocU6MuWTnHgad+g3FZo McmNXaDpVENmOEIGSMgYtXwNblRZ0+LAU+H3a1jpi84RPo8W9OnLeJIfGXZ4wJyrGo9e O0vJh+xDYLVRPayUeb9dEIzPggOQSDpWg3RFc5+AzakHZj6TbLY5vWVFys5ZKgrbUlea WkIA== X-Gm-Message-State: AC+VfDxN4voPNxktY6UaJ92KTi2bOYqexFxH1dwyS/ZbtHyoxFxJsG77 Ft7j8tRto1F3KodoGyZjw52m43Q7OIIkx9sf9z5Yo7R8zO40u0aQPBEbAv1T4f6eELoY/8lEh2i 38/KWaQnTeFgMfovJNaORGZ28DgGCz9U33MS35uA= X-Received: by 2002:a05:6402:1207:b0:514:9c7c:8a30 with SMTP id c7-20020a056402120700b005149c7c8a30mr4752011edw.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: 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 --- 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: Alexander Mikhalitsyn X-Patchwork-Id: 13270881 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 3CA0BC7EE23 for ; Wed, 7 Jun 2023 15:22:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241342AbjFGPWx (ORCPT ); Wed, 7 Jun 2023 11:22:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241335AbjFGPWV (ORCPT ); Wed, 7 Jun 2023 11:22:21 -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 7068626B1 for ; Wed, 7 Jun 2023 08:21:45 -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 DD0ED3F203 for ; Wed, 7 Jun 2023 15:21:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686151303; bh=/It8VSgZDTEKktJxHTMOOJHpvqL0RXNtakCJDr6cWYA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dFjetVHDMVLaNbrnBpHs0i9uLy+QQMkC4H4gxGEjyoqRwEmlAjKfuZCQEYZ2/Td/M Zr1xq73g6GdxV9jn3YPDzxPOtUGEA92MlUHNXTXuuvJUzdlrwMFZMC/qSW6zsAArlC /+KAdPfa5/L9ZRh/XSd4aDPedQM+nwPq7jUyiqjceQCzzVWufxZCjDqDqlY9CRCnpy 4dLGp1TNJzEb3YiJbIB9tskAzJmajFVAin+wfv/DtdHKG6lXFwCtYb7iHluZuHoi0u AmKECDsV6KB7xjmeViS8msF9pnTb/6clgXhN/2OHJHKsvWCPSyniF5cJo/JLp2a5xo JaCEv3/VkWE1w== Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-513f337d478so832523a12.3 for ; Wed, 07 Jun 2023 08:21:43 -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=Ow8+vpnEpK5hGDY7RAfUBJ2PkhXAwNXonpihwL0+Bt3GQgaQzxOC0TjduUuCDRafxZ a10IyPDM4LUXHs/lXsjKET005IsNjxZvpWCnY/hyoMvVZmaJJ3UnKJHBYtCcteqgNExX a2hS/T+UFAfio2vdB6LSYMpwKlcEi+SH2m7RCgXvy0DnBhJQd1G6fV6BVAfEOoUqDwad K8iPFJLepDgcxdhHDdovEq9a7Xb+1W+r7L7oyrEEthFNDtN73Lzh0Z7BMP+TgXCm3u/Q dG32UbggNOSz7zweFy/eAdl1j41vs0MD5FgLi32ChHOYfvRJHLC5AV6129nzceAL+tYh dvFg== X-Gm-Message-State: AC+VfDxIRzUxMtcRc5P3W0uyjqOJrom8Oyja1J3wPs4ZhgrBovY+xexf lYLsCHV19wRcSL+UHhYr4Hr/9Fq2RePQZDQEE+NkTrPLKdJtF+bQh7wZdw9Um/aVc3h2QOgQ37O X7H3+ZNHn1IMvDEdixmVd6tpS5nAvTPfDfaaVqk8= X-Received: by 2002:aa7:d6d1:0:b0:514:9b64:e16b with SMTP id x17-20020aa7d6d1000000b005149b64e16bmr4291083edr.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: 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 15:20:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Mikhalitsyn X-Patchwork-Id: 13270882 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 DD5F2C77B7A for ; Wed, 7 Jun 2023 15:23:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241348AbjFGPXG (ORCPT ); Wed, 7 Jun 2023 11:23:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241393AbjFGPWZ (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 165332715 for ; Wed, 7 Jun 2023 08:21:52 -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 B79A83F763 for ; Wed, 7 Jun 2023 15:21:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686151308; bh=8yrq/kS6S1HbL22xkrZbDKXNe0OGSicmb8/p7/WTma4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EZ/cuo7FQvkNzbR+rnciDS9QyoILaPJejwbrZeTV+EqnsdYYoFH/nBl77dwgk0b7z vLf3FH93zRqs5YUEDnuRPwPEnjqJYd8zfOXupwm6JdcAP4MwfYyjAzsL7o2ATIEYhf xWIE5AkfGwOfJGv/eCYO7eM7W9jmzCP6veWQ9UhepFsrfElp0+86y1BpzFmmS0nypQ 4cr6btPSwLwwrS2io4Lxktjg/5LmdKTV3nR32QYDggogto1u/BMbcn23WKw6l0i1Zd nJg/R0eY25nBo5ckqjQHL5Yto3mJc33NCJ5anVgksb65vWPTvkUTduzaYP5ZTreZRU 7nVNYYZIgBudQ== Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-97542592eb9so437022766b.2 for ; Wed, 07 Jun 2023 08:21:48 -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=bE9Qu/gK6rz2+6wKxoxWu0mkjD8KS/eurMvEwAat5qWqfC8WDuvn6x2z10YcSPEgBR zF2klahI8fKa/5eXjxx6W0HJe2XakU4HVYR/cCSllPJQzd4zy/+L6GENXRm/5fuMvx08 OIagPT2FUpHCPywPCrTDWONcwHoH22LtiZU/+B/7Xtted91x51Y8xKctmHXQuNnk9Hds 6BX6HDtUUWATq7bnTuexvcT0rdQWfuyS03pHTf0GOBAYcNHxjSftIbkHcnxuT7NxysNy qP7bUwi9nK0s9sKwjMGAODBvIiKANSLp7Jjkl9tBA+DPowKdybutRdNDRKtnC1PgxxBt r35w== X-Gm-Message-State: AC+VfDyWGG4X48c5PhOy9LAHtwR9Nbnmz/IN/w7LPIu0VRTrg5qYpgP+ 7fPotBfuqYyfjR3VtjVTbugI1tQlNlBFiCABILznuhOfxKxypHI51hGqQvBl9+NPR6+WfbanuLL qkdzCsTiSu/XmD5Jpawsa8Pl4DqBi7knLc6lbt50= X-Received: by 2002:a17:907:96a5:b0:973:d7cd:44ac with SMTP id hd37-20020a17090796a500b00973d7cd44acmr8178822ejc.54.1686151305692; 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: 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 --- 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: Alexander Mikhalitsyn X-Patchwork-Id: 13270883 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 03AB3C7EE2F for ; Wed, 7 Jun 2023 15:23:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241362AbjFGPXO (ORCPT ); Wed, 7 Jun 2023 11:23:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235568AbjFGPW0 (ORCPT ); Wed, 7 Jun 2023 11:22:26 -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 A88C62721 for ; Wed, 7 Jun 2023 08:21:53 -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 261FE3F7EC for ; Wed, 7 Jun 2023 15:21:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686151310; bh=sitF6aKufbc7DklTCjus/+uMnJoHcKEt7G8gHEJda3g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=P/D8AjrULi8QbykhmIESppG2V5dwmDG65C6+Y/Lc/lyH0PwChBwUDbTr4nb5QiRH+ AzfvzI0UoVv8ng85DoP90cKJBO2bjPXewzWA8ALtYxm/8PlLklLwE0jdOaCQZRWs1b voEY8gDTEW/lXDAzoQMTYuYsO1Nq1NDNjWc/dlOyK/cYL6kP9JDh7hQZlhBE2s4LfW v5ohY6pCKOwCOBE7UQSt7KP7AJOj99GbY6qmgTm8ycB7YPptofCEfY9ayYiaIlAJE8 n+ZNuWnmJ13K7qVI4ZkQiHdCNt8yNqauTdfZgImKHCYHUaILMLtKTB+Mkt4eABVPse y5o/M7Ol6uz8Q== Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-514a6909c35so1106977a12.3 for ; Wed, 07 Jun 2023 08:21:50 -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=AAXZi9ambNd6QUDKoL1N6c3sT9KLsWPUksy9rMZck//lj8fD5geAa5SKMaK23gGDOG OufBPiaqymog5sPgf0C/hOedgOD4qHs40zBeRdAaum7vaWSOToaYpdqCU2SndR7VFQoK BrZ4+pKqlmLqMqYe1ZNP6YtEpd4R64IZwyD9ZswTuqfiSovnckyDcDdLNfskFtCn9mqh wQqQsYyjdy2kWwlELvYGVQxFMv3iwoMX4ErMeZ+R/qmWNFBqHZTw/lmMD3Z2B3ELIRZv zFMpGuGBKbEVAhWvkwAcuhfFiAAgTbtb2VvzGS6HG4BLjh6bZ21QTiHSVh3V7ycR8r4i iY4w== X-Gm-Message-State: AC+VfDwGjexa1ug4jAetO8nSFbFwOQMaysO/y9Hwfu/vyVdy0KOUkqOR vJ+/xTwHAlnHn4+8Dc8eNBIL7bkleRXswiopmJ63n7Vnvyzye4TPpKELIbxZ61zOpkZ0jcqrYZL MDH6t6fixC8Xt2nH6OnMWqdulxh2HIpmNN4K762A= X-Received: by 2002:a05:6402:31e5:b0:514:9422:37dc with SMTP id dy5-20020a05640231e500b00514942237dcmr4479644edb.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: 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");