From patchwork Thu Jun 8 15:42:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 105008 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp369211vqr; Thu, 8 Jun 2023 08:47:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6yvTGgEXqk7W5F4SZdv535R8xwyxg/cJYEWcZlL2RhZZX9ghU0EKgeQ35pO+wwIPwGXZ5C X-Received: by 2002:a17:902:d4c4:b0:1ac:4735:45d7 with SMTP id o4-20020a170902d4c400b001ac473545d7mr10063472plg.6.1686239220630; Thu, 08 Jun 2023 08:47:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686239220; cv=none; d=google.com; s=arc-20160816; b=IA1BkZuhXJXAO+h/a3lwtOgmBFuH4EbOV7FlRPVJVP9B3YWaGb+8P5lZAR9SEVtlnB 1SngmMI789J7d8h1q5idD6I5Q/ftEK7rWTtBLQq5oJqnncH7z3NOQ5zsdj7Nv7bH3vqr hhDMd08hG/vSF400ZiSrShMvugSL6qqTz4eEFOVxlQPomrGE/IbCtK6M1+G9S9nqOIWw 13GA8xu6C3KsOiUlQ1geq6WTNpnJTdpAEQ5Sh1bDE+4yb946/6Bqh+q+7ucrgO5NpxtR oPqzeW/uen3j8D0QEvXlY2jkj45HRrw/wHb7gtvpsdtIViKekzDPBHF2Z8GQmJe1jhg2 NKDg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GFNwWvhavDkNrI4eqwez7OWrv+w+Iw1WNhnwQW/Fw7E=; b=W57aA4uoqCK1K9t2GwuihAvs9wYye83/ze5eIWe0hvAEtWRbJzv7dWA359W4tsJBtu h/PVOsmRe+RsnJF3xFgMbOqj50gRIJuEZx3dXlseCeZ3LT3yNN/Z1hH8RulxepTOkJTT 4LQdYCSoM6/41bT3Anq3Mgv0lFGHIrucoFBLT6WcexA+SOP/YzU98j4VMp4tBjiq7KAN xAPMLTBPtvnqeYgw8Zl2MwBboNXcQGqfK4dvd52EDTvIZ07zh6XCgZunbs1NHCPXxoH9 rAZNzOPr4nx0VWLXoskEaPWSKTEQTK4vK88joYJ+n+Uowef9RIXVvej9v+BOy+duM4oE wjKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b="UzQqOx/a"; 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 b10-20020a170902b60a00b001b18ec6ddfcsi1209210pls.294.2023.06.08.08.46.46; Thu, 08 Jun 2023 08:47:00 -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="UzQqOx/a"; 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 S237141AbjFHPna (ORCPT + 99 others); Thu, 8 Jun 2023 11:43:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237131AbjFHPn2 (ORCPT ); Thu, 8 Jun 2023 11:43:28 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 335F62D72 for ; Thu, 8 Jun 2023 08:43:25 -0700 (PDT) Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 6B8763F466 for ; Thu, 8 Jun 2023 15:43:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686239002; bh=GFNwWvhavDkNrI4eqwez7OWrv+w+Iw1WNhnwQW/Fw7E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UzQqOx/afwCY8VI7jYOfHqsG3g9AVlJgJZrZiw8W31u1LIaM5ZO3c3sIih6wUZdvL aUJOtvvV/BzsqfdtD8fMYU7OydbrFS3KVcFTISZxG1fhBHiH1sqPutGP639xOflx6s 7bMnbHeeZgRHPzp3QhecTonM6svuXatBNkkZuwh0C4derx9yZrHVjoZui/LhGzRpdZ e2FkLjc69ONX6Ua/7QWEjoC8MVWlD1JZJZLkGMskZdhdHUp4WwoRaKEPLTEJikKYLV oiR9HKK/zNktk7/jkFK565WV4zqyqw2/8QGZHoTa69OOclTFoHl+zejc7P/6fgA/A8 M0YvudZojkP5w== Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-514b8a3c0d3so767790a12.0 for ; Thu, 08 Jun 2023 08:43:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686239001; x=1688831001; 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=kbR1odEdZ5W8opHfAYmh9El5I5ZNB1WOk7M/mUFVYQyMvJG/VJAzwWWm18BeEj5LOG naM0Zv8okRChEF+oMoCKmPwE+SLNbMp4ehGoi5DDF+vo+17F6LnVnAivCqMW2F99tvzv GTEo1C8rMQIGc3CnQZHSxgkupdDVV6q2bLxBeRcGW9jtYYuZCVZrLS3kI8PXW0IgP3Vy Grsa/7fc/VeFKSWW17osWQSLFECL8k+reyopPHb+5KANgRzlEpmOt+SIOp+eRTNDgBrF Knh2xcWjSY2a2lAluAdyo00ZjA/R6B9nBjpFlvBQCjQuvO/k76izvH6RZqidBZocSmjW Fwlg== X-Gm-Message-State: AC+VfDwfCcOMKxgmd0ir5F5iyIDcvU+MbJ/yAYnfyOjDsy6xh84L28rq m7HGx9ag5iEgiQdz0/mxN1xCzGJnMc5SXwtpYnUhLoONDM6C6H1aUVS0oTezbu6oQiqPLd6CEDW oV+WUvpVopxxI/cwPdGelZ19XFcq1WCU1jeOvV3s4Ag== X-Received: by 2002:aa7:c48f:0:b0:514:a4b9:d76b with SMTP id m15-20020aa7c48f000000b00514a4b9d76bmr7147039edq.25.1686239001447; Thu, 08 Jun 2023 08:43:21 -0700 (PDT) X-Received: by 2002:aa7:c48f:0:b0:514:a4b9:d76b with SMTP id m15-20020aa7c48f000000b00514a4b9d76bmr7147022edq.25.1686239001194; Thu, 08 Jun 2023 08:43: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 y8-20020aa7c248000000b005164ae1c482sm678387edo.11.2023.06.08.08.43.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 08:43:20 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Alexander Mikhalitsyn , Alexander Viro , Seth Forshee , linux-kernel@vger.kernel.org Subject: [PATCH v5 01/14] fs: export mnt_idmap_get/mnt_idmap_put Date: Thu, 8 Jun 2023 17:42:42 +0200 Message-Id: <20230608154256.562906-2-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230608154256.562906-1-aleksandr.mikhalitsyn@canonical.com> References: <20230608154256.562906-1-aleksandr.mikhalitsyn@canonical.com> 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, 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?1768149976866405648?= X-GMAIL-MSGID: =?utf-8?q?1768149976866405648?= 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 Thu Jun 8 15:42:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 105018 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp374192vqr; Thu, 8 Jun 2023 08:56:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7+oRZetu7Hmo3HPEfnh3gZWl6Amylvii9rRiTJDk2mZVwEom7rYel5N17EpQT8O8fXrMks X-Received: by 2002:a92:c507:0:b0:33b:b6b9:a79d with SMTP id r7-20020a92c507000000b0033bb6b9a79dmr10624727ilg.31.1686239773072; Thu, 08 Jun 2023 08:56:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686239773; cv=none; d=google.com; s=arc-20160816; b=KJ36EsmGwoMD80HMxK+r5sz2/wEuhUld4tkk92m3imiVLjYllXkm64EYNni+U1J9os 0SyyM4NCBrpdql/4MTVaFEwzp3CMNZSTSyhmJf+fNvJWUFygr4jQmT+UOJV+KygBzW2C D777bhBmAIUkq8QQSdvdcAGMO7LgQ6ofBtYLZomrdbMTrNCRju2opNSCSyTO35jOXspy 7aaOtUNpsCLDo8eQwf0uD4SDrPcqWB9YInEheaTMCjaKoK0Ud7k4rabIwykUtMSVqAQo Lvw6WQMRj3hfNhvzkoTbQbX5dWHfk7DrfzcEvAOIub9QJKhoLSp8qEXCEfXnekuzqoyz wgHA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PnimYtsU8L1wziru+PbLo9AAv92Qytxkfm0LOSGrer8=; b=cbe9gMSLmP5ZQpshC23nxr2/8RkHmKAvbwoh4paaf/0PERyNTqn6UoZJMOb4lBZzg9 U6Sdn1lsZ9H70pyNaN8XTq/U52AYIRR0ANGp76cBU0Z1FXdI4VDFy9Vh9UryGsu0fZIX f+vNjuW+w6x7nstBJJa0lX9wzBvW/r0O7PqqrOOSY42IVX6QS4JOSP55NxZA1Sw1gsEj bIwrLLMa/Vimrjy79x67+nEXEliB7vv+b9ymU2QMusdKMo6ch4uiGs68ARINRrv96K+5 vAQdWoWSl6JHjELB/++rBZS91s5E9NEN2RkaHl6UKM086GcR2f8MgeCK7FnoCb8vcdFb P8eQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=CvTapLYw; 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 s2-20020a170902c64200b001b23d4573b4si1225413pls.4.2023.06.08.08.55.57; Thu, 08 Jun 2023 08:56:13 -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=CvTapLYw; 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 S237150AbjFHPnc (ORCPT + 99 others); Thu, 8 Jun 2023 11:43:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237130AbjFHPna (ORCPT ); Thu, 8 Jun 2023 11:43:30 -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 EB83E30C0 for ; Thu, 8 Jun 2023 08:43:27 -0700 (PDT) Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 725413F462 for ; Thu, 8 Jun 2023 15:43:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686239005; bh=PnimYtsU8L1wziru+PbLo9AAv92Qytxkfm0LOSGrer8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CvTapLYwYU6+j2zGj0+69m+ot7YodTRJ+5pzKEZRV6XeT1aosffwoPehZ02vcDQRA RML6lROgrl1CU6yaW2asSOLM1CElbiwc6P2OvnAzbejPVlHzTkqa8edhXJ3rzX8Xsu tHkNhB6+IqH+W7qYuYtThZ+Cv0+WS8bl/JW3yxhqwCTo2B8a/NgyoR+EjhtriadnoQ NmhrJpGM/hoM41o/0a5HCLaqHhyf7MIuRWG9yVne+/dFxP3/cKZoXF3DEvvTMeQJlA 7fYCXSvQWrb9IZKTHUKfeb+OYtZpIC7nO4g3hKR4vyxUI5t4QQQrv20/cDEeIfv5I6 AalCJMAJiDdSw== Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-514a4c3ff90so761624a12.2 for ; Thu, 08 Jun 2023 08:43:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686239005; x=1688831005; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PnimYtsU8L1wziru+PbLo9AAv92Qytxkfm0LOSGrer8=; b=YZgHyfBWft6lU8IO9YMMF4jC2+UkRbvb1q32MhZOyGLPk++kgJPZHv3ETQAoyR/phj ax74vYapNcaxq2kI6jLZDTeSh8ohh8tPQ1vHit5RxYQ8YqUSxQDbsN9K776aqVdOVNmT 88hissi57PexcdxiMaLkIxH6cHdYkf4nBVlJBS7/YHiTRwEiDPkgG+VT8099Lvap/j6p Lp6GEK2DIrrq4D7MBtgfD5OtcRWqad/j1hPRgjFPJ0S5Am2WYnMCMwdhOvnz3lodlj/H FdCNvBTt54NQDqBsIDcPGW2skrPU5M3ecZF9tXjgDmIy454wWkCTDEAKG4URmNQdOvkL kMVg== X-Gm-Message-State: AC+VfDwuDUEss+vPumVfHbcdQJvPaK0egEHnKUr3pftqxbQvPebQzIka zkEkJxSalte3rXIfc0S4Vb2IZLkkPjXgAg4zTq34komr2ImiPoTjVfPvtMxfcoOosZKEfQ2VSpu eUrfUQTHrGz46UFXCM5xyZ6iAXNeyV7tWHc7EZ4axYg== X-Received: by 2002:aa7:c30c:0:b0:514:9e61:e7b8 with SMTP id l12-20020aa7c30c000000b005149e61e7b8mr6336296edq.40.1686239005206; Thu, 08 Jun 2023 08:43:25 -0700 (PDT) X-Received: by 2002:aa7:c30c:0:b0:514:9e61:e7b8 with SMTP id l12-20020aa7c30c000000b005149e61e7b8mr6336286edq.40.1686239005041; Thu, 08 Jun 2023 08:43:25 -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 y8-20020aa7c248000000b005164ae1c482sm678387edo.11.2023.06.08.08.43.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 08:43:24 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Christian Brauner , Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v5 02/14] ceph: stash idmapping in mdsc request Date: Thu, 8 Jun 2023 17:42:43 +0200 Message-Id: <20230608154256.562906-3-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230608154256.562906-1-aleksandr.mikhalitsyn@canonical.com> References: <20230608154256.562906-1-aleksandr.mikhalitsyn@canonical.com> 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, 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?1768150556265408071?= X-GMAIL-MSGID: =?utf-8?q?1768150556265408071?= From: Christian Brauner When sending a mds request cephfs will send relevant data for the requested operation. For creation requests the caller's fs{g,u}id is used to set the ownership of the newly created filesystem object. For setattr requests the caller can pass in arbitrary {g,u}id values to which the relevant filesystem object is supposed to be changed. If the caller is performing the relevant operation via an idmapped mount cephfs simply needs to take the idmapping into account when it sends the relevant mds request. In order to support idmapped mounts for cephfs we stash the idmapping whenever they are relevant for the operation for the duration of the request. Since mds requests can be queued and performed asynchronously we make sure to keep the idmapping around and release it once the request has finished. In follow-up patches we will use this to send correct ownership information over the wire. This patch just adds the basic infrastructure to keep the idmapping around. The actual conversion patches are all fairly minimal. Cc: Xiubo Li Cc: Jeff Layton Cc: Ilya Dryomov Cc: ceph-devel@vger.kernel.org Signed-off-by: Christian Brauner Signed-off-by: Alexander Mikhalitsyn --- v4: - don't call mnt_idmap_get(..) in __register_request --- fs/ceph/mds_client.c | 5 +++++ fs/ceph/mds_client.h | 1 + 2 files changed, 6 insertions(+) diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 4c0f22acf53d..05a99a8eb292 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "super.h" #include "mds_client.h" @@ -962,6 +963,8 @@ void ceph_mdsc_release_request(struct kref *kref) kfree(req->r_path1); kfree(req->r_path2); put_cred(req->r_cred); + if (req->r_mnt_idmap) + mnt_idmap_put(req->r_mnt_idmap); if (req->r_pagelist) ceph_pagelist_release(req->r_pagelist); put_request_session(req); @@ -1018,6 +1021,8 @@ static void __register_request(struct ceph_mds_client *mdsc, insert_request(&mdsc->request_tree, req); req->r_cred = get_current_cred(); + if (!req->r_mnt_idmap) + req->r_mnt_idmap = &nop_mnt_idmap; if (mdsc->oldest_tid == 0 && req->r_op != CEPH_MDS_OP_SETFILELOCK) mdsc->oldest_tid = req->r_tid; diff --git a/fs/ceph/mds_client.h b/fs/ceph/mds_client.h index 724307ff89cd..32001ade1ea7 100644 --- a/fs/ceph/mds_client.h +++ b/fs/ceph/mds_client.h @@ -280,6 +280,7 @@ struct ceph_mds_request { int r_fmode; /* file mode, if expecting cap */ int r_request_release_offset; const struct cred *r_cred; + struct mnt_idmap *r_mnt_idmap; struct timespec64 r_stamp; /* for choosing which mds to send this request to */ From patchwork Thu Jun 8 15:42:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 105020 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp375931vqr; Thu, 8 Jun 2023 08:59:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6snNy9sGK7EZGqwwcjH7r8OR550vusIe/juK/lTplgCGitfHUTTQEvhNTYRPPjbGt7P6Ol X-Received: by 2002:a17:90a:ea09:b0:255:5f47:c85c with SMTP id w9-20020a17090aea0900b002555f47c85cmr4143690pjy.30.1686239994788; Thu, 08 Jun 2023 08:59:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686239994; cv=none; d=google.com; s=arc-20160816; b=oYkQV/wcdeM4bqLA9g3oL+bUt4Y1j25JkY9bjIUKjLhep1hwkYoAEL7+JSf1hKxbGQ BugFt3xPjekN/Nf/UJ8KZVcPZv1YvDsM6Pgp//fRiKKTvq2y2ZFVD+bKYYVwL+3OhYT8 bvgdZOpwanvoe5foZHnerbUuXzQSVVXqOfTUZ8PUWohwliNztj3y9nuL6Pv63azaN96E O+73rypliF9tWTUaQMyUzWvBh0h578RbG6i6e5TFgDxRQy3IWUoMX6pNhagN9DB+rPbG rQAPJ0rko3cQge+z8PA4+/nJvwyyBczHT8mC0U1y+ROI+gOyoVZg8cDBym900DUivF2x NRZg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=MVopSiFXJtuCZDFmw4k6EoX9EHPj+DJ/m9lrNV/HJJI=; b=lT1p93/iTYcHj8MoWxSidKL9YvomruPON3lmERmzYs5ch7m/QTJGU82nx5qo6cy0l8 OgYg845HpDKYIWmyVsZjrGVpg3JBrAca6NArJsyArlLD6tN3+b0HvnF5yjOxFaaiAUWT 7nfl+fYoo2Xz3QRvmw1IygdxrKCRYRxaYtDHjtan4NywBAPRwQo1FnhM07Uz31gCHJHT oqTek/S9j4XVvKG5l36Kv48EQu7l/Yy12SW67HXNYRJM4sJWrcVOLuNwuMyzc9sfVzSu JWGnARwSIIhxKmaDrZvXe7qemEknjyzkTei0Veen+pBKX2HCcrPOkwKaP5RgbyN5cVR7 MOKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=KOiDBApJ; 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 c5-20020a17090a8d0500b00256bb961a29si2964681pjo.35.2023.06.08.08.59.40; Thu, 08 Jun 2023 08:59:54 -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=KOiDBApJ; 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 S237165AbjFHPnu (ORCPT + 99 others); Thu, 8 Jun 2023 11:43:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236344AbjFHPnr (ORCPT ); Thu, 8 Jun 2023 11:43:47 -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 787D830DA for ; Thu, 8 Jun 2023 08:43:35 -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 C4B853F364 for ; Thu, 8 Jun 2023 15:43:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686239010; bh=MVopSiFXJtuCZDFmw4k6EoX9EHPj+DJ/m9lrNV/HJJI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KOiDBApJlcDZy2xBPGX7JmWhdBBsz97WPR3z5NiwdrWX52svjYyFgp8pTeoWcTkxW 85aaygFC0gZca0o9Jr7zZdkSLVCI+IDnBfs5yFtcttllJQIKd53S8nk2gSmATFlX0G t0TxDDYAOyqEQ8I2Ppt8eF2uw+OOuu+fzjgdlWJ5KqMu6lyzaFez0V+vSDxVF6qgN3 tjpNPFKJ915ur2kw2vXyr5VgLYKBpTDFLo78wOcD6amEQe7ZBCfraLQKsnys4meANl AzOf9MOiLsUZNtZbi6E2wkl69p2nt4neBnIMdcTtg2s+q6+cHp0RKC3c9lKBYvcQZx RJY/CyumgWOug== Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-51662972715so763388a12.1 for ; Thu, 08 Jun 2023 08:43:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686239009; x=1688831009; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MVopSiFXJtuCZDFmw4k6EoX9EHPj+DJ/m9lrNV/HJJI=; b=MNXM5/Phz41MXToEHHi2CNdScWcqgmeRS73QJhGQ0thDR+7aBU1dg8RS/P9cfF5yqY vW4TK6+JHW/89dhr9JPCmQKCtkoO2kVsFqoMOgQ5MIeskIsVS+tPrgN5QtsYnIn1s+Tz uiCVsXZCgbJudWyPHRsFOoGb33iX/bRy18wV8+q4/8kHHWKKC7MZ9nzEsyjc7y0SSOjb Jge+0GIHuNbb99dF6Te+61nDUp5xZVjRY0bel5u3piYmgC2cEVFQKASXln7aajt06BG2 hdP1LaiPY+rQuJbHG0vzi/4vGX/HOy+HdtmA83+MvoZ51ymZttbw4J1Vev8+6yrVQ98+ ZP3g== X-Gm-Message-State: AC+VfDyo/mFiY0Lr4Rytjsi6niFfyij1ozy52fvDXU1jgE6cLWxf/MpA eIzGzQ4MtiEXsXbzvYBqeG2YyP1N3tGv0Jj7jQOFyA3N1tbRKlA3fkFYqO3uc+Liyj0i77tZodF dIAhNpwxL54x1fHh49Gs/ApPBFDhS54vrkLD/2sC6XQ== X-Received: by 2002:a05:6402:1218:b0:50e:412:5a50 with SMTP id c24-20020a056402121800b0050e04125a50mr7251916edw.29.1686239008688; Thu, 08 Jun 2023 08:43:28 -0700 (PDT) X-Received: by 2002:a05:6402:1218:b0:50e:412:5a50 with SMTP id c24-20020a056402121800b0050e04125a50mr7251892edw.29.1686239008441; Thu, 08 Jun 2023 08:43:28 -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 y8-20020aa7c248000000b005164ae1c482sm678387edo.11.2023.06.08.08.43.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 08:43:28 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Christian Brauner , Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v5 03/14] ceph: handle idmapped mounts in create_request_message() Date: Thu, 8 Jun 2023 17:42:44 +0200 Message-Id: <20230608154256.562906-4-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230608154256.562906-1-aleksandr.mikhalitsyn@canonical.com> References: <20230608154256.562906-1-aleksandr.mikhalitsyn@canonical.com> 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, 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?1768150788578885446?= X-GMAIL-MSGID: =?utf-8?q?1768150788578885446?= From: Christian Brauner Inode operations that create a new filesystem object such as ->mknod, ->create, ->mkdir() and others don't take a {g,u}id argument explicitly. Instead the caller's fs{g,u}id is used for the {g,u}id of the new filesystem object. Cephfs mds creation request argument structures mirror this filesystem behavior. They don't encode a {g,u}id explicitly. Instead the caller's fs{g,u}id that is always sent as part of any mds request is used by the servers to set the {g,u}id of the new filesystem object. In order to ensure that the correct {g,u}id is used map the caller's fs{g,u}id for creation requests. This doesn't require complex changes. It suffices to pass in the relevant idmapping recorded in the request message. If this request message was triggered from an inode operation that creates filesystem objects it will have passed down the relevant idmaping. If this is a request message that was triggered from an inode operation that doens't need to take idmappings into account the initial idmapping is passed down which is an identity mapping and thus is guaranteed to leave the caller's fs{g,u}id unchanged.,u}id is sent. The last few weeks before Christmas 2021 I have spent time not just reading and poking the cephfs kernel code but also took a look at the ceph mds server userspace to ensure I didn't miss some subtlety. This made me aware of one complication to solve. All requests send the caller's fs{g,u}id over the wire. The caller's fs{g,u}id matters for the server in exactly two cases: 1. to set the ownership for creation requests 2. to determine whether this client is allowed access on this server Case 1. we already covered and explained. Case 2. is only relevant for servers where an explicit uid access restriction has been set. That is to say the mds server restricts access to requests coming from a specific uid. Servers without uid restrictions will grant access to requests from any uid by setting MDS_AUTH_UID_ANY. Case 2. introduces the complication because the caller's fs{g,u}id is not just used to record ownership but also serves as the {g,u}id used when checking access to the server. Consider a user mounting a cephfs client and creating an idmapped mount from it that maps files owned by uid 1000 to be owned uid 0: mount -t cephfs -o [...] /unmapped mount-idmapped --map-mount 1000:0:1 /idmapped That is to say if the mounted cephfs filesystem contains a file "file1" which is owned by uid 1000: - looking at it via /unmapped/file1 will report it as owned by uid 1000 (One can think of this as the on-disk value.) - looking at it via /idmapped/file1 will report it as owned by uid 0 Now, consider creating new files via the idmapped mount at /idmapped. When a caller with fs{g,u}id 1000 creates a file "file2" by going through the idmapped mount mounted at /idmapped it will create a file that is owned by uid 1000 on-disk, i.e.: - looking at it via /unmapped/file2 will report it as owned by uid 1000 - looking at it via /idmapped/file2 will report it as owned by uid 0 Now consider an mds server that has a uid access restriction set and only grants access to requests from uid 0. If the client sends a creation request for a file e.g. /idmapped/file2 it will send the caller's fs{g,u}id idmapped according to the idmapped mount. So if the caller has fs{g,u}id 1000 it will be mapped to {g,u}id 0 in the idmapped mount and will be sent over the wire allowing the caller access to the mds server. However, if the caller is not issuing a creation request the caller's fs{g,u}id will be send without the mount's idmapping applied. So if the caller that just successfully created a new file on the restricted mds server sends a request as fs{g,u}id 1000 access will be refused. This however is inconsistent. From my perspective the root of the problem lies in the fact that creation requests implicitly infer the ownership from the {g,u}id that gets sent along with every mds request. I have thought of multiple ways of addressing this problem but the one I prefer is to give all mds requests that create a filesystem object a proper, separate {g,u}id field entry in the argument struct. This is, for example how ->setattr mds requests work. This way the caller's fs{g,u}id can be used consistenly for server access checks and is separated from the ownership for new filesystem objects. Servers could then be updated to refuse creation requests whenever the {g,u}id used for access checking doesn't match the {g,u}id used for creating the filesystem object just as is done for setattr requests on a uid restricted server. But I am, of course, open to other suggestions. Cc: Xiubo Li Cc: Jeff Layton Cc: Ilya Dryomov Cc: ceph-devel@vger.kernel.org Signed-off-by: Christian Brauner Signed-off-by: Alexander Mikhalitsyn --- fs/ceph/mds_client.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 05a99a8eb292..8826be3c209f 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -2581,6 +2581,8 @@ static struct ceph_msg *create_request_message(struct ceph_mds_session *session, void *p, *end; int ret; bool legacy = !(session->s_con.peer_features & CEPH_FEATURE_FS_BTIME); + kuid_t caller_fsuid; + kgid_t caller_fsgid; ret = set_request_path_attr(req->r_inode, req->r_dentry, req->r_parent, req->r_path1, req->r_ino1.ino, @@ -2649,10 +2651,22 @@ static struct ceph_msg *create_request_message(struct ceph_mds_session *session, head->mdsmap_epoch = cpu_to_le32(mdsc->mdsmap->m_epoch); head->op = cpu_to_le32(req->r_op); - head->caller_uid = cpu_to_le32(from_kuid(&init_user_ns, - req->r_cred->fsuid)); - head->caller_gid = cpu_to_le32(from_kgid(&init_user_ns, - req->r_cred->fsgid)); + /* + * Inode operations that create filesystem objects based on the + * caller's fs{g,u}id like ->mknod(), ->create(), ->mkdir() etc. don't + * have separate {g,u}id fields in their respective structs in the + * ceph_mds_request_args union. Instead the caller_{g,u}id field is + * used to set ownership of the newly created inode by the mds server. + * For these inode operations we need to send the mapped fs{g,u}id over + * the wire. For other cases we simple set req->r_mnt_idmap to the + * initial idmapping meaning the unmapped fs{g,u}id is sent. + */ + caller_fsuid = from_vfsuid(req->r_mnt_idmap, &init_user_ns, + VFSUIDT_INIT(req->r_cred->fsuid)); + caller_fsgid = from_vfsgid(req->r_mnt_idmap, &init_user_ns, + VFSGIDT_INIT(req->r_cred->fsgid)); + head->caller_uid = cpu_to_le32(from_kuid(&init_user_ns, caller_fsuid)); + head->caller_gid = cpu_to_le32(from_kgid(&init_user_ns, caller_fsgid)); head->ino = cpu_to_le64(req->r_deleg_ino); head->args = req->r_args; From patchwork Thu Jun 8 15:42:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 105010 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp370270vqr; Thu, 8 Jun 2023 08:48:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ55h3ptAZu2ZfO7sqsHWy80J56Bjw4axvbtC21au/OgebO0FE7QO/Cr5Kf7QOO6IYWCcdPh X-Received: by 2002:a17:902:bcc6:b0:1a1:a800:96a7 with SMTP id o6-20020a170902bcc600b001a1a80096a7mr4921067pls.8.1686239333225; Thu, 08 Jun 2023 08:48:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686239333; cv=none; d=google.com; s=arc-20160816; b=pHSWSxAER1sFX1roASL05Zo+HwMrp+Vgcz6Fxbn4LOVNQDjcu7fgTf4aVzJ0zQvGzK N7CSkk0MGzQFmAz1mvGU4wAlH8uHjB0qMSBmKBw1qVXIUCVxcTRzlVpjy0QzAh1lmVjK vSMcvxpnhG5wu4buENQAkH+ifyRtS+QTsdabdYSg4IuWC5bCq/VKbTscOt5Y28BeTT8V IzmFlcvHJpzMKhwWp0ByC5MWvCkcghZsLG9NnU9b8iAgYemlrqd2QSMFizqplZANWifX HAqAZIc1RSJMKkkGsnD9WY0qUgzQbrFpsabFNakccVhZgUfqeiDGflqJD456F/Kpb2VZ bnHA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=h11FfWaHHNNtwvZRIcKn5zgsctxJ3ebjyEZJ//czxrM=; b=hIeHW/UMtGvjGOok75eu0FmipfYJuv9gsyo+fJ6J8K21VcIpFfF63N/YAOislMjE/O 74Xkk2hleiM++zoHyE5TfWwGIur1cmfNNFN1itxmAaK1A1ADOlYJC0a0AbssG8X3MjgL nt1UHvkiQkc5TIxqcVRd5D8sTSluLOB75ZKUpb9o1fbQVdQhZ/0abtkxgw7Y8Fh4CWUt p8kbzn5vNLTp7VB+LfudNrpGdAN4xIn7riEx7thJqznhhniCyWdlhyOF1Ds3nWz4joxo eVq8bL0DOnZI6EwP/hTdSwilY1w9GFkOKDyxQYBlF+I94HpNRDIKWqxIA3+JofTTc+gn 3V+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=C3odLjjM; 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 u11-20020a170902e80b00b001b063904058si1259688plg.438.2023.06.08.08.48.36; Thu, 08 Jun 2023 08:48:53 -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=C3odLjjM; 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 S237180AbjFHPny (ORCPT + 99 others); Thu, 8 Jun 2023 11:43:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237043AbjFHPnr (ORCPT ); Thu, 8 Jun 2023 11:43:47 -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 8DB1F30DB for ; Thu, 8 Jun 2023 08:43: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-1.canonical.com (Postfix) with ESMTPS id 6E1E63F33C for ; Thu, 8 Jun 2023 15:43:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686239013; bh=h11FfWaHHNNtwvZRIcKn5zgsctxJ3ebjyEZJ//czxrM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=C3odLjjMTnC4GmK2gIb11CBC+Ff1sl3Q7D6IborxstpXI29fuhqeRoJOOApGUj0wr o3I8MYSRzRcsg6EvC2X/mOVYS15ZfqQhAPwlZjgZ4ajgayBg4NVRgQ2f14doPD+/69 E3+ZAhfjRfUzm/FU33aS51EQTH1hVgCbWqG2y6n2RTN+5hstVQmVF0ZPzWx8AEwQ39 2RQ5CpOmglbEWkAAKoacfu9ILDHjzu0lRm3j8yp+diGwB7DlKn+sRKvBVLlvvERSdl 70dfTJSRoexuNjK3dHO4zharLWHnzwfZpGBcULI3MySFASSbrB2GVxacK883eamiV/ 0BzayAOKOgxsQ== Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-514bcf60cd1so758666a12.2 for ; Thu, 08 Jun 2023 08:43:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686239011; x=1688831011; 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=h11FfWaHHNNtwvZRIcKn5zgsctxJ3ebjyEZJ//czxrM=; b=Xft3SrLJR3AKq6atH2F5k9fdkN7Rxqlsruxso/UkIUnjQsNtUX5svAzah5fLybIR7c xdkRiMOns5AwLIgbMDhHl9LkOv6RXwbogDnXtRO6yfjS5xgqWrtLSlEiqwGOWAELgL5+ eaYsuz2WtuA+XM9wB1PQLHO0mIQ5hVMTEIAGv4Q7Se84AQJgLn6W0hDdZhiLsDAxQ9KO PKC5e411KVxVaEwcBnsU9RcLE6OlYyaDZA5ng6Y9q8a054i+Mv8JvJpdFbtjFpt5jsAP MT1PXR1Yh47kZNnr3KCC2ODgLiNO9I2NANklP/9yNYHLf2+JcO5ThFiNKwZcumxKlXAu yg7Q== X-Gm-Message-State: AC+VfDy1CguPpbeJvDuX4Dkypz6lmsrKfEJDC9df0ruaKuwiWm7Nn+is 05jmAGc5auckFIpamZQgqcxshPcbYgr2lOuSKqEwLYd9nUWbG5zCkQiuVxRANPHG9G4Y7QVr+EP lT6UOpfYqJVRPmNzQn2Y2upd3xsdMBrHrCipv8A5jnQ== X-Received: by 2002:a05:6402:799:b0:514:a6bd:144a with SMTP id d25-20020a056402079900b00514a6bd144amr7678708edy.11.1686239011194; Thu, 08 Jun 2023 08:43:31 -0700 (PDT) X-Received: by 2002:a05:6402:799:b0:514:a6bd:144a with SMTP id d25-20020a056402079900b00514a6bd144amr7678690edy.11.1686239010947; Thu, 08 Jun 2023 08:43:30 -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 y8-20020aa7c248000000b005164ae1c482sm678387edo.11.2023.06.08.08.43.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 08:43:30 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Christian Brauner , Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v5 04/14] ceph: pass an idmapping to mknod/symlink/mkdir/rename Date: Thu, 8 Jun 2023 17:42:45 +0200 Message-Id: <20230608154256.562906-5-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230608154256.562906-1-aleksandr.mikhalitsyn@canonical.com> References: <20230608154256.562906-1-aleksandr.mikhalitsyn@canonical.com> 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, 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?1768150094710002773?= X-GMAIL-MSGID: =?utf-8?q?1768150094710002773?= From: Christian Brauner Enable mknod/symlink/mkdir/rename iops to handle idmapped mounts. This is just a matter of passing down the mount's idmapping. Cc: Xiubo Li Cc: Jeff Layton Cc: Ilya Dryomov Cc: ceph-devel@vger.kernel.org Signed-off-by: Christian Brauner Signed-off-by: Alexander Mikhalitsyn --- v4: - call mnt_idmap_get --- fs/ceph/dir.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index cb67ac821f0e..355c5574ad27 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c @@ -884,6 +884,7 @@ static int ceph_mknod(struct mnt_idmap *idmap, struct inode *dir, req->r_parent = dir; ihold(dir); set_bit(CEPH_MDS_R_PARENT_LOCKED, &req->r_req_flags); + req->r_mnt_idmap = mnt_idmap_get(idmap); req->r_args.mknod.mode = cpu_to_le32(mode); req->r_args.mknod.rdev = cpu_to_le32(rdev); req->r_dentry_drop = CEPH_CAP_FILE_SHARED | CEPH_CAP_AUTH_EXCL; @@ -955,6 +956,7 @@ static int ceph_symlink(struct mnt_idmap *idmap, struct inode *dir, req->r_num_caps = 2; req->r_dentry_drop = CEPH_CAP_FILE_SHARED | CEPH_CAP_AUTH_EXCL; req->r_dentry_unless = CEPH_CAP_FILE_EXCL; + req->r_mnt_idmap = mnt_idmap_get(idmap); if (as_ctx.pagelist) { req->r_pagelist = as_ctx.pagelist; as_ctx.pagelist = NULL; @@ -1022,6 +1024,7 @@ static int ceph_mkdir(struct mnt_idmap *idmap, struct inode *dir, ihold(dir); set_bit(CEPH_MDS_R_PARENT_LOCKED, &req->r_req_flags); req->r_args.mkdir.mode = cpu_to_le32(mode); + req->r_mnt_idmap = mnt_idmap_get(idmap); req->r_dentry_drop = CEPH_CAP_FILE_SHARED | CEPH_CAP_AUTH_EXCL; req->r_dentry_unless = CEPH_CAP_FILE_EXCL; if (as_ctx.pagelist) { @@ -1324,6 +1327,7 @@ static int ceph_rename(struct mnt_idmap *idmap, struct inode *old_dir, req->r_old_dentry_unless = CEPH_CAP_FILE_EXCL; req->r_dentry_drop = CEPH_CAP_FILE_SHARED; req->r_dentry_unless = CEPH_CAP_FILE_EXCL; + req->r_mnt_idmap = mnt_idmap_get(idmap); /* release LINK_RDCACHE on source inode (mds will lock it) */ req->r_old_inode_drop = CEPH_CAP_LINK_SHARED | CEPH_CAP_LINK_EXCL; if (d_really_is_positive(new_dentry)) { From patchwork Thu Jun 8 15:42:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 105009 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp369615vqr; Thu, 8 Jun 2023 08:47:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5XuNFmv53J6tzWODHAmF0OyW/VGggu8vJmMqO6M6oQV0Ej0sXBYdFw3VTnGciNZUnOyb4/ X-Received: by 2002:a17:902:b701:b0:1b0:499f:7a8d with SMTP id d1-20020a170902b70100b001b0499f7a8dmr4279866pls.9.1686239259945; Thu, 08 Jun 2023 08:47:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686239259; cv=none; d=google.com; s=arc-20160816; b=V8gH+w/2PsbtzUM8QLenmUB3XSk6+cCSJ2AJp2vSyfAPVHQIu0emo5IeIrPq0VNRIN nqnnqKsEBcJ2XEgV9ehNQedTLuwMmooHt8yL56is1SqtlmNqHrlSpkhwfECf6gbp7q4I 70n54Ns6+euTlAD2ajeKDsAsjwUoU4P8Lld6ceUEvEWOdrf4aiOa0kvtGsCc9+wPIY5Z zthPgGsM0RHbTzc/lwlCrTXISNohuNVrrp1MJnPK83Aaiyf6/KCv3QC8ZKj4dKmbDK1W n1u6uiRvNnzrsJnIqKt4SS/cycAm9w3lvtUw0ciW1Chte9mU2dxp4+Y2BsmWNSv4Cjtg B5KQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=U9FNme5iBEpufhowdmn6D6u4P9E81AUlwyvYSH4GMyo=; b=y6Dzhwu076l6UXm7QkslH9oEO4gwYar4owgyjS2Qv9jir+Y/KrlHGPuRvl06jO+45a yl3qtPgbiyfwMn5QS5Rq/0ImzsuZO4OJqMe53OmCwMs+zUD7oTaxroyuwP4SpaSDcvml dey2oKhyVIUzmn5AI4g5aHcYvHxe+pkWg3PW3xdJTJLxxXwb8IruSsdNwlfgBDtTmNaH Z5r3N4QiZt9ZH3FJ31N8pKZrYcwc9JqU10HmHXK+J0v9QadkcPXkFDxak/OJIb/jhYVH yLBh4M626+isw3gFbpIcotN6hiSpMgVITp/pR+KO5v7VNHHwL7b5rtugq0F+Cy5mlpTD T/dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=nXEpBLY2; 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 i12-20020a17090332cc00b001a979e702b2si1235984plr.416.2023.06.08.08.47.22; Thu, 08 Jun 2023 08:47:39 -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=nXEpBLY2; 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 S237211AbjFHPoH (ORCPT + 99 others); Thu, 8 Jun 2023 11:44:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237162AbjFHPnt (ORCPT ); Thu, 8 Jun 2023 11:43:49 -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 0326830DF for ; Thu, 8 Jun 2023 08:43:37 -0700 (PDT) Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 81FAB3F36B for ; Thu, 8 Jun 2023 15:43:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686239015; bh=U9FNme5iBEpufhowdmn6D6u4P9E81AUlwyvYSH4GMyo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nXEpBLY25uGlswDTSF7+yXtJxiY9OwrEtmJLmgwjg/Oo59EbJaUOK2vhQSm74loZa FCODoM1TQBmmbteEHWTQe9Uz1dPt/LrlOGThyjSmuUnXmmasEHCRSbUzriLZOHg80t onJim6o8miaXTgd7HqKRWVDJZgDD0nRQbxCS2kJYcJiBadzy8FVYH9cQRe/eG6Ni1I XPricqkktgfX0Wf3Xb44Oj5oNdWXWn2D3j1mjIlh1k8l8sZM3O7iCmgudltqPmC08J hF21HTH3zFO7TeKhLgLrH+xkni+D13q9/ayUglCR1i7j8oqoAYCeV8kUHVo67F4kyD 3TBtVQcuReAtA== Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-51495d51e0fso754587a12.2 for ; Thu, 08 Jun 2023 08:43:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686239013; x=1688831013; 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=bhPHP8ltFo6rXAv/OqGmlrOuoSIuhZiJDImcWJGFa6vz4nrCB2vRP/oDDGFeVITWuL /OjwbJBk8yKrxIiS+7fEPbxefh/zz12B6UhM757CHpdwUecIfVIrTzYllhbVyllejpiM hRMFYFN//TOMhKgjLCeb2XS5NDwxEDQes/OMB8nBHCsmP52vI1Z11D4Njuhq9uKj5XOs kojGhVp3Yt4TQmZsAZmC3DIMH3UjEocWGAlFROZWWF4SZjYau8tFtxBWGEzwE8c6b9ME 5z2MYnijJml/h/j5an3xo788endVN3tVHu+sHSZ5VlJMShThqQe1Dag0GfGsE9/bJvhN H6cg== X-Gm-Message-State: AC+VfDw99TCbwqfUZCVRG0UR/l3Sj/mW9U3qu3aKQrmC/H4Mm4LJwJbd u07NvRFiPwggEH5vW8zXUyzBKhGiIiIqBZMKbCo9iPY39ZQDX31Cs2UGm7EntK9m46dYpyAPBUy ujrWhTYrwTpP9nUrohndwrNjy6O/yYIIOmq24z6B6SQ== X-Received: by 2002:a05:6402:147:b0:514:9c05:819e with SMTP id s7-20020a056402014700b005149c05819emr7681644edu.0.1686239013828; Thu, 08 Jun 2023 08:43:33 -0700 (PDT) X-Received: by 2002:a05:6402:147:b0:514:9c05:819e with SMTP id s7-20020a056402014700b005149c05819emr7681635edu.0.1686239013667; Thu, 08 Jun 2023 08:43:33 -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 y8-20020aa7c248000000b005164ae1c482sm678387edo.11.2023.06.08.08.43.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 08:43:33 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Christian Brauner , Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v5 05/14] ceph: allow idmapped getattr inode op Date: Thu, 8 Jun 2023 17:42:46 +0200 Message-Id: <20230608154256.562906-6-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230608154256.562906-1-aleksandr.mikhalitsyn@canonical.com> References: <20230608154256.562906-1-aleksandr.mikhalitsyn@canonical.com> 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, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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?1768150018066024987?= X-GMAIL-MSGID: =?utf-8?q?1768150018066024987?= 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 Thu Jun 8 15:42:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 105017 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp373393vqr; Thu, 8 Jun 2023 08:54:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5wDjMh0wPG380Cd6DcfyFWyUMzfoQrHVYnR700NEohZ+nuXaZ2ptYI38RxuCAbO7BIl32C X-Received: by 2002:a05:6a20:12c8:b0:10f:8b61:197c with SMTP id v8-20020a056a2012c800b0010f8b61197cmr4616634pzg.54.1686239678635; Thu, 08 Jun 2023 08:54:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686239678; cv=none; d=google.com; s=arc-20160816; b=IlciwUw0T8AcrmW391Fd5NW7Bf3JeBUMMzLjSstlWaUPDOLCus/jweP4EpuagOXJ5q +jc0pjkSA/InfypOWUs1FFppj1Vay1daWuLQSDFCLyBGZgs4n9aqZbiuvkAU9EXXjSi4 90QeCqHgMgjO1vM8tGi2O7d2GY1+qMjTqUHUH9GwAEHif3EzHult3IZdtPHGaf4FXsGF 3348iqNrIsYTZFABooOibPUF4rc8Ksx5nCTn+UBnm7SY9b1IKqmZM+3QRvLVsyZnTBWW cI1SIqk/ZTVmBQi96h9TDDoTPv9aUNwVwYxm75ePGzSxnv3KJAykMp09iLq2D386vVY0 fSrw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Yx9DhBwZ0J2oRahK7SO/c3VRSYe4JEpen4id9pbwqa8=; b=eih3/9al6GE+u7CCBGU0jRXDub/fK2/7BR54MjXWv346H4vexrpxC602fh5x64hn7r VSWiT0rDABriynouWsAIOj10Lq6whn1REsCTKtuRbJfgidyQuqvNNd7r9vU+5hwrzfBO AaBTKvgTAcJfKWfQCSUnPH+ALiEJbdoXzDXv/mDBqN3thg5GsSoP8A2hH3auvIlq8N6w dcaCNU7u/zeCUfO3p1N1QWT1vVsUs7MK0fTctDIcTuglo7rIU1TrmzH9M+VpBsJVrQ5v ek+OvZuWquP8ZFZ7/uchMIZ7J4U0g145me8+wNogxZlg6D1XnWoHmJUMJuKDJX2iEV4w Jx7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=bAj9D86l; 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 83-20020a630256000000b00542abcf2ce4si1149689pgc.623.2023.06.08.08.54.24; Thu, 08 Jun 2023 08:54:38 -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=bAj9D86l; 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 S236951AbjFHPom (ORCPT + 99 others); Thu, 8 Jun 2023 11:44:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237153AbjFHPoU (ORCPT ); Thu, 8 Jun 2023 11:44:20 -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 5BB4B30DA for ; Thu, 8 Jun 2023 08:43:55 -0700 (PDT) Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 0F92B3F56E for ; Thu, 8 Jun 2023 15:43:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686239022; bh=Yx9DhBwZ0J2oRahK7SO/c3VRSYe4JEpen4id9pbwqa8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bAj9D86lm7Kww9Am/3rrNGWc0XDsrvF4EhhX9nCHOvzkEALyjt0j6G0E1dN6YwP8U PvKr6lP9yyyrChWBn1CxenfhvJcZHBVQMEXHqDCUCJ+Ccr6SxfJ2jS/OKrY7igtjgi ur+YSwAqrF2uzXrCxmIZLMiy7kLUMhI4E3UDlYFea53yXrsGNm8gxwUnih5r/cR+98 Jq8eB38LfX5IR/zjlUXPLSMlkWrKTOz2XIDJSJEEmN8nZIOImBgJRHtpFzsGiBnfCO nb5Ke+Mll6mzzekQb7NC5WgQz5Hm4TbkI1V9S9G8OM5SINRihDzqWIAY9NmXpUs+/3 dIZXTUiCNZu6g== Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-9744659b7b5so100326266b.3 for ; Thu, 08 Jun 2023 08:43:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686239016; x=1688831016; 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=hNJ3ZqcAjss8+mCa0iZe2Qzofz47TTGbZcZUnVEFJsEKAFp6aoI2l5z36kszsaPw2Y IqKj7M1VGRuUugEJ9E53RLqEO442M1tokYv4gPx2imVTeaZohHu61cRAJHw1FO2wqttx akgIpK0y41Q6HWZ3nevvMSxFsTQbjX/mBMPAmsZo7Jyt8BVHTWw88uYOh8Df9994l0rO oo3t5Mtcw7DAAerevjtX5zDkSdACwyWSJAaC2YiGat/nk4Hpg3Y3pk1/CfRBfEeXqjCa EEC4bA07V/y6PjaTQSmYetyqeLCfetDQZqik/aXJ1ukdmWOV0e0LQRsAqSY4DgcOXI1o c5tQ== X-Gm-Message-State: AC+VfDxOCplQQ0Z2v5vXzpTmAiI1LMQBtOIqUW7H4heKvOkrNn70urPV iGFmAg/5sYoOAvUDElxszSWL9Mg4Mj1L/TtFuobTBYzGcRA2tMauPxC1YbJmFMrvQbJXM5gMJeE QR1pWrUMA2qmEZYN2GH5vqXCq6pHgTNqwtuUXgnMJbw== X-Received: by 2002:a17:906:5d14:b0:974:61dc:107c with SMTP id g20-20020a1709065d1400b0097461dc107cmr124323ejt.44.1686239016664; Thu, 08 Jun 2023 08:43:36 -0700 (PDT) X-Received: by 2002:a17:906:5d14:b0:974:61dc:107c with SMTP id g20-20020a1709065d1400b0097461dc107cmr124301ejt.44.1686239016513; Thu, 08 Jun 2023 08:43:36 -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 y8-20020aa7c248000000b005164ae1c482sm678387edo.11.2023.06.08.08.43.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 08:43:36 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Christian Brauner , Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v5 06/14] ceph: allow idmapped permission inode op Date: Thu, 8 Jun 2023 17:42:47 +0200 Message-Id: <20230608154256.562906-7-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230608154256.562906-1-aleksandr.mikhalitsyn@canonical.com> References: <20230608154256.562906-1-aleksandr.mikhalitsyn@canonical.com> 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, 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?1768150457599818674?= X-GMAIL-MSGID: =?utf-8?q?1768150457599818674?= 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 Thu Jun 8 15:42:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 105022 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp377821vqr; Thu, 8 Jun 2023 09:01:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Y9QWPB/u0PP+PLbMB7tHhyHjb9O9pmqAyzamzOccNAP3SY4P7e+io9yXTYCFvygFdSH1E X-Received: by 2002:a05:6a00:1302:b0:64c:9b56:6215 with SMTP id j2-20020a056a00130200b0064c9b566215mr4751478pfu.25.1686240110772; Thu, 08 Jun 2023 09:01:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686240110; cv=none; d=google.com; s=arc-20160816; b=Aunbkz+sy3TvbUDcOpgp3h4mikBcm0dc2NmH3JvIjgU83cAOV5StPAuqGXUZ59fG5n UseFG8UcKZEG0W9b0g6/a41lugqRUbOCuwjslyGLPsz/MaqWrYbpVRzP2W4/c+M8ExZI RETfcp7/aO+volNqGEgb0LuVX4ULDwumE4RHe4oCxY/E90kiGmq0onPrqyfj5CHGnoqe jb6i8Ty8jwV6roMKmRx1q7xdPnB0qcWvp/Nu2Hw8LIEbcpN/yXGzriJyEEMeWag7cVVt r8DoFiEHFrTlgb4P/IFsK/5vsIuNdwQKNzxuI0F7KjtuB7l8iZJEblhWcF5bvX95xESM CQJA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=g/m6XNFvTOUfG03RZDOMzrTB4ATEHu4pMqVecpMcDjA=; b=tYq6wfu9dwTKDAglVScIVwAX3PVMyN1eozdzu9OmQgVocdEstChqmVveD7ZGuo9SOI 4s7fz1Tm5Ai2j4Lw4mSHNxAS6D40y14/PT22Oi2cI0prYTrLzYBRUkNA91ap+OQE6QS+ rkkuK6TcWqJIIyyr+/mYfuTqjlk9VeIqN3dhM+NLqjlILFup3eQefPXdOPVH1ABhBUPB VReqm1pfi6TY5sNQjrITtG6diCzujayMFZci6VUEwLlsWIOr3VgRmT8n8u6zdf29gcvR 97Jz/ll1OiPWihoU4LznKD29Oa9Sa2N44HARbOeT5qelOVseQs+rYYxCz+apr9sAayiC 7poQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=RB2lXyPB; 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 h188-20020a6253c5000000b0065ff4b819b3si1037162pfb.52.2023.06.08.09.01.33; Thu, 08 Jun 2023 09:01:50 -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=RB2lXyPB; 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 S236658AbjFHPoU (ORCPT + 99 others); Thu, 8 Jun 2023 11:44:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236585AbjFHPoK (ORCPT ); Thu, 8 Jun 2023 11:44:10 -0400 Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D05F2D69 for ; Thu, 8 Jun 2023 08:43:44 -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 F290D3F36A for ; Thu, 8 Jun 2023 15:43:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686239019; bh=g/m6XNFvTOUfG03RZDOMzrTB4ATEHu4pMqVecpMcDjA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RB2lXyPBazDFw+z18t6MQN0Mr90Ei3G+ZtYBxzCRhhi3dxlYtn5uHCunor/NvBEzx +IWGgn8+oXotj2rLTw8C16MgU/6yxavJIL3LMeQ6LcrB7s+gD/zrz62AS4zMtdF9rY 7ZjneORo8239/ULdI8obYeijOy0yIV5JIqm5Z2BJmYVdPdqocfH611mlhLg5ZAMaX0 5iqDqoQU6k0ZU9mHl+20ycuT0Mg6duXvfD/B2ZuAfCctLah+aum/I+LpE8viJJPW6c hYGObPAQ2IVyqIeemyYju8BFCmIeqvVC3Hl7w6bm3T97EhF7PLCbYGKCiHFncsnu/l IIa3hKcx90Jfw== Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-977cb78acfcso80506566b.3 for ; Thu, 08 Jun 2023 08:43:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686239019; x=1688831019; 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=g/m6XNFvTOUfG03RZDOMzrTB4ATEHu4pMqVecpMcDjA=; b=bZ/ZdqPj9RrmB5mPFzxth1v7nfvBJB5VkMU3YafKIlp20/Dq2cf9DJBqMr2PEEHLxg JShdTV8PLF2F9vn/+XLd7H3rqTGvEYZxK8I47vKYKKD6nsK08wtl4Q+8Hx5ib4CLnBCp aOkUonLPVYu/teV0R+KKIhcCXU99YCm2qAbh9xZGYgQLPq3BE1uQ9B8pPWe4v3P8RYfm ID0Sy40+iUsvKS4FTNsIEdPnFuYqWcfjBnoHV/dVXzcvcbgzSbr7YEry7G2L2bGHjOBv /LEqnuR3Buek/3yWSy0sNQvblBCPrpfpfEADAJDW1sG4jFkrXnH2p3SMuTIaoaxN3diW Qa7g== X-Gm-Message-State: AC+VfDzzzxhHpQiLDmgf79WJzDN+4lgXmZb0jHhPnzOqSdhbAUDhbBJ7 mMdz6LT+r5XSEOxqgEJxKOpKnj15btpBSFwAvwkB7uL0b6rl5iwhS+bwEv7U9cgMI4i2EubTvRf LaaW2YsI5sjFKFAvLRMDT5iq7/WtivmZaN+n4qeTkPA== X-Received: by 2002:a17:907:74b:b0:978:a964:106e with SMTP id xc11-20020a170907074b00b00978a964106emr142674ejb.17.1686239019654; Thu, 08 Jun 2023 08:43:39 -0700 (PDT) X-Received: by 2002:a17:907:74b:b0:978:a964:106e with SMTP id xc11-20020a170907074b00b00978a964106emr142658ejb.17.1686239019513; Thu, 08 Jun 2023 08:43:39 -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 y8-20020aa7c248000000b005164ae1c482sm678387edo.11.2023.06.08.08.43.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 08:43:39 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v5 07/14] ceph: pass idmap to __ceph_setattr Date: Thu, 8 Jun 2023 17:42:48 +0200 Message-Id: <20230608154256.562906-8-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230608154256.562906-1-aleksandr.mikhalitsyn@canonical.com> References: <20230608154256.562906-1-aleksandr.mikhalitsyn@canonical.com> 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, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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?1768150910392479666?= X-GMAIL-MSGID: =?utf-8?q?1768150910392479666?= 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 | 6 ++++-- fs/ceph/super.h | 3 ++- 3 files changed, 8 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..bface707c9bb 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; @@ -2206,6 +2207,7 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr) if (mask) { req->r_inode = inode; ihold(inode); + req->r_mnt_idmap = mnt_idmap_get(idmap); req->r_inode_drop = release; req->r_args.setattr.mask = cpu_to_le32(mask); req->r_num_caps = 1; @@ -2252,7 +2254,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 Thu Jun 8 15:42:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 105025 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp379564vqr; Thu, 8 Jun 2023 09:03:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7xNa2bR1yQvGffPmDU+4x/FpzpoREmUiYrbjfP8Ao7BdNIqyqSi+AVQK+w5nMCVlx1oRhy X-Received: by 2002:a17:90b:1e04:b0:250:d293:5da0 with SMTP id pg4-20020a17090b1e0400b00250d2935da0mr5794414pjb.17.1686240219791; Thu, 08 Jun 2023 09:03:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686240219; cv=none; d=google.com; s=arc-20160816; b=JFAEe1ye5LK9LortcNsIoL3jQgwpF3OjcmqqN2sIdG7SCpc1Wxkm9cpaUf0SzaZneg P9GuGf+1z/3+qjfHk1f4Achk8EdeYw2Dmp8vYXeduZu1HibuN7EvL4y2dR+PCOZ/LQeE Nj8hFQ/RWgI/Y0QMVEFu3YXAwgtc70DNSv4R1FQ0kRFDUpSq1hQb/WxBLxV/yU0hV0Tn f+4YRKoAL7SLpLzt/RIr9nAEVGmZdgTSCYzrhXJ13ky+lxek84GIKzNbT87vQlxy53mI hg8e5Q7MWHwcAaEO311KQCtRxoQygMvmnSOezZ5WuT2jmuU/o61E6Ny6lLEvN0qWGDiH u+kA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gghyNGCh9Nhwv51CwrkrRVAEuotD0ib4eCZetw54L9Q=; b=IyoMpUVLN/3Ttrq/2asFwDSGdDRtOU/TuWTpqVTCmovZwJcED8nClrrPt686dFi7v4 0qWPS8BJ22pv4wBwXkKVM0df1VJCPeVu/Q7I8FY+li4e4X+qipqnYOiUedI9+/EsS0Ur sjVpc9125k5BQ3JdL7BtxbOxDmR1ahri1VjC1YM4d0c/lNOl1eN/4xYAI0qJ8vItnvpG JJfhgfR/JiSg8PXT8be292NHmz1pHY9sxZa5WLHcXd8r3QfSGUKX32TpwIzVVW1tKrtr 3LzoMn9fpJ0UpjP4vGx3D4eTQAtxEMlfSnsfFkm0daCE0C1jrtMKa8lB57U/3hJNVzAZ Pd+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=TtS9Bh64; 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 x8-20020a17090a530800b0025350783742si1257043pjh.5.2023.06.08.09.03.23; Thu, 08 Jun 2023 09:03:39 -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=TtS9Bh64; 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 S236585AbjFHPoi (ORCPT + 99 others); Thu, 8 Jun 2023 11:44:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237236AbjFHPoR (ORCPT ); Thu, 8 Jun 2023 11:44:17 -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 BB10B30C8 for ; Thu, 8 Jun 2023 08:43:51 -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 C32F03F374 for ; Thu, 8 Jun 2023 15:43:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686239022; bh=gghyNGCh9Nhwv51CwrkrRVAEuotD0ib4eCZetw54L9Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=TtS9Bh644+5q0boodMQLUJ4lTBcUTjo9TteChfFF9hij/Y9chzQAQspjQE6avG+9X N+hV8WeWvPcuVo19hYohumj1sHWZ7YusJWHw56wtRQNPT+u5iD/L+e9uyZVDgli9h6 pGhdrtWe24hIj6gqvswg5lNHZa1L6e3iX8B4Kjet+rF50BoExtCK+c1gRfis//Cr0Y wA+fFGEQhhUL+NgdY0EPrebF8zccAQSuFow0UW9S6sT7rpRl25r8yCDUwUu+oPE8JI 94ltbnnVNOh4fdCAup3DnO/3QgdLFCMfD4KQfaJ+Hhbnh9ZJhcLpKnqALsxSqqaMBP bgKc0JbZfqq8g== Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-50ddef368e4so706575a12.0 for ; Thu, 08 Jun 2023 08:43:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686239022; x=1688831022; 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=gghyNGCh9Nhwv51CwrkrRVAEuotD0ib4eCZetw54L9Q=; b=TwUvzty3w/KJB0FnJz1WPdjh9W1bfJwJJHZdaZf3TWVZHrCuew7RnFPfz3HwPaZtLR qCs5x+0J9xVLPnwoATB0/5Vqe56+MG/0x5jjGQTU7w/B0RWwXBVNYtMok1MnM8fjzk39 puifV91VHPa898sQWitMXc0qAnM+/HQAhf0jYYFlpxcJJVyrR2pT0yFbnw2v6B/66O4y Ldmkh1T4KkK4+l3maNCUSs2EiHZZDOs6AGw1Kz+UWRgcaO5psIwimZ51eOPT70WDaVIJ uiJXfvN5QBCOBzOwBWx7rBOXR/N6xecx3/nlqEVtjDcFIuR8xnk8LYwI+Mhd4oR58Tbe ZNdA== X-Gm-Message-State: AC+VfDybK8vO9RJOj1nH6/UbRxvwt2KM8NE7K0rer62QjwkJLbU1pl5U k4CKeNXF3rK8m0XErGRU1r7GgIZSiLNTPf5dl6MVI6uqL57nAK7UqNeQ/tb0IJJ7aRSHwd9pxf+ hJmDlKDqcrmRLLJMCcD/SaPUGNqX42p4QsdC57sc70A== X-Received: by 2002:a05:6402:2cc:b0:514:ae18:1637 with SMTP id b12-20020a05640202cc00b00514ae181637mr7681215edx.23.1686239022298; Thu, 08 Jun 2023 08:43:42 -0700 (PDT) X-Received: by 2002:a05:6402:2cc:b0:514:ae18:1637 with SMTP id b12-20020a05640202cc00b00514ae181637mr7681197edx.23.1686239022090; Thu, 08 Jun 2023 08:43:42 -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 y8-20020aa7c248000000b005164ae1c482sm678387edo.11.2023.06.08.08.43.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 08:43:41 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Christian Brauner , Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v5 08/14] ceph: allow idmapped setattr inode op Date: Thu, 8 Jun 2023 17:42:49 +0200 Message-Id: <20230608154256.562906-9-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230608154256.562906-1-aleksandr.mikhalitsyn@canonical.com> References: <20230608154256.562906-1-aleksandr.mikhalitsyn@canonical.com> 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, 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?1768151024868643439?= X-GMAIL-MSGID: =?utf-8?q?1768151024868643439?= From: Christian Brauner Enable __ceph_setattr() to handle idmapped mounts. This is just a matter of passing down the mount's idmapping. Cc: Xiubo Li Cc: Jeff Layton Cc: Ilya Dryomov Cc: ceph-devel@vger.kernel.org Signed-off-by: Christian Brauner [ adapted to b27c82e12965 ("attr: port attribute changes to new types") ] Signed-off-by: Alexander Mikhalitsyn --- v4: - introduced fsuid/fsgid local variables v3: - reworked as Christian suggested here: https://lore.kern --- fs/ceph/inode.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index bface707c9bb..58ec603a55af 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -2052,31 +2052,35 @@ int __ceph_setattr(struct mnt_idmap *idmap, struct inode *inode, dout("setattr %p issued %s\n", inode, ceph_cap_string(issued)); if (ia_valid & ATTR_UID) { + kuid_t fsuid = from_vfsuid(idmap, i_user_ns(inode), attr->ia_vfsuid); + dout("setattr %p uid %d -> %d\n", inode, from_kuid(&init_user_ns, inode->i_uid), from_kuid(&init_user_ns, attr->ia_uid)); if (issued & CEPH_CAP_AUTH_EXCL) { - inode->i_uid = attr->ia_uid; + inode->i_uid = fsuid; dirtied |= CEPH_CAP_AUTH_EXCL; } else if ((issued & CEPH_CAP_AUTH_SHARED) == 0 || - !uid_eq(attr->ia_uid, inode->i_uid)) { + !uid_eq(fsuid, inode->i_uid)) { req->r_args.setattr.uid = cpu_to_le32( - from_kuid(&init_user_ns, attr->ia_uid)); + from_kuid(&init_user_ns, fsuid)); mask |= CEPH_SETATTR_UID; release |= CEPH_CAP_AUTH_SHARED; } } if (ia_valid & ATTR_GID) { + kgid_t fsgid = from_vfsgid(idmap, i_user_ns(inode), attr->ia_vfsgid); + dout("setattr %p gid %d -> %d\n", inode, from_kgid(&init_user_ns, inode->i_gid), from_kgid(&init_user_ns, attr->ia_gid)); if (issued & CEPH_CAP_AUTH_EXCL) { - inode->i_gid = attr->ia_gid; + inode->i_gid = fsgid; dirtied |= CEPH_CAP_AUTH_EXCL; } else if ((issued & CEPH_CAP_AUTH_SHARED) == 0 || - !gid_eq(attr->ia_gid, inode->i_gid)) { + !gid_eq(fsgid, inode->i_gid)) { req->r_args.setattr.gid = cpu_to_le32( - from_kgid(&init_user_ns, attr->ia_gid)); + from_kgid(&init_user_ns, fsgid)); mask |= CEPH_SETATTR_GID; release |= CEPH_CAP_AUTH_SHARED; } @@ -2242,7 +2246,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; @@ -2257,7 +2261,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 Thu Jun 8 15:42:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 105019 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp375672vqr; Thu, 8 Jun 2023 08:59:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5/qbbvFQVM6Sm1bDVKpM3bJF0JNKRTSqvoR5jxp2YBqv8dSjnsVlM2a2BvuWmHs89zZ/05 X-Received: by 2002:a05:6a20:a126:b0:10c:7c72:bdd6 with SMTP id q38-20020a056a20a12600b0010c7c72bdd6mr4583226pzk.59.1686239965745; Thu, 08 Jun 2023 08:59:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686239965; cv=none; d=google.com; s=arc-20160816; b=EBm79xgfQbkEDFaXTFRU8Xs+aeWmtK+vRQKSbm0F8V2eu36ddpRfZfoALG3x2Lce1D +zb1Y5D9PuQCImxa5r4uoLqWZX8GVE86sR50EgiP213ek8pZGUUsCRGtt03662ix8IIS Iv3srcgttiEIkfuPp4ZA4K3vy7WO+5rD7Ke4nsstrhXhgC3UrprwIiDSmCFL/chVoEpx gh+T3sZNPRo6StNG6yv1cqba13J9LeVEwpbPj6rrG7MgGh2eaA/uwO0+/u48JCjM1GCn q2mOZFGlrApUWwX6C5OwjHw5wQ90EjYZCi/rgk5F+VIv+/OoPob3k/r2VKKpL+ebMxyc NppQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/It8VSgZDTEKktJxHTMOOJHpvqL0RXNtakCJDr6cWYA=; b=WK2FOEbbsGUhQf9nqCxGg8smPnSJ3M9hHl8TYcCTddlqIgWg45VJor7eltZQYCaIYg QMGi3D86YF+hoJG4C+tdluVVHiL7PL2ALxkPxJzOlDxHcXeX6Kr+4wCqxd+agsrt9qsT F8xt4WgA5WocGi2cDAu3KZsNAcR15yFsNYRKkHGsxXbLIn/W4o1RoWUm/bTbjcs5k4uD FN+GqtPO4zHA1ueuZTaghpMJ+2I3hXlyvNtAeM554CcuyfT/fxFUQI0xpjdXB9SgstpW 2GR/rnoEjy2udYkaQ59Um6G+Ge7IA8JfggyJ9lgKkY435IudhW+N8/ftvqvlIT7b9DDH AAOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=ZhAFBfhe; 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 s5-20020a63af45000000b00517ab01bb8fsi1188607pgo.100.2023.06.08.08.59.10; Thu, 08 Jun 2023 08:59:25 -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=ZhAFBfhe; 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 S236193AbjFHPou (ORCPT + 99 others); Thu, 8 Jun 2023 11:44:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237203AbjFHPo2 (ORCPT ); Thu, 8 Jun 2023 11:44:28 -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 294AB35A2 for ; Thu, 8 Jun 2023 08:43:59 -0700 (PDT) Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id E0FE73F370 for ; Thu, 8 Jun 2023 15:43:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686239026; bh=/It8VSgZDTEKktJxHTMOOJHpvqL0RXNtakCJDr6cWYA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZhAFBfheINB8eE2BwI9zeoKJZLRNin5AAEkC7I74PxVXoNXw2gxoGhD3ddTXopxEv PbgOnXBh8osyvi109qX6yC4dhGv5hUEbBkta3fnlUNuuQLolI3chfK8THaFUOo2ywR Ryda4hye1cUOA1TLVeAZ8Ff9qdRAFAPgYd22p325I+xj9mtuPDuXK358YngLOpZBVR GkWLzNc7PYq+WVk96hCDE5w+RP2OV3NH09EY9u5zkL71SC1XMcufUjkBq/PXhemQVi zl2MGilLnXAQtVWFGacifoojo+3m7MS80zvlc8XES7sRuBNelluZKdZdkxd2XXJj8z 57OxDV6KtDTCg== Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-514b05895f7so845264a12.0 for ; Thu, 08 Jun 2023 08:43:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686239024; x=1688831024; 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=ke4qHT7rDGnWThiYEbKEMavi3X2g44LcKhbx0ujdmTm49NfsRXKl+vX2iijqPpiHm+ Ldm62DFGVXcV67ZW4IrO3hdT0zz1OTp4lDxjwYqhl80LmkKK4nuJZSiKEJVJhrgWcFRP vlXPJ+4aEAm2gwjivtbIdJxnwIEzIFmW6jztE+K+bngE8koUwb7BjblbFK0jH4pEUWPV PIXxjpndt4v6+LuqWjBJxC7FQY7KHh/Hcb5DCgJkxqg+QE8+PBwgNk2xJAd8WJPqjbQC zb+zpZCoGY05L1fmLaThkIYLqqF4mxalAhp9gfFXpotD02uk8cNetAd14lIFoHusMGuw ISOw== X-Gm-Message-State: AC+VfDwx1GorwqjFxTkOp2RggacNY9uyrR8Hn2Ik1JlPlz75pKc6xzOl yx75+r2kPwhbyk9PGKfye8KZ22dnGLtwfhJFfXcrjAWF/khxtbfRrw7xRfH1wR3aqrM1lhrTrhH DPrp+yeyL6TZ2gLXl7Zgib79NOEBUOYuYl+1puX4dkg== X-Received: by 2002:aa7:d88a:0:b0:50c:cde7:285b with SMTP id u10-20020aa7d88a000000b0050ccde7285bmr7205759edq.29.1686239024658; Thu, 08 Jun 2023 08:43:44 -0700 (PDT) X-Received: by 2002:aa7:d88a:0:b0:50c:cde7:285b with SMTP id u10-20020aa7d88a000000b0050ccde7285bmr7205750edq.29.1686239024530; Thu, 08 Jun 2023 08:43:44 -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 y8-20020aa7c248000000b005164ae1c482sm678387edo.11.2023.06.08.08.43.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 08:43:43 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Christian Brauner , Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v5 09/14] ceph/acl: allow idmapped set_acl inode op Date: Thu, 8 Jun 2023 17:42:50 +0200 Message-Id: <20230608154256.562906-10-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230608154256.562906-1-aleksandr.mikhalitsyn@canonical.com> References: <20230608154256.562906-1-aleksandr.mikhalitsyn@canonical.com> 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, 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?1768150758655396191?= X-GMAIL-MSGID: =?utf-8?q?1768150758655396191?= 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 Thu Jun 8 15:42:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 105011 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp370541vqr; Thu, 8 Jun 2023 08:49:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4qixa0C8P+gfzPI5KO9SeZ3sA+zn4HiP4gbh1eZhbhnLD1kRVrzAACzTlUpg4lhmmPyV7I X-Received: by 2002:a05:6a20:1581:b0:110:b0ab:8798 with SMTP id h1-20020a056a20158100b00110b0ab8798mr5655127pzj.36.1686239366125; Thu, 08 Jun 2023 08:49:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686239366; cv=none; d=google.com; s=arc-20160816; b=Xm8sNDAoJg4IQp46zLNJwbYnDJ6Cva7K+rvRT37DZXLqfeEJcP6JU++YScAeptVmrZ M2JvNt9xMo+UMk3U0Ys+CcGhZadq2uGkVEPOlU5hS5dw/QYMRrn3S9Szwsj8MnKA1E8z lxn1/YwcVwrqPNvMS1EPQJ5YUQboVPjwzTlgwJRJqWsH/qxmfwDSFYBW85uCq3QQzEyq xk03gwZ9IJXku24pR1y/9JncV2aAmcofJM1O0nyH3EE4HNLmKzgOb93PWnSzbH/xjmbL v575l+3Pi19H9n+cNbUrPhArFtBgCKL+7StXt9R+7Dy92uQn0QuQOR0VpYE4wsxaoDsB Pw5Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Q8ymt4aVYk7+c3UhjbPSUCbNsUrFX+gS8T8907goBG0=; b=qXZ+BC4vIlk6wATBjFpHIBHi6Ev07V+CukEW5HmQxv7PoQMJ1M8t+pBJE9QxestVGs NMbo0OXROLSJDyA8ofRwxlOP7wjYIoIaM6+5J2PxhOfAn58tyxlmL6BbX5Gv8XL2xVC2 wLAhkgJaVzY5DP3gaPzPn7FMZ7ZFHH/ltY0WTf0exPC3153qcMTHX04Zcvp6b5looke6 DUfqxt+/GNscZd5+vo75fwawuePhb77lzX9d4S182fcbRRL4+ubPMhgSCcIrFT8iwvPa /Ib7oL+oNjJBDR7QcBIMDR367GmTtrrJorI6vIfG/8mw6I6NNBmAaRYjYw7/9ds6fE7F HKzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=BGqEI8qC; 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 v18-20020a637a12000000b0051fc9e06b8csi1127051pgc.378.2023.06.08.08.49.10; Thu, 08 Jun 2023 08:49:26 -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=BGqEI8qC; 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 S237307AbjFHPpC (ORCPT + 99 others); Thu, 8 Jun 2023 11:45:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237221AbjFHPof (ORCPT ); Thu, 8 Jun 2023 11:44: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 D9D4D35AB for ; Thu, 8 Jun 2023 08:44:02 -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 55B363F36E for ; Thu, 8 Jun 2023 15:43:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686239027; bh=Q8ymt4aVYk7+c3UhjbPSUCbNsUrFX+gS8T8907goBG0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BGqEI8qCHxOYtapB0SRpXTz3tiuulDWtRLvtxc5YNoZQLqUCE2dV3meQV1Mgol7j/ QYbNWw8Ja2pa+Wgv1PSW3sg8oIRKFyeauYeNNxRKVNRlBkcpkSpQuuIyJRXQMgGAqI o6MNP+5A7M2GHkfY7Z5wO06pGpSlUaLaVLRfozNNLz/1lEFwFpXTbJ4rEHpG0bu3ZJ H8K6Kd19QF7gavUk5prBU4YGxfBV/NiwZfZWlKQu6JIxP0mpYN7ftSTUipw40IOD2W AE5GbFRSNwIsqTWePhJxTe1CwOgXUZ97bUNtIZjGUuP+8zg0ed6rkV1LFM8D+NOG84 wV7Av5Bkb1Dcg== Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-50daa85e940so813901a12.0 for ; Thu, 08 Jun 2023 08:43:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686239027; x=1688831027; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Q8ymt4aVYk7+c3UhjbPSUCbNsUrFX+gS8T8907goBG0=; b=ABtgICxA6hwEdmE6mBvoAwXpjgnD2eKsMkJJWPS9gmYI8rT7TIdO0lkhZOicl0YKPn wRHRlr/JYNcboLfjXmVikli6SS5cVViMzVevUh51/MBLiFxVYkuT/jJoB75kFubHs0td +2URhP+r46Hy3ICtIijPDRX+zVPq3hXkDqjolwypRsu0Tg2n724rH1ZKkyb9uCttYV8V e8geMrHkuCFy5EQEEKOEf9nABC4qF9yrStgPencyiYRHJ4qbW/h9g0tH4fR/NNCutLaO 1djXdSdQEvxPQaPaKfk5tq8u75ZgK3sOg82kYBC/eRCF/DmpzbhK5jGTGmBpl5F0lJr+ 12pw== X-Gm-Message-State: AC+VfDxInYuvZlmxPMGzmMHMY70oSY49oK08VS5aJZNi1iB7XK6SBMMu qJGRdhPqnP0D6SjdwO/mTxIduX80DgZjFlqzL0uq+K5YD5/+IXUdjHw6hc0e6Uz9uDx1nF0FmBU 6wTP5GQ5IpDrMaHgf27MwHbpgmmxprk53NO1OOv3mIQ== X-Received: by 2002:aa7:c7d4:0:b0:510:f462:fc47 with SMTP id o20-20020aa7c7d4000000b00510f462fc47mr7221334eds.7.1686239027037; Thu, 08 Jun 2023 08:43:47 -0700 (PDT) X-Received: by 2002:aa7:c7d4:0:b0:510:f462:fc47 with SMTP id o20-20020aa7c7d4000000b00510f462fc47mr7221325eds.7.1686239026831; Thu, 08 Jun 2023 08:43:46 -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 y8-20020aa7c248000000b005164ae1c482sm678387edo.11.2023.06.08.08.43.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 08:43:46 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Christian Brauner , Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v5 10/14] ceph/file: allow idmapped atomic_open inode op Date: Thu, 8 Jun 2023 17:42:51 +0200 Message-Id: <20230608154256.562906-11-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230608154256.562906-1-aleksandr.mikhalitsyn@canonical.com> References: <20230608154256.562906-1-aleksandr.mikhalitsyn@canonical.com> 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, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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?1768150129417673875?= X-GMAIL-MSGID: =?utf-8?q?1768150129417673875?= From: Christian Brauner Enable ceph_atomic_open() to handle idmapped mounts. This is just a matter of passing down the mount's idmapping. Cc: Xiubo Li Cc: Jeff Layton Cc: Ilya Dryomov Cc: ceph-devel@vger.kernel.org Signed-off-by: Christian Brauner [ adapted to 5fadbd9929 ("ceph: rely on vfs for setgid stripping") ] Signed-off-by: Alexander Mikhalitsyn --- v4: - call mnt_idmap_get --- fs/ceph/file.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/ceph/file.c b/fs/ceph/file.c index f4d8bf7dec88..d46b6b8b5fcb 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -654,7 +654,9 @@ static int ceph_finish_async_create(struct inode *dir, struct dentry *dentry, in.truncate_seq = cpu_to_le32(1); in.truncate_size = cpu_to_le64(-1ULL); in.xattr_version = cpu_to_le64(1); - in.uid = cpu_to_le32(from_kuid(&init_user_ns, current_fsuid())); + in.uid = cpu_to_le32(from_kuid(&init_user_ns, + mapped_fsuid(req->r_mnt_idmap, + &init_user_ns))); if (dir->i_mode & S_ISGID) { in.gid = cpu_to_le32(from_kgid(&init_user_ns, dir->i_gid)); @@ -662,7 +664,9 @@ static int ceph_finish_async_create(struct inode *dir, struct dentry *dentry, if (S_ISDIR(mode)) mode |= S_ISGID; } else { - in.gid = cpu_to_le32(from_kgid(&init_user_ns, current_fsgid())); + in.gid = cpu_to_le32(from_kgid(&init_user_ns, + mapped_fsgid(req->r_mnt_idmap, + &init_user_ns))); } in.mode = cpu_to_le32((u32)mode); @@ -731,6 +735,7 @@ int ceph_atomic_open(struct inode *dir, struct dentry *dentry, struct file *file, unsigned flags, umode_t mode) { struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb); + struct mnt_idmap *idmap = file_mnt_idmap(file); struct ceph_mds_client *mdsc = fsc->mdsc; struct ceph_mds_request *req; struct dentry *dn; @@ -786,6 +791,7 @@ int ceph_atomic_open(struct inode *dir, struct dentry *dentry, mask |= CEPH_CAP_XATTR_SHARED; req->r_args.open.mask = cpu_to_le32(mask); req->r_parent = dir; + req->r_mnt_idmap = mnt_idmap_get(idmap); ihold(dir); if (flags & O_CREAT) { From patchwork Thu Jun 8 15:42:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 105012 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp370632vqr; Thu, 8 Jun 2023 08:49:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ53sLdndWUCeVYBlBy67+KTZQfWztfWC7CNmRBUI+QrKWH4ORExLC+8CxboDLlHtH2u12JP X-Received: by 2002:a17:903:444:b0:1b1:d39e:28bb with SMTP id iw4-20020a170903044400b001b1d39e28bbmr4586259plb.34.1686239377169; Thu, 08 Jun 2023 08:49:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686239377; cv=none; d=google.com; s=arc-20160816; b=qQJiWGm9w+CShMehhCdeYty7dGgoOWtBuaz62A1QKLrcaI2UyZJH+vq5DAJVgkFDRh kvxOljZypqXkWT1Z2kWY4VgFPvzkBFESEy/Zz/Mxx9JYcWNXeFyo62UA5/Y94BtfZPyU 5qyuJKBYxyJq+XgrGfR3RrNeZ1nZSF7gkcm1VNpSv4ICxXhdxAdRkNOO8HroEMjDPmXb VDn3gyGwM5opkmtUwoH0KulYS01duF/PvU1QnakKWgUSbg0A1o4LD0vezsp0XLd36GtF hAApHX2Q3Nly3AD9fYA6LgEIsKa6bePRcuSKHJKjwMdy+XTxZ0QLwkYXrNky12+Mk1nM utrg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2SBMId8uucXXsmkpO9XvsuxzyfuN3DNew61ExZTJFDc=; b=P4s9yO9XFkS3NBmzFN17rH50gtjgIvrnsOcW8UIkr8tdfCX7rFxZJnmaQfhOgagmGf fHHIlVi2i11fxzGtFaghjJTO7r3cFd2JtwL4imtimufUBYzFz/fxMD3RD/vEtPihI7H5 E726cbeyWMjGdfPYaytm6wwYdBt5L1soZEqKO9496yt1Pf9A44UYPMAiiPCR5tl0aAjt 1FqOUFcgQrFsChrgCcJgRtpKvfmAT2XjG9yvoQhy8SuqG4ovB+U2VV5LHmBhHXzwi8sG 15jZFMxpXUHrk9ydCdZXhUUAhiLMrGgX7G3HSl4u8lA3yOPQAN9iAjHQgo5+8DqbbWww 1f/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=nxJw72xQ; 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 u11-20020a170902e80b00b001b063904058si1259688plg.438.2023.06.08.08.49.22; Thu, 08 Jun 2023 08:49:37 -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=nxJw72xQ; 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 S236256AbjFHPpF (ORCPT + 99 others); Thu, 8 Jun 2023 11:45:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237349AbjFHPoh (ORCPT ); Thu, 8 Jun 2023 11:44:37 -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 DE2F730DD for ; Thu, 8 Jun 2023 08:44:07 -0700 (PDT) Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.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 654103F371 for ; Thu, 8 Jun 2023 15:43:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686239031; bh=2SBMId8uucXXsmkpO9XvsuxzyfuN3DNew61ExZTJFDc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nxJw72xQlyzZLWNibUYvv4UHFRUglQhF9+tWix7Ut+1bPPs9mDVY57o9XLIIBoFLs RsdxmjDWSl2zgsjQzKYKHVXFxbnsrNm3sJgptkeT5kOee0JZ24vcOoI0Ceqpnf+BDg k1JDJ7WBRydwreL0GSdPk3v/htaQvCbmj/WNXg0n/KWY0mpBH3UbETzsZFeBJm4zpn Za2SodNMZlLPNCiTkoBvmGsmaH2G/jiavqxUIhC9LQo/7wacq/a/intrxzGNTfTtIj ne9BA9PWti2k1EwZ1c+qcHTSuODGHNI0R/l4UP7kiBn8ose6edVD/5Y7rQuDoQcQ3O k6jy33uTqR/Mw== Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-30c3ad3238bso355782f8f.0 for ; Thu, 08 Jun 2023 08:43:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686239030; x=1688831030; 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=2SBMId8uucXXsmkpO9XvsuxzyfuN3DNew61ExZTJFDc=; b=aw4WXq6aaJSIXeS/7RHBp2N5rGV3L77hURdwe8pVwk/+YIJ5E57LpNFFE/5AmqvvzC jZn8IhnsxdvzO9n2l8iJuC5Ugno/wl+CD69bwY7GYTOVnL0FfoaRmwCQHdnWmA/c+AxY 7fp46M7/wBsCgNFIxw0XFW0n6JbgjBeXfxftlosW8xAwKUFvw70P9vpVisRdPv/8umKE 336uPYzMNHdixr8jenArhBkwq0+2o0mJBSfGty0EATw9BsSebeUvBAaKpFkEW7CdUZc+ A+kIIQAgA9YlOrCABn2sXcjnfTQTyV04j2IRKNT7f3cxzA/RgbGewuPN8S2cCqnu8Pqc Gi9Q== X-Gm-Message-State: AC+VfDx2TOLklqFRR96p3OCGk46AOou7OY387C16voxwWKs48UmV4nsJ ThkDX+leLAASKn0448O7JD4kBOwDxGzKp24rbfyoGlrgg5+MPkLmhfwzsMLqi53uTNc+889kWLh 2OriXsONOmewiof5wjYrOpk7vIZS/5APD8t5WvcGU4Q== X-Received: by 2002:adf:e5c6:0:b0:30e:5380:5eb3 with SMTP id a6-20020adfe5c6000000b0030e53805eb3mr5859730wrn.33.1686239030041; Thu, 08 Jun 2023 08:43:50 -0700 (PDT) X-Received: by 2002:adf:e5c6:0:b0:30e:5380:5eb3 with SMTP id a6-20020adfe5c6000000b0030e53805eb3mr5859717wrn.33.1686239029789; Thu, 08 Jun 2023 08:43:49 -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 y8-20020aa7c248000000b005164ae1c482sm678387edo.11.2023.06.08.08.43.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 08:43:49 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v5 11/14] ceph: pass idmap to ceph_do_getattr Date: Thu, 8 Jun 2023 17:42:52 +0200 Message-Id: <20230608154256.562906-12-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230608154256.562906-1-aleksandr.mikhalitsyn@canonical.com> References: <20230608154256.562906-1-aleksandr.mikhalitsyn@canonical.com> 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, 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?1768150141261437680?= X-GMAIL-MSGID: =?utf-8?q?1768150141261437680?= Just pass down the mount's idmapping to *ceph_do_getattr, everywhere when possible, because we will need it later. Here we have two cases: - filemap_fault/read/write/lseek (when idmap is accessible) - export_ops/list_xattr/get_xattr (when idmap is not accessible) in this case we pass &nop_mnt_idmap. So we can meet permission issue when MDS UID/GID-based path restriction is used. 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/addr.c | 3 ++- fs/ceph/caps.c | 3 ++- fs/ceph/export.c | 2 +- fs/ceph/file.c | 9 ++++++--- fs/ceph/inode.c | 8 +++++--- fs/ceph/ioctl.c | 6 ++++-- fs/ceph/quota.c | 2 +- fs/ceph/super.c | 4 ++-- fs/ceph/super.h | 8 +++++--- fs/ceph/xattr.c | 6 +++--- 10 files changed, 31 insertions(+), 20 deletions(-) diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 6bb251a4d613..757e8e170c48 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -1471,6 +1471,7 @@ static vm_fault_t ceph_filemap_fault(struct vm_fault *vmf) /* does not support inline data > PAGE_SIZE */ ret = VM_FAULT_SIGBUS; } else { + struct mnt_idmap *idmap = file_mnt_idmap(vma->vm_file); struct address_space *mapping = inode->i_mapping; struct page *page; @@ -1481,7 +1482,7 @@ static vm_fault_t ceph_filemap_fault(struct vm_fault *vmf) ret = VM_FAULT_OOM; goto out_inline; } - err = __ceph_do_getattr(inode, page, + err = __ceph_do_getattr(idmap, inode, page, CEPH_STAT_CAP_INLINE_DATA, true); if (err < 0 || off >= i_size_read(inode)) { unlock_page(page); diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 2321e5ddb664..d083ec5fda36 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c @@ -2906,6 +2906,7 @@ int ceph_get_caps(struct file *filp, int need, int want, loff_t endoff, int *got struct inode *inode = file_inode(filp); struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_fs_client *fsc = ceph_inode_to_client(inode); + struct mnt_idmap *idmap = file_mnt_idmap(filp); int ret, _got, flags; ret = ceph_pool_perm_check(inode, need); @@ -3015,7 +3016,7 @@ int ceph_get_caps(struct file *filp, int need, int want, loff_t endoff, int *got * getattr request will bring inline data into * page cache */ - ret = __ceph_do_getattr(inode, NULL, + ret = __ceph_do_getattr(idmap, inode, NULL, CEPH_STAT_CAP_INLINE_DATA, true); if (ret < 0) diff --git a/fs/ceph/export.c b/fs/ceph/export.c index f780e4e0d062..9f3c6e911ae6 100644 --- a/fs/ceph/export.c +++ b/fs/ceph/export.c @@ -187,7 +187,7 @@ static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino) if (IS_ERR(inode)) return ERR_CAST(inode); /* We need LINK caps to reliably check i_nlink */ - err = ceph_do_getattr(inode, CEPH_CAP_LINK_SHARED, false); + err = ceph_do_getattr(&nop_mnt_idmap, inode, CEPH_CAP_LINK_SHARED, false); if (err) { iput(inode); return ERR_PTR(err); diff --git a/fs/ceph/file.c b/fs/ceph/file.c index d46b6b8b5fcb..0019d5b4ae3c 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -1613,6 +1613,7 @@ static ssize_t ceph_read_iter(struct kiocb *iocb, struct iov_iter *to) size_t len = iov_iter_count(to); struct inode *inode = file_inode(filp); struct ceph_inode_info *ci = ceph_inode(inode); + struct mnt_idmap *idmap = file_mnt_idmap(filp); bool direct_lock = iocb->ki_flags & IOCB_DIRECT; ssize_t ret; int want = 0, got = 0; @@ -1693,7 +1694,7 @@ static ssize_t ceph_read_iter(struct kiocb *iocb, struct iov_iter *to) return -ENOMEM; } - statret = __ceph_do_getattr(inode, page, + statret = __ceph_do_getattr(idmap, inode, page, CEPH_STAT_CAP_INLINE_DATA, !!page); if (statret < 0) { if (page) @@ -1768,6 +1769,7 @@ static ssize_t ceph_write_iter(struct kiocb *iocb, struct iov_iter *from) struct inode *inode = file_inode(file); struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_fs_client *fsc = ceph_inode_to_client(inode); + struct mnt_idmap *idmap = file_mnt_idmap(file); struct ceph_osd_client *osdc = &fsc->client->osdc; struct ceph_cap_flush *prealloc_cf; ssize_t count, written = 0; @@ -1801,7 +1803,7 @@ static ssize_t ceph_write_iter(struct kiocb *iocb, struct iov_iter *from) current->backing_dev_info = inode_to_bdi(inode); if (iocb->ki_flags & IOCB_APPEND) { - err = ceph_do_getattr(inode, CEPH_STAT_CAP_SIZE, false); + err = ceph_do_getattr(idmap, inode, CEPH_STAT_CAP_SIZE, false); if (err < 0) goto out; } @@ -1957,9 +1959,10 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int whence) { if (whence == SEEK_END || whence == SEEK_DATA || whence == SEEK_HOLE) { struct inode *inode = file_inode(file); + struct mnt_idmap *idmap = file_mnt_idmap(file); int ret; - ret = ceph_do_getattr(inode, CEPH_STAT_CAP_SIZE, false); + ret = ceph_do_getattr(idmap, inode, CEPH_STAT_CAP_SIZE, false); if (ret < 0) return ret; } diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 58ec603a55af..3838d7dd7cd7 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -2300,7 +2300,8 @@ int ceph_try_to_choose_auth_mds(struct inode *inode, int mask) * Verify that we have a lease on the given mask. If not, * do a getattr against an mds. */ -int __ceph_do_getattr(struct inode *inode, struct page *locked_page, +int __ceph_do_getattr(struct mnt_idmap *idmap, struct inode *inode, + struct page *locked_page, int mask, bool force) { struct ceph_fs_client *fsc = ceph_sb_to_client(inode->i_sb); @@ -2325,6 +2326,7 @@ int __ceph_do_getattr(struct inode *inode, struct page *locked_page, return PTR_ERR(req); req->r_inode = inode; ihold(inode); + req->r_mnt_idmap = mnt_idmap_get(idmap); req->r_num_caps = 1; req->r_args.getattr.mask = cpu_to_le32(mask); req->r_locked_page = locked_page; @@ -2411,7 +2413,7 @@ int ceph_permission(struct mnt_idmap *idmap, struct inode *inode, if (mask & MAY_NOT_BLOCK) return -ECHILD; - err = ceph_do_getattr(inode, CEPH_CAP_AUTH_SHARED, false); + err = ceph_do_getattr(idmap, inode, CEPH_CAP_AUTH_SHARED, false); if (!err) err = generic_permission(idmap, inode, mask); @@ -2464,7 +2466,7 @@ int ceph_getattr(struct mnt_idmap *idmap, const struct path *path, /* Skip the getattr altogether if we're asked not to sync */ if ((flags & AT_STATX_SYNC_TYPE) != AT_STATX_DONT_SYNC) { - err = ceph_do_getattr(inode, + err = ceph_do_getattr(idmap, inode, statx_to_caps(request_mask, inode->i_mode), flags & AT_STATX_FORCE_SYNC); if (err) diff --git a/fs/ceph/ioctl.c b/fs/ceph/ioctl.c index deac817647eb..07be54ecc94d 100644 --- a/fs/ceph/ioctl.c +++ b/fs/ceph/ioctl.c @@ -17,10 +17,11 @@ static long ceph_ioctl_get_layout(struct file *file, void __user *arg) { struct ceph_inode_info *ci = ceph_inode(file_inode(file)); + struct mnt_idmap *idmap = file_mnt_idmap(file); struct ceph_ioctl_layout l; int err; - err = ceph_do_getattr(file_inode(file), CEPH_STAT_CAP_LAYOUT, false); + err = ceph_do_getattr(idmap, file_inode(file), CEPH_STAT_CAP_LAYOUT, false); if (!err) { l.stripe_unit = ci->i_layout.stripe_unit; l.stripe_count = ci->i_layout.stripe_count; @@ -64,6 +65,7 @@ static long __validate_layout(struct ceph_mds_client *mdsc, static long ceph_ioctl_set_layout(struct file *file, void __user *arg) { struct inode *inode = file_inode(file); + struct mnt_idmap *idmap = file_mnt_idmap(file); struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc; struct ceph_mds_request *req; struct ceph_ioctl_layout l; @@ -75,7 +77,7 @@ static long ceph_ioctl_set_layout(struct file *file, void __user *arg) return -EFAULT; /* validate changed params against current layout */ - err = ceph_do_getattr(file_inode(file), CEPH_STAT_CAP_LAYOUT, false); + err = ceph_do_getattr(idmap, file_inode(file), CEPH_STAT_CAP_LAYOUT, false); if (err) return err; diff --git a/fs/ceph/quota.c b/fs/ceph/quota.c index 64592adfe48f..aea122ac3cbe 100644 --- a/fs/ceph/quota.c +++ b/fs/ceph/quota.c @@ -150,7 +150,7 @@ static struct inode *lookup_quotarealm_inode(struct ceph_mds_client *mdsc, } if (qri->inode) { /* get caps */ - int ret = __ceph_do_getattr(qri->inode, NULL, + int ret = __ceph_do_getattr(&nop_mnt_idmap, qri->inode, NULL, CEPH_STAT_CAP_INODE, true); if (ret >= 0) in = qri->inode; diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 3fc48b43cab0..797a6cb3733c 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -1415,8 +1415,8 @@ int ceph_force_reconnect(struct super_block *sb) fsc->mount_state = CEPH_MOUNT_MOUNTED; if (sb->s_root) { - err = __ceph_do_getattr(d_inode(sb->s_root), NULL, - CEPH_STAT_CAP_INODE, true); + err = __ceph_do_getattr(&nop_mnt_idmap, d_inode(sb->s_root), + NULL, CEPH_STAT_CAP_INODE, true); } return err; } diff --git a/fs/ceph/super.h b/fs/ceph/super.h index d9cc27307cb7..ccef4a6bac52 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -1044,11 +1044,13 @@ static inline void ceph_queue_flush_snaps(struct inode *inode) } extern int ceph_try_to_choose_auth_mds(struct inode *inode, int mask); -extern int __ceph_do_getattr(struct inode *inode, struct page *locked_page, +extern int __ceph_do_getattr(struct mnt_idmap *idmap, struct inode *inode, + struct page *locked_page, int mask, bool force); -static inline int ceph_do_getattr(struct inode *inode, int mask, bool force) +static inline int ceph_do_getattr(struct mnt_idmap *idmap, struct inode *inode, + int mask, bool force) { - return __ceph_do_getattr(inode, NULL, mask, force); + return __ceph_do_getattr(idmap, inode, NULL, mask, force); } extern int ceph_permission(struct mnt_idmap *idmap, struct inode *inode, int mask); diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c index 806183959c47..d3ac854bc11f 100644 --- a/fs/ceph/xattr.c +++ b/fs/ceph/xattr.c @@ -952,7 +952,7 @@ ssize_t __ceph_getxattr(struct inode *inode, const char *name, void *value, mask |= CEPH_STAT_RSTAT; if (vxattr->flags & VXATTR_FLAG_DIRSTAT) mask |= CEPH_CAP_FILE_SHARED; - err = ceph_do_getattr(inode, mask, true); + err = ceph_do_getattr(&nop_mnt_idmap, inode, mask, true); if (err) return err; err = -ENODATA; @@ -989,7 +989,7 @@ ssize_t __ceph_getxattr(struct inode *inode, const char *name, void *value, } /* get xattrs from mds (if we don't already have them) */ - err = ceph_do_getattr(inode, CEPH_STAT_CAP_XATTR, true); + err = ceph_do_getattr(&nop_mnt_idmap, inode, CEPH_STAT_CAP_XATTR, true); if (err) return err; spin_lock(&ci->i_ceph_lock); @@ -1038,7 +1038,7 @@ ssize_t ceph_listxattr(struct dentry *dentry, char *names, size_t size) if (ci->i_xattrs.version == 0 || !__ceph_caps_issued_mask_metric(ci, CEPH_CAP_XATTR_SHARED, 1)) { spin_unlock(&ci->i_ceph_lock); - err = ceph_do_getattr(inode, CEPH_STAT_CAP_XATTR, true); + err = ceph_do_getattr(&nop_mnt_idmap, inode, CEPH_STAT_CAP_XATTR, true); if (err) return err; spin_lock(&ci->i_ceph_lock); From patchwork Thu Jun 8 15:42:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 105023 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp379043vqr; Thu, 8 Jun 2023 09:03:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4YFxDqWUc7DSUvR2A4l3opu772PuUskk8zITeQvapOb2y9lLQqWHbnnt6WArfo7bjO+LwG X-Received: by 2002:a05:6a00:15d1:b0:641:558:8e2e with SMTP id o17-20020a056a0015d100b0064105588e2emr6326973pfu.15.1686240188891; Thu, 08 Jun 2023 09:03:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686240188; cv=none; d=google.com; s=arc-20160816; b=Kpd1An+XCA6IF9awHBYVh/7bxFvHGUIt6wVxYlx8FHAqGAzS7QnzSR63fONFHStZv/ 71E5cKubHKi7F3XhlArAj1oNUR11uChXIULkleYR4LQ2aFMDS6TVG8iu2iAv07F0i8SW NaqeWHu881CF7P50vExFiz6SNOEVwOOwhyvqgr4oyoQH3VXR/eeTlB4Ep188HY96OapW GKn0lVZhGBjK/EnPGG7JW71xkqtM0rkLwNO1SO8ssy2Lv5TMKO1geXnhC003e78Sk8+M QyAxSgbZJUkKEbofmzeCnSq0Gue7MIy5AKT771IKzF4Oo2Y8R5SNBMlRLmXXqxS1KJYH cGvA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hMEKg4eGVgDXkovGDpYWIZx/H1D1uxAjXSI9jX8bPYQ=; b=f+mTZWnTD8ebQTMbAN9xXKVOnCfqn1n9lMu0Sop+IGiVIWWH/FVuvpqJWg4vMBrNhF q6NBwUhbGB/IeqpXpqeqQ56xRzO/+1dmMCfjxMgAECrzFWUyZcIh0JcHedtW8F10WysM BZQMDQWtswwzSVQSelX/I1YE2GJnLz1dp/besCRh6blKtq7AA/GfteUE81FAlhT/OJ+i 3V9xyja1Po0QIz9o2XQlIbtRKdWQvi5InlGZaB5fLD9QQmSwEKcoD9mCw7bMuagu005Y DwIz+NogOdRrKL8UwmmoFU5IOlteuwTJzSD72Kig2ZgagZRN1d3OHV6DByg3mS4PesLY Lkpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b="NZTbyJX/"; 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 g19-20020a633753000000b005445397229csi1147581pgn.730.2023.06.08.09.02.51; Thu, 08 Jun 2023 09:03:08 -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="NZTbyJX/"; 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 S237482AbjFHPqL (ORCPT + 99 others); Thu, 8 Jun 2023 11:46:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237476AbjFHPp4 (ORCPT ); Thu, 8 Jun 2023 11:45:56 -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 4269D3AAB for ; Thu, 8 Jun 2023 08:45:04 -0700 (PDT) Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 7D2BF3F577 for ; Thu, 8 Jun 2023 15:43:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686239033; bh=hMEKg4eGVgDXkovGDpYWIZx/H1D1uxAjXSI9jX8bPYQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NZTbyJX/dfJjYfoQbRzUwXtPcO7bh4rnISUnC1ZcLPB/RBRabXRMh0S7HOfWYvISx JatKKDLD3YtukfbIKXYbQ1PDtv+4Tbgjzp41YCp2iZRw/qlNoInJ4nh1ZKuXHXg4fK wsnkkLri6EhtLv9psEe8pa0FAhlddGJoqxiYrJkv7AejfID1bThNSR8UeJIavrn8mp 9DQFSFqG4AVH5TeojLndHYf/Qhh3OdP+ZCbrftQtVvYMgvaM6jrcxL4IbkQKjDSrnS 1hZfxXxc5eNS8TbWXylfimrUjCwYjDgwPPSBI5bT613JMABvhwEykTaQ/aTSbYXnUM jO3CfO5sQNbPQ== Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-51495d51e0fso754789a12.2 for ; Thu, 08 Jun 2023 08:43:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686239032; x=1688831032; 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=hMEKg4eGVgDXkovGDpYWIZx/H1D1uxAjXSI9jX8bPYQ=; b=SnmKSqF43dPZC68TbtOF9e0rYv5tdFrhRMWHULYpy1o6FDq2Fd4J0Y4s/pBUulLUx3 3w60CPxZeupzitgNAWYdWl4lAAcNLFFdeRto1GODjtjH6T7sJrHQTf2PkKE0UF1s7WNr dWf907Oc5H6zzpmAql7sUQO+sHh6hulln2o6SooBMfBkfABwqjA2JuC9BUvYzQ7IKrju Cuo+CDR44JD7WMBbQE+titQn2/BsTXY4CoI3nNQOoway37EmnDGjxOhLIIs8Lx9/VEQ8 WMDlroo1NcfAcqq6mJsx+VwGMkc/pw7suaGCxzNZyxPkmG5EslBOQ7hNMyVYQpNIZNlt dp1w== X-Gm-Message-State: AC+VfDzNUb9/E5PRXft3m8wBeLEuOkXGg9BtC+hQknjl3KLciI5lxrKM p2Fb5WicGzM1roDOTiboEEB3wFgjFOJMliAWrMfgXcwp+JJcAkzPSx6a1/klhdgTaSVoJtjiaGB ePmoYcHdvk/S0mxuq6hm+R9jCzZO7r4cGF6N1fN25Hw== X-Received: by 2002:a05:6402:147:b0:514:9c05:819e with SMTP id s7-20020a056402014700b005149c05819emr7682636edu.0.1686239032690; Thu, 08 Jun 2023 08:43:52 -0700 (PDT) X-Received: by 2002:a05:6402:147:b0:514:9c05:819e with SMTP id s7-20020a056402014700b005149c05819emr7682624edu.0.1686239032523; Thu, 08 Jun 2023 08:43:52 -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 y8-20020aa7c248000000b005164ae1c482sm678387edo.11.2023.06.08.08.43.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 08:43:52 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v5 12/14] ceph: pass idmap to __ceph_setxattr Date: Thu, 8 Jun 2023 17:42:53 +0200 Message-Id: <20230608154256.562906-13-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230608154256.562906-1-aleksandr.mikhalitsyn@canonical.com> References: <20230608154256.562906-1-aleksandr.mikhalitsyn@canonical.com> 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, 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?1768150992065129720?= X-GMAIL-MSGID: =?utf-8?q?1768150992065129720?= Just pass down the mount's idmapping to __ceph_setxattr. 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 | 2 +- fs/ceph/super.h | 3 ++- fs/ceph/xattr.c | 12 +++++++----- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/fs/ceph/acl.c b/fs/ceph/acl.c index d0ca5a0060d8..bb02776e3df2 100644 --- a/fs/ceph/acl.c +++ b/fs/ceph/acl.c @@ -145,7 +145,7 @@ int ceph_set_acl(struct mnt_idmap *idmap, struct dentry *dentry, goto out_free; } - ret = __ceph_setxattr(inode, name, value, size, 0); + ret = __ceph_setxattr(idmap, inode, name, value, size, 0); if (ret) { if (new_mode != old_mode) { newattrs.ia_ctime = old_ctime; diff --git a/fs/ceph/super.h b/fs/ceph/super.h index ccef4a6bac52..e23aec9554b3 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -1073,7 +1073,8 @@ static inline bool ceph_inode_is_shutdown(struct inode *inode) } /* xattr.c */ -int __ceph_setxattr(struct inode *, const char *, const void *, size_t, int); +int __ceph_setxattr(struct mnt_idmap *, struct inode *, + const char *, const void *, size_t, int); int ceph_do_getvxattr(struct inode *inode, const char *name, void *value, size_t size); ssize_t __ceph_getxattr(struct inode *, const char *, void *, size_t); extern ssize_t ceph_listxattr(struct dentry *, char *, size_t); diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c index d3ac854bc11f..0acb292f600d 100644 --- a/fs/ceph/xattr.c +++ b/fs/ceph/xattr.c @@ -1064,7 +1064,8 @@ ssize_t ceph_listxattr(struct dentry *dentry, char *names, size_t size) return err; } -static int ceph_sync_setxattr(struct inode *inode, const char *name, +static int ceph_sync_setxattr(struct mnt_idmap *idmap, + struct inode *inode, const char *name, const char *value, size_t size, int flags) { struct ceph_fs_client *fsc = ceph_sb_to_client(inode->i_sb); @@ -1118,6 +1119,7 @@ static int ceph_sync_setxattr(struct inode *inode, const char *name, req->r_inode = inode; ihold(inode); + req->r_mnt_idmap = mnt_idmap_get(idmap); req->r_num_caps = 1; req->r_inode_drop = CEPH_CAP_XATTR_SHARED; @@ -1132,8 +1134,8 @@ static int ceph_sync_setxattr(struct inode *inode, const char *name, return err; } -int __ceph_setxattr(struct inode *inode, const char *name, - const void *value, size_t size, int flags) +int __ceph_setxattr(struct mnt_idmap *idmap, struct inode *inode, + const char *name, const void *value, size_t size, int flags) { struct ceph_vxattr *vxattr; struct ceph_inode_info *ci = ceph_inode(inode); @@ -1262,7 +1264,7 @@ int __ceph_setxattr(struct inode *inode, const char *name, "during filling trace\n", inode); err = -EBUSY; } else { - err = ceph_sync_setxattr(inode, name, value, size, flags); + err = ceph_sync_setxattr(idmap, inode, name, value, size, flags); if (err >= 0 && check_realm) { /* check if snaprealm was created for quota inode */ spin_lock(&ci->i_ceph_lock); @@ -1298,7 +1300,7 @@ static int ceph_set_xattr_handler(const struct xattr_handler *handler, { if (!ceph_is_valid_xattr(name)) return -EOPNOTSUPP; - return __ceph_setxattr(inode, name, value, size, flags); + return __ceph_setxattr(idmap, inode, name, value, size, flags); } static const struct xattr_handler ceph_other_xattr_handler = { From patchwork Thu Jun 8 15:42:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 105013 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp370872vqr; Thu, 8 Jun 2023 08:50:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5xJBr7gn3pNINR120aCUu64mb/8e4c6O+g5UqLV/gIi1qayd+MDeC/hwS75OrlnLafEnrj X-Received: by 2002:a05:6a21:2d84:b0:114:ec7e:a60a with SMTP id ty4-20020a056a212d8400b00114ec7ea60amr6631971pzb.38.1686239402667; Thu, 08 Jun 2023 08:50:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686239402; cv=none; d=google.com; s=arc-20160816; b=voWWiwuZPMHlJKEvBZvVpHSj7xjJXc5PzZ8KXEHSwjqWHqsDi9HvTFDGLgRrJWCGB2 wbqobUXBJTd6YvglFDdaSfOtp1UQ8/TdmJZc8zgIr9/B9Rz4KhregsKPcLcLmaAmWP0G D00wCenB8EYNludUqWAH/GpWvdh6URhaQZiGyeI4AhGP2dRJRGU3p4nVpFt8uKJ3uOpN INbO+A3jZPy1u4yrfN8caPW5zGZGA9PUBtiBUtKPT/6uK/JH4ZAUABVWdU1V1FjLrzqv aApS1TeCRxLCf12Ar9KzPFVmg/1VzwWlXqKXh4GFzoFDf40isqAvpJmgkUip+KVAK5iz ZQAw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=MRxl+h7O52u/Mhs3Xvpqf/AHss8SBrlV6qztFSPEq4E=; b=0vOsj48ZpVufE7iFHhVXVevZNZxJyZC84sAKkmTxIsazvBlh+XvQAWXGw+boAdvJDj aGtwdV+lciQf7hBdQZWCX+Dr4hbiY3vzZwv6TsXJpT5jUMp7y4IMCFJBjDHFf5oV64wA 8lmaAe89rnMgcKhoAHDV2aUxu2CygJENX2XknmLqpHzt5zI2VFhj5VEikcsbyKJ1hks+ ghojlcd8w8mXcWHGjaUe3zm/gNhiTIlGc53cCR3Hs6oGuERNo/YH6+/2928DH+Xh3cKy TLKdBX9mZ48CNYl6fjAoXGGbru1HSvii9RDV+qKCfgjqGr8cS8OalbcgRSE+KJScWzeq VJ7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=oAjswmV0; 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 t63-20020a637842000000b0052c54de0299si1115476pgc.637.2023.06.08.08.49.48; Thu, 08 Jun 2023 08:50:02 -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=oAjswmV0; 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 S237236AbjFHPpJ (ORCPT + 99 others); Thu, 8 Jun 2023 11:45:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237363AbjFHPoi (ORCPT ); Thu, 8 Jun 2023 11:44:38 -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 4616730E7 for ; Thu, 8 Jun 2023 08:44:10 -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 455593F36B for ; Thu, 8 Jun 2023 15:43:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686239035; bh=MRxl+h7O52u/Mhs3Xvpqf/AHss8SBrlV6qztFSPEq4E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=oAjswmV0RQuZTyKzf4M1ahiTaVsJJ7Y0Jd7y7lbClp5uoJ+45k9JHag2Y3r+Hd1Sx ryw1yQizFXPmAglU0+9D5zR8u3sXuqW8xz1X558LP5ekSeOcxD8Wzf27DCWUiX3cOV NZcK/+cw/hmgs9xLmaFpu9/eFsKh6doTNucHnyAmaGLDIsQq0CHlex5GHSG+ICJ1iv jHvRVpL/of4hgvXBlfjgJa1qfI93xcSz0iYELeA9oXJ3TKfi7ZLw5FArQoea9yNcg+ BC7v41GUQJO29RqcQIB29ObBM1yumjDAc536xqhlh0ZPfkpFAM5IrWmvqPMmHEFU7P PoZzVgXsLXU9Q== Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-5147e3dfccdso699104a12.1 for ; Thu, 08 Jun 2023 08:43:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686239035; x=1688831035; 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=MRxl+h7O52u/Mhs3Xvpqf/AHss8SBrlV6qztFSPEq4E=; b=jQ2FiPYZFjMy18JHBRkFIh3zfaeV5tfDI/bgwrKz0NKC+275jX2AuXH84cw6feajqB SLamfDMar3gbbLgoamzjDnfKv0BlYhdT7iLSO4AJhZMsBnKt8/bT3i5Y/g+bljHJyAbJ TmZuozDiWKEK2EwbDlZFn6Aog46p00m5lNvJ2ykn+8GO4LqJFWgeO5HFiEOEwSyLmGPE L/w96Z/Ur3n0eNR2V5HlBZPuOrbVu6nSH+GvEJEftgI69CioYy0W+Ms8/1wnuU4wxhan PLhqTWoTIAKRd5pzEIxvvAkyC3mZ8u8+p55yFTm3Lq7uNbApYJsI7+ysnapj51DgQMIu Ryvw== X-Gm-Message-State: AC+VfDzO4yaxh/Zz0/iKcw+1UPsuXZauO0Zh7AwcxotwNvudW27ERX7U idu/lzvtLIfIgLQL+XHWRORAsRihnKsclOLNMy5CNahGb0XHX9w931TyOXjRZ/YyL6PWA3CEh74 +e2nxPh7gkOUOpaK6eCmlm5ZXJzCRv+GOW1T0zSe2rA== X-Received: by 2002:aa7:d9c3:0:b0:50c:4b9:1483 with SMTP id v3-20020aa7d9c3000000b0050c04b91483mr7476589eds.37.1686239035009; Thu, 08 Jun 2023 08:43:55 -0700 (PDT) X-Received: by 2002:aa7:d9c3:0:b0:50c:4b9:1483 with SMTP id v3-20020aa7d9c3000000b0050c04b91483mr7476574eds.37.1686239034873; Thu, 08 Jun 2023 08:43:54 -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 y8-20020aa7c248000000b005164ae1c482sm678387edo.11.2023.06.08.08.43.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 08:43:54 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v5 13/14] ceph: pass idmap to ceph_open/ioctl_set_layout Date: Thu, 8 Jun 2023 17:42:54 +0200 Message-Id: <20230608154256.562906-14-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230608154256.562906-1-aleksandr.mikhalitsyn@canonical.com> References: <20230608154256.562906-1-aleksandr.mikhalitsyn@canonical.com> 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, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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?1768150168136896542?= X-GMAIL-MSGID: =?utf-8?q?1768150168136896542?= Pass an idmapping to: - ceph_open - ceph_ioctl_set_layout 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/file.c | 2 ++ fs/ceph/ioctl.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 0019d5b4ae3c..3c3aacbf900b 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -356,6 +356,7 @@ int ceph_open(struct inode *inode, struct file *file) struct ceph_mds_client *mdsc = fsc->mdsc; struct ceph_mds_request *req; struct ceph_file_info *fi = file->private_data; + struct mnt_idmap *idmap = file_mnt_idmap(file); int err; int flags, fmode, wanted; @@ -426,6 +427,7 @@ int ceph_open(struct inode *inode, struct file *file) ihold(inode); req->r_num_caps = 1; + req->r_mnt_idmap = mnt_idmap_get(idmap); err = ceph_mdsc_do_request(mdsc, NULL, req); if (!err) err = ceph_init_file(inode, file, req->r_fmode); diff --git a/fs/ceph/ioctl.c b/fs/ceph/ioctl.c index 07be54ecc94d..d3568643d0af 100644 --- a/fs/ceph/ioctl.c +++ b/fs/ceph/ioctl.c @@ -113,6 +113,7 @@ static long ceph_ioctl_set_layout(struct file *file, void __user *arg) req->r_inode = inode; ihold(inode); req->r_num_caps = 1; + req->r_mnt_idmap = mnt_idmap_get(idmap); req->r_inode_drop = CEPH_CAP_FILE_SHARED | CEPH_CAP_FILE_EXCL; @@ -138,6 +139,7 @@ static long ceph_ioctl_set_layout(struct file *file, void __user *arg) static long ceph_ioctl_set_layout_policy (struct file *file, void __user *arg) { struct inode *inode = file_inode(file); + struct mnt_idmap *idmap = file_mnt_idmap(file); struct ceph_mds_request *req; struct ceph_ioctl_layout l; int err; @@ -159,6 +161,7 @@ static long ceph_ioctl_set_layout_policy (struct file *file, void __user *arg) req->r_inode = inode; ihold(inode); req->r_num_caps = 1; + req->r_mnt_idmap = mnt_idmap_get(idmap); req->r_args.setlayout.layout.fl_stripe_unit = cpu_to_le32(l.stripe_unit); From patchwork Thu Jun 8 15:42:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 105014 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp371434vqr; Thu, 8 Jun 2023 08:51:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6KQ13ID+iPiPPig2iARFPtZPFizEJ7hxaN3u2gO8tq02f8SYflTsD5lsAvB92tBVH1Yhh8 X-Received: by 2002:a17:902:da81:b0:1af:de3d:bbe6 with SMTP id j1-20020a170902da8100b001afde3dbbe6mr6063294plx.2.1686239468503; Thu, 08 Jun 2023 08:51:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686239468; cv=none; d=google.com; s=arc-20160816; b=L7naVSvCYYgzVChiV+9OpxkZETDZA4OgIFX5FERPGSJkbjwmXzAkGw97GJMeOLK+Qq dtvEJS2nnf0rVfsRWr5gSSPaW63UQRMWgibte9AkcYECB2xwekiHwUw7bawsp5uEn7H9 Af8SEZCtEkS5iaI9I/oRyg5XQ4FObCIb+maj7dg5epduqJEm4O1XWJzqzWSWHCQ6jYWo Q23KRygB7S9A2UGWFcTdcChfBmXRH5ILYKwT495w9L4h1nLP3ZU1P9sahZ71n6xMfzXR 8irn3oppzvYMVmxwMBcUEDtdZC2RUV4a6S6xvkDj1I0U5hXcmVg9GbzawrJ0NPDPu5f8 eH9A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=i26tUKoxa8xxbhp04Sqa6+bBNOKneC25U0PHv+Eu/CE=; b=r1dudf5jtg77XjJnHigxYCeycVzjKXigdu/0aZux96R4wGeTM/ik46lGIPvLAM2Caz B7VyVawmkynMP9g7ASmnJvc/om3iLkfVayRjNUvJpQGIkIQu6zqwFFGZhc/NOW02EOpu xIfk9Q4PRxrdSOJQxLIJWzwUCEYFufjJNPBqQGaYrNaqQnyW8A0t+EtbPDzA/553MAtx fbjaU0Zrv5sFK88S60kkntJTVguWzpX3N29sQGmmXO0dZM5ICujJe/Mq4/0oBQ26bNFl f4AWCSMRd11yDNT8XTjaDXukvcmTdL6eGLEYi4i8iVgbN0ny2FOgpOATst2vL1vS9QTe DiyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=WPv6nl9N; 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 l8-20020a170902f68800b001ac82e60516si1205009plg.323.2023.06.08.08.50.46; Thu, 08 Jun 2023 08:51:08 -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=WPv6nl9N; 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 S237421AbjFHPqW (ORCPT + 99 others); Thu, 8 Jun 2023 11:46:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237405AbjFHPqC (ORCPT ); Thu, 8 Jun 2023 11:46:02 -0400 Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 659EF3C04 for ; Thu, 8 Jun 2023 08:45:13 -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 E8E3E3F37E for ; Thu, 8 Jun 2023 15:43:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686239037; bh=i26tUKoxa8xxbhp04Sqa6+bBNOKneC25U0PHv+Eu/CE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WPv6nl9NogD3ad+NwdOu7YCQhOTLDfx7XN5PLUSPrBfb9/P8imf78rDPiAJsW6T9a nc1vHjcBhr1G1Ne2qxsnX/nrS1kagJAzCXFO/PvqkYhJdx58pAJuKZqDPsHquOiLmC b4oYubcKK8UEvEU8kGvfdSMk73x/RctZcdEwIX62eYJZ8Mw1gHd9zxPewJo1bxBDpE whUyulU6LS/iqGn1w6HF8bFzMacintNIWwh4qkw/fq+GkrKIPGnkeCNwCq6uRroJ2S GGkwpgcJsfkaoClfKO40cBEoeYbHrIBllr5fj55IjhZZtoGGM9K9XO6DvL/yI6Eh1T tx8an1lFcmFhg== Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-50ddef368e4so706680a12.0 for ; Thu, 08 Jun 2023 08:43:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686239037; x=1688831037; 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=i26tUKoxa8xxbhp04Sqa6+bBNOKneC25U0PHv+Eu/CE=; b=HGFIXqwmX+N6eQHOftkNugT4r8+INMYl2hX26yxTM3tSQU9aQT1EEw4mGx2re0FhAW GSSjpDulfrmmrVKkgEpVUz7kAjIT3pu+FcAuM4g2LAvia3fdf4FRJixDHMWg9xL1Bqpf GTikIQ1+yGtmZwspJ4EIvqjU0LFrPKBEaeZFhHJaf9Tcb4T9isJmYrov8g1e2XSb+UFq sObd+xN+xhhLfbPwDtUKwFh0EoAhyc/DMS5EuxzYPrFv4YvGzK2vxves62xA4omDkMPs fVMzoCNuI4e7MvD0A3NOUJ2o9HOJ72GMoyLU7LK/h3dxRGH/cwdHagdLZRO3LkPdNNXe DJ6Q== X-Gm-Message-State: AC+VfDyvUj3quJhnftC7Cpco5Ax2BOMTSfqM5kmQV+XtNAkYSaeQivfF tt6jmPe00/y608kUnroqFVTFXdIfK4vp6lgxghUjaRKp22JOTezENsRHGR/kst8gz2xoHsKhxMx iWdiMWAmJL2CGsxb+yhlpSxi9azSqh/7ZaxsTzec2iEL2Q1klcg== X-Received: by 2002:aa7:c602:0:b0:514:75ff:6a86 with SMTP id h2-20020aa7c602000000b0051475ff6a86mr7704526edq.29.1686239037404; Thu, 08 Jun 2023 08:43:57 -0700 (PDT) X-Received: by 2002:aa7:c602:0:b0:514:75ff:6a86 with SMTP id h2-20020aa7c602000000b0051475ff6a86mr7704509edq.29.1686239037226; Thu, 08 Jun 2023 08:43:57 -0700 (PDT) Received: from amikhalitsyn.local (dslb-002-205-064-187.002.205.pools.vodafone-ip.de. [2.205.64.187]) by smtp.gmail.com with ESMTPSA id y8-20020aa7c248000000b005164ae1c482sm678387edo.11.2023.06.08.08.43.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 08:43:56 -0700 (PDT) From: Alexander Mikhalitsyn To: xiubli@redhat.com Cc: brauner@kernel.org, stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Jeff Layton , Ilya Dryomov , ceph-devel@vger.kernel.org, Christian Brauner , Alexander Mikhalitsyn , linux-kernel@vger.kernel.org Subject: [PATCH v5 14/14] ceph: allow idmapped mounts Date: Thu, 8 Jun 2023 17:42:55 +0200 Message-Id: <20230608154256.562906-15-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230608154256.562906-1-aleksandr.mikhalitsyn@canonical.com> References: <20230608154256.562906-1-aleksandr.mikhalitsyn@canonical.com> 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, 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?1768150236696749477?= X-GMAIL-MSGID: =?utf-8?q?1768150236696749477?= 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 797a6cb3733c..a72adc21f489 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");