All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Eryu Guan <eguan@redhat.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
	linux-unionfs@vger.kernel.org, fstests@vger.kernel.org,
	zhangyi <yi.zhang@huawei.com>
Subject: [PATCH 2/2] overlay/031: fix test with inodes index enabled
Date: Tue, 19 Sep 2017 14:39:44 +0300	[thread overview]
Message-ID: <1505821184-3913-3-git-send-email-amir73il@gmail.com> (raw)
In-Reply-To: <1505821184-3913-1-git-send-email-amir73il@gmail.com>

When overlayfs is configured with CONFIG_OVERLAY_FS_INDEX=y,
workdir from previous overlay mount cannot be reused in a new
overlay mount that uses a different upper dir.

Fix the test to use a different workdir when mounting with a
different upper dir.

This change has no effect on older kernels and overlay
configured without CONFIG_OVERLAY_FS_INDEX.

Cc: zhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
 tests/overlay/031 | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/tests/overlay/031 b/tests/overlay/031
index 161022e..70ee299 100755
--- a/tests/overlay/031
+++ b/tests/overlay/031
@@ -43,12 +43,17 @@ _cleanup()
 # testfile to create a whiteout in upper dir.
 create_whiteout()
 {
-	mkdir -p $1/testdir
-	touch $1/testdir/$4
+	local lower=$1
+	local upper=$2
+	local work=$3
+	local file=$4
 
-	_overlay_mount_dirs $1 $2 $3 $OVL_BASE_SCRATCH_MNT $SCRATCH_MNT
+	mkdir -p $lower/testdir
+	touch $lower/testdir/$file
 
-	rm -f $SCRATCH_MNT/testdir/$4
+	_overlay_mount_dirs $lower $upper $work $OVL_BASE_SCRATCH_MNT $SCRATCH_MNT
+
+	rm -f $SCRATCH_MNT/testdir/$file
 
 	$UMOUNT_PROG $SCRATCH_MNT
 }
@@ -72,9 +77,13 @@ lowerdir1=$OVL_BASE_SCRATCH_MNT/lower1
 lowerdir2=$OVL_BASE_SCRATCH_MNT/lower2
 upperdir=$OVL_BASE_SCRATCH_MNT/upper
 workdir=$OVL_BASE_SCRATCH_MNT/workdir
+# When overlay inode index feature is enabled, a workdir cannot be reused
+# with a different upperdir. workdir1 in this test is used as the workdir
+# when lowerdir1 is used as the upperdir.
+workdir1=$OVL_BASE_SCRATCH_MNT/workdir1
 testfile1=a
 testfile2=b
-mkdir -p $lowerdir1 $lowerdir2 $upperdir $workdir
+mkdir -p $lowerdir1 $lowerdir2 $upperdir $workdir $workdir1
 
 create_whiteout $lowerdir1 $upperdir $workdir $testfile1
 
@@ -108,7 +117,7 @@ $UMOUNT_PROG $SCRATCH_MNT
 rm -rf $lowerdir1/testdir
 rm -rf $upperdir/testdir
 
-create_whiteout $lowerdir2 $lowerdir1 $workdir $testfile1
+create_whiteout $lowerdir2 $lowerdir1 $workdir1 $testfile1
 
 rm -rf $lowerdir2/testdir
 
@@ -128,7 +137,7 @@ create_whiteout $lowerdir1 $upperdir $workdir $testfile1
 
 rm -rf $lowerdir1/testdir/$testfile1
 
-create_whiteout $lowerdir2 $lowerdir1 $workdir $testfile2
+create_whiteout $lowerdir2 $lowerdir1 $workdir1 $testfile2
 
 _overlay_mount_dirs $lowerdir1 $upperdir $workdir $OVL_BASE_SCRATCH_MNT $SCRATCH_MNT
 
-- 
2.7.4

  parent reply	other threads:[~2017-09-19 11:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-19 11:39 [PATCH 0/2] overlay: fix INDEX=y regressions Amir Goldstein
2017-09-19 11:39 ` [PATCH 1/2] overlay/014: correct comment relating to workdir reuse Amir Goldstein
2017-09-19 11:39 ` Amir Goldstein [this message]
2017-09-19 13:02   ` [PATCH 2/2] overlay/031: fix test with inodes index enabled zhangyi (F)
2017-09-20  3:53 ` [PATCH 0/2] overlay: fix INDEX=y regressions Eryu Guan

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=1505821184-3913-3-git-send-email-amir73il@gmail.com \
    --to=amir73il@gmail.com \
    --cc=eguan@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=yi.zhang@huawei.com \
    /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.