Also test that d_ino of readdir entries and i_ino from /proc/locks are
consistent with st_ino and that inode numbers persist after rename to
new parent, drop caches and mount cycle.
With nested xino configuration, directory st_ino is not persistent and
its st_ino/d_ino/i_ino values are not consistent, so test only non-dir
in this test.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Also test that d_ino of readdir entries and i_ino from /proc/locks are
consistent with st_ino and that inode numbers persist after rename to
new parent, drop caches and mount cycle.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This is a variant of overlay file handles test for an overlayfs that
is nested over another lower overlayfs on non-samefs.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This is a variant of overlay file handles test for an overlayfs that
is nested over another lower overlayfs on the same fs.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Check that files from middle layer on same fs as upper layer
are not allowed to export the real inode st_dev;st_ino.
This is a regression test for kernel commit:
9c6d8f13e9da ("ovl: fix corner case of non-unique st_dev;st_ino")
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This is intensive copy-up test for sparse files, these cases will be
mainly used for regression test of copy-up improvement for sparse
files.
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
In late 2016, tests overlay/01[6-8] where merged to track the
state of several ilong standing posix compliance issues on overlayfs.
This practice was somewhat of an exception for xfstests project,
which more often merges tests for issues that are expected to be
resolved in the short term.
Over the years, some test cases have been fixed and more tests
where created to cover the remaining issues (e.g. overlay/04[34]).
Currently, the only failing test from this category is overlay/061
which covers item b) in the "Non-standard behavior" section of
Documentation/filesystems/overlayfs.txt.
Since there is no clear design, roadmap nor allocated resources
to resolve this remaining issue, the test is removed from the
"auto" and "quick" groups, following a suggestion that Darrick
has made for a similarly long failing generic test.
The test was added to the new "posix" group, to allow testing
for posix compliance.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Add tests for overlayfs mounts with:
- Same upperdir/lowerdir
- Overlapping upperdir/lowerdir
- Overlapping lowerdir layers
- Overlapping lowerdir with other mount upperdir/workdir
Add test for moving layer into another after mount.
Overlapping layers on mount or lookup results in ELOOP.
Overlapping lowerdir with other mount upperdir/workdir
result in EBUSY.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Make sure file capabilities are not lost over copy-up when file is
opened for WRITE but nothing is actually written to it.
Following commit introduced regression where if a lower file with
CAP_SETUID is opened for writing, and capability is cleared over copy up.
bd64e57586d3 ("ovl: During copy up, first copy up metadata and then data")
A later kernel patch will fix it. This test will help avoid introducing
such regressions again.
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
There's a bug in the overlayfs implementation starting from the very
first merged version that may cause an Oops of various forms if a
directory is created over a whiteout dentry, but the actual whiteout
on the upper layer was removed to the directory creation.
Reported by: kaixuxia <xiakaixu1987@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This test is for a regression that was introduced in kernel v4.17 by
commit 8b58924ad55c ("ovl: lookup in inode cache first when decoding
lower file handle").
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
overlay/016 tests two cases of ro/rw fd data inconsistecies -
one using pread and one using mmap read (i.e. mread).
The first case now passes with stacked overlay file operations
patch set merged. The second case will still fail.
By splitting the two test cases we get one regression test for
the common case of ro/rw fd data inconsistecy with pread and
one test to track the remaining non-standard behavior of
overlayfs w.r.t mmap.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Multiple origin references to the same lower file from upper files
that are not hardlinks will falsely return the same st_ino/st_dev
for two different overlay files and will cause 'diff' to falsely
report that content of files is the same when it is not.
This test checks that overlayfs detects and fails lookup of a
multiply referenced origin.
The check for multiply referenced origin was a by-product of kernel
commit 31747eda41ef ("ovl: hash directory inodes for fsnotify")
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
When opening a non-dir by file handle and the decoded inode/dentry
are not in cache, the resulting dentry is "disconnected" (i.e. unknown
path). This is a common case that is already covered by previous tests.
This test covers the case of decoding an overlay file handle, while a
disconnected dentry is still in cache.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Typically, when following absolute redirect, if an opauqe dentry is
found, lookup in further lower directories is stopped. But if a child
dentry has another absolute redirect, then lookup in further lower
layers should continue.
Say, following is example setup.
upper: /redirect (redirect=/a/b/c)
lower1: /a/[b]/c ([b] is opaque) (c has absolute redirect=/a/b/d/)
lower0: /a/b/d/foo
"redirect" directory in upper should merge with lower1:/a/b/c/ and
lower0:/a/b/d/, despite lower1:/a/b/ being opaque.
This example and kernel fix has come from Amir Goldstein. I am just
putting a test for it to make sure its not broken down the line.
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Tests were merged with high seq numbers to avoid conflicts with
other tests. Now renumber them to contiguous numbers, as all other
tests have been merged correctly. This is easier to do than
assigning the final seq numbers at commit time.
Signed-off-by: Eryu Guan <eguan@redhat.com>
Add fsck.overlay test case to test it how to deal with impure xattr
in underlying directories of overlayfs.
Signed-off-by: zhangyi (F) <yi.zhang@huawei.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Add fsck.overlay test case to test it how to deal with invalid/valid/
duplicate redirect xattr in underlying directories of overlayfs.
Signed-off-by: zhangyi (F) <yi.zhang@huawei.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Add fsck.overlay test case to test it how to deal with orphan/valid
whiteouts in underlying directories of overlayfs.
Signed-off-by: zhangyi (F) <yi.zhang@huawei.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Overlayfs with nfs_export enabled, indexes all directories on copy
up. Directory index is requires for decoding lower directory file
handles in case ancestors have been renamed.
When enabling nfs_export on an overlay that has merge dirs with
lower layer redirects, the possibility of ancestor rename requires
special handling when encoding lower directory file handles from
layer > 1.
- Check decode of lower dir with parent under lower redirect
- Check decode of lower dir with grandparent under lower redirect
- Check decode of lower dir after rename of lower redirected parent
- Check decode of lower dir after rename of lower redirected grandparent
This test requires and enables overlayfs NFS export support and
merge dir rename support (redirect_dir).
NFS export support depends on and requires overlayfs index feature.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Overlayfs with nfs_export enabled, indexes all directories on copy
up. Directory index is requires for decoding lower directory file
handles in case ancestors have been renamed.
When enabling nfs_export on an overlay that already has non-indexed
merge dirs, the possibility of non-indexed ancestor rename requires
special handling when encoding lower directory file handles.
- Check encode/decode/read file handles of non-indexed merge dir
- Check encode/decode/read file handles of dir with non-indexed parent
- Check encode/decode/read file handles of dir with non-indexed grandparent
- Check decode/read of file handles after rename of non-indexed merge dir
- Check decode/read of file handles after rename of non-indexed parent
- Check decode/read of file handles after rename of non-indexed grandparent
This test requires and enables overlayfs NFS export support and
merge dir rename support (redirect_dir).
NFS export support depends on and requires overlayfs index feature.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
This is a variant of overlay file handles with renames test for an
overlayfs that is composed of multiple lower layers not on the same
underlying fs.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
- Check decode/read of file handles after rename of parent
- Check decode/read of file handles after rename of grandparent
- Check decode/read of file handles after move to new parent
- Check encode/decode/read of file handles in non-upper overlay
This test requires and enables overlayfs NFS export support and merge
dir rename support (redirect_dir).
NFS export support depends on and requires overlayfs index feature.
This test covers only encode/decode of file handles for overlayfs
configuration of all layers on the same base fs.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>