diff options
author | Matthew Macy <[email protected]> | 2019-12-10 09:21:07 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2019-12-10 09:21:07 -0800 |
commit | 362ae8d11f81e5f65cd20aaf773075a3f045644d (patch) | |
tree | 97a93b596643df5341463c6bebd4cdf6cd303967 /module | |
parent | 7bda69a1a9e7b852e8651ab87a05dd7ad5572a5a (diff) |
Abstract away platform specific superblock references
The zfsvfs->z_sb field is Linux specified and should be abstracted.
Reviewed-by: Richard Laager <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Matt Macy <[email protected]>
Closes #9697
Diffstat (limited to 'module')
-rw-r--r-- | module/os/linux/zfs/zfs_ioctl_os.c | 12 | ||||
-rw-r--r-- | module/zfs/zfs_ioctl.c | 10 |
2 files changed, 17 insertions, 5 deletions
diff --git a/module/os/linux/zfs/zfs_ioctl_os.c b/module/os/linux/zfs/zfs_ioctl_os.c index 2960832a5..f31fd7ac9 100644 --- a/module/os/linux/zfs/zfs_ioctl_os.c +++ b/module/os/linux/zfs/zfs_ioctl_os.c @@ -65,6 +65,12 @@ #include <linux/miscdevice.h> #include <linux/slab.h> +boolean_t +zfs_vfs_held(zfsvfs_t *zfsvfs) +{ + return (zfsvfs->z_sb != NULL); +} + int zfs_vfs_ref(zfsvfs_t **zfvp) { @@ -75,6 +81,12 @@ zfs_vfs_ref(zfsvfs_t **zfvp) return (0); } +void +zfs_vfs_rele(zfsvfs_t *zfsvfs) +{ + deactivate_super(zfsvfs->z_sb); +} + static int zfsdev_state_init(struct file *filp) { diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c index a993d02e1..92df28b1f 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -1442,8 +1442,8 @@ zfsvfs_rele(zfsvfs_t *zfsvfs, void *tag) { rrm_exit(&zfsvfs->z_teardown_lock, tag); - if (zfsvfs->z_sb) { - deactivate_super(zfsvfs->z_sb); + if (zfs_vfs_held(zfsvfs)) { + zfs_vfs_rele(zfsvfs); } else { dmu_objset_disown(zfsvfs->z_os, B_TRUE, zfsvfs); zfsvfs_free(zfsvfs); @@ -4133,7 +4133,7 @@ zfs_ioc_rollback(const char *fsname, nvlist_t *innvl, nvlist_t *outnvl) resume_err = zfs_resume_fs(zfsvfs, ds); error = error ? error : resume_err; } - deactivate_super(zfsvfs->z_sb); + zfs_vfs_rele(zfsvfs); } else if ((zv = zvol_suspend(fsname)) != NULL) { error = dsl_dataset_rollback(fsname, target, zvol_tag(zv), outnvl); @@ -4866,7 +4866,7 @@ zfs_ioc_recv_impl(char *tofs, char *tosnap, char *origin, nvlist_t *recvprops, error = zfs_resume_fs(zfsvfs, ds); } error = error ? error : end_err; - deactivate_super(zfsvfs->z_sb); + zfs_vfs_rele(zfsvfs); } else if ((zv = zvol_suspend(tofs)) != NULL) { error = dmu_recv_end(&drc, zvol_tag(zv)); zvol_resume(zv); @@ -5784,7 +5784,7 @@ zfs_ioc_userspace_upgrade(zfs_cmd_t *zc) } if (error == 0) error = dmu_objset_userspace_upgrade(zfsvfs->z_os); - deactivate_super(zfsvfs->z_sb); + zfs_vfs_rele(zfsvfs); } else { /* XXX kind of reading contents without owning */ error = dmu_objset_hold_flags(zc->zc_name, B_TRUE, FTAG, &os); |