From patchwork Thu Mar 24 07:47:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tsutomu Itoh X-Patchwork-Id: 8658721 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0B2299FEE9 for ; Thu, 24 Mar 2016 07:58:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3CE0B202E9 for ; Thu, 24 Mar 2016 07:58:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 08DC1202FF for ; Thu, 24 Mar 2016 07:58:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752256AbcCXH55 (ORCPT ); Thu, 24 Mar 2016 03:57:57 -0400 Received: from mgwkm03.jp.fujitsu.com ([202.219.69.170]:47081 "EHLO mgwkm03.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751475AbcCXH5z (ORCPT ); Thu, 24 Mar 2016 03:57:55 -0400 X-Greylist: delayed 606 seconds by postgrey-1.27 at vger.kernel.org; Thu, 24 Mar 2016 03:57:55 EDT Received: from kw-mxoi2.gw.nic.fujitsu.com (unknown [192.168.231.133]) by mgwkm03.jp.fujitsu.com with smtp id 5666_33b6_59796592_d50e_48ef_b9fc_85dafebdeb38; Thu, 24 Mar 2016 16:47:43 +0900 Received: from m3050.s.css.fujitsu.com (msm.b.css.fujitsu.com [10.134.21.208]) by kw-mxoi2.gw.nic.fujitsu.com (Postfix) with ESMTP id 9CD23AC015E for ; Thu, 24 Mar 2016 16:47:42 +0900 (JST) Received: from WIN-5MHF4RKU941.jp.fujitsu.com (unknown [10.124.102.163]) by m3050.s.css.fujitsu.com (Postfix) with SMTP id 7D558EC for ; Thu, 24 Mar 2016 16:47:42 +0900 (JST) X-SecurityPolicyCheck: OK by SHieldMailChecker v2.3.2 X-SHieldMailCheckerPolicyVersion: FJ-ISEC-20150223 X-SHieldMailCheckerMailID: 707c7d6330124606aaa90bd639224907 Message-Id: <201603240747.AA00000@WIN-5MHF4RKU941.jp.fujitsu.com> From: Tsutomu Itoh Date: Thu, 24 Mar 2016 16:47:28 +0900 To: linux-btrfs@vger.kernel.org Subject: [PATCH] btrfs-progs: send: fix handling of multiple snapshots 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-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 We cannot send multiple snapshots at once. [before fix] # btrfs send ./snap[12] > snap12.data At subvol ./snap1 At subvol ./snap2 ERROR: parent determination failed for 0 # [after fix] # btrfs send ./snap[12] > snap12.data At subvol ./snap1 At subvol ./snap2 # Signed-off-by: Tsutomu Itoh --- cmds-send.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/cmds-send.c b/cmds-send.c index 3e34d75..a220a49 100644 --- a/cmds-send.c +++ b/cmds-send.c @@ -683,15 +683,16 @@ int cmd_send(int argc, char **argv) if (ret < 0) goto out; - /* done with this subvol, so add it to the clone sources */ - ret = add_clone_source(&send, root_id); - if (ret < 0) { - error("not enough memory"); - goto out; + if (!full_send) { + /* done with this subvol, so add it to the clone sources */ + ret = add_clone_source(&send, root_id); + if (ret < 0) { + error("not enough memory"); + goto out; + } } parent_root_id = 0; - full_send = 0; } ret = 0;