vfs:glusterfs: treat ENOATTR as ENOENT
authorMichael Adam <obnox@samba.org>
Thu, 20 Jun 2019 13:14:57 +0000 (15:14 +0200)
committerGünther Deschner <gd@samba.org>
Fri, 28 Jun 2019 11:37:24 +0000 (11:37 +0000)
commit8899eb21d48b7077328ae560490f9fb9715a6b83
tree160491d352a06b53108ed8e3c635f6f9710068e9
parent6e5bff80a0a0b5e999a9327640f3aa01b9f18777
vfs:glusterfs: treat ENOATTR as ENOENT

The original implementation of the virtual xattr get_real_filename
in gluster was misusing the ENOENT errno as the authoritative anwer
that the file/dir that we were asking the real filename for does not
exist. But since the getxattr call is done on the parent directory,
this is a violation of the getxattr API which uses ENOENT for the
case that the file/dir that the getxattr call is done against does
not exist.

Now after a recent regression for fuse-mount re-exports due to
gluster mapping ENOENT to ESTALE in the fuse-bridge, the gluster
implementation is changed to more correctly return ENOATTR if the
requested file does not exist.

This patch changes the glusterfs vfs module to treat ENOATTR as ENOENT
to be fully functional again with latest gluster.

- Without this patch, samba against a new gluster will work correctly,
  but the get_real_filename optimization for a non-existing entry
  is lost.

- With this patch, Samba will not work correctly any more against
  very old gluster servers: Those (correctly) returned ENOATTR
  always, which Samba originally interpreted as EOPNOTSUPP, triggering
  the expensive directory scan. With this patch, ENOATTR is
  interpreted as ENOENT, the authoritative answer that the requested
  entry does not exist, which is wrong unless it really does not exist.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
source3/modules/vfs_glusterfs.c