Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 492776
Collapse All | Expand All

(-)a/cmds-send.c (-30 / +6 lines)
Lines 282-312 out: Link Here
282
	return ERR_PTR(ret);
282
	return ERR_PTR(ret);
283
}
283
}
284
284
285
static int do_send(struct btrfs_send *send, u64 root_id, u64 parent_root_id,
285
static int do_send(struct btrfs_send *send, u64 parent_root_id,
286
		   int is_first_subvol, int is_last_subvol)
286
		   int is_first_subvol, int is_last_subvol, char *subvol)
287
{
287
{
288
	int ret;
288
	int ret;
289
	pthread_t t_read;
289
	pthread_t t_read;
290
	pthread_attr_t t_attr;
290
	pthread_attr_t t_attr;
291
	struct btrfs_ioctl_send_args io_send;
291
	struct btrfs_ioctl_send_args io_send;
292
	struct subvol_info *si;
293
	void *t_err = NULL;
292
	void *t_err = NULL;
294
	int subvol_fd = -1;
293
	int subvol_fd = -1;
295
	int pipefd[2] = {-1, -1};
294
	int pipefd[2] = {-1, -1};
296
295
297
	si = subvol_uuid_search(&send->sus, root_id, NULL, 0, NULL,
296
	subvol_fd = openat(send->mnt_fd, subvol, O_RDONLY | O_NOATIME);
298
			subvol_search_by_root_id);
299
	if (!si) {
300
		ret = -ENOENT;
301
		fprintf(stderr, "ERROR: could not find subvol info for %llu",
302
				root_id);
303
		goto out;
304
	}
305
306
	subvol_fd = openat(send->mnt_fd, si->path, O_RDONLY | O_NOATIME);
307
	if (subvol_fd < 0) {
297
	if (subvol_fd < 0) {
308
		ret = -errno;
298
		ret = -errno;
309
		fprintf(stderr, "ERROR: open %s failed. %s\n", si->path,
299
		fprintf(stderr, "ERROR: open %s failed. %s\n", subvol,
310
				strerror(-ret));
300
				strerror(-ret));
311
		goto out;
301
		goto out;
312
	}
302
	}
Lines 385-394 out: Link Here
385
		close(pipefd[0]);
375
		close(pipefd[0]);
386
	if (pipefd[1] != -1)
376
	if (pipefd[1] != -1)
387
		close(pipefd[1]);
377
		close(pipefd[1]);
388
	if (si) {
389
		free(si->path);
390
		free(si);
391
	}
392
	return ret;
378
	return ret;
393
}
379
}
394
380
Lines 664-677 int cmd_send(int argc, char **argv) Link Here
664
			goto out;
650
			goto out;
665
		}
651
		}
666
652
667
		ret = get_root_id(&send, get_subvol_name(send.root_path, subvol),
668
				&root_id);
669
		if (ret < 0) {
670
			fprintf(stderr, "ERROR: could not resolve root_id "
671
					"for %s\n", subvol);
672
			goto out;
673
		}
674
675
		if (!full_send && !parent_root_id) {
653
		if (!full_send && !parent_root_id) {
676
			ret = find_good_parent(&send, root_id, &parent_root_id);
654
			ret = find_good_parent(&send, root_id, &parent_root_id);
677
			if (ret < 0) {
655
			if (ret < 0) {
Lines 700-707 int cmd_send(int argc, char **argv) Link Here
700
			is_first_subvol = 1;
678
			is_first_subvol = 1;
701
			is_last_subvol = 1;
679
			is_last_subvol = 1;
702
		}
680
		}
703
		ret = do_send(&send, root_id, parent_root_id,
681
		ret = do_send(&send, parent_root_id, is_first_subvol,
704
			      is_first_subvol, is_last_subvol);
682
			      is_last_subvol, subvol);
705
		if (ret < 0)
683
		if (ret < 0)
706
			goto out;
684
			goto out;
707
685
708
- 
709
-

Return to bug 492776