public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] generic: use bind mount instead of 2nd _scratch_mount
@ 2016-11-13 13:49 Amir Goldstein
  2016-11-13 23:29 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Amir Goldstein @ 2016-11-13 13:49 UTC (permalink / raw)
  To: Eryu Guan
  Cc: Darrick J . Wong, Miklos Szeredi, Xiong Zhou, linux-unionfs,
	fstests

generic/373 and generic/374 test that cross-mountpoint reflink/dedupe
fail with EXDEV.

For this test, _scratch_mount is called a 2nd time with same mount
arguments, but a different value of SCRATCH_MNT.

This practice is incorrect for overlayfs, which should not be using
the same upper/work dirs on two different overlay super blocks.

Change the test to use bind mount instead, which results in the
expected setup for both block device mount and overlay mount.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
 tests/generic/373 | 4 ++--
 tests/generic/374 | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/generic/373 b/tests/generic/373
index cf585ba..d74324e 100755
--- a/tests/generic/373
+++ b/tests/generic/373
@@ -64,7 +64,7 @@ blksz=65536
 sz=$((blksz * blocks))
 
 echo "Mount otherdir"
-SCRATCH_MNT=$otherdir _scratch_mount
+mount --bind $SCRATCH_MNT $otherdir
 
 echo "Create file"
 _pwrite_byte 0x61 0 $sz $testdir/file >> $seqres.full
@@ -82,7 +82,7 @@ md5sum $testdir/file | _filter_scratch
 test -e $othertestdir/otherfile && echo "otherfile should not exist"
 
 echo "Unmount otherdir"
-SCRATCH_MNT=$otherdir _scratch_unmount
+umount $otherdir
 rm -rf $otherdir
 
 # success, all done
diff --git a/tests/generic/374 b/tests/generic/374
index 0173c13..4546cc5 100755
--- a/tests/generic/374
+++ b/tests/generic/374
@@ -63,7 +63,7 @@ blksz=65536
 sz=$((blocks * blksz))
 
 echo "Mount otherdir"
-SCRATCH_MNT=$otherdir _scratch_mount
+mount --bind $SCRATCH_MNT $otherdir
 
 echo "Create file"
 _pwrite_byte 0x61 0 $sz $testdir/file >> $seqres.full
@@ -80,7 +80,7 @@ echo "Check output"
 md5sum $testdir/file $othertestdir/otherfile | filter_md5
 
 echo "Unmount otherdir"
-SCRATCH_MNT=$otherdir _scratch_unmount
+umount $otherdir
 rm -rf $otherdir
 
 # success, all done
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] generic: use bind mount instead of 2nd _scratch_mount
  2016-11-13 13:49 [PATCH] generic: use bind mount instead of 2nd _scratch_mount Amir Goldstein
@ 2016-11-13 23:29 ` Darrick J. Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2016-11-13 23:29 UTC (permalink / raw)
  To: Amir Goldstein
  Cc: Eryu Guan, Miklos Szeredi, Xiong Zhou, linux-unionfs, fstests

On Sun, Nov 13, 2016 at 03:49:37PM +0200, Amir Goldstein wrote:
> generic/373 and generic/374 test that cross-mountpoint reflink/dedupe
> fail with EXDEV.
> 
> For this test, _scratch_mount is called a 2nd time with same mount
> arguments, but a different value of SCRATCH_MNT.
> 
> This practice is incorrect for overlayfs, which should not be using
> the same upper/work dirs on two different overlay super blocks.
> 
> Change the test to use bind mount instead, which results in the
> expected setup for both block device mount and overlay mount.

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> 
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> ---
>  tests/generic/373 | 4 ++--
>  tests/generic/374 | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/generic/373 b/tests/generic/373
> index cf585ba..d74324e 100755
> --- a/tests/generic/373
> +++ b/tests/generic/373
> @@ -64,7 +64,7 @@ blksz=65536
>  sz=$((blksz * blocks))
>  
>  echo "Mount otherdir"
> -SCRATCH_MNT=$otherdir _scratch_mount
> +mount --bind $SCRATCH_MNT $otherdir
>  
>  echo "Create file"
>  _pwrite_byte 0x61 0 $sz $testdir/file >> $seqres.full
> @@ -82,7 +82,7 @@ md5sum $testdir/file | _filter_scratch
>  test -e $othertestdir/otherfile && echo "otherfile should not exist"
>  
>  echo "Unmount otherdir"
> -SCRATCH_MNT=$otherdir _scratch_unmount
> +umount $otherdir
>  rm -rf $otherdir
>  
>  # success, all done
> diff --git a/tests/generic/374 b/tests/generic/374
> index 0173c13..4546cc5 100755
> --- a/tests/generic/374
> +++ b/tests/generic/374
> @@ -63,7 +63,7 @@ blksz=65536
>  sz=$((blocks * blksz))
>  
>  echo "Mount otherdir"
> -SCRATCH_MNT=$otherdir _scratch_mount
> +mount --bind $SCRATCH_MNT $otherdir
>  
>  echo "Create file"
>  _pwrite_byte 0x61 0 $sz $testdir/file >> $seqres.full
> @@ -80,7 +80,7 @@ echo "Check output"
>  md5sum $testdir/file $othertestdir/otherfile | filter_md5
>  
>  echo "Unmount otherdir"
> -SCRATCH_MNT=$otherdir _scratch_unmount
> +umount $otherdir
>  rm -rf $otherdir
>  
>  # success, all done
> -- 
> 2.7.4
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-13 23:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-13 13:49 [PATCH] generic: use bind mount instead of 2nd _scratch_mount Amir Goldstein
2016-11-13 23:29 ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox