testscripts/test_fs_bind.sh: adapt to system which marks mount point as "shared" defaultly
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
@@ -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
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
@@ -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
Wanlong Gao
AppliedQuoted 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.
Signed-off-by DAN LI <[email protected]>
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