All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/3] Btrfs-progs: add test for receive
@ 2019-01-14 13:31 fdmanana
  2019-01-14 14:08 ` David Disseldorp
  0 siblings, 1 reply; 4+ messages in thread
From: fdmanana @ 2019-01-14 13:31 UTC (permalink / raw)
  To: linux-btrfs; +Cc: ddis, Filipe Manana

From: Filipe Manana <fdmanana@suse.com>

Add a test for a scenario that used to fail due to find_mount_root()
incorrectly determining the mount point for the receive path due to the
fact that a different mount point with a path that is a prefix of the
receive path exists.

This is fixed by a recent patch titled:

  "Btrfs-progs: fix mount point detection due to partial prefix match"

Reported-by: David Disseldorp <ddis@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 .../034-receive-common-mount-point-prefix/test.sh  | 47 ++++++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100755 tests/misc-tests/034-receive-common-mount-point-prefix/test.sh

diff --git a/tests/misc-tests/034-receive-common-mount-point-prefix/test.sh b/tests/misc-tests/034-receive-common-mount-point-prefix/test.sh
new file mode 100755
index 00000000..e2a6fdfc
--- /dev/null
+++ b/tests/misc-tests/034-receive-common-mount-point-prefix/test.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# Test that receive determines the correct mount point path when there is
+# another mount point that matches the destination's path as a prefix.
+
+source "$TEST_TOP/common"
+
+check_prereq btrfs
+check_prereq mkfs.btrfs
+
+setup_root_helper
+
+rm -f dev1 dev2
+run_check truncate -s 1G dev1
+run_check truncate -s 1G dev2
+chmod a+w dev1 dev2
+
+loop1=$(run_check_stdout $SUDO_HELPER losetup --find --show dev1)
+loop2=$(run_check_stdout $SUDO_HELPER losetup --find --show dev2)
+
+run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$loop1"
+run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$loop2"
+
+run_check $SUDO_HELPER mount "$loop1" "$TEST_MNT"
+mkdir "${TEST_MNT}/ddis"
+mkdir "${TEST_MNT}/ddis-not-a-mount"
+run_check $SUDO_HELPER mount "$loop2" "${TEST_MNT}/ddis"
+
+echo "some data" > "${TEST_MNT}/ddis/file"
+
+run_check $SUDO_HELPER "$TOP/btrfs" subvolume snapshot -r \
+	  "${TEST_MNT}/ddis" "${TEST_MNT}/ddis/snap"
+
+rm -f send.data
+run_check $SUDO_HELPER "$TOP/btrfs" send -f send.data "${TEST_MNT}/ddis/snap"
+
+# The following receive used to fail because it incorrectly determined the mount
+# point of the destination path to be ${TEST_MNT}/ddis and not $TEST_MNT.
+run_check $SUDO_HELPER "$TOP/btrfs" receive -f send.data \
+	  "${TEST_MNT}/ddis-not-a-mount"
+
+run_check $SUDO_HELPER umount "${TEST_MNT}/ddis"
+run_check $SUDO_HELPER umount "$TEST_MNT"
+
+# Cleanup loop devices and send data.
+run_check $SUDO_HELPER losetup -d "$loop1"
+run_check $SUDO_HELPER losetup -d "$loop2"
+rm -f dev1 dev2 send.data
-- 
2.11.0


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

* Re: [PATCH 3/3] Btrfs-progs: add test for receive
  2019-01-14 13:31 [PATCH 3/3] Btrfs-progs: add test for receive fdmanana
@ 2019-01-14 14:08 ` David Disseldorp
  2019-01-14 14:11   ` Filipe Manana
  0 siblings, 1 reply; 4+ messages in thread
From: David Disseldorp @ 2019-01-14 14:08 UTC (permalink / raw)
  To: fdmanana; +Cc: linux-btrfs, Filipe Manana

On Mon, 14 Jan 2019 13:31:46 +0000, fdmanana@kernel.org wrote:

> From: Filipe Manana <fdmanana@suse.com>
> 
> Add a test for a scenario that used to fail due to find_mount_root()
> incorrectly determining the mount point for the receive path due to the
> fact that a different mount point with a path that is a prefix of the
> receive path exists.
> 
> This is fixed by a recent patch titled:
> 
>   "Btrfs-progs: fix mount point detection due to partial prefix match"
> 
> Reported-by: David Disseldorp <ddis@suse.com>

My address has an extra 's' (ddiss). This also applies to PATCH 1/3.

> Signed-off-by: Filipe Manana <fdmanana@suse.com>
> ---
>  .../034-receive-common-mount-point-prefix/test.sh  | 47 ++++++++++++++++++++++
>  1 file changed, 47 insertions(+)
>  create mode 100755 tests/misc-tests/034-receive-common-mount-point-prefix/test.sh

Looks good.
Reviewed-by: David Disseldorp <ddiss@suse.de>

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

* Re: [PATCH 3/3] Btrfs-progs: add test for receive
  2019-01-14 14:08 ` David Disseldorp
