mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Trond Myklebust <trond.myklebust@fys.uio.no>
To: "Halevy, Benny" <bhalevy@panasas.com>
Cc: Jeff Layton <jlayton@poochiereds.net>,
	Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>,
	Arjan van de Ven <arjan@infradead.org>,
	Jan Harkes <jaharkes@cs.cmu.edu>,
	Miklos Szeredi <miklos@szeredi.hu>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	nfsv4@ietf.org
Subject: RE: Finding hardlinks
Date: Wed, 03 Jan 2007 00:20:47 +0100	[thread overview]
Message-ID: <1167780047.6090.102.camel@lade.trondhjem.org> (raw)
In-Reply-To: <E472128B1EB43941B4E7FB268020C89B149CF0@riverside.int.panasas.com>

On Sun, 2006-12-31 at 16:19 -0500, Halevy, Benny wrote:
> Trond Myklebust wrote:
> >  
> > On Thu, 2006-12-28 at 17:12 +0200, Benny Halevy wrote:
> > 
> > > As an example, some file systems encode hint information into the filehandle
> > > and the hints may change over time, another example is encoding parent
> > > information into the filehandle and then handles representing hard links
> > > to the same file from different directories will differ.
> > 
> > Both these examples are bogus. Filehandle information should not change
> > over time (except in the special case of NFSv4 "volatile filehandles")
> > and they should definitely not encode parent directory information that
> > can change over time (think rename()!).
> > 
> > Cheers
> >   Trond
> > 
> 
> The first one is a real life example.  Hints in the filehandle change
> over time.  The old filehandles are valid indefinitely, until the file
> is deleted and hence can be considered permanent and not volatile.
> What you say above, however, contradicts the NFS protocol as I understand
> it. Here's some relevant text from the latest NFSv4.1 draft (the text in
> 4.2.1 below exists in in a similar form also in NFSv3, rfc1813)
> 
> | 4.2.1.  General Properties of a Filehandle
> | ...
> | If two filehandles from the same server are equal, they MUST refer to
> | the same file. Servers SHOULD try to maintain a one-to-one correspondence
> | between filehandles and files but this is not required. Clients MUST use
> | filehandle comparisons only to improve performance, not for correct behavior
> | All clients need to be prepared for situations in which it cannot be
> | determined whether two filehandles denote the same object and in such cases,
> | avoid making invalid assumptions which might cause incorrect behavior.
> | Further discussion of filehandle and attribute comparison in the context of
> | data caching is presented in the section "Data Caching and File Identity".
> ...
> | 9.3.4.  Data Caching and File Identity
> | ...
> |  When clients cache data, the file data needs to be organized according to
> | the file system object to which the data belongs. For NFS version 3 clients,
> | the typical practice has been to assume for the purpose of caching that
> | distinct filehandles represent distinct file system objects. The client then
> | has the choice to organize and maintain the data cache on this basis.
> |
> | In the NFS version 4 protocol, there is now the possibility to have
> | significant deviations from a "one filehandle per object" model because a
> | filehandle may be constructed on the basis of the object's pathname.
> | Therefore, clients need a reliable method to determine if two filehandles
> | designate the same file system object. If clients were simply to assume that
> | all distinct filehandles denote distinct objects and proceed to do data
> | caching on this basis, caching inconsistencies would arise between the
> | distinct client side objects which mapped to the same server side object.
> |
> | By providing a method to differentiate filehandles, the NFS version 4
> | protocol alleviates a potential functional regression in comparison with the
> | NFS version 3 protocol. Without this method, caching inconsistencies within
> | the same client could occur and this has not been present in previous
> | versions of the NFS protocol. Note that it is possible to have such
> | inconsistencies with applications executing on multiple clients but that is
> | not the issue being addressed here.
> |
> | For the purposes of data caching, the following steps allow an NFS version 4
> | client to determine whether two distinct filehandles denote the same server
> | side object:
> |
> |     * If GETATTR directed to two filehandles returns different values of the
> |       fsid attribute, then the filehandles represent distinct objects.
> |     * If GETATTR for any file with an fsid that matches the fsid of the two
> |       filehandles in question returns a unique_handles attribute with a value
> |       of TRUE, then the two objects are distinct.
> |     * If GETATTR directed to the two filehandles does not return the fileid
> |       attribute for both of the handles, then it cannot be determined whether
> |       the two objects are the same. Therefore, operations which depend on that
> |       knowledge (e.g. client side data caching) cannot be done reliably.
> |     * If GETATTR directed to the two filehandles returns different values for
> |       the fileid attribute, then they are distinct objects.
> |     * Otherwise they are the same object.

Nobody promised you that NFSv4 would be consistent. The above is a crock
of shit that carries over from RFC1813. fileid isn't even a mandatory
attribute in NFSv4.

> Even for NFSv3 (that doesn't have the unique_handles attribute I think
> that the linux nfs client can do a better job.  If you'd have a filehandle
> cache that points at inodes you could maintain a many to one relationship
> from multiple filehandles into one inode.  When you discover a new filehandle
> you can look up the inode cache for the same fileid and if one is found you
> can do a getattr on the old filehandle (without loss of generality you should 
> always use the latest filehandle that was returned for that filesystem object,
> although any filehandle that refers to it can be used).
> If the getattr succeeded then the filehandles refer to the same fs object and
> you can create a new entry in the filehandle cache pointing at that inode.
> Otherwise, if getattr says that the old filehandle is stale I think you should
> mark the inode as stale and keep it around so that applications can get an
> appropriate error until last close, before you clean up the fh cache from the
> stale filehandles. A new inode structure should be created for the new filehandle.

No! Read what I said in that last email again. The above crap is
precisely the algorithm I said is NOT wanted in the Linux client. We're
NOT going to do a bunch of totally unnecessary extra GETATTR calls in
order to cater to 1 or 2 servers out there that actually think the above
is a good idea. Not even Solaris does that IIRC.

Trond


  reply	other threads:[~2007-01-02 23:21 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-20  9:03 Mikulas Patocka
2006-12-20 11:44 ` Miklos Szeredi
2006-12-20 16:36   ` Mikulas Patocka
2006-12-20 16:50     ` Miklos Szeredi
2006-12-20 19:54       ` Al Viro
2006-12-20 20:12         ` Mikulas Patocka
2006-12-31 15:02         ` Mikulas Patocka
2006-12-21 18:58   ` Jan Harkes
2006-12-21 23:49     ` Mikulas Patocka
2006-12-22  5:05       ` Jan Harkes
2006-12-23 10:18       ` Arjan van de Ven
2006-12-23 14:00         ` Mikulas Patocka
2006-12-28  9:06           ` Benny Halevy
2006-12-28 10:05             ` Arjan van de Ven
2006-12-28 15:24               ` Benny Halevy
2006-12-28 19:58                 ` Miklos Szeredi
2007-01-02 19:15                   ` Pavel Machek
2007-01-02 20:41                     ` Miklos Szeredi
2007-01-02 20:50                       ` Mikulas Patocka
2007-01-02 21:10                         ` Miklos Szeredi
2007-01-02 21:37                           ` Mikulas Patocka
2007-01-03 11:56                       ` Pavel Machek
2007-01-03 12:33                         ` Miklos Szeredi
2007-01-03 12:42                           ` Pavel Machek
2007-01-11 23:43                             ` Denis Vlasenko
2007-01-03 12:45                           ` Martin Mares
2007-01-03 13:54                           ` Matthew Wilcox
2007-01-03 15:51                             ` Miklos Szeredi
2007-01-03 19:04                               ` Mikulas Patocka
2007-01-04 22:59                               ` Pavel Machek
2007-01-05  8:43                                 ` Miklos Szeredi
2007-01-05 13:12                                   ` Pavel Machek
2007-01-05 13:55                                     ` Miklos Szeredi
2007-01-05 14:08                                       ` Mikulas Patocka
2007-01-05 15:09                                         ` Miklos Szeredi
2007-01-05 15:15                                           ` Miklos Szeredi
2007-01-08 11:27                                             ` Pavel Machek
2007-01-08  5:57                                           ` Mikulas Patocka
2007-01-08  8:49                                             ` Miklos Szeredi
2007-01-08 11:29                                               ` Pavel Machek
2007-01-08 12:00                                                 ` Miklos Szeredi
2007-01-08 13:26                                                   ` Martin Mares
2007-01-08 13:39                                                     ` Miklos Szeredi
2007-01-09 16:26                                                   ` Steven Rostedt
2007-01-09 19:53                                                     ` Frank van Maarseveen
2007-01-09 20:11                                                       ` Steven Rostedt
2007-01-11 10:07                                                       ` Pádraig Brady
2007-01-05 17:30                                   ` Frank van Maarseveen
2006-12-28 18:14               ` Mikulas Patocka
2006-12-29 10:34                 ` Trond Myklebust
2006-12-30  1:04                   ` Mikulas Patocka
2007-01-01  2:30                     ` Nikita Danilov
2007-01-01 22:58                       ` Mikulas Patocka
2007-01-01 23:05                         ` Nikita Danilov
2007-01-01 23:22                           ` Mikulas Patocka
2007-01-04 13:59                             ` Nikita Danilov
2007-01-02 23:14                     ` Trond Myklebust
2007-01-02 23:50                       ` Mikulas Patocka
2006-12-28 13:22             ` Jeff Layton
2006-12-28 15:12               ` Benny Halevy
2006-12-28 15:54                 ` Jeff Layton
2006-12-28 16:26                   ` Jan Engelhardt
2006-12-28 18:17                 ` Mikulas Patocka
2006-12-28 20:07                   ` Halevy, Benny
2006-12-29 10:28                     ` [nfsv4] " Trond Myklebust
2006-12-31 21:25                       ` Halevy, Benny
2007-01-02 23:21                         ` Trond Myklebust
2007-01-03 12:35                           ` Benny Halevy
2007-01-04  0:43                             ` Trond Myklebust
2007-01-04  8:36                             ` Trond Myklebust
2007-01-04 10:04                               ` Benny Halevy
2007-01-04 10:47                                 ` Trond Myklebust
2007-01-05  8:28                                   ` Benny Halevy
2007-01-05 10:29                                     ` Trond Myklebust
2007-01-05 16:40                                 ` Nicolas Williams
2007-01-05 16:56                                   ` Trond Myklebust
2007-01-06  7:44                                   ` Halevy, Benny
2007-01-10 13:04                                   ` Benny Halevy
2006-12-29 10:12                 ` Trond Myklebust
2006-12-31 21:19                   ` Halevy, Benny
2007-01-02 23:20                     ` Trond Myklebust [this message]
2007-01-02 23:46                     ` Trond Myklebust
2007-01-11 23:35             ` Denis Vlasenko
2006-12-29 10:02           ` Pavel Machek
2007-01-01 22:47             ` Mikulas Patocka
2007-01-01 23:53               ` Jan Harkes
2007-01-02  0:04                 ` Mikulas Patocka
2007-01-03 18:58                   ` Frank van Maarseveen
2007-01-03 19:17                     ` Mikulas Patocka
2007-01-03 19:26                       ` Frank van Maarseveen
2007-01-03 19:31                         ` Mikulas Patocka
2007-01-03 20:26                           ` Frank van Maarseveen
2007-01-12  0:00                             ` Denis Vlasenko
2007-01-03 22:30                           ` Pavel Machek
2007-01-03 21:09                     ` Bryan Henderson
2007-01-03 22:01                       ` Frank van Maarseveen
2007-01-03 23:43                         ` Mikulas Patocka
2007-01-04  0:12                           ` Frank van Maarseveen
2007-01-08  6:19                             ` Mikulas Patocka
     [not found] <7x5mR-2wX-3@gated-at.bofh.it>
     [not found] ` <7x9Ad-18O-35@gated-at.bofh.it>
     [not found]   ` <7yXEy-UI-39@gated-at.bofh.it>
     [not found]     ` <7yYKa-2Ds-3@gated-at.bofh.it>
     [not found]       ` <7zcWP-7ET-5@gated-at.bofh.it>
     [not found]         ` <7zdzA-jc-27@gated-at.bofh.it>
     [not found]           ` <7zeP5-2ic-15@gated-at.bofh.it>
     [not found]             ` <7zgH9-5my-17@gated-at.bofh.it>
     [not found]               ` <7zJSM-14t-9@gated-at.bofh.it>
     [not found]                 ` <7zSW5-6cj-9@gated-at.bofh.it>
     [not found]                   ` <7zX9l-4rS-7@gated-at.bofh.it>
     [not found]                     ` <7zXMb-5g5-27@gated-at.bofh.it>
2007-01-05 23:54                       ` Bodo Eggert

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=1167780047.6090.102.camel@lade.trondhjem.org \
    --to=trond.myklebust@fys.uio.no \
    --cc=arjan@infradead.org \
    --cc=bhalevy@panasas.com \
    --cc=jaharkes@cs.cmu.edu \
    --cc=jlayton@poochiereds.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=mikulas@artax.karlin.mff.cuni.cz \
    --cc=nfsv4@ietf.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

all inboxes | Powered by JetHome®