native overlay uses user.overlay to store the overlay metadata instead
of trusted.overlay, let's honor it as well.
Closes: https://github.com/containers/fuse-overlayfs/issues/328
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
fix the check for FUSE_CAP_POSIX_ACL. commit
0a659e75ef61456bda1fa4b0b30117296f66f4fe introduced the issue.
It is needed to run fuse-overlayfs on RHEL 7 kernels.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
If a dir is opaque, there's no need to create a whiteout within it as
the opacity will block out any files from lower dirs already anyways.
The kernel's overlay implementation also doesn't currently handle
whiteouts in opaque dirs very well (the whiteout shows up in readdir
calls but can't be stat'd), so this fix also improves compatibility
between fuse-overlay and the kernel's overlay a bit too.
Signed-off-by: Erik Sipsma <erik@sipsma.dev>
Fix an invalid access when filtering internal xattrs.
The size passed to memmove was longer than the remaining bytes to
process.
As part of the fix: move the filtering logic to a separate function.
Closes: https://github.com/containers/fuse-overlayfs/issues/293
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
It was reported by static analysis. The resource is not really leaked
since fuse-overlayfs exits immediately when load_default_plugins()
fails.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
move the logic for loading the directory content at readdir time when
the offset is set to 0, so that any new file to the directory is
propagated.
Closes: https://github.com/containers/fuse-overlayfs/issues/287
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
FUSE never passes FUSE_SET_ATTR_ATIME_NOW without also passing
FUSE_SET_ATTR_ATIME. Since FUSE_SET_ATTR_ATIME_NOW was only checked if
FUSE_SET_ATTR_ATIME was not set, it would never be triggered.
Note that this is an *improvement*, not a *fix*, because FUSE always
passes the current time in st_atim whenever it sets
FUSE_SET_ATTR_ATIME_NOW. As a result, the previous code works properly,
but it does so differently from the way it was intended to.
(All of the above descriptions of st_atim handling also applies to
st_mtim.)
As specified in utimensat(2), *tv_nsec*, not *tv_sec*, should be set to
UTIME_NOW or UTIME_OMIT.
The way this bug manifests is that if utimensat() is called with
one of the timestamps set to UTIME_OMIT, fuse-overlayfs will
accidentally reset the timestamp to 1073741822, which is 2004-01-10
13:37:02 UTC.
Skips calculation of st_nlink for directories, which can be
expensive on higher latency file systems such as NFS.
Signed-off-by: David Hedberg <david.hedberg@gmail.com>
if a whiteout was created as part of a rename operation, mark the
directory content as not loaded so to avoid some optimizations when a
whiteout file must be deleted.
Closes: https://github.com/containers/fuse-overlayfs/issues/279
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
when device whiteouts are created (supported for unprivileged users in
newer Linux kernels) make sure the RENAME_NOREPLACE flag is dropped
when renaming the file on top of an existing whiteout.
Closes: https://github.com/containers/fuse-overlayfs/issues/273
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
on newer kernels unprivileged users can create whiteout devices. If
the whiteout device creation failed with EEXIST, check whether the
existing file is already a whiteout.
Closes: https://github.com/containers/fuse-overlayfs/issues/271
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
if we are adding a new file to a directory, the parent directory must
be invalidated if it is in the middle of a opendir/releasedir
otherwise the added files won't be cached.
Closes: https://github.com/containers/fuse-overlayfs/issues/259
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
if a file is delete and not accessible from the file system, but it is
still referenced, we must be able to open and use it.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
upstream Linux added an option "volatile" for overlay mounts that has
the same meaning as fsync=0 already supported by fuse-overlayfs.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
make sure the inodes are created with mode 0755 when using
xattr_permissions, otherwise the original permission could prevent
running on NFS. Requires Linux 5.9 for NFS with xattr support.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
if the reference held by the directory is the last one, it would miss
to clean up the inode. Fix it by calling do_forget.
Closes: https://github.com/containers/fuse-overlayfs/issues/238
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>