Print this page
OS-1566 filesystem limits for ZFS datasets

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/dsl_deleg.c
          +++ new/usr/src/uts/common/fs/zfs/dsl_deleg.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   * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   * Copyright (c) 2012 by Delphix. All rights reserved.
       24 + * Copyright (c) 2012 Joyent, Inc. All rights reserved.
  24   25   */
  25   26  
  26   27  /*
  27   28   * DSL permissions are stored in a two level zap attribute
  28   29   * mechanism.   The first level identifies the "class" of
  29   30   * entry.  The class is identified by the first 2 letters of
  30   31   * the attribute.  The second letter "l" or "d" identifies whether
  31   32   * it is a local or descendent permission.  The first letter
  32   33   * identifies the type of entry.
  33   34   *
↓ open down ↓ 480 lines elided ↑ open up ↑
 514  515                  id = gids[i];
 515  516                  (void) dsl_load_sets(mos, zapobj,
 516  517                      ZFS_DELEG_GROUP_SETS, checkflag, &id, avl);
 517  518          }
 518  519  }
 519  520  
 520  521  /*
 521  522   * Check if user has requested permission.
 522  523   */
 523  524  int
 524      -dsl_deleg_access_impl(dsl_dataset_t *ds, const char *perm, cred_t *cr)
      525 +dsl_deleg_access_impl(dsl_dataset_t *ds, const char *perm, cred_t *cr,
      526 +    boolean_t do_lock)
 525  527  {
 526  528          dsl_dir_t *dd;
 527  529          dsl_pool_t *dp;
 528  530          void *cookie;
 529  531          int     error;
 530  532          char    checkflag;
 531  533          objset_t *mos;
 532  534          avl_tree_t permsets;
 533  535          perm_set_t *setnode;
 534  536  
↓ open down ↓ 13 lines elided ↑ open up ↑
 548  550                   * local permissions do not apply.
 549  551                   */
 550  552                  checkflag = ZFS_DELEG_DESCENDENT;
 551  553          } else {
 552  554                  checkflag = ZFS_DELEG_LOCAL;
 553  555          }
 554  556  
 555  557          avl_create(&permsets, perm_set_compare, sizeof (perm_set_t),
 556  558              offsetof(perm_set_t, p_node));
 557  559  
 558      -        rw_enter(&dp->dp_config_rwlock, RW_READER);
      560 +        if (do_lock)
      561 +                rw_enter(&dp->dp_config_rwlock, RW_READER);
 559  562          for (dd = ds->ds_dir; dd != NULL; dd = dd->dd_parent,
 560  563              checkflag = ZFS_DELEG_DESCENDENT) {
 561  564                  uint64_t zapobj;
 562  565                  boolean_t expanded;
 563  566  
 564  567                  /*
 565  568                   * If not in global zone then make sure
 566  569                   * the zoned property is set
 567  570                   */
 568  571                  if (!INGLOBALZONE(curproc)) {
↓ open down ↓ 40 lines elided ↑ open up ↑
 609  612                   */
 610  613                  if (expanded)
 611  614                          goto again;
 612  615  
 613  616                  error = dsl_check_user_access(mos, zapobj, perm, checkflag, cr);
 614  617                  if (error == 0)
 615  618                          goto success;
 616  619          }
 617  620          error = EPERM;
 618  621  success:
 619      -        rw_exit(&dp->dp_config_rwlock);
      622 +        if (do_lock)
      623 +                rw_exit(&dp->dp_config_rwlock);
 620  624  
 621  625          cookie = NULL;
 622  626          while ((setnode = avl_destroy_nodes(&permsets, &cookie)) != NULL)
 623  627                  kmem_free(setnode, sizeof (perm_set_t));
 624  628  
 625  629          return (error);
 626  630  }
 627  631  
 628  632  int
 629  633  dsl_deleg_access(const char *dsname, const char *perm, cred_t *cr)
 630  634  {
 631  635          dsl_dataset_t *ds;
 632  636          int error;
 633  637  
 634  638          error = dsl_dataset_hold(dsname, FTAG, &ds);
 635  639          if (error)
 636  640                  return (error);
 637  641  
 638      -        error = dsl_deleg_access_impl(ds, perm, cr);
      642 +        error = dsl_deleg_access_impl(ds, perm, cr, B_TRUE);
 639  643          dsl_dataset_rele(ds, FTAG);
 640  644  
 641  645          return (error);
 642  646  }
 643  647  
 644  648  /*
 645  649   * Other routines.
 646  650   */
 647  651  
 648  652  static void
↓ open down ↓ 91 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX