aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/zfs/zfs_vfsops.c2
-rwxr-xr-xtests/zfs-tests/tests/functional/userquota/groupspace_003_pos.ksh14
-rwxr-xr-xtests/zfs-tests/tests/functional/userquota/userspace_003_pos.ksh10
3 files changed, 19 insertions, 7 deletions
diff --git a/module/zfs/zfs_vfsops.c b/module/zfs/zfs_vfsops.c
index af5593c2e..7286773d9 100644
--- a/module/zfs/zfs_vfsops.c
+++ b/module/zfs/zfs_vfsops.c
@@ -740,7 +740,7 @@ zfs_userspace_one(zfsvfs_t *zfsvfs, zfs_userquota_prop_t type,
return (0);
if (type == ZFS_PROP_USEROBJUSED || type == ZFS_PROP_GROUPOBJUSED) {
- strlcpy(buf, DMU_OBJACCT_PREFIX, DMU_OBJACCT_PREFIX_LEN);
+ strlcpy(buf, DMU_OBJACCT_PREFIX, DMU_OBJACCT_PREFIX_LEN + 1);
offset = DMU_OBJACCT_PREFIX_LEN;
}
diff --git a/tests/zfs-tests/tests/functional/userquota/groupspace_003_pos.ksh b/tests/zfs-tests/tests/functional/userquota/groupspace_003_pos.ksh
index 5f5965b64..56b7af031 100755
--- a/tests/zfs-tests/tests/functional/userquota/groupspace_003_pos.ksh
+++ b/tests/zfs-tests/tests/functional/userquota/groupspace_003_pos.ksh
@@ -30,6 +30,7 @@
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/include/math.shlib
. $STF_SUITE/tests/functional/userquota/userquota_common.kshlib
#
@@ -56,10 +57,15 @@ function cleanup
function group_object_count
{
typeset fs=$1
- typeset user=$2
- typeset cnt=$(zfs groupspace -oname,objused $fs | grep $user |
- awk '{print $2}')
- echo $cnt
+ typeset group=$2
+ typeset -i groupspacecnt=$(zfs groupspace -oname,objused $fs |
+ awk /$group/'{print $2}')
+ typeset -i zfsgetcnt=$(zfs get -H -ovalue groupobjused@$group $fs)
+
+ # 'zfs groupspace' and 'zfs get groupobjused@' should be equal
+ verify_eq "$groupspacecnt" "$zfsgetcnt" "groupobjused@$group"
+
+ echo $groupspacecnt
}
log_onexit cleanup
diff --git a/tests/zfs-tests/tests/functional/userquota/userspace_003_pos.ksh b/tests/zfs-tests/tests/functional/userquota/userspace_003_pos.ksh
index 671e144b0..96c3b1930 100755
--- a/tests/zfs-tests/tests/functional/userquota/userspace_003_pos.ksh
+++ b/tests/zfs-tests/tests/functional/userquota/userspace_003_pos.ksh
@@ -30,6 +30,7 @@
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/include/math.shlib
. $STF_SUITE/tests/functional/userquota/userquota_common.kshlib
#
@@ -58,9 +59,14 @@ function user_object_count
{
typeset fs=$1
typeset user=$2
- typeset cnt=$(zfs userspace -oname,objused $fs |
+ typeset -i userspacecnt=$(zfs userspace -oname,objused $fs |
awk /$user/'{print $2}')
- echo $cnt
+ typeset -i zfsgetcnt=$(zfs get -H -ovalue userobjused@$user $fs)
+
+ # 'zfs userspace' and 'zfs get userobjused@' should be equal
+ verify_eq "$userspacecnt" "$zfsgetcnt" "userobjused@$user"
+
+ echo $userspacecnt
}
log_onexit cleanup