linux-unionfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Christian Kohlschütter" <christian@kohlschutter.com>
To: Miklos Szeredi <miklos@szeredi.hu>, linux-unionfs@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] ovl: Handle ENOSYS when fileattr support is missing in lower/upper fs
Date: Mon, 4 Jul 2022 20:36:24 +0200	[thread overview]
Message-ID: <4B9D76D5-C794-4A49-A76F-3D4C10385EE0@kohlschutter.com> (raw)

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

This bug is related to a regression in v5.15 that was partially fixed in
v5.16.

This patch also adds checks for ENOSYS in case the upper file system
does not support file attributes. That change is related to a partial
fix in v5.17.

Reported-by: Christian Kohlschütter <christian@kohlschutter.com>
Fixes: 5b0a414d06c ("ovl: fix filattr copy-up failure")
Fixes: 24d7f48c723 ("ovl: don't fail copy up if no fileattr support on upper")
Cc: <stable@vger.kernel.org> # v5.15
Signed-off-by: Christian Kohlschütter <christian@kohlschutter.com>
---
 fs/overlayfs/copy_up.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
index 714ec569d25b..0ad88573e77a 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -142,7 +142,7 @@ static int ovl_copy_fileattr(struct inode *inode, struct path *old,
 	err = ovl_real_fileattr_get(old, &oldfa);
 	if (err) {
 		/* Ntfs-3g returns -EINVAL for "no fileattr support" */
-		if (err == -ENOTTY || err == -EINVAL)
+		if (err == -ENOTTY || err == -EINVAL || err == -ENOSYS)
 			return 0;
 		pr_warn("failed to retrieve lower fileattr (%pd2, err=%i)\n",
 			old->dentry, err);
@@ -173,7 +173,7 @@ static int ovl_copy_fileattr(struct inode *inode, struct path *old,
 		 * Returning an error if upper doesn't support fileattr will
 		 * result in a regression, so revert to the old behavior.
 		 */
-		if (err == -ENOTTY || err == -EINVAL) {
+		if (err == -ENOTTY || err == -EINVAL || err == -ENOSYS) {
 			pr_warn_once("copying fileattr: no support on upper\n");
 			return 0;
 		}
-- 
2.36.1



             reply	other threads:[~2022-07-04 18:36 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-04 18:36 Christian Kohlschütter [this message]
2022-07-18  9:14 ` [PATCH] ovl: Handle ENOSYS when fileattr support is missing in lower/upper fs Miklos Szeredi
2022-07-18 10:10   ` Christian Kohlschütter
2022-07-18 10:31     ` Miklos Szeredi
2022-07-18 10:56       ` Christian Kohlschütter
2022-07-18 12:21         ` Miklos Szeredi
2022-07-18 13:03           ` [PATCH] [REGRESSION] " Christian Kohlschütter
2022-07-18 13:13             ` Miklos Szeredi
2022-07-18 14:25               ` Christian Kohlschütter
2022-07-18 15:02                 ` Antonio SJ Musumeci
2022-07-18 17:23                 ` Miklos Szeredi
2022-07-18 18:29               ` Linus Torvalds
2022-07-18 19:04                 ` Christian Kohlschütter
2022-07-18 19:17                   ` Linus Torvalds
2022-07-18 19:27                     ` Miklos Szeredi
2022-07-18 20:12                       ` Linus Torvalds
2022-07-18 20:33                         ` Christian Kohlschütter
2023-01-18  3:41                           ` Jonathan Katz
2023-01-26 13:26                             ` Miklos Szeredi
2023-01-30 19:27                               ` Jonathan Katz
2023-02-23 23:11                                 ` Jonathan Katz
2023-03-07  1:12                                   ` Jonathan Katz
2023-03-07  8:38                                     ` Miklos Szeredi
2023-03-07 17:14                                       ` Jonathan Katz
2023-03-09 15:31                                         ` Miklos Szeredi
2023-03-15  2:43                                           ` Jonathan Katz
2023-03-22 18:42                                             ` Jonathan Katz
2023-04-21 14:26                                               ` Miklos Szeredi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B9D76D5-C794-4A49-A76F-3D4C10385EE0@kohlschutter.com \
    --to=christian@kohlschutter.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).