Whamcloud - gitweb
LU-9960 osd-zfs: don't auto-upgrade quota 54/28954/2
authorNathaniel Clark <nathaniel.l.clark@intel.com>
Mon, 11 Sep 2017 14:14:18 +0000 (10:14 -0400)
committerJohn L. Hammond <john.hammond@intel.com>
Thu, 14 Sep 2017 20:39:57 +0000 (20:39 +0000)
To preserve the ability to down-grade from 0.7.x to 0.6.x,
don't auto-upgrade quotas.
Print warning if quotas haven't been upgraded when mouting with 0.7.0.
Do check based on zpool feature in sanity-quota instead of just
version.

Lustre-change: https://review.whamcloud.com/#/c/28924/
Lustre-commit: 0bbef0afc16081e1af3529642436864954a73e3c

Signed-off-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Change-Id: I2b0dcba3a230c9b2dec3d07d1b4ca6f1a1717d47
Signed-off-by: Minh Diep <minh.diep@intel.com>
Reviewed-on: https://review.whamcloud.com/28954
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
lustre/osd-zfs/osd_handler.c
lustre/osd-zfs/osd_internal.h
lustre/tests/sanity-quota.sh
lustre/utils/mount_utils_zfs.c

index 056c181..fccab6b 100644 (file)
@@ -1101,6 +1101,13 @@ static int osd_mount(const struct lu_env *env,
                GOTO(err, rc);
        }
 
+#ifdef HAVE_DMU_USEROBJ_ACCOUNTING
+       if (!osd_dmu_userobj_accounting_available(o))
+               CWARN("%s: dnode accounting not enabled: "
+                     "enable feature@userobj_accounting in pool\n",
+                     o->od_mntdev);
+#endif
+
        /* parse mount option "noacl", and enable ACL by default */
        opts = lustre_cfg_string(cfg, 3);
        if (opts == NULL || strstr(opts, "noacl") == NULL)
index 1996ab2..5091a59 100644 (file)
@@ -775,9 +775,6 @@ static inline void osd_dnode_rele(dnode_t *dn)
 
 static inline bool osd_dmu_userobj_accounting_available(struct osd_device *osd)
 {
-       if (unlikely(dmu_objset_userobjspace_upgradable(osd->od_os)))
-               dmu_objset_userobjspace_upgrade(osd->od_os);
-
        return dmu_objset_userobjspace_present(osd->od_os);
 }
 #else
index 6f00ee7..f6f0f2b 100755 (executable)
@@ -1411,10 +1411,13 @@ test_7e() {
        # LU-2435: skip this quota test if underlying zfs version has not
        # supported native dnode accounting
        [ "$(facet_fstype mds1)" == "zfs" ] && {
-               local zfs_version=$(do_facet mds1 cat /sys/module/zfs/version)
+               local F="feature@userobj_accounting"
+               local pool=$(zpool_name mds1)
+               local feature=$(do_facet mds1 $ZPOOL get -H $F $pool)
 
-               [ $(version_code $zfs_version) -lt $(version_code 0.7.0) ] &&
-                       skip "requires zfs version at least 0.7.0" && return
+               [[ "$feature" != *" active "* ]] &&
+                       skip "requires zpool with active userobj_accounting" &&
+                       return
        }
 
        local ilimit=$((1024 * 2)) # 2k inodes
index aacf076..a3ffb7a 100644 (file)
@@ -665,6 +665,7 @@ int zfs_make_lustre(struct mkfs_opts *mop)
        php = zpool_open(g_zfs, pool);
        if (php) {
                pool_exists = 1;
+               zpool_set_prop(php, "canmount", "off");
                zpool_close(php);
        }
 
@@ -699,15 +700,14 @@ int zfs_make_lustre(struct mkfs_opts *mop)
        /*
         * Set Options on ZPOOL
         *
-        * ALL   - canmount=off
+        * ALL   - canmount=off (set above)
         * 0.7.0 - multihost=on
+        * 0.7.0 - feature@userobj_accounting=enabled
         */
        php = zpool_open(g_zfs, pool);
        if (php) {
-               if (pool_exists)
-                       zpool_set_prop(php, "canmount", "off");
-
                zpool_set_prop(php, "multihost", "on");
+               zpool_set_prop(php, "feature@userobj_accounting", "enabled");
 
                zpool_close(php);
        }