ovl: Ensure upper filesystem supports d_type
authorVivek Goyal <vgoyal@redhat.com>
Mon, 22 Feb 2016 14:28:34 +0000 (09:28 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 28 Aug 2018 05:23:43 +0000 (07:23 +0200)
commitd5e678942de33a5d8545a8b7c825eb93b57be1a9
tree79694b099ea1661cfed948ade6659ba56c867a49
parentf9866720724db8a163cf305fc907cdab0b38fa09
ovl: Ensure upper filesystem supports d_type

commit 45aebeaf4f67468f76bedf62923a576a519a9b68 upstream.

In some instances xfs has been created with ftype=0 and there if a file
on lower fs is removed, overlay leaves a whiteout in upper fs but that
whiteout does not get filtered out and is visible to overlayfs users.

And reason it does not get filtered out because upper filesystem does
not report file type of whiteout as DT_CHR during iterate_dir().

So it seems to be a requirement that upper filesystem support d_type for
overlayfs to work properly. Do this check during mount and fail if d_type
is not supported.

Suggested-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: SZ Lin (林上智) <sz.lin@moxa.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/overlayfs/overlayfs.h
fs/overlayfs/readdir.c
fs/overlayfs/super.c