Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3131423pxb; Sat, 26 Mar 2022 11:40:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzc9yRJDoDLVIkX4DnoN0hz1LipFWmuT/zgZS41Aa0EaMqn8IP3R55lZNrthRLuT08vks/w X-Received: by 2002:a17:906:dc90:b0:6df:f5fb:cf91 with SMTP id cs16-20020a170906dc9000b006dff5fbcf91mr18345191ejc.429.1648320015885; Sat, 26 Mar 2022 11:40:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648320015; cv=none; d=google.com; s=arc-20160816; b=So6rn9xPigQEn4rcnYFNc0qVRHVmjn2rBdDm0X7BwRUZZGGTqI3r3zezqcKCCY5sUv sPO3Jd7LBilyKwOTScKrVsQt4/yQp6MmGLc7bOby749Gxq1RQVknAmMcmiu1E6XeNYYM VAggEPEyIhe+pbDoLoXA+XzU6cuqrABrVW+/mrk/VMf67bylmo3wRp+hbQuaTm/naG4n nJzCh3eYUGNK84diLpKfs8FkGHmWhjzNc9aZ2JQm2E7810/3Yx5rDpTCh0OUILhdx59o 4hL1/orFsCtIAc1kIHYPahtSls2jjy44XTp0X585hyUc8sx9T/Fojj21yr7xi6WFIq1S YQiw== 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; bh=nnJdlmCNQSaSqXP1/ysyihQgjJ8xlZaMSiMdc1bP6ZE=; b=0vHqpa+hRC5KUQeArzCehd6PB8/hYA8YxQHoclIANn685muAscyozZbfhoX4ICRb5f cZAF3Er3T1aWg8dRNaKM4aIewHNqVb3+qBDH/B2qRlh08LrFC7sRIfWS7GW7AF6fR3nP NH8Rg5uSd3twMWGaBnce8zO4yzJaDY48kWXs4+0QX/5EhEav/ZYSYAQTgdpRL+6DMzNO 68mIh7/x3mCgaBbWeSkflE0S1HIDpIsiVJSCZ86wXRyTCINj39vGVHmskQ4fU9VcKKXI U6wp/1HJmoTOjBn3+jtZRB33xO+JNkXPevTs2kUkSUYCCxBIqFl4xhu15wMjfqVkQYfP Nkbg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mit.edu Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f3-20020a170906138300b006df76385e24si6554436ejc.708.2022.03.26.11.39.51; Sat, 26 Mar 2022 11:40: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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mit.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231162AbiCZEVR (ORCPT + 99 others); Sat, 26 Mar 2022 00:21:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229686AbiCZEVP (ORCPT ); Sat, 26 Mar 2022 00:21:15 -0400 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2197723F3F9; Fri, 25 Mar 2022 21:19:38 -0700 (PDT) Received: from cwcc.thunk.org (pool-108-7-220-252.bstnma.fios.verizon.net [108.7.220.252]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 22Q4JAos018812 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 26 Mar 2022 00:19:11 -0400 Received: by cwcc.thunk.org (Postfix, from userid 15806) id D60DD15C0038; Sat, 26 Mar 2022 00:19:10 -0400 (EDT) Date: Sat, 26 Mar 2022 00:19:10 -0400 From: "Theodore Ts'o" To: Karel Zak Cc: Greg KH , Miklos Szeredi , Christian Brauner , Miklos Szeredi , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Linux API , linux-man , LSM , 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> <20220325084646.7g6oto2ce3vou54x@ws.net.home> <20220325092553.rncxqrjslv6e4c7v@ws.net.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220325092553.rncxqrjslv6e4c7v@ws.net.home> X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 Fri, Mar 25, 2022 at 10:25:53AM +0100, Karel Zak wrote: > > Right, the speed of ps(1) or lsof(1) is not important. IMHO the current > discussion about getvalues() goes in wrong direction :-) > > I guess the primary motivation is not to replace open+read+close, but > provide to userspace something usable to get information from mount > table, because the current /proc/#/mountinfo and notification by > poll() is horrible. I think that's because the getvalues(2) prototype *only* optimizes away open+read+close, and doesn't do a *thing* with respect to /proc//mountinfo. > Don't forget that the previous attempt was fsinfo() from David Howells > (unfortunately, it was too complex and rejected by Linus). fsinfo() tried to do a lot more than solving the /proc//mountinfo problem; perhaps that was the cause of the complexity. Ignoring the notification problem (which I suspect we could solve with an extension of fsnotify), if the goal is to find a cleaner way to fetch information about a process's mount namespace and the mounts in that namespace, why not trying to export that information via sysfs? Information about devices are just as complex, after all. We could make mount namespaces to be their own first class object, so there would be an entry in /proc/ which returns the mount namespace id used by a particular process. Similarly, let each mounted file system be its own first class object. Information about each mount namespace would be in /sys/mnt_ns, and information about each mounted file system would be in /sys/superblock. Then in /sys/mnt_ns there would be a directory for each (superblock, mountpoint) pair. Given how quickly programs like lsof can open tens of thousands of small files, and typically there are't that many mounted file systems in a particular mount namespace, performance really shouldn't be a problem. If it works well enough for other kernel objects that are accessed via sysfs, and fsinfo() is way to complex, why don't we try a pattern which has worked and is "native" to Linux? - Ted