Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp192045pxb; Wed, 23 Mar 2022 16:06:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZScwhvUm+NysajipmIgKwSTs5gkQaViyeNaIt4X0rN0iMPCFDLVz6KLqu3tLBrspc4Gr/ X-Received: by 2002:a0d:c6c4:0:b0:2d6:f343:fa99 with SMTP id i187-20020a0dc6c4000000b002d6f343fa99mr2339163ywd.142.1648076775634; Wed, 23 Mar 2022 16:06:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648076775; cv=none; d=google.com; s=arc-20160816; b=AZKNLLKY4PIBqUKn0PbaI4xxkPDFOKK5teRfQ/EeDhxiWZ6qEScKm5I14dej8PhpZ1 Nd7Ia2Xy7NqLb6Jv87nx51otqVkcvMYp/RcPYxg+vTcz9ED/SwYsgniW/KYrdBMNTaju Z8Drjpv/1KcJKu3IqP/JoV0syavdOhA3UwFyUmR8RV6cYqjUDSYu1wKysLJ2zz/rSd7T RlYNHKRlVIeZJiw+76Taui5YJxWShPVQqeCp3s8yOh6XCUDGCueTu6ZjgEv6xpgL1b+t nilJEpL4Mz6wR1gAONIP3srXqXA0ceoCkb48uEmeLrDUdRdP6W3M9sbf7nWM8AEGeAFS 69og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=S5RGCL6Z0u24pl6MvSkV39af33aecVeOyzAL+NHrLGc=; b=aRWI29C+oT2uujiAdsRrvGnfWtzg2AAoC9e+vQ9ucDXyp/xNdc8paoMZSTNWXXPavR foCRQ9A9jjmnInKjrkswLVGeUFW1CslounfeRY7InrkLfFIJW4Kd2flApnI9cB8ZoKAP VFwGv0MvBYMv7Nne1thDfdhm5GUqvxcdOy5i65QigpoyEas64NSRuzLSKfXrmLu0OTU2 CE+0ylrHydR+N7mXbnbd+MoHUJMB+Q4uv3xX6/b+nhG38FOmizPcZsQ4qoQbtF8RZvcv dmFros/YBqXWc7g/n5POpS1gGJw93v9w+S3kEa5gv+C6zvhi9bF1YbLuFZXItsheB9Z0 aGXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JT3Ze9V2; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bc12-20020a05690c000c00b002e67c91f6b6si8867447ywb.346.2022.03.23.16.05.54; Wed, 23 Mar 2022 16:06:15 -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=@linuxfoundation.org header.s=korg header.b=JT3Ze9V2; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244370AbiCWNjs (ORCPT + 99 others); Wed, 23 Mar 2022 09:39:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244362AbiCWNjp (ORCPT ); Wed, 23 Mar 2022 09:39:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D8E35F8D6; Wed, 23 Mar 2022 06:38:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E3593B81F13; Wed, 23 Mar 2022 13:38:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2EFBC340E8; Wed, 23 Mar 2022 13:38:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1648042690; bh=FS4rMUgYm98K72DS/l0zV5frCfm1kqj/zcgo/7pabXw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JT3Ze9V22MkpJEe9f7BnjRn/vnsga2B9nHBVD0kV8zKLTi+VEroCdcjGzZlWKuHYJ 1gyqGo/IrlVtRZkznGfLmYBmgt2Uworm16hjtXdDeQl+39jWHRbUTf26ct9hOH0/uG er6PCviMcAqG8oVa0XLsFb3EYWzzpovOYPuNPGhM= Date: Wed, 23 Mar 2022 14:38:07 +0100 From: Greg KH To: Miklos Szeredi Cc: Christian Brauner , 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 Subject: Re: [RFC PATCH] getvalues(2) prototype Message-ID: References: <20220322192712.709170-1-mszeredi@redhat.com> <20220323114215.pfrxy2b6vsvqig6a@wittgenstein> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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 Wed, Mar 23, 2022 at 02:24:40PM +0100, 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 > > 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. This has been proposed in the past a few times. Most recently by the KVM developers, which tried to create a "generic" api, but ended up just making something to work for KVM as they got tired of people ignoring their more intrusive patch sets. See virt/kvm/binary_stats.c for what they ended up with, and perhaps you can just use that same type of interface here as well? thanks, greg k-h