public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] testscripts/test_fs_bind.sh: adapt to system which marks mount point as "shared" defaultly
@ 2013-04-09  7:30 DAN LI
  2013-04-09  7:57 ` [LTP] [PATCHv2] " DAN LI
  0 siblings, 1 reply; 3+ messages in thread
From: DAN LI @ 2013-04-09  7:30 UTC (permalink / raw)
  To: LTP list

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.

Signed-off-by: DAN LI <li.dan@cn.fujitsu.com>
---
 testscripts/test_fs_bind.sh | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/testscripts/test_fs_bind.sh b/testscripts/test_fs_bind.sh
index 92c51a1..5817174 100755
--- a/testscripts/test_fs_bind.sh
+++ b/testscripts/test_fs_bind.sh
@@ -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" || \
-- 
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [LTP] [PATCHv2] testscripts/test_fs_bind.sh: adapt to system which marks mount point as "shared" defaultly
  2013-04-09  7:30 [LTP] [PATCH] testscripts/test_fs_bind.sh: adapt to system which marks mount point as "shared" defaultly DAN LI
@ 2013-04-09  7:57 ` DAN LI
  2013-04-15  3:12   ` Wanlong Gao
  0 siblings, 1 reply; 3+ messages in thread
From: DAN LI @ 2013-04-09  7:57 UTC (permalink / raw)
  To: ltp-list

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.

Signed-off-by: DAN LI <li.dan@cn.fujitsu.com>
---
 testscripts/test_fs_bind.sh | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/testscripts/test_fs_bind.sh b/testscripts/test_fs_bind.sh
index 92c51a1..792fff2 100755
--- a/testscripts/test_fs_bind.sh
+++ b/testscripts/test_fs_bind.sh
@@ -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" || \
-- 
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCHv2] testscripts/test_fs_bind.sh: adapt to system which marks mount point as "shared" defaultly
  2013-04-09  7:57 ` [LTP] [PATCHv2] " DAN LI
@ 2013-04-15  3:12   ` Wanlong Gao
  0 siblings, 0 replies; 3+ messages in thread
From: Wanlong Gao @ 2013-04-15  3:12 UTC (permalink / raw)
  To: DAN LI; +Cc: ltp-list

On 04/09/2013 03:57 PM, DAN LI wrote:
> 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.
> 
> Signed-off-by: DAN LI <li.dan@cn.fujitsu.com>

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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-15  3:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-09  7:30 [LTP] [PATCH] testscripts/test_fs_bind.sh: adapt to system which marks mount point as "shared" defaultly DAN LI
2013-04-09  7:57 ` [LTP] [PATCHv2] " DAN LI
2013-04-15  3:12   ` Wanlong Gao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox