Received: by 2002:a25:d783:0:0:0:0:0 with SMTP id o125csp492862ybg; Thu, 19 Mar 2020 03:38:07 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsW4dgQ4D/7OusxK4TJLBpjKd93MmasGSMOo2U0v6C3GnYz1JPEJ39fMukmwhXh7kZaKPpX X-Received: by 2002:a05:6830:125a:: with SMTP id s26mr414033otp.230.1584614287321; Thu, 19 Mar 2020 03:38:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584614287; cv=none; d=google.com; s=arc-20160816; b=GCSgZzbkXFqevC41QEZ9I/yNdu8GpQYcscdmnFOtB10d5b9JGShePjZmyVSESFfvZO BWfcdYyA/CfsDmNjP73eJUKVFaEV1S8JuUoxGHAtYmy3Sm1sXM5YF/7zpI6WrK2pS0Zu eHBbYQHHspVfCP8+FLyFK+LZIEAZPvu4ye6zN02siU7+cEC6qBr9SILhTtHvSGg1W/sQ Dv4AIr5bHUcCfXXcgSPivybcnTy6BvoHGN0EOdkKNYBGWssx/1U7gBV5kke47a9arPF5 DMPsPfqMHlx3N7wMj/4z5TpCoMPR6Qss3YkAJE+9g+ofk/W5LqrwwBNol0LZ27YZg2lZ NrTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:content-transfer-encoding :content-id:mime-version:subject:cc:to:references:in-reply-to:from :organization:dkim-signature; bh=CiofkCH/sv7+7rpU6YsJXFWeq/w+9dcTqMLo0EbVExc=; b=S1fdhmDCl+azbGbuIiZ+8EJsoqIENhEZGtY3XgD0oilooqw6JUBBggAQ2IKXjYYqv0 jbEr7V0FrxRj/1peJT3reNyrNEI5LDEnwCWkugYe7601bznR1XiVr6fYvSn85uGymF5b u10xpL1vnG0b/IN+ERO/1dLX5KO41feyoOundEAkm6X8qc0uqsVBXKr8IHB8SXZXz4wu gyenuVSmsZrOAr0YWXZV2s9k+V95pLZoUpX/UDTFrSi+RW1XDI030SDzeE5UanjoM/eg lEyMUTZjFnm1KnJXlbGf6CI9PGNwBzrVxrnziq/zRvRR4rgFe/2mnHs+cT5bMrmXpX/1 rX/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=W7enGfnG; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q13si1056751otn.141.2020.03.19.03.37.51; Thu, 19 Mar 2020 03:38:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=W7enGfnG; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726968AbgCSKhq (ORCPT + 99 others); Thu, 19 Mar 2020 06:37:46 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:55866 "EHLO us-smtp-delivery-74.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726901AbgCSKhq (ORCPT ); Thu, 19 Mar 2020 06:37:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584614265; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CiofkCH/sv7+7rpU6YsJXFWeq/w+9dcTqMLo0EbVExc=; b=W7enGfnGkzo+p5isCuaz2QP27q8GOvyQ76Ay8BoyaC/khJGWZOfSdTWDjhVz19C21djghg 9IztDMJzlYu3VzND6E8nPAKKEUtAkGaRmO+43nBy9qLrvoykX/5lZkjkj3PDSTYmjvBvut SMdc5niQc0JA+wjxge8N980vt2y+fds= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-285-cUdAiS5ZN1Sq4KuQlxE-7w-1; Thu, 19 Mar 2020 06:37:44 -0400 X-MC-Unique: cUdAiS5ZN1Sq4KuQlxE-7w-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BBCD5107ACC4; Thu, 19 Mar 2020 10:37:41 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-113-126.rdu2.redhat.com [10.10.113.126]) by smtp.corp.redhat.com (Postfix) with ESMTP id C3A2117B91; Thu, 19 Mar 2020 10:37:37 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: References: <158454408854.2864823.5910520544515668590.stgit@warthog.procyon.org.uk> To: Miklos Szeredi Cc: dhowells@redhat.com, Linus Torvalds , Al Viro , Linux NFS list , Andreas Dilger , Anna Schumaker , "Theodore Ts'o" , Linux API , linux-ext4@vger.kernel.org, Trond Myklebust , Ian Kent , Miklos Szeredi , Christian Brauner , Jann Horn , "Darrick J. Wong" , Karel Zak , Jeff Layton , linux-fsdevel@vger.kernel.org, LSM , linux-kernel@vger.kernel.org Subject: Re: [PATCH 00/13] VFS: Filesystem information [ver #19] MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3085879.1584614257.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Thu, 19 Mar 2020 10:37:37 +0000 Message-ID: <3085880.1584614257@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Miklos Szeredi wrote: > > (2) It's more efficient as we can return specific binary data rather = than > > making huge text dumps. Granted, sysfs and procfs could present = the > > same data, though as lots of little files which have to be > > individually opened, read, closed and parsed. > = > Asked this a number of times, but you haven't answered yet: what > application would require such a high efficiency? Low efficiency means more time doing this when that time could be spent do= ing other things - or even putting the CPU in a powersaving state. Using an open/read/close render-to-text-and-parse interface *will* be slower and le= ss efficient as there are more things you have to do to use it. Then consider doing a walk over all the mounts in the case where there are 10000 of them - we have issues with /proc/mounts for such. fsinfo() will = end up doing a lot less work. > I strongly feel that mount info belongs in the latter category I feel strongly that a lot of stuff done through /proc or /sys shouldn't b= e. Yes, it's nice that you can explore it with cat and poke it with echo, but= it has a number of problems: security, atomiticity, efficiency and providing = an round-the-back way to pin stuff if not done right. > > (3) We wouldn't have the overhead of open and close (even adding a > > self-contained readfile() syscall has to do that internally > = > Busted: add f_op->readfile() and be done with all that. For example > DEFINE_SHOW_ATTRIBUTE() could be trivially moved to that interface. Look at your example. "f_op->". That's "file->f_op->" I presume. You would have to make it "i_op->" to avoid the open and the close - and f= or things like procfs and sysfs, that's probably entirely reasonable - but be= ar in mind that you still have to apply all the LSM file security controls, j= ust in case the backing filesystem is, say, ext4 rather than procfs. > We could optimize existing proc, sys, etc. interfaces, but it's not > been an issue, apparently. You can't get rid of or change many of the existing interfaces. A lot of = them are effectively indirect system calls and are, as such, part of the fixed UAPI. You'd have to add a parallel optimised set. > > (6) Don't have to create/delete a bunch of sysfs/procfs nodes each ti= me a > > mount happens or is removed - and since systemd makes much use of > > mount namespaces and mount propagation, this will create a lot of > > nodes. > = > Not true. This may not be true if you roll your own special filesystem. It *is* tru= e if you do it in procfs or sysfs. The files don't exist if you don't create n= odes or attribute tables for them. > > The argument for doing this through procfs/sysfs/somemagicfs is that > > someone using a shell can just query the magic files using ordinary te= xt > > tools, such as cat - and that has merit - but it doesn't solve the > > query-by-pathname problem. > > > > The suggested way around the query-by-pathname problem is to open the > > target file O_PATH and then look in a magic directory under procfs > > corresponding to the fd number to see a set of attribute files[*] laid= out. > > Bash, however, can't open by O_PATH or O_NOFOLLOW as things stand... > = > Bash doesn't have fsinfo(2) either, so that's not really a good argument= . I never claimed that fsinfo() could be accessed directly from the shell. = For you proposal, you claimed "immediately usable from all programming languag= es, including scripts". > Implementing a utility to show mount attribute(s) by path is trivial > for the file based interface, while it would need to be updated for > each extension of fsinfo(2). Same goes for libc, language bindings, > etc. That's not precisely true. If you aren't using an extension to an fsinfo(= ) attribute, you wouldn't need to change anything[*]. If you want to use an extension - *even* through a file based interface - = you *would* have to change your code and your parser. And, no, extending an fsinfo() attribute would not require any changes to = libc unless libc is using that attribute[*] and wants to access the extension. [*] I assume that in C/C++ at least, you'd use linux/fsinfo.h rather than = some libc version. [*] statfs() could be emulated this way, but I'm not sure what else libc specifically is going to look at. This is more aimed at libmount amon= gst other things. David