From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39215C433FE for ; Thu, 24 Mar 2022 08:57:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349085AbiCXI7S (ORCPT ); Thu, 24 Mar 2022 04:59:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243847AbiCXI7K (ORCPT ); Thu, 24 Mar 2022 04:59:10 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB2549D0C3 for ; Thu, 24 Mar 2022 01:57:38 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id j15so7714273eje.9 for ; Thu, 24 Mar 2022 01:57:38 -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=TZ6s65rDvN8Tqn0qDZEB8Ijp4jvPh0GyNpSk/ZtB3pI=; b=m8uvN3vl8Uzj9zAwWsZQwJeD4SgdTCd74DSTmwxQoZYwKcDUMIa06VjnueJ49ViSg6 AH6m1oASGMxV+L7gbdqnZl0DsC1kLdBlx0tkhj9scA0ROyULs+xnhqKjG+EjiECTe9v9 fHLplZ4INS5E2/hQbGf40wOuvgjoBCnl4uueQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TZ6s65rDvN8Tqn0qDZEB8Ijp4jvPh0GyNpSk/ZtB3pI=; b=0FrH4c4qd8Y2MW7z/dfgNh0ubO8d22jsqoC0L7hTZ3Q3Zhkjd3TE/NKvd0bbjv4Wup 4LLUG+BLh1AwGJABDQOLxb3uw8gHcv5jYcwq1J6YGLCvRdPbKlZv8fbJjmst3izU6+Qx aML5/BK36gjmbUJ6Aju4aLNBXy5UISF361jcyIKXpajTINEQ9Bks5brCNpfZihzw+5yo jYNassPpWurm39NAYGs1gkh4uoSk0C38Lw6bm2xFaVAVXaIh1r1xEcaRPyMHqzkR8uCV dekDuYb228cOLkYLkz4KdqelG/mF0wBBrjTsaMuXMPkvU4bTQlt4xLLkVDY23sV9MPoa P72w== X-Gm-Message-State: AOAM53328fCjH0NBqFQXKSy6y0O0IyqFQa+eZH+d1rL9YiuuamM7zrfa SIRVRZWNU+y50GoS2HjX4XCBQ8zaKVi77zVdsLIxUg== X-Google-Smtp-Source: ABdhPJz7TgZDeh0+kDj2ymXCRjzBF8dMmiYeu1yauoVqNwsy2kRkXd9LUCYEVYbpcsr51BEAZ9P7D4i0qDYXH2dm+jA= X-Received: by 2002:a17:907:c16:b0:6db:1dfc:ca73 with SMTP id ga22-20020a1709070c1600b006db1dfcca73mr4602838ejc.192.1648112257373; Thu, 24 Mar 2022 01:57:37 -0700 (PDT) MIME-Version: 1.0 References: <20220322192712.709170-1-mszeredi@redhat.com> <20220323225843.GI1609613@dread.disaster.area> In-Reply-To: <20220323225843.GI1609613@dread.disaster.area> From: Miklos Szeredi Date: Thu, 24 Mar 2022 09:57:26 +0100 Message-ID: Subject: Re: [RFC PATCH] getvalues(2) prototype To: Dave Chinner 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 23 Mar 2022 at 23:58, Dave Chinner wrote: > > On Tue, Mar 22, 2022 at 08:27:12PM +0100, Miklos Szeredi wrote: > > - Interfaces for getting various attributes and statistics are fragmented. > > For files we have basic stat, statx, extended attributes, file attributes > > (for which there are two overlapping ioctl interfaces). For mounts and > > superblocks we have stat*fs as well as /proc/$PID/{mountinfo,mountstats}. > > The latter also has the problem on not allowing queries on a specific > > mount. > > https://xkcd.com/927/ Haha! > I've said in the past when discussing things like statx() that maybe > everything should be addressable via the xattr namespace and > set/queried via xattr names regardless of how the filesystem stores > the data. The VFS/filesystem simply translates the name to the > storage location of the information. It might be held in xattrs, but > it could just be a flag bit in an inode field. Right, that would definitely make sense for inode attributes. What about other objects' attributes, statistics? Remember this started out as a way to replace /proc/self/mountinfo with something that can query individual mount. > > mnt - list of mount parameters > > mnt:mountpoint - the mountpoint of the mount of $ORIGIN > > mntns - list of mount ID's reachable from the current root > > mntns:21:parentid - parent ID of the mount with ID of 21 > > xattr:security.selinux - the security.selinux extended attribute > > data:foo/bar - the data contained in file $ORIGIN/foo/bar > > How are these different from just declaring new xattr namespaces for > these things. e.g. open any file and list the xattrs in the > xattr:mount.mnt namespace to get the list of mount parameters for > that mount. Okay. > Why do we need a new "xattr in everything but name" interface when > we could just extend the one we've already got and formalise a new, > cleaner version of xattr batch APIs that have been around for 20-odd > years already? Seems to make sense. But...will listxattr list everyting recursively? I guess that won't work, better just list traditional xattrs, otherwise we'll likely get regressions, and anyway the point of a hierarchical namespace is to be able to list nodes on each level. We can use getxattr() for this purpose, just like getvalues() does in the above example. Thanks, Miklos