Don't open zfs control device exclusively

With the FreeBSD platform changes that were made for #10073
it is no longer necessary on FreeBSD to open the control device
exclusively to get onexit callbacks invoked.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Matt Macy <mmacy@FreeBSD.org>
Closes #10076
This commit is contained in:
Matthew Macy 2020-02-28 14:54:14 -08:00 committed by GitHub
parent cf118ae8dc
commit d32eff3a27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -697,7 +697,7 @@ setup_differ_info(zfs_handle_t *zhp, const char *fromsnap,
{ {
di->zhp = zhp; di->zhp = zhp;
di->cleanupfd = open(ZFS_DEV, O_RDWR|O_EXCL); di->cleanupfd = open(ZFS_DEV, O_RDWR);
VERIFY(di->cleanupfd >= 0); VERIFY(di->cleanupfd >= 0);
if (get_snapshot_names(di, fromsnap, tosnap) != 0) if (get_snapshot_names(di, fromsnap, tosnap) != 0)

View File

@ -2596,7 +2596,7 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap,
++holdseq; ++holdseq;
(void) snprintf(sdd.holdtag, sizeof (sdd.holdtag), (void) snprintf(sdd.holdtag, sizeof (sdd.holdtag),
".send-%d-%llu", getpid(), (u_longlong_t)holdseq); ".send-%d-%llu", getpid(), (u_longlong_t)holdseq);
sdd.cleanup_fd = open(ZFS_DEV, O_RDWR|O_EXCL); sdd.cleanup_fd = open(ZFS_DEV, O_RDWR);
if (sdd.cleanup_fd < 0) { if (sdd.cleanup_fd < 0) {
err = errno; err = errno;
goto stderr_out; goto stderr_out;
@ -5532,7 +5532,7 @@ zfs_receive(libzfs_handle_t *hdl, const char *tosnap, nvlist_t *props,
return (err); return (err);
} }
cleanup_fd = open(ZFS_DEV, O_RDWR|O_EXCL); cleanup_fd = open(ZFS_DEV, O_RDWR);
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,