From: Neil Brown <neilb@suse.de>
To: David Howells <dhowells@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Jan Engelhardt <jengelh@medozas.de>,
Jeremy Allison <jra@samba.org>,
Volker.Lendecke@sernet.de, linux-cifs@vger.kernel.org,
linux-nfs@vger.kernel.org, samba-technical@lists.samba.org,
linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk,
linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org
Subject: Re: [PATCH 02/18] xstat: Add a pair of system calls to make extended file stats available [ver #6]
Date: Thu, 29 Jul 2010 09:04:01 +1000 [thread overview]
Message-ID: <20100729090401.4b0a21f8@notabene> (raw)
In-Reply-To: <13591.1280338082@redhat.com>
On Wed, 28 Jul 2010 18:28:02 +0100
David Howells <dhowells@redhat.com> wrote:
> Neil Brown <neilb@suse.de> wrote:
>
> > ctime and mtime have real cache-coherence semantics which require them being
> > updated by the kernel (whether the cache is on an NFS client, in a backup
> > archive, or in a .o translation of a .c file).
>
> So does creation time, at least for CIFS caching. Creation time has potential
> for spotting when the object at a pathname has changed for something else,
> given the lack of inode number and inode generation from windows servers.
> Creation time gives us one more datum to use.
This justifies for me why a CIFS client would want to extract the
creation-time from the CIFS protocol, but not why you want to expose it via a
generic interface.
The kernel/filesystem doesn't need to maintain creation-time to meet this
need, only the CIFS server needs to maintain it - the kernel/filesystem just
needs to provide somewhere to store it - xattrs.
Given that we have an extensible attribute framework, it seems wrong to be
adding new attributes to *stat. If a given filesystem wants to store certain
attributes more efficiently, then it is welcome to intercept xattr calls and
store (say) "cifs.birthtime" directly at a known offset in the inode.
The flip-side of extracting these various attributes is setting them. One
presumably doesn't want to set st_data_version and possibly not st_gen, but
there seems to be a need to set st_btime and FS_SYSTEM_FL and FS_TEMPORARY_FL
might want to be set. Your xstat doesn't give any way to do that, xattrs
already does - you just need to define names for the attributes.
So I'm against adding new attributes that simply involve the fs storing some
information for the application to use.
I'm still pondering those extra flags:
FS_SPECIAL_FL
FS_AUTOMOUNT_FL
FS_AUTOMOUNT_ANY_FL
FS_REMOTE_FL
FS_ENCRYPTED_FL
FS_OFFLINE_FL
They sound like they might be useful, they are not file-metadata (like
btime) but rather implementation details (like st_blocks). So it is probably
sensible to include them as you have done.
However I would really like to see clear and complete documentation for them.
When exactly should a filesystem set these flag, and what exactly can an
application assume if they are (or are not) set.
If a filesystem is mounted on an network-block-device, or a loop-back of a
file on NFS, is FS_REMOTE_FL set?
Is ROT13 enough for FS_ENCRYPTED_FL to be set?
If the NFS server is "not responding, still trying", should FS_OFFLINE_FL get
set on all files?
And I cannot even guess at the different between the two FS_AUTOMOUNT flags.
I'm sure it is something useful, but doco would be good. Should one of them
be set on mountpoints that NFSv4 detects from the server?
They sound useful, but they are only really useful if they have precise
meanings.
>
> > The only role the kernel might have would be setting the 'creation time' when
> > the file was created, but it seems even that isn't always what is wanted,
> > because people don't so much what the time of create of the
> > container-on-disk, but the time of creation of the data-content.
>
> That should be a timestamp in the content itself, not a filesystem metadata
> timestamp.
>
> > I would want to see a pretty convincing use-case that cannot be solved with
> > xattrs before 'creation time' was added to a generic kernel interface.
>
> Then there's no point even considering this. You could emulate the entirety
> of stat() with getxattr(). I've previously posted a patch to implement the
> retrieval of creation time, inode gen and data version as xattrs and been told
> that it's the wrong way to do it and I should extend stat instead.
:-( stuck between a rock and a hard-place ??
It would probably help to keep that sort of decision process (complete with
who to blame) documented in the change-log entry, but one never thinks of
doing that at the time.
I don't have any veto power here, and I don't want any. I think creation
time and inode gen make more sense as xattrs. I'm less certain about
data-version as the kernel has to know about it as a first-class concept.
If I have any power to influence the results, I would much rather spend it on
requiring clear precise useful definitions for each new attribute than on
determining which attributes should be first-class and which should be xattrs.
>
> > So just use xattrs and don't involve the kernel in any detailed knowledge of
> > this value.
>
> Why not? BSD has it in its stat struct. Windows has it in its Win32
> equivalents. Samba for one will look for it there, and use it if it is.
>
> Using an xattr means an extra pathwalk and extra locking per access for any
> program that wants it. It's a reasonable bet such a program will also be
> stat'ing the file it wants the creation time for.
>
> If we are going to extend stat anyway, then why not make out a short list of
> extra things we could usefully return and consider adding them? Something
> like creation time is reasonably easy to come by for little extra overhead.
> Ext4, for example, retains a copy of it in RAM in its inode struct.
Providing everybody imposes exactly the same semantics for "creation time"...
>
> > Maybe xstat should take a list of xattrs to be retrieved as well?? or maybe
> > not.
>
> The idea of xstat() having a variable-length buffer and variable arguments has
> been well derided. It ain't going to happen, much though I'd like it to. I'd
> quite like to offer the opportunity to return the security label, for example.
"well derided" like high-mem and SMP support? or "real-time" support and
priority inheritance?
I guess the deriders are wrong, and will eventually realise that they are
wrong. The difficult bit is we cannot know how long it will take them, or
how much you have to care.
NeilBrown
(unambiguous documentation!! the rest is just details)
next prev parent reply other threads:[~2010-07-28 23:04 UTC|newest]
Thread overview: 133+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-15 2:17 [PATCH 00/18] Extended file stat functions [ver #6] David Howells
2010-07-15 2:17 ` [PATCH 01/18] Mark arguments to certain syscalls as being const " David Howells
2010-07-15 2:17 ` [PATCH 02/18] xstat: Add a pair of system calls to make extended file stats available " David Howells
2010-07-15 20:35 ` Arnd Bergmann
2010-07-15 21:53 ` David Howells
2010-07-16 6:22 ` Mark Harris
2010-07-16 10:24 ` David Howells
2010-07-16 11:02 ` Arnd Bergmann
2010-07-16 12:38 ` David Howells
2010-07-16 13:32 ` Arnd Bergmann
2010-07-17 5:51 ` Mark Harris
2010-07-17 9:00 ` Arnd Bergmann
[not found] ` <20100717055130.GA2053-EJgEOVOPJGBzbRFIqnYvSA@public.gmane.org>
2010-07-17 9:49 ` David Howells
2010-07-16 10:46 ` Arnd Bergmann
2010-07-16 15:10 ` David Howells
2010-07-18 8:48 ` Christoph Hellwig
2010-07-22 10:52 ` Jan Engelhardt
2010-07-22 12:25 ` David Howells
2010-07-19 14:05 ` David Howells
2010-07-19 15:17 ` Linus Torvalds
2010-07-19 16:15 ` David Howells
2010-07-19 16:51 ` Linus Torvalds
2010-07-19 17:26 ` David Howells
2010-07-19 17:46 ` Linus Torvalds
2010-07-20 8:28 ` Andreas Dilger
2010-07-22 10:35 ` Jan Engelhardt
2010-07-22 12:14 ` David Howells
2010-07-22 12:17 ` Volker Lendecke
2010-07-22 13:05 ` Jan Engelhardt
2010-07-22 15:14 ` Linus Torvalds
2010-07-22 15:36 ` Volker Lendecke
2010-07-22 15:47 ` Linus Torvalds
2010-07-22 16:06 ` Greg Freemyer
2010-07-22 16:07 ` Greg Freemyer
2010-07-22 16:25 ` Jan Engelhardt
2010-07-22 16:27 ` Jeremy Allison
2010-07-22 16:40 ` Linus Torvalds
2010-07-22 16:58 ` Trond Myklebust
2010-07-22 18:02 ` Jeremy Allison
2010-07-22 18:04 ` Volker Lendecke
2010-07-22 18:07 ` Jeremy Allison
2010-07-22 18:59 ` Trond Myklebust
2010-07-30 17:55 ` Phil Pishioneri
2010-07-30 18:11 ` Trond Myklebust
2010-07-30 18:19 ` Phil Pishioneri
2010-07-31 18:41 ` Andreas Dilger
2010-07-31 18:48 ` Jan Engelhardt
2010-07-31 19:03 ` Trond Myklebust
2010-07-31 21:20 ` Jan Engelhardt
2010-08-01 13:17 ` Jeff Layton
2010-07-22 18:05 ` Jan Engelhardt
[not found] ` <alpine.LSU.2.01.1007222004430.4215-SHaQjdQMGhDmsUXKMKRlFA@public.gmane.org>
2010-07-22 18:07 ` Jeremy Allison
2010-07-22 19:18 ` John Stoffel
2010-07-22 17:03 ` Jan Engelhardt
2010-07-22 17:16 ` Trond Myklebust
2010-07-22 17:36 ` Jan Engelhardt
2010-07-22 17:24 ` Linus Torvalds
2010-07-22 18:15 ` Jeremy Allison
2010-07-22 18:21 ` Benny Halevy
2010-07-22 18:45 ` Greg Freemyer
2010-07-22 19:53 ` Benny Halevy
2010-07-22 18:41 ` Greg Freemyer
2010-07-28 1:15 ` Neil Brown
2010-07-28 17:28 ` David Howells
2010-07-28 23:04 ` Neil Brown [this message]
2010-07-30 18:38 ` J. Bruce Fields
2010-08-01 13:40 ` Jeff Layton
2010-08-02 14:09 ` Greg Freemyer
2010-08-02 14:42 ` Jeff Layton
2010-07-29 16:15 ` David Howells
2010-08-03 1:13 ` Neil Brown
2010-07-22 17:12 ` Jim Rees
2010-07-22 17:32 ` Linus Torvalds
2010-07-23 1:03 ` tridge
2010-07-23 1:21 ` Ted Ts'o
2010-07-23 2:12 ` tridge
2010-07-23 9:14 ` Björn Jacke
2010-07-30 21:22 ` utz lehmann
2010-07-31 8:08 ` Jan Engelhardt
2010-07-31 14:43 ` utz lehmann
2010-08-01 13:25 ` Jeff Layton
2010-08-05 23:52 ` Jeremy Allison
2010-08-06 3:38 ` Neil Brown
2010-08-06 3:55 ` Steve French
2010-08-06 11:18 ` Jeff Layton
2010-08-06 23:30 ` Neil Brown
2010-08-06 23:58 ` Steve French
2010-08-07 0:29 ` Neil Brown
2010-08-07 2:42 ` Steve French
2010-08-07 2:54 ` Steve French
2010-08-07 3:32 ` Neil Brown
2010-08-07 10:34 ` Jeff Layton
2010-08-07 11:04 ` Neil Brown
2010-08-08 12:12 ` Jeremy Allison
2010-08-08 12:53 ` Jeff Layton
2010-08-08 13:05 ` Jeremy Allison
2010-08-13 12:54 ` J. Bruce Fields
2010-08-13 17:54 ` Jeremy Allison
2010-08-13 18:09 ` Steve French
2010-08-13 19:06 ` Jan Engelhardt
2010-08-13 19:19 ` Jeremy Allison
2010-08-16 18:04 ` J. Bruce Fields
2010-08-16 18:08 ` J. Bruce Fields
2010-08-16 19:07 ` Jeremy Allison
2010-08-08 23:07 ` Neil Brown
[not found] ` <AANLkTimwIq0pBhCeOjOVjB0y <1280603032.3125.24.camel@heimdal.trondhjem.org>
[not found] ` <1280603032.3125.24.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2010-08-01 16:18 ` utz lehmann
2010-07-22 15:46 ` Jan Engelhardt
2010-07-22 16:06 ` David Howells
[not found] ` <AANLkTikBCXK6uEw <AANLkTimdFCGSKLn7aGMpBMIauHTsHY7hpAAmpo6uTcnD@mail.gmail.com>
2010-07-31 16:53 ` David Howells
2010-07-31 18:05 ` utz lehmann
2010-07-31 19:26 ` David Howells
2010-07-15 2:17 ` [PATCH 03/18] AFS: Use i_generation not i_version for the vnode uniquifier " David Howells
2010-07-15 2:17 ` [PATCH 04/18] xstat: AFS: Return extended attributes " David Howells
2010-07-15 2:17 ` [PATCH 05/18] xstat: eCryptFS: " David Howells
2010-07-15 2:17 ` [PATCH 06/18] xstat: Ext4: " David Howells
2010-07-15 2:17 ` [PATCH 07/18] xstat: NFS: " David Howells
2010-07-15 2:17 ` [PATCH 08/18] xstat: CIFS: " David Howells
2010-07-15 2:17 ` [PATCH 09/18] xstat: Make special system filesystems return FS_SPECIAL_FL " David Howells
2010-07-18 8:49 ` Christoph Hellwig
2010-07-19 14:09 ` David Howells
2010-07-27 13:41 ` David Howells
2010-07-15 2:17 ` [PATCH 10/18] xstat: Make network filesystems return FS_REMOTE_FL " David Howells
2010-07-15 2:17 ` [PATCH 11/18] xstat: Make automounter filesystems return FS_AUTOMOUNT_FL " David Howells
2010-07-15 2:17 ` [PATCH 12/18] xstat: Add a dentry op to handle automounting rather than abusing follow_link() " David Howells
2010-07-18 8:50 ` Christoph Hellwig
2010-07-19 14:10 ` David Howells
2010-07-15 2:17 ` [PATCH 13/18] xstat: AFS: Use d_automount() " David Howells
2010-07-15 2:17 ` [PATCH 14/18] xstat: NFS: " David Howells
2010-07-15 2:17 ` [PATCH 15/18] xstat: CIFS: " David Howells
2010-07-15 2:17 ` [PATCH 16/18] xstat: Remove the automount through follow_link() kludge code from pathwalk " David Howells
2010-07-15 2:17 ` [PATCH 17/18] xstat: Add an AT_NO_AUTOMOUNT flag to suppress terminal automount " David Howells
[not found] ` <20100715021709.5544.64506.stgit-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2010-07-15 2:17 ` [PATCH 18/18] xstat: Provide a mechanism to gather extra results for [f]xstat() " David Howells
[not found] ` <20100715021730.5544.68442.stgit-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2010-07-18 8:51 ` Christoph Hellwig
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=20100729090401.4b0a21f8@notabene \
--to=neilb@suse.de \
--cc=Volker.Lendecke@sernet.de \
--cc=dhowells@redhat.com \
--cc=jengelh@medozas.de \
--cc=jra@samba.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=samba-technical@lists.samba.org \
--cc=torvalds@linux-foundation.org \
--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;
as well as URLs for NNTP newsgroup(s).