lkml.org 
[lkml]   [2022]   [Jul]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH] ovl: Handle ENOSYS when fileattr support is missing in lower/upper fs
    Date
    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

    \
     
     \ /
      Last update: 2022-07-04 20:37    [W:6.525 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site