Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp3131652ybf; Mon, 2 Mar 2020 23:46:47 -0800 (PST) X-Google-Smtp-Source: ADFU+vsij7k/HORKY9CQXcrDx5Wwvr58NTAlvuIbm6xXbX97vjMJ+9ANZkFv43dIIxn8FFgNin3x X-Received: by 2002:a05:6830:22ca:: with SMTP id q10mr2613402otc.280.1583221606904; Mon, 02 Mar 2020 23:46:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583221606; cv=none; d=google.com; s=arc-20160816; b=atLaRSEbn2fA02ddV+cO7XLF/T709FhP4cwumMOG5xgYjJ3virhOjt1yHDNOxTw0aM w6FYkJztJrz7R07fq0YEsDmxnxtsdV1gvClsnrmlclTDKfjuPE3T9UqRuce9ZVJxas4a RbW0Cik3SyYi9vNiluJ5xi9gpDGa2xwJDCiLiaat8cjW+bskpzI4zxk1R+vSrOdQFx/9 0aIER/enIepx60MLwl5DTZfjD+YOYIiHdPFA3Q3n0stNc5RDpZ3XrZymO1MHfaeWYZh1 tPoHaoITdp+FKw8bY9r+PAOTTCc8gdALq5QX54purIWlaoy1MTWZw4L4jGdbsuE+Y7B+ y5Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ELZPyz+JMM9KR/Aq1ALyZfnG+hF1PW/nIOxRAiYMFlA=; b=m3SIZPJb5E59LLh4E8bEcjxCFGN/Nfw+rS/du7dglhxR1TFj1jk0Fztph4Hq8Z+EbZ tPZ8zPs1hN0qkHYRkid73m8U0S+QSXPC33UAcfFEw+WHo20R2RNypJ+a0bxKtIFmS1ET Tf6B2djSRc+KDSJwLOSxLCwIZ8xx9IeWQUVbppgTtWZCnqChQ3tIPAYe9RiOopZks4qw GBu48IZx7mi5PFxSYgobycyasCS/RSvPnsQ4XY12vzzfwfWQwq0ODaOMujZB5gOlrB7P xENho8VL45vT6PDWGcZ0yHn7yLH8IqePDfB2fDLUtUJNEBnTSpo4OCAq9J2ZpZYUo7P6 aKww== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b="h//WCX1u"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j20si7396990oii.80.2020.03.02.23.46.34; Mon, 02 Mar 2020 23:46:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b="h//WCX1u"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727571AbgCCHqW (ORCPT + 99 others); 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-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