Introduce a test which runs fsstress on the top and bottom overlayfs
directories simultaneously to find potential races that plagued
wrapfs derived file systems.
[eguan: add copyright info and fix minor code style issue]
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Introduce a new test to demonstrate a known issue with overlayfs:
- file A and B are hardlinked in lower
- modify A to trigger copy up
- file A is no longer a hardlink of file B
There is no fix for this issue at this time.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Tests 016 and 013 both test behavior of concurrent
file access during copy up (truncate+exec and read+write).
Associate those tests to the copyup group.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Introduce a new test to demonstrate a known issue with overlayfs:
- stat file A shows inode number X
- modify A to trigger copy up
- stat file A shows inode number Y != X
Also test if d_ino of readdir entries changes after copy up.
There is a POC patch by Miklos Szeredi that fixes this issue.
Not dealing with hardlinks here, because there is more to test
then stable inode number.
Hardlinks will get a test of their own.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
This test requires a fix to xfs_io to support
-C one shot commands and -c "open foo" command.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Introduce a new test to demonstrates a known issue with overlayfs:
- process A opens file F for read
- process B writes new data to file F
- process A reads old data from file F
This issue is about to be fixed with a patch set by Miklos Szeredi.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Commit 4d0c5ba (vfs: do get_write_access() on upper layer of overlayfs)
that was merged for kernel v4.8 changes the behavior of execve+truncate
in a subtle way.
When file is executed from lower and then truncated, the truncation is
allowed, becasue it only affects the size of the copied up file and does
not affect the VM mapping of the executed lower file.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
test_upper file was supposed to be in upper layer,
but it was wrongly created in lower layer.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Newly created files and dirs should inherit sgit bit from parent
dir, no matter the new files & dirs are created over whiteout or
not.
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
When copying up a directory with opaque xattr set, the xattr was
copied up as well, after a remount the opaque flag is honored so the
copied-up directory is treated as opaque, which causes files created
in the lowerdir to be hidden when using multiple lower directories.
This is fixed by "ovl: don't copy up opaqueness".
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Introduce a new _overlay_mount_dirs() helper to do the actual
overlay mount operation and factor _overlay_scratch_mount and
_overlay_mount code to use a single implemention of
_overlay_mount_dirs(). Also convert all bare mount of overlay in
tests to use it.
Suggested-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Test truncate running executable binaries from lower and upper dirs.
truncate(2) should return ETXTBSY, not other errno nor segfault
Commit 03bea6040932 ("ovl: get_write_access() in truncate") fixed
this issue.
Reviewed-by: Xiong Zhou <xzhou@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
The upper dentry may become stale before we remove it from overlay,
e.g. file was removed from upperdir directly, which triggered
warning/oops in ovl_remove_and_whiteout().
Commit cfc9fde0b07c ("ovl: verify upper dentry in
ovl_remove_and_whiteout()") fixed this issue.
Reviewed-by: Xiong Zhou <xzhou@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Test dump overlay private xattr on overlayfs with multiple lower
dirs. All the lower layers, except the lowest one, should honor
overlay private xattr "trusted.overlay", which means it should not
be visible to user.
Commit b581755b1c56 ("ovl: xattr filter fix") fixed this issue.
Reviewed-by: Xiong Zhou <xzhou@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
xfstests supports extended test names like 314-foo-bar, but
installation of these tests was skipped (not matching a regexp). So
this patch fixes the makefiles in tests/*/
The include/buildrules change was written by Dave Chinner.
Signed-off-by: Jan Tulak <jtulak@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Test the removal of a dir which contains whiteout from lower dir,
which could crash the kernel.
The following kernel commit fixed this issue
84889d4 ovl: check dentry positiveness in ovl_cleanup_whiteouts()
Reviewed-by: Xiong Zhou <xzhou@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
overlayfs was leaking dentry on non-directories when using the
'default_permissions' mount option, which resulted in "BUG Dentry
still in use".
The following kernel commit fixed it:
ovl: fix dentry leak for default_permissions
Reviewed-by: Xiong Zhou <xzhou@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Create file/dir over whiteout by another user, uid/gid of the
file/dir should be current fsuid/fsgid, not the mounter's.
This upstream kernel patch fixed the issue
d0e13f5 ovl: fix uid/gid when creating over whiteout
Reviewed-by: Xiong Zhou <xzhou@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Test getcwd() failure after unsuccessful rmdir, the getcwd() call
should return the correct path.
Upstream commit ce9113bbcbf4 ("ovl: fix getcwd() failure after
unsuccessful rmdir") fixed this issue.
Reviewed-by: Xiong Zhou <xzhou@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Test visible whiteout issue after renaming file from lowerdir to a
dir in upperdir.
Upstream commit 45d117389696 ("ovl: ignore lower entries when
checking purity of non-directory entries") fixed the issue
Reviewed-by: Xiong Zhou <xzhou@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Changing file attr in overlayfs triggers copy up.
Test this by changing mode bits then check both mode
bits and copy up results.
Signed-off-by: Xiong Zhou <xzhou@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Once a while, overlayfs whiteout can be visible if upper fs
does not support d_type(ftype/filetype). Test as a sanity
check on whiteout of regular files, links, dirs, devices
and pipes.
Signed-off-by: Xiong Zhou <xzhou@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
The supported fs was set to generic by mistake, so fix it by setting it
to the proper type 'overlay'.
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>