ovl: don't remove non-empty opaque directory
ovl: don't remove non-empty opaque directory

When removing an opaque directory we can't just call rmdir() to check for
emptiness, because the directory will need to be replaced with a whiteout.
The replacement is done with RENAME_EXCHANGE, which doesn't check
emptiness.

Solution is just to check emptiness by reading the directory.  In the
future we could add a new rename flag to check for emptiness even for
RENAME_EXCHANGE to optimize this case.

Reported-by: Vincent Batts <d01a4772f0cffd3f005a7d7f01c59cd104c7a5fe@gmail.com>
Signed-off-by: Miklos Szeredi <84cd5483a2f9acd1c37251cba7c2908448f221b8@suse.cz>
Tested-by: Jordi Pujol Palomer <01e8ccbc8b413d501cb0ad8e7b39f33dde49632e@gmail.com>
Fixes: 263b4a0fee43 ("ovl: dont replace opaque dir")
Cc: <4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@vger.kernel.org> # v4.0+

KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs