overlay/029: fix test failure with nfs_export feature enabled
[xfstests-dev.git] / tests / overlay / 029
index 2ac674f02cda29bcf65c3ca7326362ca1b20a07b..17f58de77aded00db319210489db23ab0ef6b0fd 100755 (executable)
@@ -1,4 +1,7 @@
 #! /bin/bash
 #! /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
 # 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>
 #
 # 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"
 seq=`basename $0`
 seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
@@ -83,12 +68,18 @@ _overlay_mount_dirs $SCRATCH_MNT/up $tmp/{upper,work} \
 cat $tmp/mnt/foo
 $UMOUNT_PROG $tmp/mnt
 
 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
 
 # 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
 # mount overlay again using SCRATCH_MNT dir
 _overlay_mount_dirs $SCRATCH_MNT/ $tmp/{upper,work} \
   overlay $tmp/mnt