Print this page
NEX-16159 Time spent sharing SMB filesystems could be reduced by optimizing smb_getdataset for default mount points
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Reviewed by: Matt Barden <matt.barden@nexenta.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/smbsrv/libmlsvc/common/srvsvc_sd.c
          +++ new/usr/src/lib/smbsrv/libmlsvc/common/srvsvc_sd.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
       24 + * Copyright 2018 Nexenta Systems, Inc.  All rights reserved.
  24   25   */
  25   26  
  26   27  /*
  27   28   * This is a helper file to get/set Windows SD. This is used by
  28   29   * SRVSVC service.
  29   30   */
  30   31  #include <strings.h>
  31   32  #include <libzfs.h>
  32   33  
  33   34  #include <smbsrv/libsmb.h>
↓ open down ↓ 18 lines elided ↑ open up ↑
  52   53   */
  53   54  static int
  54   55  srvsvc_shareacl_getpath(smb_share_t *si, char *shr_acl_path)
  55   56  {
  56   57          char dataset[MAXPATHLEN];
  57   58          char mp[ZFS_MAXPROPLEN];
  58   59          libzfs_handle_t *libhd;
  59   60          zfs_handle_t *zfshd;
  60   61          int ret = 0;
  61   62  
  62      -        ret = smb_getdataset(si->shr_path, dataset, MAXPATHLEN);
  63      -        if (ret != 0)
  64      -                return (ret);
  65      -
  66   63          if ((libhd = libzfs_init()) == NULL)
  67   64                  return (-1);
  68   65  
       66 +        ret = smb_getdataset(libhd, si->shr_path, dataset, MAXPATHLEN);
       67 +        if (ret != 0) {
       68 +                libzfs_fini(libhd);
       69 +                return (ret);
       70 +        }
       71 +
       72 +
  69   73          if ((zfshd = zfs_open(libhd, dataset, ZFS_TYPE_DATASET)) == NULL) {
  70   74                  libzfs_fini(libhd);
  71   75                  return (-1);
  72   76          }
  73   77  
  74   78          if (zfs_prop_get(zfshd, ZFS_PROP_MOUNTPOINT, mp, sizeof (mp), NULL,
  75   79              NULL, 0, B_FALSE) != 0) {
  76   80                  zfs_close(zfshd);
  77   81                  libzfs_fini(libhd);
  78   82                  return (-1);
↓ open down ↓ 456 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX