All of lore.kernel.org
 help / color / mirror / Atom feed
From: DAN LI <li.dan@cn.fujitsu.com>
To: LTP list <ltp-list@lists.sourceforge.net>
Subject: [LTP] [PATCH] testscripts/test_fs_bind.sh: adapt to system which marks mount point as "shared" defaultly
Date: Tue, 09 Apr 2013 15:30:06 +0800	[thread overview]
Message-ID: <5163C37E.9@cn.fujitsu.com> (raw)

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

             reply	other threads:[~2013-04-09  7:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-09  7:30 DAN LI [this message]
2013-04-09  7:57 ` [LTP] [PATCHv2] testscripts/test_fs_bind.sh: adapt to system which marks mount point as "shared" defaultly DAN LI
2013-04-15  3:12   ` Wanlong Gao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5163C37E.9@cn.fujitsu.com \
    --to=li.dan@cn.fujitsu.com \
    --cc=ltp-list@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.