Re: [fuse-devel] Cross-host entry caching and file open/create

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 23, 2020 at 10:07 PM Ken Schalk <kschalk@xxxxxxxxxx> wrote:
>
> On Thu, Oct 1, 2020 Miklos Szeredi <miklos@xxxxxxxxxx> wrote:
> > On Fri, Aug 28, 2020 at 11:01 PM Ken Schalk <kschalk@xxxxxxxxxx> wrote:
> > > > Thanks very much for your help.  The patch you provided does solve
> > > > the problem in the O_CREAT|O_EXCL case (by making a lookup call to
> > > > re-validate the entry of the since deleted file), but not in the
> > > > O_CREAT case.  (In that case the kernel still winds up making a FUSE
> > > > open request rather than a FUSE create request.)  I'd like to
> > > > suggest the slightly different attached patch instead, which
> > > > triggers re-validation in both cases.
>
> > Which is a problem, because that makes O_CREAT on existing files (a
> > fairly common case) add a new synchronous request, possibly
> > resulting in a performance regression.
>
> > I don't see an easy way this can be fixed, and I'm not sure this
> > needs to be fixed.
>
> > Are you seeing a real issue with just O_CREAT?
>
> Yes, we definitely do see issues with just O_CREAT.  The specific
> sequence that involves O_CREAT without O_EXCL is:
>
> 1. A file exists and is accessed through our FUSE distributed
>    filesystem on host X.  The kernel on host X caches the directory
>    entry for the file.
>
> 2. The file is unlinked through our FUSE distributed filesystem on
>    host Y.
>
> 3. An open(2) call with O_CREAT for the file occurs on host X.
>    Because the kernel has a cached dentry for the now deleted file, it
>    makes a FUSE open request to our filesystem (rather than a FUSE
>    create request).
>
> 4. Our filesystem's open handler finds that the file does not exist
>    (because it was unlinked in step 2) and replies to the open request
>    with ENOENT.

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.  In no case shall the OPEN request return ENOENT, that's
up to the LOOKUP request.

Exclusive create is a different matter.  It must not open an existing
file, and so it must never send an OPEN request.

Thanks,
Miklos



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux