Changeset View
Changeset View
Standalone View
Standalone View
cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
Show First 20 Lines • Show All 2,887 Lines • ▼ Show 20 Lines | if (fromsnap != NULL && recursive) { | ||||
pair)) != NULL) { | pair)) != NULL) { | ||||
zfs_handle_t *zhp; | zfs_handle_t *zhp; | ||||
prop_changelist_t *clp = NULL; | prop_changelist_t *clp = NULL; | ||||
zhp = zfs_open(hdl, nvpair_name(pair), | zhp = zfs_open(hdl, nvpair_name(pair), | ||||
ZFS_TYPE_FILESYSTEM); | ZFS_TYPE_FILESYSTEM); | ||||
if (zhp != NULL) { | if (zhp != NULL) { | ||||
clp = changelist_gather(zhp, | clp = changelist_gather(zhp, | ||||
ZFS_PROP_MOUNTPOINT, 0, 0); | ZFS_PROP_MOUNTPOINT, 0, | ||||
flags->force ? MS_FORCE : 0); | |||||
pjd: flags->forceunmount? | |||||
Not Done Inline Actionsis this meant to be flags->force or flags->forceunmount ? allanjude: is this meant to be flags->force or flags->forceunmount ? | |||||
Done Inline Actionsflags->forceunmount. Fixed. oshogbo: flags->forceunmount. Fixed. | |||||
zfs_close(zhp); | zfs_close(zhp); | ||||
if (clp != NULL) { | if (clp != NULL) { | ||||
softerr |= | softerr |= | ||||
changelist_prefix(clp); | changelist_prefix(clp); | ||||
changelist_free(clp); | changelist_free(clp); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 485 Lines • ▼ Show 20 Lines | if (stream_wantsnewfs && | ||||
"must destroy it to overwrite it"), | "must destroy it to overwrite it"), | ||||
zc.zc_name); | zc.zc_name); | ||||
return (zfs_error(hdl, EZFS_EXISTS, errbuf)); | return (zfs_error(hdl, EZFS_EXISTS, errbuf)); | ||||
} | } | ||||
if (!flags->dryrun && zhp->zfs_type == ZFS_TYPE_FILESYSTEM && | if (!flags->dryrun && zhp->zfs_type == ZFS_TYPE_FILESYSTEM && | ||||
stream_wantsnewfs) { | stream_wantsnewfs) { | ||||
/* We can't do online recv in this case */ | /* We can't do online recv in this case */ | ||||
clp = changelist_gather(zhp, ZFS_PROP_NAME, 0, 0); | clp = changelist_gather(zhp, ZFS_PROP_NAME, 0, | ||||
flags->forceunmount ? MS_FORCE : 0); | |||||
if (clp == NULL) { | if (clp == NULL) { | ||||
zfs_close(zhp); | zfs_close(zhp); | ||||
zcmd_free_nvlists(&zc); | zcmd_free_nvlists(&zc); | ||||
return (-1); | return (-1); | ||||
} | } | ||||
if (changelist_prefix(clp) != 0) { | if (changelist_prefix(clp) != 0) { | ||||
changelist_free(clp); | changelist_free(clp); | ||||
zfs_close(zhp); | zfs_close(zhp); | ||||
▲ Show 20 Lines • Show All 412 Lines • ▼ Show 20 Lines | |||||
zfs_receive(libzfs_handle_t *hdl, const char *tosnap, nvlist_t *props, | zfs_receive(libzfs_handle_t *hdl, const char *tosnap, nvlist_t *props, | ||||
recvflags_t *flags, int infd, avl_tree_t *stream_avl) | recvflags_t *flags, int infd, avl_tree_t *stream_avl) | ||||
{ | { | ||||
char *top_zfs = NULL; | char *top_zfs = NULL; | ||||
int err; | int err; | ||||
int cleanup_fd; | int cleanup_fd; | ||||
uint64_t action_handle = 0; | uint64_t action_handle = 0; | ||||
char *originsnap = NULL; | char *originsnap = NULL; | ||||
int mflags = 0; | |||||
printf("asd1 hi\n"); | |||||
Not Done Inline ActionsAnother debug output here and below? bcr: Another debug output here and below? | |||||
if (props) { | if (props) { | ||||
err = nvlist_lookup_string(props, "origin", &originsnap); | err = nvlist_lookup_string(props, "origin", &originsnap); | ||||
if (err && err != ENOENT) | if (err && err != ENOENT) | ||||
return (err); | return (err); | ||||
} | } | ||||
printf("asd2\n"); | |||||
cleanup_fd = open(ZFS_DEV, O_RDWR|O_EXCL); | cleanup_fd = open(ZFS_DEV, O_RDWR|O_EXCL); | ||||
VERIFY(cleanup_fd >= 0); | VERIFY(cleanup_fd >= 0); | ||||
err = zfs_receive_impl(hdl, tosnap, originsnap, flags, infd, NULL, NULL, | err = zfs_receive_impl(hdl, tosnap, originsnap, flags, infd, NULL, NULL, | ||||
stream_avl, &top_zfs, cleanup_fd, &action_handle, NULL); | stream_avl, &top_zfs, cleanup_fd, &action_handle, NULL); | ||||
VERIFY(0 == close(cleanup_fd)); | VERIFY(0 == close(cleanup_fd)); | ||||
if (flags->forceunmount) { | |||||
mflags = MS_FORCE; | |||||
Not Done Inline ActionsI think mflags is never used. pjd: I think mflags is never used. | |||||
} | |||||
printf("asd3 %d %d\n", mflags, err); | |||||
if (err == 0 && !flags->nomount && top_zfs) { | if (err == 0 && !flags->nomount && top_zfs) { | ||||
zfs_handle_t *zhp; | zfs_handle_t *zhp; | ||||
prop_changelist_t *clp; | prop_changelist_t *clp; | ||||
zhp = zfs_open(hdl, top_zfs, ZFS_TYPE_FILESYSTEM); | zhp = zfs_open(hdl, top_zfs, ZFS_TYPE_FILESYSTEM); | ||||
printf("asdx %p\n", zhp); | |||||
if (zhp != NULL) { | if (zhp != NULL) { | ||||
clp = changelist_gather(zhp, ZFS_PROP_MOUNTPOINT, | clp = changelist_gather(zhp, ZFS_PROP_MOUNTPOINT, | ||||
CL_GATHER_MOUNT_ALWAYS, 0); | CL_GATHER_MOUNT_ALWAYS, | ||||
flags->forceunmount ? MS_FORCE : 0); | |||||
zfs_close(zhp); | zfs_close(zhp); | ||||
if (clp != NULL) { | if (clp != NULL) { | ||||
/* mount and share received datasets */ | /* mount and share received datasets */ | ||||
err = changelist_postfix(clp); | err = changelist_postfix(clp); | ||||
changelist_free(clp); | changelist_free(clp); | ||||
} | } | ||||
} | } | ||||
if (zhp == NULL || clp == NULL || err) | if (zhp == NULL || clp == NULL || err) | ||||
err = -1; | err = -1; | ||||
} | } | ||||
if (top_zfs) | if (top_zfs) | ||||
free(top_zfs); | free(top_zfs); | ||||
return (err); | return (err); | ||||
} | } |
flags->forceunmount?