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.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, 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 9C5EDC3F2D7 for ; Tue, 3 Mar 2020 07:46:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6EAF6215A4 for ; Tue, 3 Mar 2020 07:46:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=szeredi.hu header.i=@szeredi.hu header.b="h//WCX1u" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727617AbgCCHqW (ORCPT ); Tue, 3 Mar 2020 02:46:22 -0500 Received: from mail-il1-f196.google.com ([209.85.166.196]:37579 "EHLO mail-il1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726164AbgCCHqW (ORCPT ); Tue, 3 Mar 2020 02:46:22 -0500 Received: by mail-il1-f196.google.com with SMTP id a6so1936133ilc.4 for ; Mon, 02 Mar 2020 23:46:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ELZPyz+JMM9KR/Aq1ALyZfnG+hF1PW/nIOxRAiYMFlA=; b=h//WCX1u89UHh6CAN0ekseTsItC2J5xMQfHl6n0s1N9AX+zx70w8Zxu0fuym78HBDv ZEt42SF+RPlW0mcOJcki5T5Usfq7aLeqO1zd9I0brS5E9QMGuQHA63EHHUADxREX/OqS gy0aUO+wM4MvJT1ssK9MvsaXJZqHt+TItge3Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ELZPyz+JMM9KR/Aq1ALyZfnG+hF1PW/nIOxRAiYMFlA=; b=anNLewjdYA6oVMPS7Y9GMlutjp5/gyThK2MWmth1HRO/qUTkzciho/J/NA7eMrXjoN MpP0tu2MXBCIIaFuPRHon+l/mch23ivDCIfLA5XTUThstG09+n6vLcOcV0+5H8MO39nz erABGK1Y25YHCoKoQyOKKx/pD2+bszZXaf4eA9gNfp94fIzu/bR9vBp0AK3zi/tV1gVD JrVr5IFEiaI1lnlcTBnXRGSHvS9GyXHxWc9EWrt25TKAYJCyOCSrvBEVxOyd0UnDLALi TfxCxn8cxcSp/1t/0HKSGOfEe4f7pyx18px5WKIjDwB35jCkXtWSzbuaBc6qqQ/q5d0G TT/A== X-Gm-Message-State: ANhLgQ3j2JNPal191EfZaYHWgWFO9V9Q/n9Epo/AswRBvYeA0gx5/meM fm8cJw4G+proBdx+Z4LZpf2Flb94h1ZBHd9uMUk4QQ== X-Google-Smtp-Source: ADFU+vvEp1VOCUcDcLeAQYAAy2siLYtK8Vfu/WGfBBl0ZwK2hZRppZiOkMiVlWL/6lKu5Nh0cVOfH98k5NauZOHJE88= X-Received: by 2002:a05:6e02:f43:: with SMTP id y3mr3580059ilj.174.1583221580782; Mon, 02 Mar 2020 23:46:20 -0800 (PST) MIME-Version: 1.0 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> <0403cda7345e34c800eec8e2870a1917a8c07e5c.camel@themaw.net> In-Reply-To: <0403cda7345e34c800eec8e2870a1917a8c07e5c.camel@themaw.net> From: Miklos Szeredi Date: Tue, 3 Mar 2020 08:46:09 +0100 Message-ID: Subject: Re: [PATCH 00/17] VFS: Filesystem information and notifications [ver #17] To: Ian Kent Cc: David Howells , Christian Brauner , James Bottomley , Steven Whitehouse , Miklos Szeredi , viro , Christian Brauner , Jann Horn , "Darrick J. Wong" , Linux API , linux-fsdevel , lkml , Greg Kroah-Hartman Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 3, 2020 at 6:28 AM Ian Kent wrote: > > 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. I'm doing a patch. Let's see how it fares in the face of all these preconceptions. Thanks, Miklos