From patchwork Sat Feb 1 02:02:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 3564161 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 054E9C02DC for ; Sat, 1 Feb 2014 02:02:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 385312024F for ; Sat, 1 Feb 2014 02:02:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6FC6B2022D for ; Sat, 1 Feb 2014 02:02:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754413AbaBACCd (ORCPT ); Fri, 31 Jan 2014 21:02:33 -0500 Received: from mail-we0-f178.google.com ([74.125.82.178]:53231 "EHLO mail-we0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754378AbaBACCc (ORCPT ); Fri, 31 Jan 2014 21:02:32 -0500 Received: by mail-we0-f178.google.com with SMTP id q59so284502wes.9 for ; Fri, 31 Jan 2014 18:02:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=6lkuQo6y/wmvXW1LZ/+NHLe5FihsG1Hav2cnGffefRg=; b=mwL1XdALXCMRDmowNQ1x+hbbh3GOxYdLceMPqcboF8pQb42M3pfvOQD1gwdxvILfsQ FfZyJRgrMIY6C61hiJFbpVnzKKiaYW09f/ySkomPMZ86v5EGlSaXBy5m8j63JxY9/r5h hnX1aO4f2pEQvlMu5fTl1HrRMTMALm9hmaWNIXF+/xlwh0vi1dl53r3i2O3idXQHuX7j PcRG1/P3dGSUaF92qCG/i6ktlHJDe0IcsQrI2ATkwrl+Bs+801MLM6r97ns6ih127x/i VXkmuDCetaf9YrjNYZsebu71UNAqI59d/VshjuwFlPEK4ey7LbDGY+JrmicpfntUp7hd 58Rw== X-Received: by 10.180.11.142 with SMTP id q14mr844051wib.45.1391220151873; Fri, 31 Jan 2014 18:02:31 -0800 (PST) Received: from storm-desktop.lan (bl10-140-184.dsl.telepac.pt. [85.243.140.184]) by mx.google.com with ESMTPSA id t6sm2533459wix.4.2014.01.31.18.02.31 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Jan 2014 18:02:31 -0800 (PST) From: Filipe David Borba Manana To: linux-btrfs@vger.kernel.org Cc: Filipe David Borba Manana Subject: [PATCH] Btrfs: more send support for parent/child dir relationship inversion Date: Sat, 1 Feb 2014 02:02:16 +0000 Message-Id: <1391220136-22034-1-git-send-email-fdmanana@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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; }