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>
        
*** 19,28 ****
--- 19,29 ----
   * CDDL HEADER END
   */
  
  /*
   * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+  * Copyright 2018 Nexenta Systems, Inc.  All rights reserved.
   */
  
  /*
   * This is a helper file to get/set Windows SD. This is used by
   * SRVSVC service.
*** 57,73 ****
          char mp[ZFS_MAXPROPLEN];
          libzfs_handle_t *libhd;
          zfs_handle_t *zfshd;
          int ret = 0;
  
-         ret = smb_getdataset(si->shr_path, dataset, MAXPATHLEN);
-         if (ret != 0)
-                 return (ret);
- 
          if ((libhd = libzfs_init()) == NULL)
                  return (-1);
  
          if ((zfshd = zfs_open(libhd, dataset, ZFS_TYPE_DATASET)) == NULL) {
                  libzfs_fini(libhd);
                  return (-1);
          }
  
--- 58,77 ----
          char mp[ZFS_MAXPROPLEN];
          libzfs_handle_t *libhd;
          zfs_handle_t *zfshd;
          int ret = 0;
  
          if ((libhd = libzfs_init()) == NULL)
                  return (-1);
  
+         ret = smb_getdataset(libhd, si->shr_path, dataset, MAXPATHLEN);
+         if (ret != 0) {
+                 libzfs_fini(libhd);
+                 return (ret);
+         }
+ 
+ 
          if ((zfshd = zfs_open(libhd, dataset, ZFS_TYPE_DATASET)) == NULL) {
                  libzfs_fini(libhd);
                  return (-1);
          }