diff --git a/module/zfs/zfs_ctldir.c b/module/zfs/zfs_ctldir.c index 6abbedf5cc6a..ed43e615f149 100644 --- a/module/zfs/zfs_ctldir.c +++ b/module/zfs/zfs_ctldir.c @@ -677,7 +677,14 @@ zfsctl_unmount_snapshot(zfs_sb_t *zsb, char *name, int flags) else zfsctl_sep_free(sep); } else { - error = ENOENT; + /* + * This was not recorded in z_ctldir_snaps but may have been + * mounted manually so may need to add check and unmount if + * this being called prior to a destroy. + * Returning ENOENT here causes race in dsl_dataset_user_release_tmp() and + * prevents destroy of snapshots so return 0. + */ + error = 0; } mutex_exit(&zsb->z_ctldir_lock); diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c index cb2f04c7050e..0cd54a2dfb4f 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -3079,7 +3079,7 @@ zfs_ioc_snapshot(zfs_cmd_t *zc) /* * inputs: - * name full snapshot name, or when 'arg == NULL' the dataset name + * name dataset name, or when 'arg == NULL' the full snapshot name * arg short snapshot name (i.e. part after the '@') */ int @@ -3106,7 +3106,7 @@ zfs_unmount_snap(const char *name, void *arg) } } - fullname = kmem_asprintf("%s@%s", name, snapname); + fullname = kmem_asprintf("%s@%s", dsname, snapname); error = zfs_sb_hold(dsname, FTAG, &zsb, B_FALSE); if (error == 0) {