util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Milan Broz <mbroz@redhat.com>
To: util-linux@vger.kernel.org
Cc: Milan Broz <mbroz@redhat.com>
Subject: [PATCH 3/3] tests: fix mount move test to work with shared mount
Date: Fri,  5 Oct 2012 18:37:40 +0200	[thread overview]
Message-ID: <1349455060-807-3-git-send-email-mbroz@redhat.com> (raw)
In-Reply-To: <1349455060-807-1-git-send-email-mbroz@redhat.com>

If parent mount for test directory is mounted with shared flag,
move mount test fails because kernel rejects mount move operation.

Use another directory level and explicitly make parent mount private.

(All "modern" systems using system have mounts shared for some reason.)

Signed-off-by: Milan Broz <mbroz@redhat.com>
---
 tests/ts/mount/move |   19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/tests/ts/mount/move b/tests/ts/mount/move
index 3862f46..ea37685 100755
--- a/tests/ts/mount/move
+++ b/tests/ts/mount/move
@@ -22,9 +22,19 @@ TS_DESC="move"
 ts_init "$*"
 ts_skip_nonroot
 
-DIR_SRC="$TS_OUTDIR/mnt-move-src"
-DIR_A="$TS_OUTDIR/mnt-move-A"
-DIR_B="$TS_OUTDIR/mnt-move-B"
+DIR_PRIVATE2="$TS_OUTDIR/mnt-move-private2"
+DIR_PRIVATE="$TS_OUTDIR/mnt-move-private"
+
+DIR_SRC="$DIR_PRIVATE/mnt-move-src"
+DIR_A="$DIR_PRIVATE/mnt-move-A"
+DIR_B="$DIR_PRIVATE/mnt-move-B"
+
+# create bind mount and make it private to be sure
+# (kernel cannot move mount with shared parent)
+[ -d $DIR_PRIVATE2 ] || mkdir $DIR_PRIVATE2
+[ -d $DIR_PRIVATE ] || mkdir $DIR_PRIVATE
+$TS_CMD_MOUNT --bind $DIR_PRIVATE2 $DIR_PRIVATE
+$TS_CMD_MOUNT --make-private $DIR_PRIVATE
 
 [ -d $DIR_SRC ] || mkdir $DIR_SRC
 [ -d $DIR_A ] || mkdir $DIR_A
@@ -48,6 +58,9 @@ $TS_CMD_FINDMNT --kernel --target "$DIR_B" &> /dev/null
 $TS_CMD_UMOUNT $DIR_B
 rmdir $DIR_SRC $DIR_A $DIR_B
 
+$TS_CMD_UMOUNT $DIR_PRIVATE
+rmdir $DIR_PRIVATE $DIR_PRIVATE2
+
 ts_log "Success"
 ts_finalize
 
-- 
1.7.10.4


  parent reply	other threads:[~2012-10-05 16:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-05 16:37 [PATCH 1/3] tests: fix timezone for cramfs Milan Broz
2012-10-05 16:37 ` [PATCH 2/3] tests: ignore test if kernel doesn't support minix fs Milan Broz
2012-10-05 16:37 ` Milan Broz [this message]
2012-10-09 11:50 ` [PATCH 1/3] tests: fix timezone for cramfs Karel Zak

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=1349455060-807-3-git-send-email-mbroz@redhat.com \
    --to=mbroz@redhat.com \
    --cc=util-linux@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).