linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Finding hardlinks
@ 2006-12-20  9:03 Mikulas Patocka
  2006-12-20 11:44 ` Miklos Szeredi
  0 siblings, 1 reply; 100+ messages in thread
From: Mikulas Patocka @ 2006-12-20  9:03 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel

Hi

I've came across this problem: how can a userspace program (such as for 
example "cp -a") tell that two files form a hardlink? Comparing inode 
number will break on filesystems that can have more than 2^32 files (NFS3, 
OCFS, SpadFS; kernel developers already implemented iget5_locked for the 
case of colliding inode numbers). Other possibilities:

--- compare not only ino, but all stat entries and make sure that
 	i_nlink > 1?
 	--- is not 100% reliable either, only lowers failure probability
--- create a hardlink and watch if i_nlink is increased on both files?
 	--- doesn't work on read-only filesystems
--- compare file content?
 	--- "cp -a" won't then corrupt data at least, but will create
 	hardlinks where they shouldn't be.

Is there some reliable way how should "cp -a" command determine that? 
Finding in kernel whether two dentries point to the same inode is trivial 
but I am not sure how to let userspace know ... am I missing something?

Mikulas

^ permalink raw reply	[flat|nested] 100+ messages in thread
* RE: [nfsv4] RE: Finding hardlinks
@ 2007-01-05 17:24 Noveck, Dave
  0 siblings, 0 replies; 100+ messages in thread
From: Noveck, Dave @ 2007-01-05 17:24 UTC (permalink / raw)
  To: Trond Myklebust, Benny Halevy
  Cc: Jan Harkes, Miklos Szeredi, nfsv4, linux-kernel, Mikulas Patocka,
	linux-fsdevel, Jeff Layton, Arjan van de Ven

For now, I'm not going to address the controversial issues here,
mainly because I haven't decided how I feel about them yet.

     Whether allowing multiple filehandles per object is a good
     or even reasonably acceptable idea.

     What the fact that RFC3530 talks about implies about what
     clients should do about the issue.

One thing that I hope is not controversial is that the v4.1 spec
should either get rid of this or make it clear and implementable.
I expect plenty of controversy about which of those to choose, but
hope that there isn't any about the proposition that we have to 
choose one of those two.

> SECINFO information is, for instance, given
> out on a per-filehandle basis, does that mean that the server will
have
> different security policies? 

Well yes, RFC3530 does say "The new SECINFO operation will allow the 
client to determine, on a per filehandle basis", but I think that
just has to be considered as an error rather than indicating that if
you have two different filehandles for the same object, they can have 
different security policies.  SECINFO in RFC3530 takes a directory fh
and a name, so if there are multiple filehandles for the object with
that name, there is no way for SECINFO to associate different policies
with different filehandles.  All it has is the name to go by.  I think
this should be corrected to "on a per-object basis" in the new spec no 
matter what we do on other issues.

I think the principle here has to be that if we do allow multiple 
fh's to map to the same object, we require that they designate the 
same object, and thus it is not allowed for the server to act as if 
you have multiple different object with different characteristics.

Similarly as to:

> In some places, people haven't even started
> to think about the consequences: 
>
>     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.

I think they (and maybe "they" includes me, I haven't checked the
history
here) started to think about them, but went in a bad direction.

The implication here that you can have a different set of attributes
supported for the same object based on which filehandle is used to 
access the attributes is totally bogus.

The definition of supp_attr says "The bit vector which would retrieve
all mandatory and recommended attributes that are supported for this 
object.  The scope of this attribute applies to all objects with a
matching fsid."  So having the same object have different attributes
supported based on the filehandle used or even two objects in the same
fs having different attributes supported, in particular having fileid
supported for one and not the other just isn't valid.

> The fact is that RFC3530 contains masses of rope with which
> to allow server and client vendors to hang themselves. 

If that means simply making poor choices, then OK.  But if there are 
other cases where you feel that the specification of a feature is simply

incoherent and the consequences not really thought out, then I think 
we need to discuss them and not propagate that state of affairs to v4.1.

-----Original Message-----
From: Trond Myklebust [mailto:trond.myklebust@fys.uio.no] 
Sent: Friday, January 05, 2007 5:29 AM
To: Benny Halevy
Cc: Jan Harkes; Miklos Szeredi; nfsv4@ietf.org;
linux-kernel@vger.kernel.org; Mikulas Patocka;
linux-fsdevel@vger.kernel.org; Jeff Layton; Arjan van de Ven
Subject: Re: [nfsv4] RE: Finding hardlinks


On Fri, 2007-01-05 at 10:28 +0200, Benny Halevy wrote:
> Trond Myklebust wrote:
> > Exactly where do you see us violating the close-to-open cache
> > consistency guarantees?
> > 
> 
> I haven't seen that. What I did see is cache inconsistency when
opening
> the same file with different file descriptors when the filehandle
changes.
> My testing shows that at least fsync and close fail with EIO when the
filehandle
> changed while there was dirty data in the cache and that's good.
Still,
> not sharing the cache while the file is opened (even on a different
file
> descriptors by the same process) seems impractical.

Tough. I'm not going to commit to adding support for multiple
filehandles. The fact is that RFC3530 contains masses of rope with which
to allow server and client vendors to hang themselves. The fact that the
protocol claims support for servers that use multiple filehandles per
inode does not mean it is necessarily a good idea. It adds unnecessary
code complexity, it screws with server scalability (extra GETATTR calls
just in order to probe existing filehandles), and it is insufficiently
well documented in the RFC: SECINFO information is, for instance, given
out on a per-filehandle basis, does that mean that the server will have
different security policies? In some places, people haven't even started
to think about the consequences:

      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.

This implies the combination is legal, but offers no indication as to
how you would match OPEN/CLOSE requests via different paths. AFAICS you
would have to do non-cached I/O with no share modes (i.e. NFSv3-style
"special" stateids). There is no way in hell we will ever support
non-cached I/O in NFS other than the special case of O_DIRECT.


...and no, I'm certainly not interested in "fixing" the RFC on this
point in any way other than getting this crap dropped from the spec. I
see no use for it at all.

Trond


_______________________________________________
nfsv4 mailing list
nfsv4@ietf.org
https://www1.ietf.org/mailman/listinfo/nfsv4

^ permalink raw reply	[flat|nested] 100+ messages in thread

end of thread, other threads:[~2007-01-12  0:02 UTC | newest]

Thread overview: 100+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-20  9:03 Finding hardlinks 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
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
2007-01-05 17:24 [nfsv4] " Noveck, Dave

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).