OpenZFS 7301 - zpool export -f should be able to interrupt file freeing

Authored by: Alek Pinchuk <alek@nexenta.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: John Kennedy <john.kennedy@delphix.com>
Approved by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed-by: Tim Chase <tim@chase2k.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Ported-by: George Melikov <mail@gmelikov.ru>

OpenZFS-issue: https://www.illumos.org/issues/7301
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/eb72182
Closes #5680
This commit is contained in:
George Melikov
2017-01-27 22:46:39 +03:00
committed by Brian Behlendorf
parent cc9bb3e58e
commit a08abc1bb3
4 changed files with 48 additions and 5 deletions
+24 -2
View File
@@ -1263,7 +1263,7 @@ EXPORT_SYMBOL(zfs_sb_prune);
/*
* Teardown the zfs_sb_t.
*
* Note, if 'unmounting' if FALSE, we return with the 'z_teardown_lock'
* Note, if 'unmounting' is FALSE, we return with the 'z_teardown_lock'
* and 'z_teardown_inactive_lock' held.
*/
int
@@ -1358,8 +1358,8 @@ zfs_sb_teardown(zfs_sb_t *zsb, boolean_t unmounting)
*/
if (unmounting) {
zsb->z_unmounted = B_TRUE;
rrm_exit(&zsb->z_teardown_lock, FTAG);
rw_exit(&zsb->z_teardown_inactive_lock);
rrm_exit(&zsb->z_teardown_lock, FTAG);
}
/*
@@ -1906,6 +1906,28 @@ zfs_get_zplprop(objset_t *os, zfs_prop_t prop, uint64_t *value)
}
EXPORT_SYMBOL(zfs_get_zplprop);
/*
* Return true if the coresponding vfs's unmounted flag is set.
* Otherwise return false.
* If this function returns true we know VFS unmount has been initiated.
*/
boolean_t
zfs_get_vfs_flag_unmounted(objset_t *os)
{
zfs_sb_t *zfvp;
boolean_t unmounted = B_FALSE;
ASSERT(dmu_objset_type(os) == DMU_OST_ZFS);
mutex_enter(&os->os_user_ptr_lock);
zfvp = dmu_objset_get_user(os);
if (zfvp != NULL && zfvp->z_unmounted)
unmounted = B_TRUE;
mutex_exit(&os->os_user_ptr_lock);
return (unmounted);
}
void
zfs_init(void)
{