Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix destroy snapshots and race on zfs diff
Fixes "dataset not found" error on zfs destory <snapshot> see openzfs#173. Fixes race in dsl_dataset_user_release_tmp() when the temp snapshot from zfs diff dataset@snap command is used see openzfs#481.
- Loading branch information
2d69db2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for running down the root cause on this. I think a slightly cleaner fix would be just to check for ENOENT as a safe return code from
zfs_unmount_snap()
indsl_dataset_user_release_one()
. This was the ENOENT behavior is preserved for all other callers which might need to know why an unmount failed. I'll roll this change in to an updated snapshot patch.2d69db2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries sounds good, I did start with that change but I pushed it down into zfs_umount_snap because the change above fixes the temp snapshot destroy in the diff, but think deleting a snapshot using zfs destroy and getting dataset not found comes from a different caller that also not setup to deal with ENOENT from zfs_unmount_snap, so we might need to identify that caller as well.
Do you know the path zfs destroy would take? I put a print_backtrace in the stap script I was using in the zfs_unmount_snap but it didn't seem to make sense and then I ran out of time and went on hol's...
2d69db2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2d69db2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
zfs destroy
path is short, just zfs_ioc_destroy->zfs_unmount_snap(). But you raise an interesting point about the other various error cases. It got me wondering why this isn't an issue on OpenSolaris. It turns out it's because their dounmount() hook already takes a reference to the mounted vfs namespace so ENOENT is impossible. The Linux version I reworked just takes a path. So we should really do is rework zfs_unmount_snap() to provide the same behavior and just treat ENOENT as success like Solaris.