public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: tytso <tytso@mit.edu>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
	linux-fsdevel@vger.kernel.org, Karel Zak <kzak@redhat.com>,
	Greg KH <gregkh@linuxfoundation.org>,
	Christian Brauner <brauner@kernel.org>,
	linux-kernel@vger.kernel.org,
	Linux API <linux-api@vger.kernel.org>,
	linux-man <linux-man@vger.kernel.org>,
	LSM <linux-security-module@vger.kernel.org>,
	Ian Kent <raven@themaw.net>, David Howells <dhowells@redhat.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <christian@brauner.io>,
	Amir Goldstein <amir73il@gmail.com>,
	James Bottomley <James.Bottomley@hansenpartnership.com>
Subject: Re: [RFC PATCH] getting misc stats/attributes via xattr API
Date: Sat, 7 May 2022 10:32:00 +1000	[thread overview]
Message-ID: <20220507003200.GM1949718@dread.disaster.area> (raw)
In-Reply-To: <YnRf5CNN2yNKVu0B@mit.edu>

On Thu, May 05, 2022 at 04:38:12PM -0700, tytso wrote:
> On Tue, May 03, 2022 at 02:23:23PM +0200, Miklos Szeredi wrote:
> > 
> > : - root
> > bar - an attribute
> > foo: - a folder (can contain attributes and/or folders)
> > 
> > The contents of a folder is represented by a null separated list of names.
> > 
> > Examples:
> > 
> > $ getfattr -etext -n ":" .
> > # file: .
> > :="mnt:\000mntns:"
> 
> In your example, does it matter what "." is?  It looks like in some
> cases, it makes no difference at all, and in other cases, like this,
> '.' *does* matter:
> 
> > $ getfattr -etext -n ":mnt:info" .
> > # file: .
> > :mnt:info="21 1 254:0 / / rw,relatime - ext4 /dev/root rw\012"
> 
> Is that right?
> 
> > $ getfattr -etext -n ":mntns:" .
> > # file: .
> > :mntns:="21:\00022:\00024:\00025:\00023:\00026:\00027:\00028:\00029:\00030:\00031:"
> 
> What is this returning?  All possible mount name spaces?  Or all of
> the mount spaces where '.' happens to exist?
> 
> Also, using the null character means that we can't really use shell
> scripts calling getfattr.

Yeah, it should be returning an attr per namespace, not an attr
whose value contains all the valid namespaces.

i.e. if the next level of the heirachy is 21, 22, 24, .... we should
be seeing a listing of multiple attributes with naming like:

:mntns:21:
:mntns:22:
:mntns:24:
....

rather than an attribute whose value contains the names of the
attrbiutes in the next layer of the heirarchy. Then we can just
pull the namespace we want and feed it directly to:

$ getfattr -n ":mntns:21:"

and we get a list of all the attributes available for that
namespace...

> I understand that the problem is that in
> some cases, you might want to return a pathname, and NULL is the only
> character which is guaranteed not to show up in a pathname.  However,
> it makes parsing the returned value in a shell script exciting.

We shouldn't be returning the names of children in an attribute
value. We have a syscall API for doing this that - listxattr() will
iterate attribute names just like a directory does with readdir()
via listxattr(). IOWs, we should not need to encode the next layer
of child attribute names into the value of the parent attribute - if
we do a listxattr on a parent that has children, return the list of
child names as individual attribute names....

(Yes, I know listxattr null separates the attribute names - it's a
godawful kernel API - but that's not the programmatic interface
we should expose at the shell script level.)

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  parent reply	other threads:[~2022-05-07  0:32 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-03 12:23 [RFC PATCH] getting misc stats/attributes via xattr API Miklos Szeredi
2022-05-03 14:39 ` Amir Goldstein
2022-05-03 14:53   ` Greg KH
2022-05-03 15:04     ` Miklos Szeredi
2022-05-03 15:14       ` Amir Goldstein
2022-05-03 16:54       ` Greg KH
2022-05-03 22:43 ` Dave Chinner
2022-05-04  7:18   ` Miklos Szeredi
2022-05-04 14:22     ` Amir Goldstein
2022-05-05 12:30 ` Karel Zak
2022-05-05 13:59   ` Miklos Szeredi
2022-05-05 23:38 ` tytso
2022-05-06  0:06   ` Amir Goldstein
2022-05-07  0:32   ` Dave Chinner [this message]
2022-05-09 12:48 ` Christian Brauner
2022-05-09 14:20   ` Amir Goldstein
2022-05-09 15:08     ` Christian Brauner
2022-05-09 17:07       ` Amir Goldstein
2022-05-09 21:42       ` Vivek Goyal
2022-05-10  3:34         ` Ian Kent
2022-05-10  0:55   ` Dave Chinner
2022-05-10 12:40     ` Christian Brauner
2022-05-11  0:42       ` Dave Chinner
2022-05-11  9:16         ` Christian Brauner
2022-05-10 12:45     ` Florian Weimer
2022-05-10 23:04       ` Dave Chinner
2022-05-10  3:49   ` Miklos Szeredi
2022-05-10  4:27     ` Ian Kent
2022-05-10  8:06       ` Miklos Szeredi
2022-05-10  8:07         ` Miklos Szeredi
2022-05-10 11:53     ` Christian Brauner
2022-05-10 13:15       ` Miklos Szeredi
2022-05-10 13:18         ` Miklos Szeredi
2022-05-10 14:19         ` Christian Brauner
2022-05-10 14:41           ` Miklos Szeredi
2022-05-10 15:30             ` Christian Brauner
2022-05-10 15:47               ` Miklos Szeredi
2022-05-10 15:53                 ` Christian Brauner
2022-05-10 12:35   ` Karel Zak
2022-05-10 23:25     ` Dave Chinner
2022-05-11  8:58       ` Karel Zak
2022-11-14  9:00 ` Abel Wu
2022-11-14 12:35   ` Miklos Szeredi
2022-11-15  3:39     ` Abel Wu
2023-04-15 11:06     ` [LSF/MM TOPIC] fsinfo and mount namespace notifications Amir Goldstein
2023-04-18  8:54       ` Miklos Szeredi
2023-04-18 15:56         ` Amir Goldstein
2023-04-18 18:57           ` Miklos Szeredi
2023-04-19  8:18             ` Amir Goldstein
2023-04-19  8:43               ` Miklos Szeredi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220507003200.GM1949718@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=amir73il@gmail.com \
    --cc=brauner@kernel.org \
    --cc=christian@brauner.io \
    --cc=dhowells@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kzak@redhat.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=raven@themaw.net \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox