Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp786925ybh; Wed, 18 Mar 2020 09:06:53 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvqOvn63CHpcn04PdD30EkJUTCnB8wN6jqldcyPxIeeUb9PgFGG+Otlb8iRhkI19zX1sJO2 X-Received: by 2002:aca:f17:: with SMTP id 23mr3842050oip.32.1584547613148; Wed, 18 Mar 2020 09:06:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584547613; cv=none; d=google.com; s=arc-20160816; b=WjCE6ynNh5W9nQT7lywoCB93Pb51/naPkk/vT/7KGJw7R9ywW2DnbpcJRnS3IjMHKE jWqwxnH2h0t0bXwWwt7U8f88Y5FH2uQ8mtEgYAI9E5s7yj7Qn6HQssx1h3M0Su7dwRLr g/drtEZsc5KeM8lt9Ar7vyRADb1IG/GlORdsPpTUJzWvddUGclCaMPFAZdyfvN2KF/PE SOw81XEFRVUzRMTZWIERhK00vfA9vb+SkLWb+0ERzW18pRBVVzFI0KjNW2xSjud0W1ye dWlie26A6WwGQamQfvDEmukSYZV9XdiDhO9Xsbi1ddk4FME2n0via7s/ZqH7rXaL035E VP1A== 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=Q+E6phefA0/UCxZU68Ee5CkdpY/LreXqfKusKthyp5I=; b=VJt62X+SDCB4NXQ/EHb29QIbbIgw5bQ/BxgnLM1uKujHFlIbmBPyzzwxmTQrsOZgJ4 tpibs+u0TstzoJ7YQUSDeYpCPuflhrfXIw7UV+419+z14777ltEfz3AUA4dxZslWs5xf RAkaWH3JZC9g6Fg4lnk2kNujaFdCSXV8NWMGxDtQJfHeMqNrJL53SRPSBPRBk8LSxuH5 +DauNOhAVNVOTGk8j3hGEMzYMJJhy6WXr+tBydv2kxY97e9GgnbYEwdKDYj9n8YXk3QJ Oft91FiV+iiVaqiAQ4P8Deo7iTODQ43lkLWi6dJoswWmjIxVSZqo0UllzyBoKgkwsT7p tzyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=PmkHFgaj; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-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 j66si3329121oif.4.2020.03.18.09.06.11; Wed, 18 Mar 2020 09:06:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-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=PmkHFgaj; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727049AbgCRQGD (ORCPT + 99 others); Wed, 18 Mar 2020 12:06:03 -0400 Received: from mail-il1-f193.google.com ([209.85.166.193]:34022 "EHLO mail-il1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726871AbgCRQGC (ORCPT ); Wed, 18 Mar 2020 12:06:02 -0400 Received: by mail-il1-f193.google.com with SMTP id c8so24232120ilm.1 for ; Wed, 18 Mar 2020 09:06:02 -0700 (PDT) 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=Q+E6phefA0/UCxZU68Ee5CkdpY/LreXqfKusKthyp5I=; b=PmkHFgajk2/8VWOHdYUg8VCj1tVopeX6fqfrGgYm0sPb35e5EoxUjxowANbaw3zCwS wqDhItzeSSD2F4OzNelMLAyDUKSqRDkOzITlg+Hge+tWY5LhXczVM8GuM5pTiPEM5aFa ut6OlQnzTW2CXrIbgEnOI63xRs4UIkIGUhynA= 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=Q+E6phefA0/UCxZU68Ee5CkdpY/LreXqfKusKthyp5I=; b=VBQXaCIp15lQOGPtIWRSnwzOkkKYkFVlynSX0WngRnAMw2Yjc0Hq7i+eJUbfv3QUbR HT7ZOQKMmp9j8MsYaaI1Yt3K99S+eBtoy+wsFIzpnsYC/cbSq2D/aby0NtoNfct/jRG3 yFO2KYdJFcRmHoNwdhmjNR5GzcutRTEcRpzeUPbEJhx+qHWd23z64QcIYAXTRVFu9ffI b8NdkFsY9YFS7Tkyfj+nfX+8EQ6ylGkNHnVoTogM+pAZHwkOZkxxZ8Pg+BdOFPljqbdr 4lBR5uu/30X5X9HNgM3kvkcVIbOG394dhpHqiaketbk/EpyDsHeEVZ0oVxIgHpk5fph+ sy/A== X-Gm-Message-State: ANhLgQ1NKj6uY8JRGjbga4EUqtV0zCe+Uz4MdbnhLHVhuhLXlu6kdgMs xu3rx5jJGLg0+NbQBfirVP7gj7V5DfGJbxgSkC2Wmw== X-Received: by 2002:a92:5d52:: with SMTP id r79mr4664957ilb.212.1584547562099; Wed, 18 Mar 2020 09:06:02 -0700 (PDT) MIME-Version: 1.0 References: <158454408854.2864823.5910520544515668590.stgit@warthog.procyon.org.uk> In-Reply-To: <158454408854.2864823.5910520544515668590.stgit@warthog.procyon.org.uk> From: Miklos Szeredi Date: Wed, 18 Mar 2020 17:05:50 +0100 Message-ID: Subject: Re: [PATCH 00/13] VFS: Filesystem information [ver #19] To: David Howells Cc: 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Wed, Mar 18, 2020 at 4:08 PM David Howells wrote: > ============================ > WHY NOT USE PROCFS OR SYSFS? > ============================ > > Why is it better to go with a new system call rather than adding more magic > stuff to /proc or /sysfs for each superblock object and each mount object? > > (1) It can be targetted. It makes it easy to query directly by path. > procfs and sysfs cannot do this easily. > > (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? Nobody's suggesting we move stat(2) to proc interfaces, and AFAIK nobody suggested we move /proc/PID/* to a binary syscall interface. Each one has its place, and I strongly feel that mount info belongs in the latter category. Feel free to prove the opposite. > (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. We could optimize existing proc, sys, etc. interfaces, but it's not been an issue, apparently. > > (4) Opening a file in procfs or sysfs has a pathwalk overhead for each > file accessed. We can use an integer attribute ID instead (yes, this > is similar to ioctl) - but could also use a string ID if that is > preferred. > > (5) Can easily query cross-namespace if, say, a container manager process > is given an fs_context that hasn't yet been mounted into a namespace - > or hasn't even been fully created yet. Works with my patch. > (6) Don't have to create/delete a bunch of sysfs/procfs nodes each time 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. > The argument for doing this through procfs/sysfs/somemagicfs is that > someone using a shell can just query the magic files using ordinary text > 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. 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. Thanks, Miklos