Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jun 2019 19:46:35 +0000 (UTC)
From:      Allan Jude <allanjude@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r348696 - stable/12/cddl/contrib/opensolaris/cmd/zfs
Message-ID:  <201906051946.x55JkZNc024491@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: allanjude
Date: Wed Jun  5 19:46:35 2019
New Revision: 348696
URL: https://svnweb.freebsd.org/changeset/base/348696

Log:
  MFC r347953:
  
  MFV/ZoL: `zfs userspace` ignored all unresolved UIDs after the first
  
  zfsonlinux/zfs@88cfff182432e4d1c24c877f33b47ee6cf109eee
  
  zfs_main: fix `zfs userspace` squashing unresolved entries
  
  The `zfs userspace` squashes all entries with unresolved numeric
  values into a single output entry due to the comparsion always
  made by the string name which is empty in case of unresolved IDs.
  
  Fix this by falling to a numerical comparison when either one
  of string values is not found. This then compares any numerical
  values after all with a name resolved.
  
  Signed-off-by: Pavel Boldin <boldin.pavel@gmail.com>
  Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
  
  Reported by:	clusteradm
  Obtained from:	ZFS-on-Linux

Modified:
  stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==============================================================================
--- stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c	Wed Jun  5 19:30:32 2019	(r348695)
+++ stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c	Wed Jun  5 19:46:35 2019	(r348696)
@@ -2361,6 +2361,7 @@ us_compare(const void *larg, const void *rarg, void *u
 		case ZFS_PROP_NAME:
 			propname = "name";
 			if (numname) {
+compare_nums:
 				(void) nvlist_lookup_uint64(lnvl, propname,
 				    &lv64);
 				(void) nvlist_lookup_uint64(rnvl, propname,
@@ -2368,10 +2369,12 @@ us_compare(const void *larg, const void *rarg, void *u
 				if (rv64 != lv64)
 					rc = (rv64 < lv64) ? 1 : -1;
 			} else {
-				(void) nvlist_lookup_string(lnvl, propname,
-				    &lvstr);
-				(void) nvlist_lookup_string(rnvl, propname,
-				    &rvstr);
+				if ((nvlist_lookup_string(lnvl, propname,
+						&lvstr) == ENOENT) ||
+				    (nvlist_lookup_string(rnvl, propname,
+						&rvstr) == ENOENT)) {
+					goto compare_nums;
+				}
 				rc = strcmp(lvstr, rvstr);
 			}
 			break;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906051946.x55JkZNc024491>