Print this page
OS-1566 filesystem limits for ZFS datasets

@@ -19,10 +19,11 @@
  * CDDL HEADER END
  */
 /*
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2012 Joyent, Inc. All rights reserved.
  */
 
 /*
  * DSL permissions are stored in a two level zap attribute
  * mechanism.   The first level identifies the "class" of

@@ -519,11 +520,12 @@
 
 /*
  * Check if user has requested permission.
  */
 int
-dsl_deleg_access_impl(dsl_dataset_t *ds, const char *perm, cred_t *cr)
+dsl_deleg_access_impl(dsl_dataset_t *ds, const char *perm, cred_t *cr,
+    boolean_t do_lock)
 {
         dsl_dir_t *dd;
         dsl_pool_t *dp;
         void *cookie;
         int     error;

@@ -553,10 +555,11 @@
         }
 
         avl_create(&permsets, perm_set_compare, sizeof (perm_set_t),
             offsetof(perm_set_t, p_node));
 
+        if (do_lock)
         rw_enter(&dp->dp_config_rwlock, RW_READER);
         for (dd = ds->ds_dir; dd != NULL; dd = dd->dd_parent,
             checkflag = ZFS_DELEG_DESCENDENT) {
                 uint64_t zapobj;
                 boolean_t expanded;

@@ -614,10 +617,11 @@
                 if (error == 0)
                         goto success;
         }
         error = EPERM;
 success:
+        if (do_lock)
         rw_exit(&dp->dp_config_rwlock);
 
         cookie = NULL;
         while ((setnode = avl_destroy_nodes(&permsets, &cookie)) != NULL)
                 kmem_free(setnode, sizeof (perm_set_t));

@@ -633,11 +637,11 @@
 
         error = dsl_dataset_hold(dsname, FTAG, &ds);
         if (error)
                 return (error);
 
-        error = dsl_deleg_access_impl(ds, perm, cr);
+        error = dsl_deleg_access_impl(ds, perm, cr, B_TRUE);
         dsl_dataset_rele(ds, FTAG);
 
         return (error);
 }