From 2d69db27f9f459d4205050899589893dee4564bc Mon Sep 17 00:00:00 2001 From: Andrew Barnes Date: Tue, 7 Feb 2012 01:23:20 +1100 Subject: [PATCH] Fix destroy snapshots and race on zfs diff Fixes "dataset not found" error on zfs destory see #173. Fixes race in dsl_dataset_user_release_tmp() when the temp snapshot from zfs diff dataset@snap command is used see #481. --- module/zfs/zfs_ctldir.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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);