Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp1529090rdh; Fri, 27 Oct 2023 18:37:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGRxNz6o2+YFInZRq8XZG0umOm4d+ga271ZhJTI67f3lMUNKR7Uh44jWXL+SkDv1eka3/8F X-Received: by 2002:a05:6808:8eb:b0:3a7:6213:6899 with SMTP id d11-20020a05680808eb00b003a762136899mr4302015oic.24.1698457074871; Fri, 27 Oct 2023 18:37:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698457074; cv=none; d=google.com; s=arc-20160816; b=BOg5z2hqkfa//f3OZ87LFFX+AlqHmYxUxaWiCWiJq7Zo2Pubegk4Fom61Lfh4njTqK F+9xJoyR5wewks24R+gtauewqes4T7POlTVBOexPklu1hdiy+lEMjgkx4/OmTAZIcDDX zSplNO80lMUpyrVLe5zWrf/GMi64ezSZ6+B7gzMRle5wmYhqUn+IOfMuGngekduJYjiR mFS6CR0ry7PlqvGAW0iSMDXz+KRqczPsPZv/HGwAY+q9e43WZvqKwiCzwn0eh4EK5pLT 1Oy25Mc97ZZAk5b9RLhAsxlf16P/IGmXFCkiFDs+j68grhAANRMMuyZl3YkR7Q98q58J mR6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:feedback-id:dkim-signature:dkim-signature; bh=KsUaa2dQRxZCNliH8E4IgB96uElIa6AZYOiIzXKoc/g=; fh=0aClYxBEUJjF5QzWPOIwz0LsBVX1cvMGrZ1POdvkB/o=; b=RNyr5MCxZausMrY2uOCmHk5uhZuVNNjBmLsI5MpMe0Hco3WigZmh2EzcpNovGYxGvW wPxI1Vyv4lLhWEJKReqtW++VBFiTQw2tOfXhxT+DpyiTr6sy4vmKmDJB2U+/DS+1Kpj8 Op52FpdWgcdNj4ltkxW4NoIrSRFq499odxERuyDKC4o5v7u73Th09naurT7r9n4ypH1q 262Pzy6F48iu7bj2jKvonuNpiI4MaFZmD09NRw2JiUnNOPT21VeLM5FtE88/90HfRi8P d1bS7AZpbxKgBtTPxBZp+YdRY6maDZKRGKNW8fVu67Df8nQX+JLNB6YGyKgS+QPpbN5X nYGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@themaw.net header.s=fm2 header.b=fZYSL1Hh; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=F3HFKyzm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id l1-20020a056a00140100b0068e4704fd5bsi1791509pfu.346.2023.10.27.18.37.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 18:37:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@themaw.net header.s=fm2 header.b=fZYSL1Hh; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=F3HFKyzm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 6E421804DDAF; Fri, 27 Oct 2023 18:36:52 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232978AbjJ1Bgm (ORCPT + 99 others); Fri, 27 Oct 2023 21:36:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229471AbjJ1Bgj (ORCPT ); Fri, 27 Oct 2023 21:36:39 -0400 Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69DD91A6; Fri, 27 Oct 2023 18:36:36 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 066505C0100; Fri, 27 Oct 2023 21:36:34 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Fri, 27 Oct 2023 21:36:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=themaw.net; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm2; t= 1698456994; x=1698543394; bh=KsUaa2dQRxZCNliH8E4IgB96uElIa6AZYOi IzXKoc/g=; b=fZYSL1Hh4egXuicxkMFg+jLgSXE3ZgD8AFpH+th6BJTlZigkseO mtkr17z5D5GSLqS3VGFVp3OeFx9U78fXmtLa9W0N/XHvBo5ajUNKShNtUDs7/sKd ZV4tr0uGpIz8uPI45OdgM/w5KYporhOEOR24znvm/rirYuDF3x6YBc+zxbDplwcj 7eBteMNTZrNWsvL9HHyHvp/BuuTW1dNXe++6VfFOS27Qnk8Z+nS9kmlR+bgDjVzf gzUPt1jW0vMwPsIsCCc5Gobwv8H4jeIM+R7sWGfp/qmKEDAGzJQ7Vn3acMbKXa6M jPYyerd5HZZrgWis7rMj8zYIuHGTycY1cyQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1698456994; x=1698543394; bh=KsUaa2dQRxZCNliH8E4IgB96uElIa6AZYOi IzXKoc/g=; b=F3HFKyzmmg9oxz/ntz+T5+XmYWDdcKhDALX/MCh6lte6GAO0rwY RBcb9BjyHp8jfuTcYbT2DGUA7udnstUUZIewC+T0DtyeWdgMhJ1CexKem91iZYy6 UGw2pgxXP/vDrtoAus18DfE8shNHIcPiyWKBOSmk2oal3LptEcqVlRX5oMXDlu+F AF3WjmY+PFO3tr/zpnWzGTezgZo9zPILxeYMg5+G5Z3PliD3q1tUvm7YPhNsNzVD HoedNHyyAhNO8zmJjwOqJoRSuLUhPzLCExH6mpE/QFi0Bg+8usyrjuGQNliseQTW 6ABGQ2psafUCNfRw0eRgJHREBL0cIJ+Q2tA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrleehgdegjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffggfgfuvfevfhfhjggtgfesthekredttdefjeenucfhrhhomhepkfgrnhcu mfgvnhhtuceorhgrvhgvnhesthhhvghmrgifrdhnvghtqeenucggtffrrghtthgvrhhnpe egvdetvedvfeeivdeuueejgeetvdehlefhheethfekgfejueffgeeugfekudfhjeenucev lhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehrrghvvghnse hthhgvmhgrfidrnhgvth X-ME-Proxy: Feedback-ID: i31e841b0:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 27 Oct 2023 21:36:27 -0400 (EDT) Message-ID: Date: Sat, 28 Oct 2023 09:36:23 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v4 2/6] mounts: keep list of mounts in an rbtree To: Miklos Szeredi Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, linux-man@vger.kernel.org, linux-security-module@vger.kernel.org, Karel Zak , David Howells , Linus Torvalds , Al Viro , Christian Brauner , Amir Goldstein , Matthew House , Florian Weimer , Arnd Bergmann References: <20231025140205.3586473-1-mszeredi@redhat.com> <20231025140205.3586473-3-mszeredi@redhat.com> Content-Language: en-US From: Ian Kent In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 27 Oct 2023 18:36:52 -0700 (PDT) On 27/10/23 16:17, Miklos Szeredi wrote: > On Fri, Oct 27, 2023 at 5:12 AM Ian Kent wrote: >> On 25/10/23 22:02, Miklos Szeredi wrote: >>> The mnt.mnt_list is still used to set up the mount tree and for >>> propagation, but not after the mount has been added to a namespace. Hence >>> mnt_list can live in union with rb_node. Use MNT_ONRB mount flag to >>> validate that the mount is on the correct list. >> Is that accurate, propagation occurs at mount and also at umount. > When propagating a mount, the new mount's mnt_list is used as a head > for the new propagated mounts. These are then moved to the rb tree by > commit_tree(). > > When umounting there's a "to umount" list called tmp_list in > umount_tree(), this list is used to collect direct umounts and then > propagated umounts. The direct umounts are added in umount_tree(), > the propagated ones umount_one(). > > Note: umount_tree() can be called on a not yet finished mount, in that > case the mounts are still on mnt_list, so umount_tree() needs to deal > with both. > >> IDG how the change to umount_one() works, it looks like umount_list() >> >> uses mnt_list. It looks like propagate_umount() is also using mnt_list. >> >> >> Am I missing something obvious? > So when a mount is part of a namespace (either anonymous or not) it is > on the rb tree, when not then it can temporarily be on mnt_list. > MNT_ONRB flag is used to validate that the mount is on the list that > we expect it to be on, but also to detect the case of the mount setup > being aborted. > > We could handle the second case differently, since we should be able > to tell when we are removing the mount from a namespace and when we > are aborting a mount, but this was the least invasive way to do this. Thanks for the explanation, what you've said is essentially what I understood reading the series. But I still haven't quite got this so I'll need to spend more time on this part of the patch series. That's not a problem, ;). Ian > > Thanks, > Miklos >