]> git.baikalelectronics.ru Git - kernel.git/commit
fuse: ioctl: translate ENOSYS
authorMiklos Szeredi <mszeredi@redhat.com>
Thu, 21 Jul 2022 14:06:18 +0000 (16:06 +0200)
committerMiklos Szeredi <mszeredi@redhat.com>
Thu, 21 Jul 2022 14:06:18 +0000 (16:06 +0200)
commit124ef49f6bb00484476c9a1b67fa8c3658f0f894
treee34389b147770de2b2881076ab7639434bca4e38
parent9ff943c9925539529ee0a5f2b291cf40c1b44fb9
fuse: ioctl: translate ENOSYS

Overlayfs may fail to complete updates when a filesystem lacks
fileattr/xattr syscall support and responds with an ENOSYS error code,
resulting in an unexpected "Function not implemented" error.

This bug may occur with FUSE filesystems, such as davfs2.

Steps to reproduce:

  # install davfs2, e.g., apk add davfs2
  mkdir /test mkdir /test/lower /test/upper /test/work /test/mnt
  yes '' | mount -t davfs -o ro http://some-web-dav-server/path \
    /test/lower
  mount -t overlay -o upperdir=/test/upper,lowerdir=/test/lower \
    -o workdir=/test/work overlay /test/mnt

  # when "some-file" exists in the lowerdir, this fails with "Function
  # not implemented", with dmesg showing "overlayfs: failed to retrieve
  # lower fileattr (/some-file, err=-38)"
  touch /test/mnt/some-file

The underlying cause of this regresion is actually in FUSE, which fails to
translate the ENOSYS error code returned by userspace filesystem (which
means that the ioctl operation is not supported) to ENOTTY.

Reported-by: Christian Kohlschütter <christian@kohlschutter.com>
Fixes: 36cfe446576b ("ovl: copy up sync/noatime fileattr flags")
Fixes: 3a2ea24ef112 ("fuse: implement ioctl support")
Cc: <stable@vger.kernel.org>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/fuse/ioctl.c