OpenZFS 7181 - race between zfs_mount and zfs_ioc_rollback

Authored by: Andriy Gapon <andriy.gapon@clusterhq.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Gordon Ross <gordon.w.ross@gmail.com>
Reviewed-by: Richard Yao <ryao@gentoo.org>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>

OpenZFS-issue: https://www.illumos.org/issues/7181
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/90f2c09
Closes #5585
This commit is contained in:
Brian Behlendorf 2017-01-13 15:29:32 -08:00 committed by GitHub
parent e254c8d8ee
commit 9775e98844

View File

@ -911,13 +911,6 @@ zfs_sb_setup(zfs_sb_t *zsb, boolean_t mounting)
if (error) if (error)
return (error); return (error);
/*
* Set the objset user_ptr to track its zsb.
*/
mutex_enter(&zsb->z_os->os_user_ptr_lock);
dmu_objset_set_user(zsb->z_os, zsb);
mutex_exit(&zsb->z_os->os_user_ptr_lock);
zsb->z_log = zil_open(zsb->z_os, zfs_get_data); zsb->z_log = zil_open(zsb->z_os, zfs_get_data);
/* /*
@ -981,6 +974,13 @@ zfs_sb_setup(zfs_sb_t *zsb, boolean_t mounting)
readonly_changed_cb(zsb, B_TRUE); readonly_changed_cb(zsb, B_TRUE);
} }
/*
* Set the objset user_ptr to track its zsb.
*/
mutex_enter(&zsb->z_os->os_user_ptr_lock);
dmu_objset_set_user(zsb->z_os, zsb);
mutex_exit(&zsb->z_os->os_user_ptr_lock);
return (0); return (0);
} }
EXPORT_SYMBOL(zfs_sb_setup); EXPORT_SYMBOL(zfs_sb_setup);