diff options
author | Vivek Goyal <vgoyal@redhat.com> | 2016-05-20 09:04:26 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-08-28 07:23:43 +0200 |
commit | 0f9a6d88cd9f3b16a86639bd652202fe27096b18 (patch) | |
tree | d702450dde970540707d3f776db911185ca85fc3 | |
parent | d5e678942de33a5d8545a8b7c825eb93b57be1a9 (diff) | |
download | linux-stable-0f9a6d88cd9f3b16a86639bd652202fe27096b18.tar.gz linux-stable-0f9a6d88cd9f3b16a86639bd652202fe27096b18.tar.bz2 linux-stable-0f9a6d88cd9f3b16a86639bd652202fe27096b18.zip |
ovl: Do d_type check only if work dir creation was successful
commit 21765194cecf2e4514ad75244df459f188140a0f 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>
-rw-r--r-- | fs/overlayfs/super.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 2de4e3a7d6e7..fd21c5f74fba 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -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; + } } } |