diff options
author | Vivek Goyal <vgoyal@redhat.com> | 2016-02-22 09:28:34 -0500 |
---|---|---|
committer | Miklos Szeredi <miklos@szeredi.hu> | 2016-03-21 17:31:45 +0100 |
commit | 45aebeaf4f67468f76bedf62923a576a519a9b68 (patch) | |
tree | ae92aff7e8351c838975e1401bf510bece7fa09b /fs/overlayfs/super.c | |
parent | fb5bb2c3b73df060d588b6521de5ab03589283f7 (diff) | |
download | lwn-45aebeaf4f67468f76bedf62923a576a519a9b68.tar.gz lwn-45aebeaf4f67468f76bedf62923a576a519a9b68.zip |
ovl: Ensure upper filesystem supports d_type
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>
Diffstat (limited to 'fs/overlayfs/super.c')
-rw-r--r-- | fs/overlayfs/super.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 6b0111ae2ceb..ef64984c9bbc 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -1029,6 +1029,21 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) sb->s_flags |= MS_RDONLY; ufs->workdir = NULL; } + + /* + * Upper should support d_type, else whiteouts are visible. + * Given workdir and upper are on same fs, we can do + * iterate_dir() on workdir. + */ + err = ovl_check_d_type_supported(&workpath); + if (err < 0) + goto out_put_workdir; + + if (!err) { + pr_err("overlayfs: upper fs needs to support d_type.\n"); + err = -EINVAL; + goto out_put_workdir; + } } err = -ENOMEM; |