Changeset View
Changeset View
Standalone View
Standalone View
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
Show First 20 Lines • Show All 1,247 Lines • ▼ Show 20 Lines | if (error) { | ||||
zfsvfs_free(zfsvfs); | zfsvfs_free(zfsvfs); | ||||
} else { | } else { | ||||
atomic_inc_32(&zfs_active_fs_count); | atomic_inc_32(&zfs_active_fs_count); | ||||
} | } | ||||
return (error); | return (error); | ||||
} | } | ||||
void | void | ||||
delphij: I wonder if we should mark zfs_unregister_callbacks static, just like zfs_register_callbacks? | |||||
avgAuthorUnsubmitted Not Done Inline ActionsIt looks like this function can be made static, but I'd do it as a separate commit. avg: It looks like this function can be made static, but I'd do it as a separate commit. | |||||
zfs_unregister_callbacks(zfsvfs_t *zfsvfs) | zfs_unregister_callbacks(zfsvfs_t *zfsvfs) | ||||
{ | { | ||||
objset_t *os = zfsvfs->z_os; | objset_t *os = zfsvfs->z_os; | ||||
struct dsl_dataset *ds; | struct dsl_dataset *ds; | ||||
/* | /* | ||||
* Unregister properties. | * Unregister properties. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 447 Lines • ▼ Show 20 Lines | #endif | ||||
vfsp->vfs_flag |= MNT_NFS4ACLS; | vfsp->vfs_flag |= MNT_NFS4ACLS; | ||||
/* | /* | ||||
* When doing a remount, we simply refresh our temporary properties | * When doing a remount, we simply refresh our temporary properties | ||||
* according to those options set in the current VFS options. | * according to those options set in the current VFS options. | ||||
*/ | */ | ||||
if (vfsp->vfs_flag & MS_REMOUNT) { | if (vfsp->vfs_flag & MS_REMOUNT) { | ||||
/* refresh mount options */ | zfsvfs_t *zfsvfs = vfsp->vfs_data; | ||||
zfs_unregister_callbacks(vfsp->vfs_data); | |||||
/* | |||||
* Refresh mount options with z_teardown_lock blocking I/O while | |||||
* the filesystem is in an inconsistent state. | |||||
* The lock also serializes this code with filesystem | |||||
* manipulations between entry to zfs_suspend_fs() and return | |||||
* from zfs_resume_fs(). | |||||
*/ | |||||
rrm_enter(&zfsvfs->z_teardown_lock, RW_WRITER, FTAG); | |||||
zfs_unregister_callbacks(zfsvfs); | |||||
error = zfs_register_callbacks(vfsp); | error = zfs_register_callbacks(vfsp); | ||||
rrm_exit(&zfsvfs->z_teardown_lock, FTAG); | |||||
goto out; | goto out; | ||||
} | } | ||||
/* Initial root mount: try hard to import the requested root pool. */ | /* Initial root mount: try hard to import the requested root pool. */ | ||||
if ((vfsp->vfs_flag & MNT_ROOTFS) != 0 && | if ((vfsp->vfs_flag & MNT_ROOTFS) != 0 && | ||||
(vfsp->vfs_flag & MNT_UPDATE) == 0) { | (vfsp->vfs_flag & MNT_UPDATE) == 0) { | ||||
char pname[MAXNAMELEN]; | char pname[MAXNAMELEN]; | ||||
▲ Show 20 Lines • Show All 185 Lines • ▼ Show 20 Lines | #endif | ||||
* unregistered and cached data had been evicted before. | * unregistered and cached data had been evicted before. | ||||
*/ | */ | ||||
if (zfsvfs->z_os == NULL) | if (zfsvfs->z_os == NULL) | ||||
return (0); | return (0); | ||||
/* | /* | ||||
* Unregister properties. | * Unregister properties. | ||||
*/ | */ | ||||
zfs_unregister_callbacks(zfsvfs); | zfs_unregister_callbacks(zfsvfs); | ||||
delphijUnsubmitted Not Done Inline ActionsI'm not very convinced that we can safely do unregister without having z_teardown_lock held here... If it's safe, maybe we should document it in the comment? delphij: I'm not very convinced that we can safely do unregister without having z_teardown_lock held… | |||||
avgAuthorUnsubmitted Not Done Inline ActionsIf !unmounting we, in fact, do hold the lock here. avg: If `!unmounting` we, in fact, do hold the lock here.
And if `unmounting` then no other thread… | |||||
/* | /* | ||||
* Evict cached data | * Evict cached data | ||||
*/ | */ | ||||
if (dsl_dataset_is_dirty(dmu_objset_ds(zfsvfs->z_os)) && | if (dsl_dataset_is_dirty(dmu_objset_ds(zfsvfs->z_os)) && | ||||
!(zfsvfs->z_vfs->vfs_flag & VFS_RDONLY)) | !(zfsvfs->z_vfs->vfs_flag & VFS_RDONLY)) | ||||
txg_wait_synced(dmu_objset_pool(zfsvfs->z_os), 0); | txg_wait_synced(dmu_objset_pool(zfsvfs->z_os), 0); | ||||
dmu_objset_evict_dbufs(zfsvfs->z_os); | dmu_objset_evict_dbufs(zfsvfs->z_os); | ||||
▲ Show 20 Lines • Show All 626 Lines • Show Last 20 Lines |
I wonder if we should mark zfs_unregister_callbacks static, just like zfs_register_callbacks? (Or is this intentional to make them DTrace proble eligible?)