OpenCloudOS-Kernel/fs/overlayfs
Amir Goldstein d15951198e ovl: check for emptiness of redirect dir
Before introducing redirect_dir feature, the condition
!ovl_lower_positive(dentry) for a directory, implied that it is a pure
upper directory, which may be removed if empty.

Now that directory can be redirect, it is possible that upper does not
cover any lower (i.e. !ovl_lower_positive(dentry)), but the directory is a
merge (with redirected path) and maybe non empty.

Check for this case in ovl_remove_upper().

This change fixes the following test case from rename-pop-dir.py
of unionmount-testsuite:

    """Remove dir and rename old name"""
    d = ctx.non_empty_dir()
    d2 = ctx.no_dir()

    ctx.rmdir(d, err=ENOTEMPTY)
    ctx.rename(d, d2)
    ctx.rmdir(d, err=ENOENT)
    ctx.rmdir(d2, err=ENOTEMPTY)

./run --ov rename-pop-dir
/mnt/a/no_dir103: Expected error (Directory not empty) was not produced

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
2016-12-16 11:02:57 +01:00
..
Kconfig ovl: rename filesystem type to "overlay" 2014-11-20 16:39:59 +01:00
Makefile ovl: split super.c 2016-12-16 11:02:56 +01:00
copy_up.c ovl: redirect on rename-dir 2016-12-16 11:02:56 +01:00
dir.c ovl: check for emptiness of redirect dir 2016-12-16 11:02:57 +01:00
inode.c ovl: treat special files like a regular fs 2016-12-16 11:02:55 +01:00
namei.c ovl: lookup redirects 2016-12-16 11:02:56 +01:00
overlayfs.h ovl: redirect on rename-dir 2016-12-16 11:02:56 +01:00
ovl_entry.h ovl: redirect on rename-dir 2016-12-16 11:02:56 +01:00
readdir.c ovl: proper cleanup of workdir 2016-09-01 11:11:59 +02:00
super.c ovl: redirect on rename-dir 2016-12-16 11:02:56 +01:00
util.c ovl: redirect on rename-dir 2016-12-16 11:02:56 +01:00