From patchwork Wed Oct 19 02:35:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tsutomu Itoh X-Patchwork-Id: 9383509 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0B6186086B for ; Wed, 19 Oct 2016 02:35:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F111529730 for ; Wed, 19 Oct 2016 02:35:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4C0A29836; Wed, 19 Oct 2016 02:35:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B279E29834 for ; Wed, 19 Oct 2016 02:35:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938148AbcJSCfi (ORCPT ); Tue, 18 Oct 2016 22:35:38 -0400 Received: from mgwym01.jp.fujitsu.com ([211.128.242.40]:36478 "EHLO mgwym01.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933120AbcJSCfb (ORCPT ); Tue, 18 Oct 2016 22:35:31 -0400 Received: from yt-mxoi2.gw.nic.fujitsu.com (unknown [192.168.229.69]) by mgwym01.jp.fujitsu.com with smtp id 73ec_3de4_94f0d0b0_1710_4f15_b350_2f7f36665003; Wed, 19 Oct 2016 11:35:20 +0900 Received: from m3051.s.css.fujitsu.com (m3051.s.css.fujitsu.com [10.134.21.209]) by yt-mxoi2.gw.nic.fujitsu.com (Postfix) with ESMTP id 3637BAC00AA for ; Wed, 19 Oct 2016 11:35:19 +0900 (JST) Received: from WIN-5MHF4RKU941.jp.fujitsu.com (unknown [10.124.102.163]) by m3051.s.css.fujitsu.com (Postfix) with SMTP id 25DFC43E for ; Wed, 19 Oct 2016 11:35:19 +0900 (JST) X-SecurityPolicyCheck: OK by SHieldMailChecker v2.3.2 X-SHieldMailCheckerPolicyVersion: FJ-ISEC-20150223 X-SHieldMailCheckerMailID: 49531e66cde0410f9b16187e35eb9192 Message-Id: <201610190235.AA00002@WIN-5MHF4RKU941.jp.fujitsu.com> From: Tsutomu Itoh Date: Wed, 19 Oct 2016 11:35:03 +0900 To: linux-btrfs@vger.kernel.org Subject: [PATCH 2/3] btrfs-progs: send: fix handling of multiple snapshots (-p option) MIME-Version: 1.0 X-Mailer: AL-Mail32 Version 1.13 X-TM-AS-MML: disable Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We cannot send multiple snapshots at once by -p option. [before] # btrfs send -f /tmp/data0 -p Snap0 Snap[12] At subvol Snap1 At subvol Snap2 ERROR: parent determination failed for 0 # [after] # btrfs send -f /tmp/data0 -p Snap0 Snap[12] At subvol Snap1 At subvol Snap2 # Signed-off-by: Tsutomu Itoh --- cmds-send.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cmds-send.c b/cmds-send.c index dfdfe01..2a8a697 100644 --- a/cmds-send.c +++ b/cmds-send.c @@ -650,7 +650,7 @@ int cmd_send(int argc, char **argv) goto out; } - if (!full_send && !parent_root_id) { + if (!full_send && root_id) { ret = find_good_parent(&send, root_id, &parent_root_id); if (ret < 0) { error("parent determination failed for %lld", @@ -673,7 +673,7 @@ int cmd_send(int argc, char **argv) if (ret < 0) goto out; - if (!full_send) { + if (!full_send && root_id) { /* done with this subvol, so add it to the clone sources */ ret = add_clone_source(&send, root_id); if (ret < 0) { @@ -681,8 +681,6 @@ int cmd_send(int argc, char **argv) goto out; } } - - parent_root_id = 0; } ret = 0;