All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 3/3] btrfs-progs: send: fix handling of -c option
Date: Wed, 19 Oct 2016 11:35:40 +0900	[thread overview]
Message-ID: <201610190235.AA00003@WIN-5MHF4RKU941.jp.fujitsu.com> (raw)

When two or more -c options are specified, cannot find a suitable
parent. So, output stream is bigger than correct one.

[before]
# btrfs send -f /tmp/data1 -c Snap0 -c ../SnapX Snap[12] ../SnapY
At subvol Snap1
At subvol Snap2
At subvol ../SnapY
# ls -l /tmp/data1
-rw------- 1 root root 3153 Oct 19 10:37 /tmp/data1
#

[after]
# btrfs send -f /tmp/data1 -c Snap0 -c ../SnapX Snap[12] ../SnapY
At subvol Snap1
At subvol Snap2
At subvol ../SnapY
# ls -l /tmp/data1
-rw------- 1 root root 1492 Oct 19 10:39 /tmp/data1
#

Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
---
 cmds-send.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/cmds-send.c b/cmds-send.c
index 2a8a697..b93a667 100644
--- a/cmds-send.c
+++ b/cmds-send.c
@@ -651,6 +651,18 @@ int cmd_send(int argc, char **argv)
 		}
 
 		if (!full_send && root_id) {
+			ret = init_root_path(&send, subvol);
+			if (ret < 0)
+				goto out;
+
+			ret = get_root_id(&send,
+				subvol_strip_mountpoint(send.root_path, subvol),
+				&root_id);
+			if (ret < 0) {
+				error("cannot resolve rootid for %s", subvol);
+				goto out;
+			}
+
 			ret = find_good_parent(&send, root_id, &parent_root_id);
 			if (ret < 0) {
 				error("parent determination failed for %lld",
-- 
2.9.3

             reply	other threads:[~2016-10-19  2:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-19  2:35 Tsutomu Itoh [this message]
2016-11-02 12:22 ` [PATCH 3/3] btrfs-progs: send: fix handling of -c option David Sterba
2016-11-04  2:10   ` Tsutomu Itoh
2016-11-04  8:33 ` [PATCH v2 " Tsutomu Itoh
2016-11-07 15:57   ` David Sterba
2016-11-04  8:35 ` [PATCH] btrfs-progs: send-test: add checking of clone-src option Tsutomu Itoh
2016-11-07 15:16   ` David Sterba
2016-11-09  1:25   ` [PATCH v2] " Tsutomu Itoh
2016-11-09  1:39     ` Qu Wenruo
2016-11-09  1:57       ` Tsutomu Itoh
2016-11-09  4:44   ` [PATCH v3] " Tsutomu Itoh
2016-11-09 10:49     ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201610190235.AA00003@WIN-5MHF4RKU941.jp.fujitsu.com \
    --to=t-itoh@jp.fujitsu.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.