From bb6ed7dcde71b3878402f1ad4c2d88bc8edd8557 Mon Sep 17 00:00:00 2001 From: Nathaniel Clark Date: Mon, 11 Sep 2017 10:14:18 -0400 Subject: [PATCH] LU-9960 osd-zfs: don't auto-upgrade quota 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. Signed-off-by: Nathaniel Clark Change-Id: I2b0dcba3a230c9b2dec3d07d1b4ca6f1a1717d47 Reviewed-on: https://review.whamcloud.com/28924 Tested-by: Jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: John L. Hammond --- lustre/osd-zfs/osd_handler.c | 7 +++++++ lustre/osd-zfs/osd_internal.h | 3 --- lustre/tests/sanity-quota.sh | 9 ++++++--- lustre/utils/libmount_utils_zfs.c | 8 ++++---- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/lustre/osd-zfs/osd_handler.c b/lustre/osd-zfs/osd_handler.c index 0d135b4..25ffbc6 100644 --- a/lustre/osd-zfs/osd_handler.c +++ b/lustre/osd-zfs/osd_handler.c @@ -1100,6 +1100,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) diff --git a/lustre/osd-zfs/osd_internal.h b/lustre/osd-zfs/osd_internal.h index 1996ab2..5091a59 100644 --- a/lustre/osd-zfs/osd_internal.h +++ b/lustre/osd-zfs/osd_internal.h @@ -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 diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index 6f00ee7..f6f0f2b 100755 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -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 diff --git a/lustre/utils/libmount_utils_zfs.c b/lustre/utils/libmount_utils_zfs.c index b616225..f77ea7e 100644 --- a/lustre/utils/libmount_utils_zfs.c +++ b/lustre/utils/libmount_utils_zfs.c @@ -667,6 +667,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); } @@ -701,15 +702,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); } -- 1.8.3.1