linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Btrfs: more send support for parent/child dir relationship inversion
@ 2014-02-01  2:02 Filipe David Borba Manana
  2014-02-15 18:26 ` Filipe David Manana
  0 siblings, 1 reply; 2+ messages in thread
From: Filipe David Borba Manana @ 2014-02-01  2:02 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Filipe David Borba Manana

The commit titled "Btrfs: fix infinite path build loops in incremental send"
didn't cover a particular case where the parent-child relationship inversion
of directories doesn't imply a rename of the new parent directory. This was
due to a simple logic mistake, a logical and instead of a logical or.

Steps to reproduce:

  $ mkfs.btrfs -f /dev/sdb3
  $ mount /dev/sdb3 /mnt/btrfs
  $ mkdir -p /mnt/btrfs/a/b/bar1/bar2/bar3/bar4
  $ btrfs subvol snapshot -r /mnt/btrfs /mnt/btrfs/snap1
  $ mv /mnt/btrfs/a/b/bar1/bar2/bar3/bar4 /mnt/btrfs/a/b/k44
  $ mv /mnt/btrfs/a/b/bar1/bar2/bar3 /mnt/btrfs/a/b/k44
  $ mv /mnt/btrfs/a/b/bar1/bar2 /mnt/btrfs/a/b/k44/bar3
  $ mv /mnt/btrfs/a/b/bar1 /mnt/btrfs/a/b/k44/bar3/bar2/k11
  $ btrfs subvol snapshot -r /mnt/btrfs /mnt/btrfs/snap2
  $ btrfs send -p /mnt/btrfs/snap1 /mnt/btrfs/snap2 > /tmp/incremental.send

A patch to update the test btrfs/030 from xfstests, so that it covers
this case, will be submitted soon.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
---
 fs/btrfs/send.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index e0b49f6..c47fcef 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -3041,8 +3041,8 @@ static int wait_for_parent_move(struct send_ctx *sctx,
 
 	len1 = fs_path_len(path_before);
 	len2 = fs_path_len(path_after);
-	if ((parent_ino_before != parent_ino_after) && (len1 != len2 ||
-	     memcmp(path_before->start, path_after->start, len1))) {
+	if (parent_ino_before != parent_ino_after || len1 != len2 ||
+	     memcmp(path_before->start, path_after->start, len1)) {
 		ret = 1;
 		goto out;
 	}
-- 
1.7.9.5


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

* Re: [PATCH] Btrfs: more send support for parent/child dir relationship inversion
  2014-02-01  2:02 [PATCH] Btrfs: more send support for parent/child dir relationship inversion Filipe David Borba Manana
@ 2014-02-15 18:26 ` Filipe David Manana
  0 siblings, 0 replies; 2+ messages in thread
From: Filipe David Manana @ 2014-02-15 18:26 UTC (permalink / raw)
  To: linux-btrfs@vger.kernel.org
  Cc: Filipe David Borba Manana, Chris Mason, Josef Bacik

On Sat, Feb 1, 2014 at 2:02 AM, Filipe David Borba Manana
<fdmanana@gmail.com> wrote:
> The commit titled "Btrfs: fix infinite path build loops in incremental send"
> didn't cover a particular case where the parent-child relationship inversion
> of directories doesn't imply a rename of the new parent directory. This was
> due to a simple logic mistake, a logical and instead of a logical or.
>
> Steps to reproduce:
>
>   $ mkfs.btrfs -f /dev/sdb3
>   $ mount /dev/sdb3 /mnt/btrfs
>   $ mkdir -p /mnt/btrfs/a/b/bar1/bar2/bar3/bar4
>   $ btrfs subvol snapshot -r /mnt/btrfs /mnt/btrfs/snap1
>   $ mv /mnt/btrfs/a/b/bar1/bar2/bar3/bar4 /mnt/btrfs/a/b/k44
>   $ mv /mnt/btrfs/a/b/bar1/bar2/bar3 /mnt/btrfs/a/b/k44
>   $ mv /mnt/btrfs/a/b/bar1/bar2 /mnt/btrfs/a/b/k44/bar3
>   $ mv /mnt/btrfs/a/b/bar1 /mnt/btrfs/a/b/k44/bar3/bar2/k11
>   $ btrfs subvol snapshot -r /mnt/btrfs /mnt/btrfs/snap2
>   $ btrfs send -p /mnt/btrfs/snap1 /mnt/btrfs/snap2 > /tmp/incremental.send
>
> A patch to update the test btrfs/030 from xfstests, so that it covers
> this case, will be submitted soon.
>
> Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
> ---

Hi,

Should this go to 3.14 too? It is covered by the test case btrfs/030
for xfstests.

thanks

>  fs/btrfs/send.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
> index e0b49f6..c47fcef 100644
> --- a/fs/btrfs/send.c
> +++ b/fs/btrfs/send.c
> @@ -3041,8 +3041,8 @@ static int wait_for_parent_move(struct send_ctx *sctx,
>
>         len1 = fs_path_len(path_before);
>         len2 = fs_path_len(path_after);
> -       if ((parent_ino_before != parent_ino_after) && (len1 != len2 ||
> -            memcmp(path_before->start, path_after->start, len1))) {
> +       if (parent_ino_before != parent_ino_after || len1 != len2 ||
> +            memcmp(path_before->start, path_after->start, len1)) {
>                 ret = 1;
>                 goto out;
>         }
> --
> 1.7.9.5
>



-- 
Filipe David Manana,

"Reasonable men adapt themselves to the world.
 Unreasonable men adapt the world to themselves.
 That's why all progress depends on unreasonable men."

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

end of thread, other threads:[~2014-02-15 18:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-01  2:02 [PATCH] Btrfs: more send support for parent/child dir relationship inversion Filipe David Borba Manana
2014-02-15 18:26 ` Filipe David Manana

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).