Project

General

Profile

Bug #11524

show_group() in sharemgr has superfluous call

Added by Dan McDonald 13 days ago. Updated 13 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
nfs-zone

Description

While investigating upstreaming NFS-service-in-a-zone, I encountered this buglet inside the initial commit.

@@ -20,11 +20,15 @@

  */

 /*
  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
+ */
+
+/*
  * Copyright 2012 Milan Jurik. All rights reserved.
+ * Copyright 2018 Nexenta Systems, Inc.
  */

 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>

@@ -2164,18 +2168,19 @@

 static void
 show_group(sa_group_t group, int verbose, int properties, char *proto,
     char *subgroup)
 {
-        sa_share_t share;
         char *groupname;
         char *zfs = NULL;
         int iszfs = 0;
         char *sharepath;

         groupname = sa_get_group_attr(group, "name");
         if (groupname != NULL) {
+                sa_share_t share;
+
                 if (proto != NULL && !has_protocol(group, proto)) {
                         sa_free_attr_string(groupname);
                         return;
                 }
                 /*

@@ -2188,11 +2193,11 @@
                 zfs = sa_get_group_attr(group, "zfs");
                 if (zfs != NULL) {
                         iszfs = 1;
                         sa_free_attr_string(zfs);
                 }
-                share = sa_get_share(group, NULL);
+
                 if (subgroup == NULL)
                         (void) printf("%s", groupname);
                 else
                         (void) printf("    %s/%s", subgroup, groupname);
                 if (properties)

Some buglets like these can go upstream much sooner than a vast NFS-server-in-a-zone wad. Other smaller bugs may be prerequisites. They will be all tagged with `nfs-zone`.

History

#1

Updated by Dan McDonald 13 days ago

  • Subject changed from show_group() in sharemgr to show_group() in sharemgr has superfluous call
#2

Updated by Dan McDonald 13 days ago

Testing should be straightforward via truss and having a few existing shares:

truss -t\!all -u 'libshare:sa_get-share' sharemgr show

The number of calls will drop with this fix, but the output should remain the same.

Also available in: Atom PDF