Print this page
11083 support NFS server in zone
Portions contributed by: Dan Kruchinin <dan.kruchinin@nexenta.com>
Portions contributed by: Stepan Zastupov <stepan.zastupov@gmail.com>
Portions contributed by: Joyce McIntosh <joyce.mcintosh@nexenta.com>
Portions contributed by: Mike Zeller <mike@mikezeller.net>
Portions contributed by: Dan McDonald <danmcd@joyent.com>
Portions contributed by: Gordon Ross <gordon.w.ross@gmail.com>
Portions contributed by: Vitaliy Gusev <gusev.vitaliy@gmail.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Jason King <jbk@joyent.com>
Reviewed by: C Fraire <cfraire@me.com>
Change-Id: I22f289d357503f9b48a0bc2482cc4328a6d43d16

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/nfs/nfs4_srv_deleg.c
          +++ new/usr/src/uts/common/fs/nfs/nfs4_srv_deleg.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  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 2009 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25      - * Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
  26   25   */
  27   26  
       27 +/*
       28 + * Copyright 2018 Nexenta Systems, Inc.
       29 + */
       30 +
  28   31  #include <sys/systm.h>
  29   32  #include <rpc/auth.h>
  30   33  #include <rpc/clnt.h>
  31   34  #include <nfs/nfs4_kprot.h>
  32   35  #include <nfs/nfs4.h>
  33   36  #include <nfs/lm.h>
  34   37  #include <sys/cmn_err.h>
  35   38  #include <sys/disp.h>
  36   39  #include <sys/sdt.h>
  37   40  
↓ open down ↓ 3 lines elided ↑ open up ↑
  41   44  #include <sys/ddi.h>
  42   45  
  43   46  #include <sys/vnode.h>
  44   47  #include <sys/sdt.h>
  45   48  #include <inet/common.h>
  46   49  #include <inet/ip.h>
  47   50  #include <inet/ip6.h>
  48   51  
  49   52  #define MAX_READ_DELEGATIONS 5
  50   53  
  51      -krwlock_t rfs4_deleg_policy_lock;
  52      -srv_deleg_policy_t rfs4_deleg_policy = SRV_NEVER_DELEGATE;
  53   54  static int rfs4_deleg_wlp = 5;
  54      -kmutex_t rfs4_deleg_lock;
  55   55  static int rfs4_deleg_disabled;
  56   56  static int rfs4_max_setup_cb_tries = 5;
  57   57  
  58   58  #ifdef DEBUG
  59   59  
  60   60  static int rfs4_test_cbgetattr_fail = 0;
  61   61  int rfs4_cb_null;
  62   62  int rfs4_cb_debug;
  63   63  int rfs4_deleg_debug;
  64   64  
↓ open down ↓ 66 lines elided ↑ open up ↑
 131  131          }
 132  132  
 133  133          return (EINVAL);
 134  134  }
 135  135  
 136  136  /*
 137  137   * Update the delegation policy with the
 138  138   * value of "new_policy"
 139  139   */
 140  140  void
 141      -rfs4_set_deleg_policy(srv_deleg_policy_t new_policy)
      141 +rfs4_set_deleg_policy(nfs4_srv_t *nsrv4, srv_deleg_policy_t new_policy)
 142  142  {
 143      -        rw_enter(&rfs4_deleg_policy_lock, RW_WRITER);
 144      -        rfs4_deleg_policy = new_policy;
 145      -        rw_exit(&rfs4_deleg_policy_lock);
      143 +        rw_enter(&nsrv4->deleg_policy_lock, RW_WRITER);
      144 +        nsrv4->nfs4_deleg_policy = new_policy;
      145 +        rw_exit(&nsrv4->deleg_policy_lock);
 146  146  }
 147  147  
 148  148  void
 149      -rfs4_hold_deleg_policy(void)
      149 +rfs4_hold_deleg_policy(nfs4_srv_t *nsrv4)
 150  150  {
 151      -        rw_enter(&rfs4_deleg_policy_lock, RW_READER);
      151 +        rw_enter(&nsrv4->deleg_policy_lock, RW_READER);
 152  152  }
 153  153  
 154  154  void
 155      -rfs4_rele_deleg_policy(void)
      155 +rfs4_rele_deleg_policy(nfs4_srv_t *nsrv4)
 156  156  {
 157      -        rw_exit(&rfs4_deleg_policy_lock);
      157 +        rw_exit(&nsrv4->deleg_policy_lock);
 158  158  }
 159  159  
      160 +srv_deleg_policy_t
      161 +nfs4_get_deleg_policy()
      162 +{
      163 +        nfs4_srv_t *nsrv4 = nfs4_get_srv();
      164 +        return (nsrv4->nfs4_deleg_policy);
      165 +}
 160  166  
      167 +
 161  168  /*
 162  169   * This free function is to be used when the client struct is being
 163  170   * released and nothing at all is needed of the callback info any
 164  171   * longer.
 165  172   */
 166  173  void
 167  174  rfs4_cbinfo_free(rfs4_cbinfo_t *cbp)
 168  175  {
 169  176          char *addr = cbp->cb_callback.cb_location.r_addr;
 170  177          char *netid = cbp->cb_callback.cb_location.r_netid;
↓ open down ↓ 32 lines elided ↑ open up ↑
 203  210          struct timeval tv;
 204  211          CLIENT *ch;
 205  212          rfs4_cbstate_t newstate;
 206  213          rfs4_cbinfo_t *cbp = &cp->rc_cbinfo;
 207  214  
 208  215          mutex_enter(cbp->cb_lock);
 209  216          /* If another thread is doing CB_NULL RPC then return */
 210  217          if (cbp->cb_nullcaller == TRUE) {
 211  218                  mutex_exit(cbp->cb_lock);
 212  219                  rfs4_client_rele(cp);
 213      -                return;
      220 +                zthread_exit();
 214  221          }
 215  222  
 216  223          /* Mark the cbinfo as having a thread in the NULL callback */
 217  224          cbp->cb_nullcaller = TRUE;
 218  225  
 219  226          /*
 220  227           * Are there other threads still using the cbinfo client
 221  228           * handles?  If so, this thread must wait before going and
 222  229           * mucking aroiund with the callback information
 223  230           */
↓ open down ↓ 47 lines elided ↑ open up ↑
 271  278                  cbp->cb_state = CB_NONE;
 272  279                  cbp->cb_timefailed = 0; /* reset the clock */
 273  280                  cbp->cb_notified_of_cb_path_down = TRUE;
 274  281          }
 275  282  
 276  283          if (cbp->cb_state != CB_NONE) {
 277  284                  cv_broadcast(cbp->cb_cv);       /* let the others know */
 278  285                  cbp->cb_nullcaller = FALSE;
 279  286                  mutex_exit(cbp->cb_lock);
 280  287                  rfs4_client_rele(cp);
 281      -                return;
      288 +                zthread_exit();
 282  289          }
 283  290  
 284  291          /* mark rfs4_client_t as CALLBACK NULL in progress */
 285  292          cbp->cb_state = CB_INPROG;
 286  293          mutex_exit(cbp->cb_lock);
 287  294  
 288  295          /* get/generate a client handle */
 289  296          if ((ch = rfs4_cb_getch(cbp)) == NULL) {
 290  297                  mutex_enter(cbp->cb_lock);
 291  298                  cbp->cb_state = CB_BAD;
↓ open down ↓ 21 lines elided ↑ open up ↑
 313  320                  goto retry;     /* give the CB_NULL another chance */
 314  321          }
 315  322  
 316  323          cbp->cb_state = newstate;
 317  324          if (cbp->cb_state == CB_BAD)
 318  325                  cbp->cb_timefailed = gethrestime_sec(); /* observability */
 319  326  
 320  327          cv_broadcast(cbp->cb_cv);       /* start up the other threads */
 321  328          cbp->cb_nullcaller = FALSE;
 322  329          mutex_exit(cbp->cb_lock);
 323      -
 324  330          rfs4_client_rele(cp);
      331 +        zthread_exit();
 325  332  }
 326  333  
 327  334  /*
 328  335   * Given a client struct, inspect the callback info to see if the
 329  336   * callback path is up and available.
 330  337   *
 331  338   * If new callback path is available and no one has set it up then
 332  339   * try to set it up. If setup is not successful after 5 tries (5 secs)
 333  340   * then gives up and returns NULL.
 334  341   *
↓ open down ↓ 345 lines elided ↑ open up ↑
 680  687  void
 681  688  rfs4_deleg_cb_check(rfs4_client_t *cp)
 682  689  {
 683  690          if (cp->rc_cbinfo.cb_newer.cb_new == FALSE)
 684  691                  return;
 685  692  
 686  693          cp->rc_cbinfo.cb_newer.cb_confirmed = TRUE;
 687  694  
 688  695          rfs4_dbe_hold(cp->rc_dbe); /* hold the client struct for thread */
 689  696  
 690      -        (void) thread_create(NULL, 0, rfs4_do_cb_null, cp, 0, &p0, TS_RUN,
      697 +        (void) zthread_create(NULL, 0, rfs4_do_cb_null, cp, 0,
 691  698              minclsyspri);
 692  699  }
 693  700  
 694  701  static void
 695  702  rfs4args_cb_recall_free(nfs_cb_argop4 *argop)
 696  703  {
 697  704          CB_RECALL4args  *rec_argp;
 698  705  
 699  706          rec_argp = &argop->nfs_cb_argop4_u.opcbrecall;
 700  707          if (rec_argp->fh.nfs_fh4_val)
↓ open down ↓ 240 lines elided ↑ open up ↑
 941  948          fp->rf_dinfo.rd_recall_count--;
 942  949          if (fp->rf_dinfo.rd_recall_count == 0)
 943  950                  cv_signal(fp->rf_dinfo.rd_recall_cv);
 944  951          mutex_exit(fp->rf_dinfo.rd_recall_lock);
 945  952  
 946  953          mutex_enter(&cpr_lock);
 947  954          CALLB_CPR_EXIT(&cpr_info);
 948  955          mutex_destroy(&cpr_lock);
 949  956  
 950  957          rfs4_deleg_state_rele(dsp); /* release the hold for this thread */
 951      -
 952  958          kmem_free(arg, sizeof (struct recall_arg));
      959 +        zthread_exit();
 953  960  }
 954  961  
 955  962  struct master_recall_args {
 956  963      rfs4_file_t *fp;
 957  964      void (*recall)(rfs4_deleg_state_t *, bool_t);
 958  965      bool_t trunc;
 959  966  };
 960  967  
 961  968  static void
 962  969  do_recall_file(struct master_recall_args *map)
↓ open down ↓ 7 lines elided ↑ open up ↑
 970  977  
 971  978          rfs4_dbe_lock(fp->rf_dbe);
 972  979  
 973  980          /* Recall already in progress ? */
 974  981          mutex_enter(fp->rf_dinfo.rd_recall_lock);
 975  982          if (fp->rf_dinfo.rd_recall_count != 0) {
 976  983                  mutex_exit(fp->rf_dinfo.rd_recall_lock);
 977  984                  rfs4_dbe_rele_nolock(fp->rf_dbe);
 978  985                  rfs4_dbe_unlock(fp->rf_dbe);
 979  986                  kmem_free(map, sizeof (struct master_recall_args));
 980      -                return;
      987 +                zthread_exit();
 981  988          }
 982  989  
 983  990          mutex_exit(fp->rf_dinfo.rd_recall_lock);
 984  991  
 985  992          mutex_init(&cpr_lock, NULL, MUTEX_DEFAULT, NULL);
 986  993          CALLB_CPR_INIT(&cpr_info, &cpr_lock, callb_generic_cpr, "v4RecallFile");
 987  994  
 988  995          recall_count = 0;
 989  996          for (dsp = list_head(&fp->rf_delegstatelist); dsp != NULL;
 990  997              dsp = list_next(&fp->rf_delegstatelist, dsp)) {
↓ open down ↓ 12 lines elided ↑ open up ↑
1003 1010                  rfs4_dbe_hold(dsp->rds_dbe);
1004 1011                  rfs4_dbe_unlock(dsp->rds_dbe);
1005 1012  
1006 1013                  arg = kmem_alloc(sizeof (struct recall_arg), KM_SLEEP);
1007 1014                  arg->recall = map->recall;
1008 1015                  arg->trunc = map->trunc;
1009 1016                  arg->dsp = dsp;
1010 1017  
1011 1018                  recall_count++;
1012 1019  
1013      -                (void) thread_create(NULL, 0, do_recall, arg, 0, &p0, TS_RUN,
     1020 +                (void) zthread_create(NULL, 0, do_recall, arg, 0,
1014 1021                      minclsyspri);
1015 1022          }
1016 1023  
1017 1024          rfs4_dbe_unlock(fp->rf_dbe);
1018 1025  
1019 1026          mutex_enter(fp->rf_dinfo.rd_recall_lock);
1020 1027          /*
1021 1028           * Recall count may go negative if the parent thread that is
1022 1029           * creating the individual callback threads does not modify
1023 1030           * the recall_count field before the callback thread actually
↓ open down ↓ 4 lines elided ↑ open up ↑
1028 1035                  cv_wait(fp->rf_dinfo.rd_recall_cv, fp->rf_dinfo.rd_recall_lock);
1029 1036  
1030 1037          mutex_exit(fp->rf_dinfo.rd_recall_lock);
1031 1038  
1032 1039          DTRACE_PROBE1(nfss__i__recall_done, rfs4_file_t *, fp);
1033 1040          rfs4_file_rele(fp);
1034 1041          kmem_free(map, sizeof (struct master_recall_args));
1035 1042          mutex_enter(&cpr_lock);
1036 1043          CALLB_CPR_EXIT(&cpr_info);
1037 1044          mutex_destroy(&cpr_lock);
     1045 +        zthread_exit();
1038 1046  }
1039 1047  
1040 1048  static void
1041 1049  rfs4_recall_file(rfs4_file_t *fp,
1042 1050      void (*recall)(rfs4_deleg_state_t *, bool_t trunc),
1043 1051      bool_t trunc, rfs4_client_t *cp)
1044 1052  {
1045 1053          struct master_recall_args *args;
1046 1054  
1047 1055          rfs4_dbe_lock(fp->rf_dbe);
↓ open down ↓ 15 lines elided ↑ open up ↑
1063 1071          if (cp)
1064 1072                  fp->rf_dinfo.rd_conflicted_client = cp->rc_clientid;
1065 1073  
1066 1074          rfs4_dbe_unlock(fp->rf_dbe);
1067 1075  
1068 1076          args = kmem_alloc(sizeof (struct master_recall_args), KM_SLEEP);
1069 1077          args->fp = fp;
1070 1078          args->recall = recall;
1071 1079          args->trunc = trunc;
1072 1080  
1073      -        (void) thread_create(NULL, 0, do_recall_file, args, 0, &p0, TS_RUN,
     1081 +        (void) zthread_create(NULL, 0, do_recall_file, args, 0,
1074 1082              minclsyspri);
1075 1083  }
1076 1084  
1077 1085  void
1078 1086  rfs4_recall_deleg(rfs4_file_t *fp, bool_t trunc, rfs4_client_t *cp)
1079 1087  {
1080 1088          time_t elapsed1, elapsed2;
1081 1089  
1082 1090          if (fp->rf_dinfo.rd_time_recalled != 0) {
1083 1091                  elapsed1 = gethrestime_sec() - fp->rf_dinfo.rd_time_recalled;
↓ open down ↓ 115 lines elided ↑ open up ↑
1199 1207  
1200 1208          /* Shouldn't get here */
1201 1209          return (OPEN_DELEGATE_NONE);
1202 1210  }
1203 1211  
1204 1212  /*
1205 1213   * Given the desired delegation type and the "history" of the file
1206 1214   * determine the actual delegation type to return.
1207 1215   */
1208 1216  static open_delegation_type4
1209      -rfs4_delegation_policy(open_delegation_type4 dtype,
     1217 +rfs4_delegation_policy(nfs4_srv_t *nsrv4, open_delegation_type4 dtype,
1210 1218      rfs4_dinfo_t *dinfo, clientid4 cid)
1211 1219  {
1212 1220          time_t elapsed;
1213 1221  
1214      -        if (rfs4_deleg_policy != SRV_NORMAL_DELEGATE)
     1222 +        if (nsrv4->nfs4_deleg_policy != SRV_NORMAL_DELEGATE)
1215 1223                  return (OPEN_DELEGATE_NONE);
1216 1224  
1217 1225          /*
1218 1226           * Has this file/delegation ever been recalled?  If not then
1219 1227           * no further checks for a delegation race need to be done.
1220 1228           * However if a recall has occurred, then check to see if a
1221 1229           * client has caused its own delegation recall to occur.  If
1222 1230           * not, then has a delegation for this file been returned
1223 1231           * recently?  If so, then do not assign a new delegation to
1224 1232           * avoid a "delegation race" between the original client and
↓ open down ↓ 22 lines elided ↑ open up ↑
1247 1255  
1248 1256  /*
1249 1257   * Try and grant a delegation for an open give the state. The routine
1250 1258   * returns the delegation type granted. This could be OPEN_DELEGATE_NONE.
1251 1259   *
1252 1260   * The state and associate file entry must be locked
1253 1261   */
1254 1262  rfs4_deleg_state_t *
1255 1263  rfs4_grant_delegation(delegreq_t dreq, rfs4_state_t *sp, int *recall)
1256 1264  {
     1265 +        nfs4_srv_t *nsrv4;
1257 1266          rfs4_file_t *fp = sp->rs_finfo;
1258 1267          open_delegation_type4 dtype;
1259 1268          int no_delegation;
1260 1269  
1261 1270          ASSERT(rfs4_dbe_islocked(sp->rs_dbe));
1262 1271          ASSERT(rfs4_dbe_islocked(fp->rf_dbe));
1263 1272  
     1273 +        nsrv4 = nfs4_get_srv();
     1274 +
1264 1275          /* Is the server even providing delegations? */
1265      -        if (rfs4_deleg_policy == SRV_NEVER_DELEGATE || dreq == DELEG_NONE)
     1276 +        if (nsrv4->nfs4_deleg_policy == SRV_NEVER_DELEGATE ||
     1277 +            dreq == DELEG_NONE) {
1266 1278                  return (NULL);
     1279 +        }
1267 1280  
1268 1281          /* Check to see if delegations have been temporarily disabled */
1269      -        mutex_enter(&rfs4_deleg_lock);
     1282 +        mutex_enter(&nsrv4->deleg_lock);
1270 1283          no_delegation = rfs4_deleg_disabled;
1271      -        mutex_exit(&rfs4_deleg_lock);
     1284 +        mutex_exit(&nsrv4->deleg_lock);
1272 1285  
1273 1286          if (no_delegation)
1274 1287                  return (NULL);
1275 1288  
1276 1289          /* Don't grant a delegation if a deletion is impending. */
1277 1290          if (fp->rf_dinfo.rd_hold_grant > 0) {
1278 1291                  return (NULL);
1279 1292          }
1280 1293  
1281 1294          /*
↓ open down ↓ 60 lines elided ↑ open up ↑
1342 1355                  /* Get the "best" delegation candidate */
1343 1356                  dtype = rfs4_check_delegation(sp, fp);
1344 1357  
1345 1358                  if (dtype == OPEN_DELEGATE_NONE)
1346 1359                          return (NULL);
1347 1360  
1348 1361                  /*
1349 1362                   * Based on policy and the history of the file get the
1350 1363                   * actual delegation.
1351 1364                   */
1352      -                dtype = rfs4_delegation_policy(dtype, &fp->rf_dinfo,
     1365 +                dtype = rfs4_delegation_policy(nsrv4, dtype, &fp->rf_dinfo,
1353 1366                      sp->rs_owner->ro_client->rc_clientid);
1354 1367  
1355 1368                  if (dtype == OPEN_DELEGATE_NONE)
1356 1369                          return (NULL);
1357 1370                  break;
1358 1371          default:
1359 1372                  return (NULL);
1360 1373          }
1361 1374  
1362 1375          /* set the delegation for the state */
↓ open down ↓ 68 lines elided ↑ open up ↑
1431 1444   * recalled, unless the clientid of the caller matches the clientid of the
1432 1445   * delegation. If the caller has specified, there is a slight delay
1433 1446   * inserted in the hopes that the delegation will be returned quickly.
1434 1447   */
1435 1448  bool_t
1436 1449  rfs4_check_delegated_byfp(int mode, rfs4_file_t *fp,
1437 1450      bool_t trunc, bool_t do_delay, bool_t is_rm, clientid4 *cp)
1438 1451  {
1439 1452          rfs4_deleg_state_t *dsp;
1440 1453  
     1454 +        nfs4_srv_t *nsrv4 = nfs4_get_srv();
     1455 +
1441 1456          /* Is delegation enabled? */
1442      -        if (rfs4_deleg_policy == SRV_NEVER_DELEGATE)
     1457 +        if (nsrv4->nfs4_deleg_policy == SRV_NEVER_DELEGATE)
1443 1458                  return (FALSE);
1444 1459  
1445 1460          /* do we have a delegation on this file? */
1446 1461          rfs4_dbe_lock(fp->rf_dbe);
1447 1462          if (fp->rf_dinfo.rd_dtype == OPEN_DELEGATE_NONE) {
1448 1463                  if (is_rm)
1449 1464                          fp->rf_dinfo.rd_hold_grant++;
1450 1465                  rfs4_dbe_unlock(fp->rf_dbe);
1451 1466                  return (FALSE);
1452 1467          }
↓ open down ↓ 44 lines elided ↑ open up ↑
1497 1512  }
1498 1513  
1499 1514  /*
1500 1515   * Check if the file is delegated in the case of a v2 or v3 access.
1501 1516   * Return TRUE if it is delegated which in turn means that v2 should
1502 1517   * drop the request and in the case of v3 JUKEBOX should be returned.
1503 1518   */
1504 1519  bool_t
1505 1520  rfs4_check_delegated(int mode, vnode_t *vp, bool_t trunc)
1506 1521  {
     1522 +        nfs4_srv_t *nsrv4;
1507 1523          rfs4_file_t *fp;
1508 1524          bool_t create = FALSE;
1509 1525          bool_t rc = FALSE;
1510 1526  
1511      -        rfs4_hold_deleg_policy();
     1527 +        nsrv4 = nfs4_get_srv();
     1528 +        rfs4_hold_deleg_policy(nsrv4);
1512 1529  
1513 1530          /* Is delegation enabled? */
1514      -        if (rfs4_deleg_policy != SRV_NEVER_DELEGATE) {
     1531 +        if (nsrv4->nfs4_deleg_policy != SRV_NEVER_DELEGATE) {
1515 1532                  fp = rfs4_findfile(vp, NULL, &create);
1516 1533                  if (fp != NULL) {
1517 1534                          if (rfs4_check_delegated_byfp(mode, fp, trunc,
1518 1535                              TRUE, FALSE, NULL)) {
1519 1536                                  rc = TRUE;
1520 1537                          }
1521 1538                          rfs4_file_rele(fp);
1522 1539                  }
1523 1540          }
1524      -        rfs4_rele_deleg_policy();
     1541 +        rfs4_rele_deleg_policy(nsrv4);
1525 1542          return (rc);
1526 1543  }
1527 1544  
1528 1545  /*
1529 1546   * Release a hold on the hold_grant counter which
1530 1547   * prevents delegation from being granted while a remove
1531 1548   * or a rename is in progress.
1532 1549   */
1533 1550  void
1534 1551  rfs4_clear_dont_grant(rfs4_file_t *fp)
1535 1552  {
1536      -        if (rfs4_deleg_policy == SRV_NEVER_DELEGATE)
     1553 +        nfs4_srv_t *nsrv4 = nfs4_get_srv();
     1554 +
     1555 +        if (nsrv4->nfs4_deleg_policy == SRV_NEVER_DELEGATE)
1537 1556                  return;
1538 1557          rfs4_dbe_lock(fp->rf_dbe);
1539 1558          ASSERT(fp->rf_dinfo.rd_hold_grant > 0);
1540 1559          fp->rf_dinfo.rd_hold_grant--;
1541 1560          fp->rf_dinfo.rd_time_rm_delayed = 0;
1542 1561          rfs4_dbe_unlock(fp->rf_dbe);
1543 1562  }
1544 1563  
1545 1564  /*
1546 1565   * State support for delegation.
↓ open down ↓ 315 lines elided ↑ open up ↑
1862 1881                  if (cp != dsp->rds_client) {
1863 1882                          return (TRUE);
1864 1883                  }
1865 1884          }
1866 1885          return (FALSE);
1867 1886  }
1868 1887  
1869 1888  void
1870 1889  rfs4_disable_delegation(void)
1871 1890  {
1872      -        mutex_enter(&rfs4_deleg_lock);
     1891 +        nfs4_srv_t *nsrv4;
     1892 +
     1893 +        nsrv4 = nfs4_get_srv();
     1894 +        mutex_enter(&nsrv4->deleg_lock);
1873 1895          rfs4_deleg_disabled++;
1874      -        mutex_exit(&rfs4_deleg_lock);
     1896 +        mutex_exit(&nsrv4->deleg_lock);
1875 1897  }
1876 1898  
1877 1899  void
1878 1900  rfs4_enable_delegation(void)
1879 1901  {
1880      -        mutex_enter(&rfs4_deleg_lock);
     1902 +        nfs4_srv_t *nsrv4;
     1903 +
     1904 +        nsrv4 = nfs4_get_srv();
     1905 +        mutex_enter(&nsrv4->deleg_lock);
1881 1906          ASSERT(rfs4_deleg_disabled > 0);
1882 1907          rfs4_deleg_disabled--;
1883      -        mutex_exit(&rfs4_deleg_lock);
     1908 +        mutex_exit(&nsrv4->deleg_lock);
1884 1909  }
1885 1910  
1886 1911  void
1887 1912  rfs4_mon_hold(void *arg)
1888 1913  {
1889 1914          rfs4_file_t *fp = arg;
1890 1915  
1891 1916          rfs4_dbe_hold(fp->rf_dbe);
1892 1917  }
1893 1918  
1894 1919  void
1895 1920  rfs4_mon_rele(void *arg)
1896 1921  {
1897 1922          rfs4_file_t *fp = arg;
1898 1923  
1899 1924          rfs4_dbe_rele_nolock(fp->rf_dbe);
1900 1925  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX