[Gluster-devel] Report ESTALE as ENOENT

J. Bruce Fields bfields at fieldses.org
Mon Oct 23 18:01:24 UTC 2017


On Mon, Oct 23, 2017 at 05:37:53PM +0200, Michael Kerrisk (man-pages) wrote:
> On 20 October 2017 at 22:22, J. Bruce Fields <bfields at fieldses.org> wrote:
> > The basic issue is that unlike on a local filesystem, NFS can't
> > necessarily keep an unlinked but in-use object around; so attempts to
> > use such may return ESTALE.
> >
> > So, any call that could take a filehandle for an object on NFS could
> > return ESTALE.
> >
> > Ditto for any call that might need to lookup within an NFS directory, if
> > the directory disappears during the lookup.
> >
> > I say "NFS", but other distributed filesystems may have the same issue,
> > I don't know.
> >
> > Example of how it might look for open/openat and read follows.
> >
> > Alternatively we could stick something in BUGS or NOTES sections.  But
> > I like having an etry under ERRORS.  Maybe an entry under ERRORS that
> > just says "see NOTES"?
> 
> I think having an entry in ERRORS is best. But, how many pages need
> this fix? Quite a large number, I am guessing.

Yes.  Just looking very quickly at man2/, I'm guessing:

	access, chdir, chmod, chown, chroot, close, copy_file_range,
	execve, execveat, posix_fadvise, fallocate, fcntl, fsync,
	fgetxattr/listxattr/removexattr/setxattr, flock, stat, truncate,
	getdents, link, lseek, mkdir, mknod, mmap, mount, open, pread,
	read, readahead, readdir, readlink, readv, rename, rmdir,
	sendfile, splice, statx, sync_file_range, symlink, write,
	unlink, utime

It might be helpful to be able to say something like:

	ESTALE
		fd refers to a deleted object on an NFS filesystem; see
		XXX for details

and put a little more discussion somewhere central; any idea for that?
ernno(3)?

I'm curious what the deal is with filesystems other than NFS.  It
shouldn't normally happen on disk filesystems (except for
open_by_handle_at).  Interesting cases might be afs, ceph, cifs, fuse,
orangefs, overlayfs.

--b.

> Cheers,
> 
> Michael
> 
> 
> > diff --git a/man2/read.2 b/man2/read.2
> > index f2e1379865df..b50602526901 100644
> > --- a/man2/read.2
> > +++ b/man2/read.2
> > @@ -164,6 +164,10 @@ is orphaned.
> >  It may also occur when there is a low-level I/O error
> >  while reading from a disk or tape.
> >  .TP
> > +.B ESTALE
> > +.I fd
> > +refers to a deleted object on a distributed filesystem such as NFS.
> > +.TP
> >  .B EISDIR
> >  .I fd
> >  refers to a directory.
> > diff --git a/man2/open.2 b/man2/open.2
> > index eeed37bfdd70..10f3f48ed625 100644
> > --- a/man2/open.2
> > +++ b/man2/open.2
> > @@ -1080,6 +1080,15 @@ but this kernel version does not provide the
> >  .B O_TMPFILE
> >  functionality.
> >  .TP
> > +.B ESTALE
> > +.I dirfd
> > +refers to a deleted directory on a distributed filesystem such as NFS.
> > +Or, a directory component in
> > +.I pathname
> > +is on a distributed filesystem such as NFS, and was removed during the
> > +process of traversing
> > +.IR pathname .
> > +.TP
> >  .B ENOMEM
> >  The named file is a FIFO,
> >  but memory for the FIFO buffer can't be allocated because
> 
> 
> 
> -- 
> Michael Kerrisk
> Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
> Linux/UNIX System Programming Training: http://man7.org/training/


More information about the Gluster-devel mailing list