linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ken Schalk <kschalk@nvidia.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: "fuse-devel@lists.sourceforge.net"
	<fuse-devel@lists.sourceforge.net>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: RE: [fuse-devel] Cross-host entry caching and file open/create
Date: Fri, 18 Dec 2020 04:39:15 +0000	[thread overview]
Message-ID: <DM6PR12MB3385E1298E4C729F734548C4DDC30@DM6PR12MB3385.namprd12.prod.outlook.com> (raw)
In-Reply-To: <CAJfpeguja0QPtn3jKcd1k4MK=eauLt4RgHyqJnxYeTU8h=WDcg@mail.gmail.com>

On Tue, Nov 24, 2020 Miklos Szeredi <miklos@szeredi.hu> wrote:
> ESTALE is the correct error value here, not ENOENT.  I agree this is
> subtle and not well documented, but it's quite logical: the cache
> contains stale lookup information and hence open finds the file
> non-existent.

Thank you for explaining the use of ESTALE here.  It definitely does
resolve my O_CREAT without O_EXCL issue in a better way.  I would
agree that this is not well documented, as other than the kernel
source itself the only reference I can find to this is in
Documentation/filesystems/path-lookup.rst (which I admit I had not
read prior to this).

Do you have any recommendation on the portion of my patch relating to
negative directory entries?  This is another area where currently we
don't seem to be able to get precisely the same behavior under FUSE as
under NFS.  Specifically, a file open under NFS when there is a
negative directory entry in the kernel's cache always seems to result
in a re-validating GETATTR RPC to the NFS server (which, if the file
has been recently created, allows the client to become aware of its
existence).  Is there a better way we can achieve this with FUSE than
the change in the other portion of my patch (forcing a lookup call on
any open when there is a negative directory entry for the target of
the open)?

To again be specific, the sequence of events that I'm trying to get to
work differently is:

1. A lookup occurs on host X for name which does not exist, and our
   FUSE daemon's response causes the kernel to cache a negative
   directory entry.  (I know that we can disable kernel-level caching
   of negative lookup results, but we would rather not do so for
   performance.)

2. The name is created as a file through our through our FUSE
   distributed filesystem on host Y.

3. An open(2) call for the recently created file occurs on host X.
   Because the kernel has a cached negative dentry for the file (which
   now exists), the open(2) call fails with ENOENT without any FUSE
   requests.

This comes up in the context of a distributed build system where the
work of building an intermediate file may be dispatched to a remote
host.  Under NFS, the open(2) consults the NFS server and discovers
that the name now exists.

--Ken Schalk


      reply	other threads:[~2020-12-18  4:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <DM6PR12MB33857B8B2E49DF0DD0C4F950DD5D0@DM6PR12MB3385.namprd12.prod.outlook.com>
2020-08-21 15:49 ` [fuse-devel] Cross-host entry caching and file open/create Miklos Szeredi
2020-08-26 20:28   ` Ken Schalk
2020-08-28 21:01     ` Ken Schalk
2020-10-01 18:25       ` Miklos Szeredi
2020-11-23 21:07         ` Ken Schalk
2020-11-24  8:16           ` Miklos Szeredi
2020-12-18  4:39             ` Ken Schalk [this message]

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=DM6PR12MB3385E1298E4C729F734548C4DDC30@DM6PR12MB3385.namprd12.prod.outlook.com \
    --to=kschalk@nvidia.com \
    --cc=fuse-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /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).