From ec923db25c823dd460fdb5db44a5a202a0975f27 Mon Sep 17 00:00:00 2001 From: George Melikov Date: Mon, 23 Jan 2017 21:53:46 +0300 Subject: OpenZFS 7180 - potential race between zfs_suspend_fs+zfs_resume_fs and zfs_ioc_rename Authored by: Andriy Gapon Reviewed by: Matt Ahrens Reviewed by: Pavel Zakharov Approved by: Richard Lowe Reviewed-by: Brian Behlendorf Ported-by: George Melikov OpenZFS-issue: https://www.illumos.org/issues/7180 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/690041b Closes #5627 --- module/zfs/zfs_vfsops.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'module/zfs/zfs_vfsops.c') diff --git a/module/zfs/zfs_vfsops.c b/module/zfs/zfs_vfsops.c index 65efcdce5..20ff165d9 100644 --- a/module/zfs/zfs_vfsops.c +++ b/module/zfs/zfs_vfsops.c @@ -1710,7 +1710,7 @@ EXPORT_SYMBOL(zfs_suspend_fs); * Reopen zfs_sb_t and release VFS ops. */ int -zfs_resume_fs(zfs_sb_t *zsb, const char *osname) +zfs_resume_fs(zfs_sb_t *zsb, dsl_dataset_t *ds) { int err, err2; znode_t *zp; @@ -1720,13 +1720,12 @@ zfs_resume_fs(zfs_sb_t *zsb, const char *osname) ASSERT(RW_WRITE_HELD(&zsb->z_teardown_inactive_lock)); /* - * We already own this, so just hold and rele it to update the - * objset_t, as the one we had before may have been evicted. + * We already own this, so just update the objset_t, as the one we + * had before may have been evicted. */ - VERIFY0(dmu_objset_hold(osname, zsb, &zsb->z_os)); - VERIFY3P(zsb->z_os->os_dsl_dataset->ds_owner, ==, zsb); - VERIFY(dsl_dataset_long_held(zsb->z_os->os_dsl_dataset)); - dmu_objset_rele(zsb->z_os, zsb); + VERIFY3P(ds->ds_owner, ==, zsb); + VERIFY(dsl_dataset_long_held(ds)); + VERIFY0(dmu_objset_from_ds(ds, &zsb->z_os)); /* * Make sure version hasn't changed -- cgit v1.2.3