]> granicus.if.org Git - zfs/commitdiff
Revert "Long hold the dataset during upgrade"
authorTony Hutter <hutter2@llnl.gov>
Thu, 7 Dec 2017 00:04:57 +0000 (16:04 -0800)
committerTony Hutter <hutter2@llnl.gov>
Wed, 6 Dec 2017 19:25:40 +0000 (13:25 -0600)
This reverts commit a5c8119eba0a3b8a2a780780099eb82e250ba7f9.

The commit (which was modified to remove encryption) was hitting
ASSERT(dsl_pool_config_held(dmu_objset_pool(os))) in
dmu_objset_upgrade() during automated testing.

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
module/zfs/dmu_objset.c
module/zfs/zfs_ioctl.c
module/zfs/zfs_vfsops.c

index 1706937aded919b5e6e7c260f16b7d481811ba1c..9a7a6968d6319163b39ab2e5ea2be6f023ae731c 100644 (file)
@@ -28,7 +28,6 @@
  * Copyright (c) 2015, STRATO AG, Inc. All rights reserved.
  * Copyright (c) 2016 Actifio, Inc. All rights reserved.
  * Copyright 2017 Nexenta Systems, Inc.
- * Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
  */
 
 /* Portions Copyright 2010 Robert Milkowski */
@@ -79,8 +78,6 @@ int dmu_find_threads = 0;
  */
 int dmu_rescan_dnode_threshold = 1 << DN_MAX_INDBLKSHIFT;
 
-static char *upgrade_tag = "upgrade_tag";
-
 static void dmu_objset_find_dp_cb(void *arg);
 
 static void dmu_objset_upgrade(objset_t *os, dmu_objset_upgrade_cb_t cb);
@@ -1160,7 +1157,6 @@ dmu_objset_upgrade_task_cb(void *data)
        os->os_upgrade_exit = B_TRUE;
        os->os_upgrade_id = 0;
        mutex_exit(&os->os_upgrade_lock);
-       dsl_dataset_long_rele(dmu_objset_ds(os), upgrade_tag);
 }
 
 static void
@@ -1169,9 +1165,6 @@ dmu_objset_upgrade(objset_t *os, dmu_objset_upgrade_cb_t cb)
        if (os->os_upgrade_id != 0)
                return;
 
-       ASSERT(dsl_pool_config_held(dmu_objset_pool(os)));
-       dsl_dataset_long_hold(dmu_objset_ds(os), upgrade_tag);
-
        mutex_enter(&os->os_upgrade_lock);
        if (os->os_upgrade_id == 0 && os->os_upgrade_status == 0) {
                os->os_upgrade_exit = B_FALSE;
@@ -1179,10 +1172,8 @@ dmu_objset_upgrade(objset_t *os, dmu_objset_upgrade_cb_t cb)
                os->os_upgrade_id = taskq_dispatch(
                    os->os_spa->spa_upgrade_taskq,
                    dmu_objset_upgrade_task_cb, os, TQ_SLEEP);
-               if (os->os_upgrade_id == TASKQID_INVALID) {
-                       dsl_dataset_long_rele(dmu_objset_ds(os), upgrade_tag);
+               if (os->os_upgrade_id == TASKQID_INVALID)
                        os->os_upgrade_status = ENOMEM;
-               }
        }
        mutex_exit(&os->os_upgrade_lock);
 }
@@ -1198,10 +1189,7 @@ dmu_objset_upgrade_stop(objset_t *os)
                os->os_upgrade_id = 0;
                mutex_exit(&os->os_upgrade_lock);
 
-               if ((taskq_cancel_id(os->os_spa->spa_upgrade_taskq, id)) == 0) {
-                       dsl_dataset_long_rele(dmu_objset_ds(os), upgrade_tag);
-               }
-               txg_wait_synced(os->os_spa->spa_dsl_pool, 0);
+               taskq_cancel_id(os->os_spa->spa_upgrade_taskq, id);
        } else {
                mutex_exit(&os->os_upgrade_lock);
        }
index 7106576c49e3755aff471cf38b470669f95ebdee..d195eded76dc818f2f5da68677ce53915449ba41 100644 (file)
@@ -5181,6 +5181,9 @@ zfs_ioc_userobjspace_upgrade(zfs_cmd_t *zc)
        if (error != 0)
                return (error);
 
+       dsl_dataset_long_hold(dmu_objset_ds(os), FTAG);
+       dsl_pool_rele(dmu_objset_pool(os), FTAG);
+
        if (dmu_objset_userobjspace_upgradable(os)) {
                mutex_enter(&os->os_upgrade_lock);
                if (os->os_upgrade_id == 0) {
@@ -5193,12 +5196,8 @@ zfs_ioc_userobjspace_upgrade(zfs_cmd_t *zc)
                        mutex_exit(&os->os_upgrade_lock);
                }
 
-               dsl_pool_rele(dmu_objset_pool(os), FTAG);
-
                taskq_wait_id(os->os_spa->spa_upgrade_taskq, os->os_upgrade_id);
                error = os->os_upgrade_status;
-       } else {
-               dsl_pool_rele(dmu_objset_pool(os), FTAG);
        }
 
        dsl_dataset_long_rele(dmu_objset_ds(os), FTAG);
index 0d03f1ef6af11c825e98d898edc7a84664cd13ac..761133936bc1046c3463aab199fec0377330665b 100644 (file)
@@ -834,13 +834,8 @@ zfs_fuid_overobjquota(zfsvfs_t *zfsvfs, boolean_t isgroup, uint64_t fuid)
        int err;
 
        if (!dmu_objset_userobjspace_present(zfsvfs->z_os)) {
-               if (dmu_objset_userobjspace_upgradable(zfsvfs->z_os)) {
-                       dsl_pool_config_enter(
-                           dmu_objset_pool(zfsvfs->z_os), FTAG);
+               if (dmu_objset_userobjspace_upgradable(zfsvfs->z_os))
                        dmu_objset_userobjspace_upgrade(zfsvfs->z_os);
-                       dsl_pool_config_exit(
-                           dmu_objset_pool(zfsvfs->z_os), FTAG);
-               }
                return (B_FALSE);
        }