Skip to content

Commit

Permalink
ovl: Do d_type check only if work dir creation was successful
Browse files Browse the repository at this point in the history
commit 2176519 upstream.

d_type check requires successful creation of workdir as iterates
through work dir and expects work dir to be present in it. If that's
not the case, this check will always return d_type not supported even
if underlying filesystem might be supporting it.

So don't do this check if work dir creation failed in previous step.

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>
  • Loading branch information
Vivek Goyal authored and Greg Kroah-Hartman committed Aug 28, 2018
1 parent d5e6789 commit 0f9a6d8
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions fs/overlayfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -1058,16 +1058,19 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
/*
* Upper should support d_type, else whiteouts are visible.
* Given workdir and upper are on same fs, we can do
* iterate_dir() on workdir.
* iterate_dir() on workdir. This check requires successful
* creation of workdir in previous step.
*/
err = ovl_check_d_type_supported(&workpath);
if (err < 0)
goto out_put_workdir;
if (ufs->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;
if (!err) {
pr_err("overlayfs: upper fs needs to support d_type.\n");
err = -EINVAL;
goto out_put_workdir;
}
}
}

Expand Down

0 comments on commit 0f9a6d8

Please sign in to comment.