25 Aug, 2022

1 commit

  • [ Upstream commit b10b85fe5149ee8b39fbbf86095b303632dde2cd ]

    When mounting overlayfs in an unprivileged user namespace, trusted xattr
    creation will fail. This will lead to failures in some file operations,
    e.g. in the following situation:

    mkdir lower upper work merged
    mkdir lower/directory
    mount -toverlay -olowerdir=lower,upperdir=upper,workdir=work none merged
    rmdir merged/directory
    mkdir merged/directory

    The last mkdir will fail:

    mkdir: cannot create directory 'merged/directory': Input/output error

    The cause for these failures is currently extremely non-obvious and hard to
    debug. Hence, warn the user and suggest using the userxattr mount option,
    if it is not already supplied and xattr creation fails during the
    self-check.

    Reported-by: Alois Wohlschlager
    Signed-off-by: Miklos Szeredi
    Signed-off-by: Sasha Levin

    Miklos Szeredi
     

17 Aug, 2022

1 commit

  • commit dd524b7f317de8d31d638cbfdc7be4cf9b770e42 upstream.

    Some code paths cannot guarantee the inode have any dentry alias. So
    WARN_ON() all !dentry may flood the kernel logs.

    For example, when an overlayfs inode is watched by inotifywait (1), and
    someone is trying to read the /proc/$(pidof inotifywait)/fdinfo/INOTIFY_FD,
    at that time if the dentry has been reclaimed by kernel (such as
    echo 2 > /proc/sys/vm/drop_caches), there will be a WARN_ON(). The
    printed call stack would be like:

    ? show_mark_fhandle+0xf0/0xf0
    show_mark_fhandle+0x4a/0xf0
    ? show_mark_fhandle+0xf0/0xf0
    ? seq_vprintf+0x30/0x50
    ? seq_printf+0x53/0x70
    ? show_mark_fhandle+0xf0/0xf0
    inotify_fdinfo+0x70/0x90
    show_fdinfo.isra.4+0x53/0x70
    seq_show+0x130/0x170
    seq_read+0x153/0x440
    vfs_read+0x94/0x150
    ksys_read+0x5f/0xe0
    do_syscall_64+0x59/0x1e0
    entry_SYSCALL_64_after_hwframe+0x44/0xa9

    So let's drop WARN_ON() to avoid kernel log flooding.

    Reported-by: Hongbo Yin
    Signed-off-by: Jiachen Zhang
    Signed-off-by: Tianci Zhang
    Fixes: 8ed5eec9d6c4 ("ovl: encode pure upper file handles")
    Cc: # v4.16
    Signed-off-by: Miklos Szeredi
    Signed-off-by: Greg Kroah-Hartman

    Jiachen Zhang
     

02 Jul, 2022

1 commit

  • commit bb49e9e730c2906a958eee273a7819f401543d6c upstream.

    Multiple places open-code the same check to determine whether a given
    mount is idmapped. Introduce a simple helper function that can be used
    instead. This allows us to get rid of the fragile open-coding. We will
    later change the check that is used to determine whether a given mount
    is idmapped. Introducing a helper allows us to do this in a single
    place instead of doing it for multiple places.

    Link: https://lore.kernel.org/r/20211123114227.3124056-2-brauner@kernel.org (v1)
    Link: https://lore.kernel.org/r/20211130121032.3753852-2-brauner@kernel.org (v2)
    Link: https://lore.kernel.org/r/20211203111707.3901969-2-brauner@kernel.org
    Cc: Seth Forshee
    Cc: Christoph Hellwig
    Cc: Al Viro
    CC: linux-fsdevel@vger.kernel.org
    Reviewed-by: Amir Goldstein
    Reviewed-by: Seth Forshee
    Signed-off-by: Christian Brauner
    Signed-off-by: Christian Brauner (Microsoft)
    Signed-off-by: Greg Kroah-Hartman

    Christian Brauner
     

05 Feb, 2022

