Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp8266rwl; Thu, 13 Apr 2023 19:44:14 -0700 (PDT) X-Google-Smtp-Source: AKy350bqxI45FxVha3cGRSYtNCpz7kniBJaoXe+1DGgGqKHeE5T7PW0xL53IR4hZilo46OwSUpa8 X-Received: by 2002:a05:6a00:1411:b0:63b:599b:a2ec with SMTP id l17-20020a056a00141100b0063b599ba2ecmr3875045pfu.27.1681440254132; Thu, 13 Apr 2023 19:44:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681440254; cv=none; d=google.com; s=arc-20160816; b=G+mx1wmlZpearrROOjKkbnzkZh97Bycl7M4k7Av8/VUtqqHaGNxCIcLhOCDIiY6GRB /HZmhKji906zBgdj6Wu2FJ41gLn5N+/2kxbSvxxr9VgC5z8yAFljPxxBqJIP3PwgjUtC 14As2kX5z6ODDoS6hMNuSUTAYji8PwiKWB30tqB1ZmpM9yzJtitPrtB8KO3dxKwDwkWp sMEurkHqftHjOLeV5fTTiLJRZOYwdtzVRuGJBvwx2Sox2S4PNHvfFI8c6BO579ySDaGk mZfnQof8EpIXpAoe6HhscTXqq7YGqQCoatOy8ET9dnXX9xprFxWUpsqv5PZy8YuGa/W9 ZZDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=jqKaCs+Xg68lf0Aqkm/WtZSel69SOQIWeTNIPifGmoU=; b=stRlh3ddqIeDcbjekNAzuiSD7RFU1hh8hqy0P+v+Pm5e6xX5Qz31+iZWfsys3daWrq Nyq227d3b7oB/kcygTeQYdFQsZeXCFXsPfEJDQn85FmKgBWbZS6odkhzOWGw0L1S5tsh ITI0xAtKZxiS/qVQwact9FKfaCDhDE6sQyjzMD/XwQBwVkGPmvTXA2ujrf9LE2qGIS4A KSSA6+ueRCQHc4O+o54dY0Wv11bBeMV8bzEOf/ZgfTL1g1qcTxQp1IVzTh8l1H7qVLjW PB5Y+FgrThDfnkwaPMyUZS5AD96Bz4v8goVCZaBtxf/lZCdYm95hYqdrCEakUUTFWJOn dyqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=eJZu5Pa6; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 1-20020a630201000000b00513973864fcsi3497819pgc.782.2023.04.13.19.43.58; Thu, 13 Apr 2023 19:44:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-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=@linux.org.uk header.s=zeniv-20220401 header.b=eJZu5Pa6; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230027AbjDNCn4 (ORCPT + 99 others); Thu, 13 Apr 2023 22:43:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229950AbjDNCno (ORCPT ); Thu, 13 Apr 2023 22:43:44 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75AD95FE2; Thu, 13 Apr 2023 19:43:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=jqKaCs+Xg68lf0Aqkm/WtZSel69SOQIWeTNIPifGmoU=; b=eJZu5Pa60RMhD7xuIeezWoX/Vu cX2TrHOrhTIikLL12aBK6EPDzCAr83e04vWNBJg0LicwEQgo2VSOY/8BWMIzMwsOxeMHI7ALrE/WM 1xPlSmoDW33+lRp8QaYpHxgZGe1tzq7epqAB80whfpmwU052Wovzgnpv5fnzy7sAZYo6F9WN11jNS RV32GB/Xv3ZoHFt8Jz8nrhhSC7iKMKBWkXhBj2W4G2aUThZj/wsHW1NdUKMvFE5DPL+psn8v8SKuU aPWjsdB4a51Ru2BuOoIOwVswWSmWHH62ur1sRqzJRK0E5ume7OpmYuNKBBv6Is1ggVc3AE8EUp+Jp CUq6YG7w==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1pn9P6-008p9d-2x; Fri, 14 Apr 2023 02:43:12 +0000 Date: Fri, 14 Apr 2023 03:43:12 +0100 From: Al Viro To: NeilBrown Cc: Jeff Layton , Christian Brauner , Dave Wysochanski , linux-fsdevel , linux-nfs , David Howells , Christoph Hellwig Subject: Re: allowing for a completely cached umount(2) pathwalk Message-ID: <20230414024312.GF3390869@ZenIV> References: <95ee689c76bf034fa2fe9fade0bccdb311f3a04f.camel@kernel.org> <168142566371.24821.15867603327393356000@noble.neil.brown.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <168142566371.24821.15867603327393356000@noble.neil.brown.name> Sender: Al Viro X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,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-nfs@vger.kernel.org On Fri, Apr 14, 2023 at 08:41:03AM +1000, NeilBrown wrote: > The path name that appears in /proc/mounts is the key that must be used > to find and unmount a filesystem. When you do that "find"ing you are > not looking up a name in a filesystem, you are looking up a key in the > mount table. No. The path name in /proc/mounts is *NOT* a key - it's a best-effort attempt to describe the mountpoint. Pathname resolution does not work in terms of "the longest prefix is found and we handle the rest within that filesystem". > We could, instead, create an api that is given a mount-id (first number > in /proc/self/mountinfo) and unmounts that. Then /sbin/umount could > read /proc/self/mountinfo, find the mount-id, and unmount it - all > without ever doing path name lookup in the traditional sense. > > But I prefer your suggestion. LOOKUP_MOUNTPOINT could be renamed > LOOKUP_CACHED, and it only finds paths that are in the dcache, never > revalidates, at most performs simple permission checks based on cached > content. umount /proc/self/fd/42/barf/something Discuss. OTON, umount-by-mount-id is an interesting idea, but we'll need to decide what would the right permissions be for it. But please, lose the "mount table is a mapping from path prefix to filesystem" notion - it really, really is not. IIRC, there are systems that work that way, but it's nowhere near the semantics used by any Unices, all variants of Linux included.