From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 084C2C3F2D7 for ; Tue, 3 Mar 2020 05:36:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CD12C206D5 for ; Tue, 3 Mar 2020 05:36:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=themaw.net header.i=@themaw.net header.b="BT76Yia4"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="QYQzeOwe" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725554AbgCCFf7 (ORCPT ); Tue, 3 Mar 2020 00:35:59 -0500 Received: from wnew4-smtp.messagingengine.com ([64.147.123.18]:60435 "EHLO wnew4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725440AbgCCFf7 (ORCPT ); Tue, 3 Mar 2020 00:35:59 -0500 X-Greylist: delayed 469 seconds by postgrey-1.27 at vger.kernel.org; Tue, 03 Mar 2020 00:35:58 EST Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.west.internal (Postfix) with ESMTP id 63E5B787; Tue, 3 Mar 2020 00:28:08 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 03 Mar 2020 00:28:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=themaw.net; h= message-id:subject:from:to:cc:date:in-reply-to:references :content-type:mime-version:content-transfer-encoding; s=fm2; bh= tggywWKtWN6rOIFQkxL1pkuJH5gISL+DxeYq7A1sess=; b=BT76Yia40KWvlkva zxMUOgQ2cGh1G4CgkSd9LSzdv6pa1NSdycnVvMLIAVXgY/qhSZv23Enfe5LwvSnP EnOyOczk5IZPIJRHEDJkuzShBusCvGpFbRToi16x1NH36tS8pUdzBY1l+MY3l/hn 3FMSPuh2SfVOobkPUkwnGw/UccwiqHsKL4E9hDUsBQ0iLvArw7joxKkF16ZHoYv2 E2El88/+YeVWpdiv+bC97e7YkaCsEUXGNpEZTBNPOzuVRQDwQOeYnz/yCLphwOjh LbUyx0HxZiXgrSsL8xISkG5XZw0P3tPw8lObQw3cHKcF94+LuBDHiJ2hJk5DLQjk get+tg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=tggywWKtWN6rOIFQkxL1pkuJH5gISL+DxeYq7A1se ss=; b=QYQzeOweAI6VXarA2WPokNZgWLn9+9ymb4ttoNqRCfHxTNHhxuA1BuqNe xTzy0j8EY5psHGRl0hN3M9HQ75NBopgkUJe99IZ9mrMkMrDTVIKTN1fbqJnbwIsK ZinT2nK5jeO/rgN9iP9tYYdgXipgMH6bd61QrW8MZs7aWgHrr6O6AhUcaEs6NMxJ xMmh+N17h9gyHfggea6TB/h1iXycAMPYuCaV3AOoLb6/B9LjninTWgnJHHnJW79G J+gJYgCH7vyGZUxIZN2kDUBkelGsy+vdobfXYqltBvRVI2itWDPNbqub+VVshRsp SuGV0KQiaOgwoPizuH00f9zHo8JPg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedruddthedgkedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkffuhffvffgjfhgtfggggfesthejredttderjeenucfhrhhomhepkfgrnhcu mfgvnhhtuceorhgrvhgvnhesthhhvghmrgifrdhnvghtqeenucfkphepuddukedrvddtke drudekkedruddufeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhl fhhrohhmpehrrghvvghnsehthhgvmhgrfidrnhgvth X-ME-Proxy: Received: from mickey.themaw.net (unknown [118.208.188.113]) by mail.messagingengine.com (Postfix) with ESMTPA id 76C9A328005A; Tue, 3 Mar 2020 00:28:02 -0500 (EST) Message-ID: <0403cda7345e34c800eec8e2870a1917a8c07e5c.camel@themaw.net> Subject: Re: [PATCH 00/17] VFS: Filesystem information and notifications [ver #17] From: Ian Kent To: Miklos Szeredi , David Howells Cc: Christian Brauner , James Bottomley , Steven Whitehouse , Miklos Szeredi , viro , Christian Brauner , Jann Horn , "Darrick J. Wong" , Linux API , linux-fsdevel , lkml , Greg Kroah-Hartman Date: Tue, 03 Mar 2020 13:27:59 +0800 In-Reply-To: References: <158230810644.2185128.16726948836367716086.stgit@warthog.procyon.org.uk> <1582316494.3376.45.camel@HansenPartnership.com> <1582556135.3384.4.camel@HansenPartnership.com> <1582644535.3361.8.camel@HansenPartnership.com> <20200228155244.k4h4hz3dqhl7q7ks@wittgenstein> <107666.1582907766@warthog.procyon.org.uk> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.5 (3.32.5-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-api-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-api@vger.kernel.org On Mon, 2020-03-02 at 10:09 +0100, Miklos Szeredi wrote: > On Fri, Feb 28, 2020 at 5:36 PM David Howells > wrote: > > sysfs also has some other disadvantages for this: > > > > (1) There's a potential chicken-and-egg problem in that you have > > to create a > > bunch of files and dirs in sysfs for every created mount and > > superblock > > (possibly excluding special ones like the socket mount) - but > > this > > includes sysfs itself. This might work - provided you create > > sysfs > > first. > > Sysfs architecture looks something like this (I hope Greg will > correct > me if I'm wrong): > > device driver -> kobj tree <- sysfs tree > > The kobj tree is created by the device driver, and the dentry tree is > created on demand from the kobj tree. Lifetime of kobjs is bound to > both the sysfs objects and the device but not the other way round. > I.e. device can go away while the sysfs object is still being > referenced, and sysfs can be freely mounted and unmounted > independently of device initialization. > > So there's no ordering requirement between sysfs mounts and other > mounts. I might be wrong on the details, since mounts are created > very early in the boot process... > > > (2) sysfs is memory intensive. The directory structure has to be > > backed by > > dentries and inodes that linger as long as the referenced > > object does > > (procfs is more efficient in this regard for files that aren't > > being > > accessed) > > See above: I don't think dentries and inodes are pinned, only kobjs > and their associated cruft. Which may be too heavy, depending on the > details of the kobj tree. > > > (3) It gives people extra, indirect ways to pin mount objects and > > superblocks. > > See above. > > > For the moment, fsinfo() gives you three ways of referring to a > > filesystem > > object: > > > > (a) Directly by path. > > A path is always representable by an O_PATH descriptor. > > > (b) By path associated with an fd. > > See my proposal about linking from /proc/$PID/fdmount/$FD -> > /sys/devices/virtual/mounts/$MOUNT_ID. > > > (c) By mount ID (perm checked by working back up the tree). > > Check that perm on lookup of /sys/devices/virtual/mounts/$MOUNT_ID. > The proc symlink would bypass the lookup check by directly jumping to > the mountinfo dir. > > > but will need to add: > > > > (d) By fscontext fd (which is hard to find in sysfs). Indeed, the > > superblock > > may not even exist yet. > > Proc symlink would work for that too. There's mounts enumeration too, ordering is required to identify the top (or bottom depending on terminology) with more than one mount on a mount point. > > If sysfs is too heavy, this could be proc or a completely new > filesystem. The implementation is much less relevant at this stage > of > the discussion than the interface. Ha, proc with the seq file interface, that's already proved to not work properly and looks difficult to fix. Ian