Skip to contentSkip to conversation

testscripts/test_fs_bind.sh: adapt to system which marks mount point as "shared" defaultly

PATCH Superseded DAN LI 2 participants 3 messages Apr 9, 2013 – Apr 15, 2013

lore
Share & tools
lore

DAN LI

author
#0 lore raw

PATCH 1/1 testscripts/test_fs_bind.sh: adapt to system which marks mount point as "shared" defaultly

Linux kernel does not allow to move a mount residing under a shared mount.

This patch tries to make sure test cases of "move" run under a private mount.

---
 testscripts/test_fs_bind.sh | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)
testscripts/test_fs_bind.sh +19 -9
index 92c51a1..5817174 100755
@@ -107,6 +107,18 @@ test_prereqs()
 		exit -1
 	fi
 
+	mount --bind "${sandbox}" "${sandbox}" >& /dev/null
+	if [ $? -ne 0 ]; then
+		tst_brkm TBROK true "$0: failed to perform bind mount on directory \"${sandbox}\""
+	exit 1
+	fi
+
+	mount --make-private "${sandbox}" >& /dev/null
+	if [ $? -ne 0 ]; then
+		tst_brkm TBROK true "$0: failed to make private mountpoint on directory \"${sandbox}\""
+		exit 1
+	fi
+
 	local mnt_bind=1
 	local mnt_move=1
 
@@ -153,17 +165,11 @@ test_prereqs()
 		tst_resm TINFO "$0: kernel >= 2.6.15 detected -- continuing"
 	fi
 
-	mount --bind "${sandbox}" "${sandbox}" && {
-		mount --make-shared "${sandbox}" > /dev/null 2>&1 || "${FS_BIND_ROOT}/bin/smount" "${sandbox}" shared
-		umount "${sandbox}" || {
-			tst_resm TFAIL "$0: failed to umount simplest shared subtree"
-			exit 1
-		}
-	} || {
-		tst_brkm TBROK true "$0: failed to perform bind mount"
+	mount --make-shared "${sandbox}" > /dev/null 2>&1 || "${FS_BIND_ROOT}/bin/smount" "${sandbox}" shared
+	umount "${sandbox}" || {
+		tst_resm TFAIL "$0: failed to umount simplest shared subtree"
 		exit 1
 	}
-
 	tst_resm TPASS "$0: umounted simplest shared subtree"
 
 }
@@ -428,6 +434,9 @@ run_test()
 	save_sandbox "$tname" "$resdir/$tname" || do_break=1
 	save_mounts "$tname" "$resdir/$tname" || do_break=1
 	save_proc_mounts "$tname" "$resdir/$tname" || do_break=1
+	mount --bind "${sandbox}" "${sandbox}" >& /dev/null || do_break=1
+	mount --make-private "${sandbox}" >& /dev/null || do_break=1
+
 	if [ $do_break -eq 1 ]; then
 		tst_brkm TBROK true "$tname: failed to save pre-test state of \"${sandbox}\""
 		return 2
@@ -453,6 +462,7 @@ run_test()
 		#echo "SUCCEEDED"
 		((nsucceeded++))
 	fi
+	umount -l "${sandbox}" >& /dev/null
 	check_proc_mounts "$tname" "$resdir/$tname" || \
 	restore_proc_mounts "$tname" "$resdir/$tname" || do_break=1
 	check_mounts "$tname" "$resdir/$tname" || \
Signature · 12 lines
1.8.1

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
author
#1 lore raw

PATCH v2 1/1 testscripts/test_fs_bind.sh: adapt to system which marks mount point as "shared" defaultly

Linux kernel does not allow to move a mount residing under a shared mount.

This patch tries to make sure test cases of "move" run under a private mount.

---
 testscripts/test_fs_bind.sh | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)
testscripts/test_fs_bind.sh +19 -9
index 92c51a1..792fff2 100755
@@ -107,6 +107,18 @@ test_prereqs()
 		exit -1
 	fi
 
+	mount --bind "${sandbox}" "${sandbox}" >& /dev/null
+	if [ $? -ne 0 ]; then
+		tst_brkm TBROK true "$0: failed to perform bind mount on directory \"${sandbox}\""
+		exit 1
+	fi
+
+	mount --make-private "${sandbox}" >& /dev/null
+	if [ $? -ne 0 ]; then
+		tst_brkm TBROK true "$0: failed to make private mountpoint on directory \"${sandbox}\""
+		exit 1
+	fi
+
 	local mnt_bind=1
 	local mnt_move=1
 
@@ -153,17 +165,11 @@ test_prereqs()
 		tst_resm TINFO "$0: kernel >= 2.6.15 detected -- continuing"
 	fi
 
-	mount --bind "${sandbox}" "${sandbox}" && {
-		mount --make-shared "${sandbox}" > /dev/null 2>&1 || "${FS_BIND_ROOT}/bin/smount" "${sandbox}" shared
-		umount "${sandbox}" || {
-			tst_resm TFAIL "$0: failed to umount simplest shared subtree"
-			exit 1
-		}
-	} || {
-		tst_brkm TBROK true "$0: failed to perform bind mount"
+	mount --make-shared "${sandbox}" > /dev/null 2>&1 || "${FS_BIND_ROOT}/bin/smount" "${sandbox}" shared
+	umount "${sandbox}" || {
+		tst_resm TFAIL "$0: failed to umount simplest shared subtree"
 		exit 1
 	}
-
 	tst_resm TPASS "$0: umounted simplest shared subtree"
 
 }
@@ -428,6 +434,9 @@ run_test()
 	save_sandbox "$tname" "$resdir/$tname" || do_break=1
 	save_mounts "$tname" "$resdir/$tname" || do_break=1
 	save_proc_mounts "$tname" "$resdir/$tname" || do_break=1
+	mount --bind "${sandbox}" "${sandbox}" >& /dev/null || do_break=1
+	mount --make-private "${sandbox}" >& /dev/null || do_break=1
+
 	if [ $do_break -eq 1 ]; then
 		tst_brkm TBROK true "$tname: failed to save pre-test state of \"${sandbox}\""
 		return 2
@@ -453,6 +462,7 @@ run_test()
 		#echo "SUCCEEDED"
 		((nsucceeded++))
 	fi
+	umount -l "${sandbox}" >& /dev/null
 	check_proc_mounts "$tname" "$resdir/$tname" || \
 	restore_proc_mounts "$tname" "$resdir/$tname" || do_break=1
 	check_mounts "$tname" "$resdir/$tname" || \
Signature · 14 lines
1.8.1



------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Applied
#2 lore raw
Quoted 7 lines · DAN LI

Linux kernel does not allow to move a mount residing under a shared mount.

This patch tries to make sure test cases of "move" run under a private mount.

Applied, thank you.

Wanlong Gao

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list