]> git.ipfire.org Git - thirdparty/kernel/linux.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)
commit02c0cab8e7345b06f1c0838df444e2902e4138d3
treee34389b147770de2b2881076ab7639434bca4e38
parent47912eaa061a6a81e4aa790591a1874c650733c0
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: 72db82115d2b ("ovl: copy up sync/noatime fileattr flags")
Fixes: 59efec7b9039 ("fuse: implement ioctl support")
Cc: <stable@vger.kernel.org>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/fuse/ioctl.c