mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Trond Myklebust <trond.myklebust@fys.uio.no>
To: Vitaliy Gusev <vgusev@sw.ru>
Cc: linux-kernel@vger.kernel.org, devel@openvz.org
Subject: Re: Problem: LTP linkat01 test fails on nfs directory (NFS v3)
Date: Fri, 21 Sep 2007 08:37:07 -0400	[thread overview]
Message-ID: <1190378227.6680.10.camel@heimdal.trondhjem.org> (raw)
In-Reply-To: <200709211313.01040.vgusev@sw.ru>

On Fri, 2007-09-21 at 13:13 +0400, Vitaliy Gusev wrote:
> Hello.
> 
> Tested kernels: 2.6.18, 2.6.22, 2.6.23-rc2
> 
> Steps to reproduce: Suppose that we have mounted some directory from nfs v3 
> server with default options. Also we  have the two directories in this 
> mountpoint and each directory has hard linked file. Try to open those files 
> and write to one and read from another. Data will not be equal. (Testcase: 
> attached hardlink_test.c)

Please retry after re-exporting the filesystem using the highly
recommended "no_subtree_check" option. The default subtree_check option
is broken: it changes the filehandle of the file upon a cross-directory
rename() of that file.

> Analysis: Although these hard linked files have same nfs_fattr::fileid but 
> have different nfs_fh fhandle. In this case nfs_find_actor() function 
> (fs/nfs/inode.c) returns false during opening each file:
> 
> nfs_find_actor()
> {
> ...
> 	if (nfs_compare_fh(NFS_FH(inode), fh))
> 		return 0;
> ...
> }
> 
> Therefore for each of hard links new struct inode is allocated. It leads to 
> cache aliasing.
> 
> Please explain why nfs_find_actor() function compares file handles?

'cos this is the only way to know that two files are the same. fileid is
not always supported by servers: it is an optional NFSv4 attribute, and
on NFSv3, most non-posix filesystems will fake it using something like
iunique().

Comparing filehandles allows you to be certain that two files are the
same if the filehandles are equal. If they are not equal, then that does
not guarantee that the files are different, but then how else are you
going to determine it?

Trond


  reply	other threads:[~2007-09-21 12:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <46F1541B.2040800@sw.ru>
2007-09-21  9:13 ` Vitaliy Gusev
2007-09-21 12:37   ` Trond Myklebust [this message]
2007-09-21 14:39     ` Vitaliy Gusev
2007-09-21 10:16 ` Vitaliy Gusev

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=1190378227.6680.10.camel@heimdal.trondhjem.org \
    --to=trond.myklebust@fys.uio.no \
    --cc=devel@openvz.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vgusev@sw.ru \
    /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®