Skip to contentSkip to conversation

overlay: fix INDEX=y regressions

PATCH In review Amir Goldstein 3 participants 5 messages Sep 19, 2017 – Sep 20, 2017

lore
Share & tools
lore
#0 lore raw

cover overlay: fix INDEX=y regressions

Eryu,

When you added the comment to overlay/014, I said Looks good to me, but I wasn't looking well.
Second patch is the same treatment to overlay/031 (with the correct comment).

Test overlay/031 does not pass on master, but with INDEX=y, it fails on the wrong errors.
The test passes on my development branch:
https://github.com/amir73il/linux/commits/overlayfs-devel

Amir.

Amir Goldstein (2):
overlay/014: correct comment relating to workdir reuse overlay/031: fix test with inodes index enabled

 tests/overlay/014 |  7 +++----
 tests/overlay/031 | 23 ++++++++++++++++-------
 2 files changed, 19 insertions(+), 11 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/2 overlay/014: correct comment relating to workdir reuse

Clarification: EBUSY is what you get when trying to use the same upperdir/workdir with two different *concurent* overlayfs mounts. The EBUSY case is independent of the inodes index feature.

This is not the case in this test, but rather the case of trying to reuse the same workdir with different upper dirs on *subsequent* overlayfs mounts.

---
 tests/overlay/014 | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
tests/overlay/014 +3 -4
index f228b15..cd76835 100755
@@ -63,10 +63,9 @@ 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, using an upper layer path and/or
-# a workdir path that are already used by another overlay mount is not allowed
-# and will fail with EBUSY, so create another workdir for the second overlay
-# mount
+# When overlay inode index feature is enabled, a workdir cannot be reused
+# with a different upperdir. workdir2 in this test is used as the workdir
+# when lowerdir2 is used as the upperdir.
 workdir2=$OVL_BASE_SCRATCH_MNT/workdir2
 mkdir -p $lowerdir1 $lowerdir2 $upperdir $workdir $workdir2
 mkdir -p $lowerdir1/testdir/d
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/2 overlay/031: fix test with inodes index enabled

In reply to Amir Goldstein

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.

---
 tests/overlay/031 | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)
tests/overlay/031 +16 -7
index 161022e..70ee299 100755
@@ -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
 
Signature · 1 line
2.7.4
#3 lore raw

Re: [PATCH 2/2] overlay/031: fix test with inodes index enabled

On 2017/9/19 19:39, Amir Goldstein Wrote:

Quoted 7 lines

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.

Quoted 9 lines

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

---
 tests/overlay/031 | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

Looks good.

Thanks,
Yi.

#4 lore raw
In reply to Amir Goldstein
Quoted 11 lines · Amir Goldstein

Eryu,

When you added the comment to overlay/014, I said Looks good to me, but I wasn't looking well.
Second patch is the same treatment to overlay/031 (with the correct comment).

Test overlay/031 does not pass on master, but with INDEX=y, it fails on the wrong errors.
The test passes on my development branch:
https://github.com/amir73il/linux/commits/overlayfs-devel

Thanks for all the fixes and clarifications! Queued for next update.

Eryu

Quoted 14 lines

Amir.

Amir Goldstein (2):
overlay/014: correct comment relating to workdir reuse overlay/031: fix test with inodes index enabled

 tests/overlay/014 |  7 +++----
 tests/overlay/031 | 23 ++++++++++++++++-------
 2 files changed, 19 insertions(+), 11 deletions(-)
Signature · 1 line
2.7.4