]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
overlay: avoid to use NULL OVL_BASE_FSTYP for mounting
authorBaokun Li <libaokun1@huawei.com>
Thu, 29 Dec 2022 13:44:34 +0000 (21:44 +0800)
committerZorro Lang <zlang@kernel.org>
Sat, 14 Jan 2023 13:29:49 +0000 (21:29 +0800)
Generally, FSTYP is used to specify OVL_BASE_FSTYP. When we specify FSTYP
through an environment variable, it is not converted to OVL_BASE_FSTYP.
In addition, sometimes we do not even specify the file type. For example,
we only use `./check -n -overlay -g auto` to list overlay-related cases.
If OVL_BASE_FSTYP is NULL, mounting fails and the test fails.

To solve this problem, try to assign a value to OVL_BASE_FSTYP when
specifying -overlay. In addition, in the _overlay_base_mount function,
the basic file system type of the overlay is specified only when
OVL_BASE_FSTYP is not NULL.

Reported-by: Murphy Zhou <jencce.kernel@gmail.com>
Signed-off-by: Baokun Li <libaokun1@huawei.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
check
common/overlay

diff --git a/check b/check
index 1ff0f44af13cfcf9fe9913c8c7b6a76d2e13c3bd..22062935304cc0abd3458b2f3adcbe4219390abd 100755 (executable)
--- a/check
+++ b/check
@@ -283,6 +283,7 @@ while [ $# -gt 0 ]; do
                FSTYP="${1:1}"
                ;;
        -overlay)
+               [ "$FSTYP" == overlay ] || export OVL_BASE_FSTYP="$FSTYP"
                FSTYP=overlay
                export OVERLAY=true
                ;;
index e35419d0e0452a18e93a88dc5b255345a687e4ea..20cafeb157b1a50b80ec298dc80a2e1e1a37ff87 100644 (file)
@@ -85,7 +85,12 @@ _overlay_base_mount()
                return 1
        fi
 
-       _mount -t $OVL_BASE_FSTYP $* $dev $mnt
+       if [ $OVL_BASE_FSTYP ]; then
+               _mount -t $OVL_BASE_FSTYP $* $dev $mnt
+       else
+               _mount $* $dev $mnt
+       fi
+
        _idmapped_mount $dev $mnt
 }