]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ovl: Do d_type check only if work dir creation was successful
authorVivek Goyal <vgoyal@redhat.com>
Fri, 20 May 2016 13:04:26 +0000 (09:04 -0400)
committerChuck Anderson <chuck.anderson@oracle.com>
Thu, 18 May 2017 04:22:48 +0000 (21:22 -0700)
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>
(cherry picked from commit 21765194cecf2e4514ad75244df459f188140a0f)
Signed-off-by: Divya Indi <divya.indi@oracle.com>
Orabug: 25802620

fs/overlayfs/super.c

index 41a09c3a5862b8540c5ecc69fbbef807bd4461a4..656340a22c602b74907a3cfce9314708dfc601b2 100644 (file)
@@ -940,16 +940,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 (!err) {
-                       pr_err("overlayfs: upper fs needs to support d_type.\n");
-                       err = -EINVAL;
-                       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;
+                       }
                }
        }