@ 2019-01-14 14:11   ` Filipe Manana
  2019-01-15 17:26     ` David Sterba
  0 siblings, 1 reply; 4+ messages in thread
From: Filipe Manana @ 2019-01-14 14:11 UTC (permalink / raw)
  To: David Disseldorp; +Cc: linux-btrfs, Filipe Manana

On Mon, Jan 14, 2019 at 2:08 PM David Disseldorp <ddiss@suse.de> wrote:
>
> On Mon, 14 Jan 2019 13:31:46 +0000, fdmanana@kernel.org wrote:
>
> > From: Filipe Manana <fdmanana@suse.com>
> >
> > Add a test for a scenario that used to fail due to find_mount_root()
> > incorrectly determining the mount point for the receive path due to the
> > fact that a different mount point with a path that is a prefix of the
> > receive path exists.
> >
> > This is fixed by a recent patch titled:
> >
> >   "Btrfs-progs: fix mount point detection due to partial prefix match"
> >
> > Reported-by: David Disseldorp <ddis@suse.com>
>
> My address has an extra 's' (ddiss). This also applies to PATCH 1/3.

Ops.
David can probably correct that when he picks the patch, otherwise
I'll send a new version.
Thanks.

>
> > Signed-off-by: Filipe Manana <fdmanana@suse.com>
> > ---
> >  .../034-receive-common-mount-point-prefix/test.sh  | 47 ++++++++++++++++++++++
> >  1 file changed, 47 insertions(+)
> >  create mode 100755 tests/misc-tests/034-receive-common-mount-point-prefix/test.sh
>
> Looks good.
> Reviewed-by: David Disseldorp <ddiss@suse.de>

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

* Re: [PATCH 3/3] Btrfs-progs: add test for receive
  2019-01-14 14:11   ` Filipe Manana
@ 2019-01-15 17:26     ` David Sterba
  0 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2019-01-15 17:26 UTC (permalink / raw)
  To: Filipe Manana; +Cc: David Disseldorp, linux-btrfs, Filipe Manana

On Mon, Jan 14, 2019 at 02:11:17PM +0000, Filipe Manana wrote:
> On Mon, Jan 14, 2019 at 2:08 PM David Disseldorp <ddiss@suse.de> wrote:
> >
> > On Mon, 14 Jan 2019 13:31:46 +0000, fdmanana@kernel.org wrote:
> >
> > > From: Filipe Manana <fdmanana@suse.com>
> > >
> > > Add a test for a scenario that used to fail due to find_mount_root()
> > > incorrectly determining the mount point for the receive path due to the
> > > fact that a different mount point with a path that is a prefix of the
> > > receive path exists.
> > >
> > > This is fixed by a recent patch titled:
> > >
> > >   "Btrfs-progs: fix mount point detection due to partial prefix match"
> > >
> > > Reported-by: David Disseldorp <ddis@suse.com>
> >
> > My address has an extra 's' (ddiss). This also applies to PATCH 1/3.
> 
> Ops.
> David can probably correct that when he picks the patch, otherwise

All fixed and applied, thanks.

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

end of thread, other threads:[~2019-01-15 17:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-14 13:31 [PATCH 3/3] Btrfs-progs: add test for receive fdmanana
2019-01-14 14:08 ` David Disseldorp
2019-01-14 14:11   ` Filipe Manana
2019-01-15 17:26     ` David Sterba

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.