#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2017 Red Hat Inc. All Rights Reserved.
+#
# FS QA Test 029
#
# There are dirs/files in lower dir and upper dir before
# This reproducer was originally written by
# Miklos Szeredi <mszeredi@redhat.com>
#
-#-----------------------------------------------------------------------
-# Copyright (c) 2017 Red Hat Inc. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-#-----------------------------------------------------------------------
-#
-
seq=`basename $0`
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
cat $tmp/mnt/foo
$UMOUNT_PROG $tmp/mnt
+# re-create upper/work to avoid ovl_verify_origin() mount failure
+# when index is enabled
+rm -rf $tmp/{upper,work}
+mkdir -p $tmp/{upper,work}
# mount overlay again using lower dir from SCRATCH_MNT dir
_overlay_mount_dirs $SCRATCH_MNT/low $tmp/{upper,work} \
overlay $tmp/mnt
cat $tmp/mnt/bar
$UMOUNT_PROG $tmp/mnt
+rm -rf $tmp/{upper,work}
+mkdir -p $tmp/{upper,work}
# mount overlay again using SCRATCH_MNT dir
_overlay_mount_dirs $SCRATCH_MNT/ $tmp/{upper,work} \
overlay $tmp/mnt