From patchwork Wed May 24 15:33:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 9808 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:3046:b0:115:7a1d:dabb with SMTP id p6csp2920469rwl; Wed, 24 May 2023 08:52:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5KIOG/py9wr6U4BgidERC+ZpQk0nCrZv/yclQqyEZVTw03z2MjO61wEMhNvp8n/a0GxhrD X-Received: by 2002:a05:6a20:1611:b0:10c:d33a:5c50 with SMTP id l17-20020a056a20161100b0010cd33a5c50mr4878911pzj.36.1684943566881; Wed, 24 May 2023 08:52:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684943566; cv=none; d=google.com; s=arc-20160816; b=wZ74JQlwsNjoyUx/ucP31jnnSjQhE51QK0N94+ngdwTNDsujaMHTyetg24wGA52lrK 3HRYOoG5xAfl+diPy7vh7QlNnitv834/N3g6rSpIwe2RkUCNMuCu6oSwtO+W6YA8LAbQ MhQCA9ZDD5ULu8mCPvO/1DLpW8x9XGFHPIUGQA7pk6Pq3/XTeeWIVWsQSUlXRwoaM+hz wFY+k/8jBE8qCVpTI47003mGAAVnUSknoiatnKejlnLmIcdz9mYpvd3BHNH6M9FrV5oA BHaKnVn53xovo8058zUILWNe7tIvTTawXIdpFVQ4T/JZaD4qkr0UaIoLsbFikMZsOdiq ZiPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=EWhp3bFE5YGNYZTeqnLuyw/BwJKRfP8fBMMP2Kg8LVA=; b=wmUGr7rwF5NW4P/7wjo2AHqrlYly0n+76EAbVBJn6Eaj1EEV2+jOzRfftfCatxACIn GolsON2wor6oesSaQqP2eAAWTVzcR/9A9PsUIjCE8XRfRGN4tpfFje4opQxZBMdwlH9O luXvxvUMYx/fLXAa3U3MP0jmyEjqfz3+Zur6LOHlqDTioTWCnhTF8TQckg5bit3xXWEp BhId4XU5GCDlqiYnNYqTrrR2hKPGbnqNzBtPWD8ksyipdmqZHMcd48tefzggRvqEzcy4 Ja7/ZUQk4ZMYvy+rwA39ydQGMZKXhkyrZ/4H4yg3iv/vADR+ERi4GCOgvaivrV/LOwm+ DLFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=hEvuMSZ2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y20-20020aa79af4000000b0063d23b80e00si1489511pfp.392.2023.05.24.08.52.34; Wed, 24 May 2023 08:52:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=hEvuMSZ2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235779AbjEXPej (ORCPT + 99 others); Wed, 24 May 2023 11:34:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235342AbjEXPef (ORCPT ); Wed, 24 May 2023 11:34:35 -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 20428119 for ; Wed, 24 May 2023 08:34:10 -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 558573F179 for ; Wed, 24 May 2023 15:33:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1684942429; bh=EWhp3bFE5YGNYZTeqnLuyw/BwJKRfP8fBMMP2Kg8LVA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=hEvuMSZ2BeoPvQPD4BTr1eV8g6z5we1ykH5gFhohLxheGvp+kArJWQulAp9eHXJV9 xFh9rtaD8PI1fEJnLWBjpsylLgVGZIkd5/drPM7U6/jH++tnpmwfPdxUwLdezxPCYo sD56Sn3vKNdgQHzN7bzeNinlXhtGqrQK+qnfQYkTwyRiiJKENXhwDyOGaoqLiyhg7y yuJsRUlKVHBu7kLvkRSZ56+v9yWBcgPNjgIwu6yHhrWKbztzFRnbFaXZ5aaKNvoyHg OH7fuN2bpUeXWPsQLsg9+EVEFvR57hr1fmspNjj1bo9937jVrOgbc6WEkk+LpepzrJ Bma0EvkEcjmuQ== Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-9715654ab36so109486066b.0 for ; Wed, 24 May 2023 08:33:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684942429; x=1687534429; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=EWhp3bFE5YGNYZTeqnLuyw/BwJKRfP8fBMMP2Kg8LVA=; b=Afha7gtXtnwYvtxBtdso61iFjhVFAlL/uNH/5TUaTs7IBrhjToxYyqmErtjYsQyIPi gtIr6GALlRHUtQpnj5kBizUQTww/kLUBA6sZxHLG0VONyVz0MVlUlkSDgX92gQrEHtIT VUlQApydkmEG5oPEiLD4SAleqUMiOUI5dO8qW5L7cUgWro/MQutBzEJ3AiUMrSeDcumu cvRPqlFFI91h1jPbjGpFwQ/+JWN+ZKq7USUcd57kdmGCtEYCGcXjPjMa+5Od3S9/bYWm aZXgcAJ2H13j7aS/jE9chRZXPnhxadqpcGsLIUXZK0LRIspbVHDmKURnThbD9AqrtbQg Uqew== X-Gm-Message-State: AC+VfDzVlF3lqUScF6VajbwYePUgVEHRzhDLGy2FBRRrS+VQrJ2kxsp5 f4K4oE+gXPdnhCB3VE6d1F6YiOdobZuL15frfuScKyo2wYPb2/LG2H+RW4Y/ZHmwXksWWwOQI0e /hU2P+7wFYYqN0AFKoHE8zl7z3VBXxsnXxN762qgoYg== X-Received: by 2002:a17:906:ee81:b0:96f:1629:3e9a with SMTP id wt1-20020a170906ee8100b0096f16293e9amr7864682ejb.34.1684942428986; Wed, 24 May 2023 08:33:48 -0700 (PDT) X-Received: by 2002:a17:906:ee81:b0:96f:1629:3e9a with SMTP id wt1-20020a170906ee8100b0096f16293e9amr7864653ejb.34.1684942428590; Wed, 24 May 2023 08:33:48 -0700 (PDT) Received: from amikhalitsyn.local (dslb-088-074-206-207.088.074.pools.vodafone-ip.de. [88.74.206.207]) by smtp.gmail.com with ESMTPSA id p26-20020a17090664da00b0096f7105b3a6sm5986979ejn.189.2023.05.24.08.33.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 May 2023 08:33:48 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Alexander Mikhalitsyn , Ilya Dryomov , Jeff Layton , ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 00/13] ceph: support idmapped mounts Date: Wed, 24 May 2023 17:33:02 +0200 Message-Id: <20230524153316.476973-1-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766791385985146616?= X-GMAIL-MSGID: =?utf-8?q?1766791385985146616?= Dear friends, This patchset was originally developed by Christian Brauner but I'll continue to push it forward. Christian allowed me to do that :) This feature is already actively used/tested with LXD/LXC project. v2 is just a rebased version of the original series with some small field naming change. Git tree (based on https://github.com/ceph/ceph-client.git master): https://github.com/mihalicyn/linux/tree/fs.idmapped.ceph.v2 Original description from Christian: ======================================================================== This patch series enables cephfs to support idmapped mounts, i.e. the ability to alter ownership information on a per-mount basis. Container managers such as LXD support sharaing data via cephfs between the host and unprivileged containers and between unprivileged containers. They may all use different idmappings. Idmapped mounts can be used to create mounts with the idmapping used for the container (or a different one specific to the use-case). There are in fact more use-cases such as remapping ownership for mountpoints on the host itself to grant or restrict access to different users or to make it possible to enforce that programs running as root will write with a non-zero {g,u}id to disk. The patch series is simple overall and few changes are needed to cephfs. There is one cephfs specific issue that I would like to discuss and solve which I explain in detail in: [PATCH 02/12] ceph: handle idmapped mounts in create_request_message() It has to do with how to handle mds serves which have id-based access restrictions configured. I would ask you to please take a look at the explanation in the aforementioned patch. The patch series passes the vfs and idmapped mount testsuite as part of xfstests. To run it you will need a config like: [ceph] export FSTYP=ceph export TEST_DIR=/mnt/test export TEST_DEV=10.103.182.10:6789:/ export TEST_FS_MOUNT_OPTS="-o name=admin,secret=$password and then simply call sudo ./check -g idmapped ======================================================================== Alexander Mikhalitsyn (1): fs: export mnt_idmap_get/mnt_idmap_put Christian Brauner (12): ceph: stash idmapping in mdsc request ceph: handle idmapped mounts in create_request_message() ceph: allow idmapped mknod inode op ceph: allow idmapped symlink inode op ceph: allow idmapped mkdir inode op ceph: allow idmapped rename inode op ceph: allow idmapped getattr inode op ceph: allow idmapped permission inode op ceph: allow idmapped setattr inode op ceph/acl: allow idmapped set_acl inode op ceph/file: allow idmapped atomic_open inode op ceph: allow idmapped mounts fs/ceph/acl.c | 2 +- fs/ceph/dir.c | 4 ++++ fs/ceph/file.c | 10 ++++++++-- fs/ceph/inode.c | 15 +++++++++++---- fs/ceph/mds_client.c | 29 +++++++++++++++++++++++++---- fs/ceph/mds_client.h | 1 + fs/ceph/super.c | 2 +- fs/mnt_idmapping.c | 2 ++ include/linux/mnt_idmapping.h | 3 +++ 9 files changed, 56 insertions(+), 12 deletions(-)