Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix destroy snapshots and race on zfs diff #562

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion module/zfs/zfs_ctldir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions module/zfs/zfs_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down