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>