linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Andreas Dilger <adilger-m1MBpc4rdrD3fQ9qLvQP4Q@public.gmane.org>
Cc: dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	viro-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org,
	smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	mcao-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org,
	aneesh.kumar-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org,
	linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	samba-technical-w/Ol4Ecudpl8XjKLYN78aQ@public.gmane.org,
	sjayaraman-l3A5Bk7waGM@public.gmane.org,
	linux-ext4-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 0/3] Extended file stat functions [ver #2]
Date: Thu, 01 Jul 2010 00:15:13 +0100	[thread overview]
Message-ID: <30875.1277939713@redhat.com> (raw)
In-Reply-To: <FB78A152-53D3-4000-ABDB-9D6051ECB887-m1MBpc4rdrD3fQ9qLvQP4Q@public.gmane.org>

Andreas Dilger <adilger-m1MBpc4rdrD3fQ9qLvQP4Q@public.gmane.org> wrote:

> For the cost of those extra bytes it would definitely save a lot of extra
> complexity in every application packing and unpacking the struct.  At a
> minimum put a 32-bit padding that is zero-filled for now.

Blech.  I'd prefer to just expand the fields to 64-bits.

Note that you can't just arbitrarily pass a raw 64-bit UID, say, back to
vfs_getattr() and expect it to be coped with.  Those stat syscalls that return
32-bit (or even 16-bit) would have to do something with it, and glibc would
have to do something with it.

I think we'd need extra request bits to ask for the longer UID/GID - at which
point the extra result data can be appended and extra capacity in the basic
part of the struct is not required.

> > so perhaps something like:
> > 
> > 	struct xstat_u128 { unsigned long long lsw, msw; };
> > 
> > however, I suspect the kernel will require a bit of reengineering to handle
> > a pgoff_t and loff_t of 128-bits.
>
> Well, not any different from having 32-bit platforms work with two 32-bit
> values for 64-bit offsets today, except that we would be doing this with two
> 64-bit values.

gcc for 32-bit platforms can handle 64-bit numbers.  gcc doesn't handle 128-bit
numbers.

This can be handled as suggested above by allocating extra result bits to get
the upper halves of longer fields:

	XSTAT_REQUEST_SIZE__MSW
	XSTAT_REQUEST_BLOCKS__MSW

for example.

> > Passing -1 (or ULONGLONG_MAX) to get everything would be reasonable.
> 
> NOOOO.  That is exactly what we _don't_ want, since it makes it impossible
> for the kernel to actually understand which fields the application is ready
> to handle.  If the application always uses XSTAT_QUERY_ALL, instead of "-1",
> then the kernel can easily tell which fields are present in the userspace
> structure, and what it should avoid touching.
> 
> If applications start using "-1" to mean "all fields", then it will work so
> long as the kernel and userspace agree on the size of struct xstat, but as
> soon as the kernel understands some new field, but userspace does not, the
> application will segfault or clobber random memory because the kernel thinks
> it is asking for XSTAT_QUERY_NEXT_NEW_FIELD|... when it really isn't asking
> for that at all.

As long as the field bits allocated in order and the extra results are tacked
on in bit number order, will it actually be a problem?  Userspace must know how
to deal with all the bits up to the last one it knows about; anything beyond
that is irrelevant.

What would you have me do?  Return an error if a request is made that the
kernel doesn't support?  That's bad too.  This can be handled simply by
clearing the result bit for any unsupported field.

David

  parent reply	other threads:[~2010-06-30 23:15 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-30  1:16 [PATCH 0/3] Extended file stat functions [ver #2] David Howells
2010-06-30  1:17 ` [PATCH 1/3] Mark arguments to certain syscalls as being const " David Howells
2010-06-30  1:17 ` [PATCH 2/3] AFS: Use i_generation not i_version for the vnode uniquifier " David Howells
2010-06-30  1:17 ` [PATCH 3/3] Add a pair of system calls to make extended file stats available " David Howells
2010-06-30  1:48   ` Trond Myklebust
2010-06-30  9:33     ` Andreas Dilger
     [not found]     ` <CE3451EE-F8B2-47EF-AC1C-4EEEBE68B30F-m1MBpc4rdrD3fQ9qLvQP4Q@public.gmane.org>
2010-06-30  9:47       ` David Howells
2010-06-30  2:32   ` Nicholas Miell
2010-06-30  8:30   ` Arnd Bergmann
2010-06-30  8:55   ` David Howells
2010-06-30  9:31     ` Arnd Bergmann
2010-06-30 10:01     ` David Howells
     [not found]       ` <29346.1277892068-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-06-30 11:46         ` Arnd Bergmann
2010-06-30 12:14       ` David Howells
     [not found]         ` <26650.1277900050-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-06-30 12:44           ` Arnd Bergmann
2010-06-30  9:45   ` Andreas Dilger
     [not found]   ` <B82FC7EE-93D2-4D86-906D-5D6AFA502709-m1MBpc4rdrD3fQ9qLvQP4Q@public.gmane.org>
2010-06-30 10:22     ` David Howells
2010-06-30 11:04 ` [PATCH 0/3] Extended file stat functions " Andreas Dilger
2010-06-30 12:05 ` David Howells
2010-06-30 12:11   ` Christoph Hellwig
2010-06-30 13:31     ` Arnd Bergmann
2010-06-30 14:05       ` Jeff Layton
     [not found]         ` <20100630100553.707785c7-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2010-06-30 17:36           ` Arnd Bergmann
2010-06-30 12:23   ` David Howells
     [not found]   ` <26505.1277899544-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-06-30 21:45     ` Andreas Dilger
     [not found]   ` <FB78A152-53D3-4000-ABDB-9D6051ECB887-m1MBpc4rdrD3fQ9qLvQP4Q@public.gmane.org>
2010-06-30 23:15     ` David Howells [this message]
2010-06-30 23:27       ` H. Peter Anvin
2010-07-01  0:15       ` David Howells
     [not found]         ` <8331.1277943337-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-07-01  3:20           ` H. Peter Anvin
     [not found]       ` <30875.1277939713-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-07-01  4:57         ` Andreas Dilger
     [not found]           ` <84225B35-7365-4DE2-8920-5741011B347C-m1MBpc4rdrD3fQ9qLvQP4Q@public.gmane.org>
2010-07-01  8:09             ` Arnd Bergmann
2010-07-05 23:52 ` Brad Boyer
2013-11-26 10:40 ` Jan Kara
     [not found] ` <20131126104034.GA4854-+0h/O2h83AeN3ZZ/Hiejyg@public.gmane.org>
2013-11-28 13:07   ` David Howells
2013-11-28 13:57     ` Jan Kara

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=30875.1277939713@redhat.com \
    --to=dhowells-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=adilger-m1MBpc4rdrD3fQ9qLvQP4Q@public.gmane.org \
    --cc=aneesh.kumar-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
    --cc=jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-ext4-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mcao-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
    --cc=samba-technical-w/Ol4Ecudpl8XjKLYN78aQ@public.gmane.org \
    --cc=sjayaraman-l3A5Bk7waGM@public.gmane.org \
    --cc=smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=viro-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org \
    /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;
as well as URLs for NNTP newsgroup(s).