Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp312245pxb; Wed, 23 Mar 2022 19:08:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQiq31r5mAUThiYOZ1Lrfjqy7y9bpxwU6AoXX9crlPMiuKoaPJCRiX/k15tqBRMC1FmCCv X-Received: by 2002:a17:90b:4f44:b0:1c7:9f03:9b2d with SMTP id pj4-20020a17090b4f4400b001c79f039b2dmr5502718pjb.24.1648087718287; Wed, 23 Mar 2022 19:08:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648087718; cv=none; d=google.com; s=arc-20160816; b=O1w6V40sij+BWx10fHDeJq8Ic9D7ck/VMRlMW+unrMg1dSOuyz1rleCc8giIel7lvB CG0xBQKhXAS/Ln1QXm43KbbCk7oLhjXcMf6pxywxAcH33K57GruAQw34picvk/sOg1na +JQW9gozo+o2DKc7c0PZZHYYTlk7Y9Ngfu+RLl/zQLdGK9RZVg+4Jx0iAoh2TeGdj2iT 2V0NAuSvks86FOmdsrRAT5oMuxZ0EW+s/QMK5WEvGhnHwdZYwsNwDCRAIO1VmYMcwSkV 8AmHErtRg3rOfR8fGTBhaCv5jg9lCT7o8Zeqc3ghq8zZrqr6AA1UP9rc1S2/5+OH2vCS RbCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=nGrBDIOfk09I8FWc6QOIz7JQf3bHy8tyuHNVM0EP6sk=; b=uCoYNoXcWM4VUyKFcmmLdmcIRUFCFq9Tv0W/gwBqe16lk4p6NACWhWT9BD7AMQ6TAy F8oUPdeStezS+udHQlARowUpWmdWOn7D2wVMHAZ61EDDVCArTjJlYY8fzDt1ur0008Wl lgCHHvcuRRSi5JaL0tmIqGbOJFxvmTQD7QzuB/DrylWaEmfcFxVaqLRFAcMG5g0M405h huUv8cbJH1CCqC2ybTYkPeGKMYC7x91QskdMmj57QM3mDE+yXVNsU/c4I20Qs495UBbd oColMI+MkuLKUBZFUVAX1uXZGAMc25/8PJ0se44PTGh2CR/nTWwEYZjthWh2lmvgqFPG 1yPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b="XH/bdGA5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r23-20020a170903021700b00153b2d16463si17356644plh.107.2022.03.23.19.08.24; Wed, 23 Mar 2022 19:08:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b="XH/bdGA5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236423AbiCWNxP (ORCPT + 99 others); Wed, 23 Mar 2022 09:53:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229896AbiCWNxO (ORCPT ); Wed, 23 Mar 2022 09:53:14 -0400 Received: from sonic306-27.consmr.mail.ne1.yahoo.com (sonic306-27.consmr.mail.ne1.yahoo.com [66.163.189.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEFEF7DE39 for ; Wed, 23 Mar 2022 06:51:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1648043503; bh=nGrBDIOfk09I8FWc6QOIz7JQf3bHy8tyuHNVM0EP6sk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From:Subject:Reply-To; b=XH/bdGA55CR2QnzRtm1mRaxx2JaRO91BcAs5Av2UMiwu4WLu07z+iXTxs06NWj7lVKFCQL8yrF2ubXEKuyijcFnWuuF91/G+16JtCIevCWFuzig3aBgV9DZN+lkOMRwHkyGbAOhpmLkWPfnGdjFZRxo6Olb9P6KQmIv/UA92mlE1Abg2yMi5iwiHnK42W53EFBa3Ss7rHosmRAwblE+QaObQ9UyprpUQPmS0iOSxnL/Tuxcqb1ZQ3tVOsy5Gy5GduS+KY7KH4tYtIDljXGTuAJqRLqawoF14i+3vVJUdXaG/l7Hn+lAQepweF+xK8wdaKqEAVlFwvhYO4NV/gdS1zA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1648043503; bh=jxqTA43iFlFSWocJpudyyVWVGBeLiHSpYPxyBnWqoGn=; h=X-Sonic-MF:Date:Subject:To:From:From:Subject; b=GAHm4KTahupGqWTIl1kgIYqDhkTCXvnhCKbXHSDBI/yAqLXur3nCSCmXn8Hh8CIOukAP4tigN7bYDW+18wp9SHr6ZSpH489/Fef93tlTkUfciDzdTOHJ8PlUU7olgXRE5KVnhr2ZRerEdKlO9Pftx10iDSvwefT3mqB51l/NDTf6tUK4xNjY8STePoxmjKBXrEuVmVVrng5g6u3Wmo4jIKGyKqrd0C+GXj4vxcSeaE6EeSyqTLKvuLZYm4kqUZl7fvxvZ1S8lQXPuakaEGRDS9v85rSNh/pHC8gp5qlBtmZojQoV83Cc9p46W9vrkOh+PEfSVbEWQbHgyL6Urs1c5g== X-YMail-OSG: arvGonAVM1klZhaOCKStvzpriEHCTWAoxpRlp0X_xhZZtLdflYMA2LLpcLa5iSA xk0NeP2DUUhwDP0zqv_auzFizXfSHSFoJfQE9L3BEdYhPiSzVA.2TNn1sUBfCdtAirfG_d0vtzAP 2U4CGqeW_WcgNVDkfw.w0OO2N_BQ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HouaZQ-- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic306.consmr.mail.ne1.yahoo.com with HTTP; Wed, 23 Mar 2022 13:51:43 +0000 Received: by hermes--canary-production-bf1-665cdb9985-6hz22 (VZM Hermes SMTP Server) with ESMTPA ID 1e898808bfb982390c464824ceac17fc; Wed, 23 Mar 2022 13:51:39 +0000 (UTC) Message-ID: Date: Wed, 23 Mar 2022 06:51:35 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [RFC PATCH] getvalues(2) prototype Content-Language: en-US To: Miklos Szeredi , Christian Brauner Cc: Miklos Szeredi , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Linux API , linux-man , LSM , Karel Zak , Ian Kent , David Howells , Linus Torvalds , Al Viro , Christian Brauner , Amir Goldstein , James Bottomley , Casey Schaufler References: <20220322192712.709170-1-mszeredi@redhat.com> <20220323114215.pfrxy2b6vsvqig6a@wittgenstein> From: Casey Schaufler In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Mailer: WebService/1.1.19894 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/23/2022 6:24 AM, Miklos Szeredi wrote: > On Wed, 23 Mar 2022 at 12:43, Christian Brauner wrote: > >> Yes, we really need a way to query for various fs information. I'm a bit >> torn about the details of this interface though. I would really like if >> we had interfaces that are really easy to use from userspace comparable >> to statx for example. > The reason I stated thinking about this is that Amir wanted a per-sb > iostat interface and dumped it into /proc/PID/mountstats. And that is > definitely not the right way to go about this. > > So we could add a statfsx() and start filling in new stuff, and that's > what Linus suggested. But then we might need to add stuff that is not > representable in a flat structure (like for example the stuff that > nfs_show_stats does) and that again needs new infrastructure. > > Another example is task info in /proc. Utilities are doing a crazy > number of syscalls to get trivial information. Why don't we have a > procx(2) syscall? I guess because lots of that is difficult to > represent in a flat structure. Just take the lsof example: tt's doing > hundreds of thousands of syscalls on a desktop computer with just a > few hundred processes. > > So I'm trying to look beyond fsinfo and about how we could better > retrieve attributes, statistics, small bits and pieces within a > unified framework. > > The ease of use argument does not really come into the picture here, > because (unlike stat and friends) most of this info is specialized and > will be either consumed by libraries, specialized utilities > (util-linux, procos) or with a generic utility application that can > query any information about anything that is exported through such an > interface. That applies to plain stat(2) as well: most users will > not switch to statx() simply because that's too generic. And that's > fine, for info as common as struct stat a syscall is warranted. If > the info is more specialized, then I think a truly generic interface > is a much better choice. > >> I know having this generic as possible was the >> goal but I'm just a bit uneasy with such interfaces. They become >> cumbersome to use in userspace. I'm not sure if the data: part for >> example should be in this at all. That seems a bit out of place to me. > Good point, reduction of scope may help. > >> Would it be really that bad if we added multiple syscalls for different >> types of info? For example, querying mount information could reasonably >> be a more focussed separate system call allowing to retrieve detailed >> mount propagation info, flags, idmappings and so on. Prior approaches to >> solve this in a completely generic way have gotten us not very far too >> so I'm a bit worried about this aspect too. > And I fear that this will just result in more and more ad-hoc > interfaces being added, because a new feature didn't quite fit the old > API. You can see the history of this happening all over the place > with multiple new syscall versions being added as the old one turns > out to be not generic enough. > > I think a new interface needs to > > - be uniform (a single utility can be used to retrieve various > attributes and statistics, contrast this with e.g. stat(1), > getfattr(1), lsattr(1) not to mention various fs specific tools). > > - have a hierarchical namespace (the unix path lookup is an example > of this that stood the test of time) > > - allow retrieving arbitrary text or binary data You also need a way to get a list off what attributes are available and/or a way to get all available attributes. Applications and especially libraries shouldn't have to guess what information is relevant. If the attributes change depending on the filesystem and/or LSM involved, and they do, how can a general purpose library function know what data to ask for? > > And whatever form it takes, I'm sure it will be easier to use than the > mess we currently have in various interfaces like the mount or process > stats. > > Thanks, > Miklos