2 commits

  • commit 4ee7e4a6c9b298da44029ed9ec8ed23ae49cc209 upstream.

    This patch is fixing a NULL pointer dereference to get a recently
    introduced warning message working.

    Fixes: 5b0a414d06c3 ("ovl: fix filattr copy-up failure")
    Signed-off-by: Christoph Fritz
    Cc: # v5.15
    Signed-off-by: Miklos Szeredi
    Signed-off-by: Greg Kroah-Hartman

    Christoph Fritz
     
  • commit 94fd19752b28aa66c98e7991734af91dfc529f8f upstream.

    Christoph Fritz is reporting that failure to copy up fileattr when upper
    doesn't support fileattr or xattr results in a regression.

    Return success in these failure cases; this reverts overlayfs to the old
    behavior.

    Add a pr_warn_once() in these cases to still let the user know about the
    copy up failures.

    Reported-by: Christoph Fritz
    Fixes: 72db82115d2b ("ovl: copy up sync/noatime fileattr flags")
    Cc: # v5.15
    Signed-off-by: Miklos Szeredi
    Signed-off-by: Greg Kroah-Hartman

    Miklos Szeredi
     

22 Dec, 2021

1 commit

  • commit 1f5573cfe7a7056e80a92c7a037a3e69f3a13d1c upstream.

    Syzbot triggered the following warning in ovl_workdir_create() ->
    ovl_create_real():

    if (!err && WARN_ON(!newdentry->d_inode)) {

    The reason is that the cgroup2 filesystem returns from mkdir without
    instantiating the new dentry.

    Weird filesystems such as this will be rejected by overlayfs at a later
    stage during setup, but to prevent such a warning, call ovl_mkdir_real()
    directly from ovl_workdir_create() and reject this case early.

    Reported-and-tested-by: syzbot+75eab84fd0af9e8bf66b@syzkaller.appspotmail.com
    Signed-off-by: Miklos Szeredi
    Signed-off-by: Greg Kroah-Hartman

    Miklos Szeredi
     

19 Nov, 2021

2 commits

  • commit 5b0a414d06c3ed2097e32ef7944a4abb644b89bd upstream.

    This regression can be reproduced with ntfs-3g and overlayfs:

    mkdir lower upper work overlay
    dd if=/dev/zero of=ntfs.raw bs=1M count=2
    mkntfs -F ntfs.raw
    mount ntfs.raw lower
    touch lower/file.txt
    mount -t overlay -o lowerdir=lower,upperdir=upper,workdir=work - overlay
    mv overlay/file.txt overlay/file2.txt

    mv fails and (misleadingly) prints

    mv: cannot move 'overlay/file.txt' to a subdirectory of itself, 'overlay/file2.txt'

    The reason is that ovl_copy_fileattr() is triggered due to S_NOATIME being
    set on all inodes (by fuse) regardless of fileattr.

    ovl_copy_fileattr() tries to retrieve file attributes from lower file, but
    that fails because filesystem does not support this ioctl (this should fail
    with ENOTTY, but ntfs-3g return EINVAL instead). This failure is
    propagated to origial operation (in this case rename) that triggered the
    copy-up.

    The fix is to ignore ENOTTY and EINVAL errors from fileattr_get() in copy
    up. This also requires turning the internal ENOIOCTLCMD into ENOTTY.

    As a further measure to prevent unnecessary failures, only try the
    fileattr_get/set on upper if there are any flags to copy up.

    Side note: a number of filesystems set S_NOATIME (and sometimes other inode
    flags) irrespective of fileattr flags. This causes unnecessary calls
    during copy up, which might lead to a performance issue, especially if
    latency is high. To fix this, the kernel would need to differentiate
    between the two cases. E.g. introduce SB_NOATIME_UPDATE, a per-sb variant
    of S_NOATIME. SB_NOATIME doesn't work, because that's interpreted as
    "filesystem doesn't store an atime attribute"

    Reported-and-tested-by: Kevin Locke
    Fixes: 72db82115d2b ("ovl: copy up sync/noatime fileattr flags")
    Cc: # v5.15
    Signed-off-by: Miklos Szeredi
    Signed-off-by: Greg Kroah-Hartman

    Miklos Szeredi
     
  • commit 9a254403760041528bc8f69fe2f5e1ef86950991 upstream.

    Example for triggering use after free in a overlay on ext4 setup:

    aio_read
    ovl_read_iter
    vfs_iter_read
    ext4_file_read_iter
    ext4_dio_read_iter
    iomap_dio_rw -> -EIOCBQUEUED
    /*
    * Here IO is completed in a separate thread,
    * ovl_aio_cleanup_handler() frees aio_req which has iocb embedded
    */
    file_accessed(iocb->ki_filp); /**BOOM**/

    Fix by introducing a refcount in ovl_aio_req similarly to aio_kiocb. This
    guarantees that iocb is only freed after vfs_read/write_iter() returns on
    underlying fs.

    Fixes: 2406a307ac7d ("ovl: implement async IO routines")
    Signed-off-by: yangerkun
    Link: https://lore.kernel.org/r/20210930032228.3199690-3-yangerkun@huawei.com/
    Cc: # v5.6
    Signed-off-by: Miklos Szeredi
    Signed-off-by: Greg Kroah-Hartman

    yangerkun
     

28 Sep, 2021

1 commit

  • Normally the check at open time suffices, but e.g loop device does set
    IOCB_DIRECT after doing its own checks (which are not sufficent for
    overlayfs).

    Make sure we don't call the underlying filesystem read/write method with
    the IOCB_DIRECT if it's not supported.

    Reported-by: Huang Jianan
    Fixes: 16914e6fc7e1 ("ovl: add ovl_read_iter()")
    Cc: # v4.19
    Tested-by: Huang Jianan
    Signed-off-by: Miklos Szeredi

    Miklos Szeredi
     

25 Sep, 2021

1 commit

  • The following reproducer

    mkdir lower upper work merge
    touch lower/old
    touch lower/new
    mount -t overlay overlay -olowerdir=lower,upperdir=upper,workdir=work merge
    rm merge/new
    mv merge/old merge/new & unlink upper/new

    may result in this race:

    PROCESS A:
    rename("merge/old", "merge/new");
    overwrite=true,ovl_lower_positive(old)=true,
    ovl_dentry_is_whiteout(new)=true -> flags |= RENAME_EXCHANGE

    PROCESS B:
    unlink("upper/new");

    PROCESS A:
    lookup newdentry in new_upperdir
    call vfs_rename() with negative newdentry and RENAME_EXCHANGE

    Fix by adding the missing check for negative newdentry.

    Signed-off-by: Zheng Liang
    Fixes: e9be9d5e76e3 ("overlay filesystem")
    Cc: # v3.18
    Signed-off-by: Miklos Szeredi

    Zheng Liang
     

19 Aug, 2021

2 commits

  • Overlayfs does not cache ACL's (to avoid double caching). Instead it just
    calls the underlying filesystem's i_op->get_acl(), which will return the
    cached value, if possible.

    In rcu path walk, however, get_cached_acl_rcu() is employed to get the
    value from the cache, which will fail on overlayfs resulting in dropping
    out of rcu walk mode. This can result in a big performance hit in certain
    situations.

    Fix by calling ->get_acl() with rcu=true in case of ACL_DONT_CACHE (which
    indicates pass-through)

    Reported-by: garyhuang
    Signed-off-by: Miklos Szeredi

    Miklos Szeredi
     
  • Add a rcu argument to the ->get_acl() callback to allow
    get_cached_acl_rcu() to call the ->get_acl() method in the next patch.

    Signed-off-by: Miklos Szeredi

    Miklos Szeredi
     

17 Aug, 2021

11 commits

  • If function ovl_instantiate() returns an error, ovl_cleanup will be called
    and try to remove newdentry from wdir, but the newdentry has been moved to
    udir at this time. This will causes BUG_ON(victim->d_parent->d_inode !=
    dir) in fs/namei.c:may_delete.

    Signed-off-by: chenying
    Fixes: 01b39dcc9568 ("ovl: use inode_insert5() to hash a newly created inode")
    Link: https://lore.kernel.org/linux-unionfs/e6496a94-a161-dc04-c38a-d2544633acb4@bytedance.com/
    Cc: # v4.18
    Signed-off-by: Miklos Szeredi

    chenying
     
  • Extended attributes are usually small, but could be up to 64k in size, so
    use the most efficient method for doing the allocation.

    Signed-off-by: Miklos Szeredi

    Miklos Szeredi
     
  • Currently we keep size, mode and times of overlay inode
    as the same as upper inode, so should update ctime when
    changing file attribution as well.

    Signed-off-by: Chengguang Xu
    Signed-off-by: Miklos Szeredi

    Chengguang Xu
     
  • It is possible that a directory tree is shared between multiple overlay
    instances as a lower layer. In this case when one instance executes a file
    residing on the lower layer, the other instance denies a truncate(2) call
    on this file.

    This only happens for truncate(2) and not for open(2) with the O_TRUNC
    flag.

    Fix this interference and inconsistency by removing the preliminary
    i_writecount check before copy-up.

    This means that unlike on normal filesystems truncate(argv[0]) will now
    succeed. If this ever causes a regression in a real world use case this
    needs to be revisited.

    One way to fix this properly would be to keep a correct i_writecount in the
    overlay inode, but that is difficult due to memory mapping code only
    dealing with the real file/inode.

    Signed-off-by: Chengguang Xu
    Signed-off-by: Miklos Szeredi

    Chengguang Xu
     
  • We get occasional reports of lookup errors due to mismatched
    origin ftype from users that re-format a lower squashfs image.

    Commit 13c6ad0f45fd ("ovl: document lower modification caveats")
    tries to discourage the practice of re-formating lower layers and
    describes the expected behavior as undefined.

    Commit b0e0f69731cd ("ovl: restrict lower null uuid for "xino=auto"")
    limits the configurations in which origin file handles are followed.

    In addition to these measures, change the behavior in case of detecting
    a mismatch origin ftype in lookup to issue a warning, not follow origin,
    but not fail the lookup operation either.

    That should make overall more users happy without any big consequences.

    Link: https://lore.kernel.org/linux-unionfs/CAOQ4uxgPq9E9xxwU2CDyHy-_yCZZeymg+3n+-6AqkGGE1YtwvQ@mail.gmail.com/
    Signed-off-by: Amir Goldstein
    Signed-off-by: Miklos Szeredi

    Amir Goldstein
     
  • Enable optimizations only if user opted-in for any of extended features.
    If optimization is enabled, it breaks existing use case when a lower layer
    directory appears after directory was created on a merged layer. If
    overlay.opaque is applied, new files on lower layer are not visible.

    Consider the following scenario:
    - /lower and /upper are mounted to /merged
    - directory /merged/new-dir is created with a file test1
    - overlay is unmounted
    - directory /lower/new-dir is created with a file test2
    - overlay is mounted again

    If opaque is applied by default, file test2 is not going to be visible
    without explicitly clearing the overlay.opaque attribute

    Signed-off-by: Vyacheslav Yurkov
    Reviewed-by: Amir Goldstein
    Signed-off-by: Miklos Szeredi

    Vyacheslav Yurkov
     
  • Allows to check whether any of extended features are enabled

    Signed-off-by: Vyacheslav Yurkov
    Reviewed-by: Amir Goldstein
    Signed-off-by: Miklos Szeredi

    Vyacheslav Yurkov
     
  • Currently decoding origin with lower null uuid is not allowed unless user
    opted-in to one of the new features that require following the lower inode
    of non-dir upper (index, xino, metacopy). Now we add redirect_dir too to
    that feature list.

    Signed-off-by: Vyacheslav Yurkov
    Reviewed-by: Amir Goldstein
    Signed-off-by: Miklos Szeredi

    Vyacheslav Yurkov
     
  • When a lower file has immutable/append-only fileattr flags, the behavior of
    overlayfs post copy up is inconsistent.

    Immediattely after copy up, ovl inode still has the S_IMMUTABLE/S_APPEND
    inode flags copied from lower inode, so vfs code still treats the ovl inode
    as immutable/append-only. After ovl inode evict or mount cycle, the ovl
    inode does not have these inode flags anymore.

    We cannot copy up the immutable and append-only fileattr flags, because
    immutable/append-only inodes cannot be linked and because overlayfs will
    not be able to set overlay.* xattr on the upper inodes.

    Instead, if any of the fileattr flags of interest exist on the lower inode,
    we store them in overlay.protattr xattr on the upper inode and we read the
    flags from xattr on lookup and on fileattr_get().

    This gives consistent behavior post copy up regardless of inode eviction
    from cache.

    When user sets new fileattr flags, we update or remove the overlay.protattr
    xattr.

    Storing immutable/append-only fileattr flags in an xattr instead of upper
    fileattr also solves other non-standard behavior issues - overlayfs can now
    copy up children of "ovl-immutable" directories and lower aliases of
    "ovl-immutable" hardlinks.

    Reported-by: Chengguang Xu
    Link: https://lore.kernel.org/linux-unionfs/20201226104618.239739-1-cgxu519@mykernel.net/
    Link: https://lore.kernel.org/linux-unionfs/20210210190334.1212210-5-amir73il@gmail.com/
    Signed-off-by: Amir Goldstein
    Signed-off-by: Miklos Szeredi

    Amir Goldstein
     
  • When a lower file has sync/noatime fileattr flags, the behavior of
    overlayfs post copy up is inconsistent.

    Immediately after copy up, ovl inode still has the S_SYNC/S_NOATIME
    inode flags copied from lower inode, so vfs code still treats the ovl
    inode as sync/noatime. After ovl inode evict or mount cycle,
    the ovl inode does not have these inode flags anymore.

    To fix this inconsistency, try to copy the fileattr flags on copy up
    if the upper fs supports the fileattr_set() method.

    This gives consistent behavior post copy up regardless of inode eviction
    from cache.

    We cannot copy up the immutable/append-only inode flags in a similar
    manner, because immutable/append-only inodes cannot be linked and because
    overlayfs will not be able to set overlay.* xattr on the upper inodes.

    Those flags will be addressed by a followup patch.

    Signed-off-by: Amir Goldstein
    Signed-off-by: Miklos Szeredi

    Amir Goldstein
     
  • Instead of passing the overlay dentry.

    Signed-off-by: Amir Goldstein
    Signed-off-by: Miklos Szeredi

    Amir Goldstein
     

10 Aug, 2021

3 commits

  • One error path can result in release_dentry_name_snapshot() being called
    before "name" was initialized by take_dentry_name_snapshot().

    Fix by moving the release_dentry_name_snapshot() to immediately after the
    only use.

    Reported-by: Colin Ian King
    Signed-off-by: Miklos Szeredi

    Miklos Szeredi
     
  • There's possibility of an ABBA deadlock in case of a splice write to an
    overlayfs file and a concurrent splice write to a corresponding real file.

    The call chain for splice to an overlay file:

    -> do_splice [takes sb_writers on overlay file]
    -> do_splice_from
    -> iter_file_splice_write [takes pipe->mutex]
    -> vfs_iter_write
    ...
    -> ovl_write_iter [takes sb_writers on real file]

    And the call chain for splice to a real file:

    -> do_splice [takes sb_writers on real file]
    -> do_splice_from
    -> iter_file_splice_write [takes pipe->mutex]

    Syzbot successfully bisected this to commit 82a763e61e2b ("ovl: simplify
    file splice").

    Fix by reverting the write part of the above commit and by adding missing
    bits from ovl_write_iter() into ovl_splice_write().

    Fixes: 82a763e61e2b ("ovl: simplify file splice")
    Reported-and-tested-by: syzbot+579885d1a9a833336209@syzkaller.appspotmail.com
    Signed-off-by: Miklos Szeredi

    Miklos Szeredi
     
  • On the first getdents call, ovl_iterate() populates the readdir cache
    with a list of entries, but for upper entries with origin lower inode,
    p->ino remains zero.

    Following getdents calls traverse the readdir cache list and call
    ovl_cache_update_ino() for entries with zero p->ino to lookup the entry
    in the overlay and return d_ino that is consistent with st_ino.

    If the upper file was unlinked between the first getdents call and the
    getdents call that lists the file entry, ovl_cache_update_ino() will not
    find the entry and fall back to setting d_ino to the upper real st_ino,
    which is inconsistent with how this object was presented to users.

    Instead of listing a stale entry with inconsistent d_ino, simply skip
    the stale entry, which is better for users.

    xfstest overlay/077 is failing without this patch.

    Signed-off-by: Amir Goldstein
    Link: https://lore.kernel.org/fstests/CAOQ4uxgR_cLnC_vdU5=seP3fwqVkuZM_-WfD6maFTMbMYq=a9w@mail.gmail.com/
    Signed-off-by: Miklos Szeredi

    Amir Goldstein
     

01 May, 2021

1 commit

  • Pull overlayfs update from Miklos Szeredi:

    - Fix a regression introduced in 5.2 that resulted in valid overlayfs
    mounts being rejected with ELOOP (Too many levels of symbolic links)

    - Fix bugs found by various tools

    - Miscellaneous improvements and cleanups

    * tag 'ovl-update-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs:
    ovl: add debug print to ovl_do_getxattr()
    ovl: invalidate readdir cache on changes to dir with origin
    ovl: allow upperdir inside lowerdir
    ovl: show "userxattr" in the mount data
    ovl: trivial typo fixes in the file inode.c
    ovl: fix misspellings using codespell tool
    ovl: do not copy attr several times
    ovl: remove ovl_map_dev_ino() return value
    ovl: fix error for ovl_fill_super()
    ovl: fix missing revert_creds() on error path
    ovl: fix leaked dentry
    ovl: restrict lower null uuid for "xino=auto"
    ovl: check that upperdir path is not on a read-only mount
    ovl: plumb through flush method

    Linus Torvalds
     

28 Apr, 2021

2 commits

  • Pull fileattr conversion updates from Miklos Szeredi via Al Viro:
    "This splits the handling of FS_IOC_[GS]ETFLAGS from ->ioctl() into a
    separate method.

    The interface is reasonably uniform across the filesystems that
    support it and gives nice boilerplate removal"

    * 'miklos.fileattr' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (23 commits)
    ovl: remove unneeded ioctls
    fuse: convert to fileattr
    fuse: add internal open/release helpers
    fuse: unsigned open flags
    fuse: move ioctl to separate source file
    vfs: remove unused ioctl helpers
    ubifs: convert to fileattr
    reiserfs: convert to fileattr
    ocfs2: convert to fileattr
    nilfs2: convert to fileattr
    jfs: convert to fileattr
    hfsplus: convert to fileattr
    efivars: convert to fileattr
    xfs: convert to fileattr
    orangefs: convert to fileattr
    gfs2: convert to fileattr
    f2fs: convert to fileattr
    ext4: convert to fileattr
    ext2: convert to fileattr
    btrfs: convert to fileattr
    ...

    Linus Torvalds
     
  • Pull vfs inode type handling updates from Al Viro:
    "We should never change the type bits of ->i_mode or the method tables
    (->i_op and ->i_fop) of a live inode.

    Unfortunately, not all filesystems took care to prevent that"

    * 'work.inode-type-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    spufs: fix bogosity in S_ISGID handling
    9p: missing chunk of "fs/9p: Don't update file type when updating file attributes"
    openpromfs: don't do unlock_new_inode() until the new inode is set up
    hostfs_mknod(): don't bother with init_special_inode()
    cifs: have cifs_fattr_to_inode() refuse to change type on live inode
    cifs: have ->mkdir() handle race with another client sanely
    do_cifs_create(): don't set ->i_mode of something we had not created
    gfs2: be careful with inode refresh
    ocfs2_inode_lock_update(): make sure we don't change the type bits of i_mode
    orangefs_inode_is_stale(): i_mode type bits do *not* form a bitmap...
    vboxsf: don't allow to change the inode type
    afs: Fix updating of i_mode due to 3rd party change
    ceph: don't allow type or device number to change on non-I_NEW inodes
    ceph: fix up error handling with snapdirs
    new helper: inode_wrong_type()

    Linus Torvalds
     

24 Apr, 2021

1 commit

  • mmap_region() now calls fput() on the vma->vm_file.

    Fix this by using vma_set_file() so it doesn't need to be handled
    manually here any more.

    Link: https://lkml.kernel.org/r/20210421132012.82354-2-christian.koenig@amd.com
    Fixes: 1527f926fd04 ("mm: mmap: fix fput in error path v2")
    Signed-off-by: Christian König
    Reviewed-by: Daniel Vetter
    Cc: Jan Harkes
    Cc: Miklos Szeredi
    Cc: Jason Gunthorpe
    Cc: [5.11+]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christian König
     

12 Apr, 2021

10 commits

  • The FS_IOC_[GS]ETFLAGS/FS_IOC_FS[GS]ETXATTR ioctls are now handled via the
    fileattr api. The only unconverted filesystem remaining is CIFS and it is
    not allowed to be overlayed due to case insensitive filenames.

    Signed-off-by: Miklos Szeredi

    Miklos Szeredi
     
  • Add stacking for the fileattr operations.

    Add hack for calling security_file_ioctl() for now. Probably better to
    have a pair of specific hooks for these operations.

    Signed-off-by: Miklos Szeredi

    Miklos Szeredi
     
  • It was the only ovl_do helper missing it.

    Signed-off-by: Amir Goldstein
    Signed-off-by: Miklos Szeredi

    Amir Goldstein
     
  • The test in ovl_dentry_version_inc() was out-dated and did not include
    the case where readdir cache is used on a non-merge dir that has origin
    xattr, indicating that it may contain leftover whiteouts.

    To make the code more robust, use the same helper ovl_dir_is_real()
    to determine if readdir cache should be used and if readdir cache should
    be invalidated.

    Fixes: b79e05aaa166 ("ovl: no direct iteration for dir with origin xattr")
    Link: https://lore.kernel.org/linux-unionfs/CAOQ4uxht70nODhNHNwGFMSqDyOKLXOKrY0H6g849os4BQ7cokA@mail.gmail.com/
    Cc: Chris Murphy
    Signed-off-by: Amir Goldstein
    Signed-off-by: Miklos Szeredi

    Amir Goldstein
     
  • Commit 146d62e5a586 ("ovl: detect overlapping layers") made sure we don't
    have overlapping layers, but it also broke the arguably valid use case of

    mount -olowerdir=/,upperdir=/subdir,..

    where upperdir overlaps lowerdir on the same filesystem. This has been
    causing regressions.

    Revert the check, but only for the specific case where upperdir and/or
    workdir are subdirectories of lowerdir. Any other overlap (e.g. lowerdir
    is subdirectory of upperdir, etc) case is crazy, so leave the check in
    place for those.

    Overlaps are detected at lookup time too, so reverting the mount time check
    should be safe.

    Fixes: 146d62e5a586 ("ovl: detect overlapping layers")
    Cc: # v5.2
    Signed-off-by: Miklos Szeredi

    Miklos Szeredi
     
  • This was missed when adding the option.

    Signed-off-by: Giuseppe Scrivano
    Reviewed-by: Vivek Goyal
    Fixes: 2d2f2d7322ff ("ovl: user xattr")
    Signed-off-by: Miklos Szeredi

    Giuseppe Scrivano
     
  • s/peresistent/persistent/
    s/xatts/xattrs/
    s/annotaion/annotation/

    Signed-off-by: Bhaskar Chowdhury
    Signed-off-by: Miklos Szeredi

    Bhaskar Chowdhury
     
  • A typo is found out by codespell tool:

    $ codespell ./fs/overlayfs/
    ./fs/overlayfs/util.c:217: dependig ==> depending

    Fix a typo found by codespell.

    Signed-off-by: Xiong Zhenwu
    Signed-off-by: Miklos Szeredi

    Xiong Zhenwu
     
  • In ovl_xattr_set() we have already copied attr of real inode
    so no need to copy it again in ovl_posix_acl_xattr_set().

    Signed-off-by: Chengguang Xu
    Signed-off-by: Miklos Szeredi

    Chengguang Xu
     
  • ovl_map_dev_ino() always returns success. Remove unnecessary return value.

    Signed-off-by: youngjun
    Signed-off-by: Miklos Szeredi

    youngjun