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/nfs_client.c
          +++ new/usr/src/uts/common/fs/nfs/nfs_client.c
↓ open down ↓ 10 lines elided ↑ open up ↑
  11   11   * and limitations under the License.
  12   12   *
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  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   * Copyright (c) 1986, 2010, Oracle and/or its affiliates. All rights reserved.
  23      - *
  24      - *      Copyright (c) 1983,1984,1985,1986,1987,1988,1989  AT&T.
       24 + */
       25 +
       26 +/*
       27 + *      Copyright (c) 1983,1984,1985,1986,1987,1988,1989  AT&T.
  25   28   *      All rights reserved.
  26   29   */
  27   30  
       31 +/*
       32 + * Copyright 2018 Nexenta Systems, Inc.
       33 + */
       34 +
  28   35  #include <sys/param.h>
  29   36  #include <sys/types.h>
  30   37  #include <sys/systm.h>
  31   38  #include <sys/thread.h>
  32   39  #include <sys/t_lock.h>
  33   40  #include <sys/time.h>
  34   41  #include <sys/vnode.h>
  35   42  #include <sys/vfs.h>
  36   43  #include <sys/errno.h>
  37   44  #include <sys/buf.h>
↓ open down ↓ 15 lines elided ↑ open up ↑
  53   60  #include <sys/list.h>
  54   61  #include <sys/zone.h>
  55   62  
  56   63  #include <rpc/types.h>
  57   64  #include <rpc/xdr.h>
  58   65  #include <rpc/auth.h>
  59   66  #include <rpc/clnt.h>
  60   67  
  61   68  #include <nfs/nfs.h>
  62   69  #include <nfs/nfs_clnt.h>
       70 +#include <nfs/nfs_cmd.h>
  63   71  
  64   72  #include <nfs/rnode.h>
  65   73  #include <nfs/nfs_acl.h>
  66   74  #include <nfs/lm.h>
  67   75  
  68   76  #include <vm/hat.h>
  69   77  #include <vm/as.h>
  70   78  #include <vm/page.h>
  71   79  #include <vm/pvn.h>
  72   80  #include <vm/seg.h>
↓ open down ↓ 2716 lines elided ↑ open up ↑
2789 2797                  nfs_mi_free_globals(mig);
2790 2798                  return;
2791 2799          }
2792 2800          mutex_exit(&mig->mig_lock);
2793 2801  }
2794 2802  
2795 2803  /*
2796 2804   * NFS Client initialization routine.  This routine should only be called
2797 2805   * once.  It performs the following tasks:
2798 2806   *      - Initalize all global locks
2799      - *      - Call sub-initialization routines (localize access to variables)
     2807 + *      - Call sub-initialization routines (localize access to variables)
2800 2808   */
2801 2809  int
2802 2810  nfs_clntinit(void)
2803 2811  {
2804 2812  #ifdef DEBUG
2805 2813          static boolean_t nfs_clntup = B_FALSE;
2806 2814  #endif
2807 2815          int error;
2808 2816  
2809 2817  #ifdef DEBUG
↓ open down ↓ 10 lines elided ↑ open up ↑
2820 2828                   * Cleanup nfs_subrinit() work
2821 2829                   */
2822 2830                  nfs_subrfini();
2823 2831                  return (error);
2824 2832          }
2825 2833          zone_key_create(&mi_list_key, nfs_mi_init, nfs_mi_shutdown,
2826 2834              nfs_mi_destroy);
2827 2835  
2828 2836          nfs4_clnt_init();
2829 2837  
     2838 +        nfscmd_init();
     2839 +
2830 2840  #ifdef DEBUG
2831 2841          nfs_clntup = B_TRUE;
2832 2842  #endif
2833 2843  
2834 2844          return (0);
2835 2845  }
2836 2846  
2837 2847  /*
2838 2848   * This routine is only called if the NFS Client has been initialized but
2839 2849   * the module failed to be installed. This routine will cleanup the previously
2840 2850   * allocated/initialized work.
2841 2851   */
2842 2852  void
2843 2853  nfs_clntfini(void)
2844 2854  {
2845 2855          (void) zone_key_delete(mi_list_key);
2846 2856          nfs_subrfini();
2847 2857          nfs_vfsfini();
2848 2858          nfs4_clnt_fini();
     2859 +        nfscmd_fini();
2849 2860  }
2850 2861  
2851 2862  /*
2852 2863   * nfs_lockrelease:
2853 2864   *
2854 2865   * Release any locks on the given vnode that are held by the current
2855 2866   * process.
2856 2867   */
2857 2868  void
2858 2869  nfs_lockrelease(vnode_t *vp, int flag, offset_t offset, cred_t *cr)
↓ open down ↓ 480 lines elided ↑ open up ↑
3339 3350  {
3340 3351          kmem_free(delmap_call, sizeof (nfs_delmapcall_t));
3341 3352  }
3342 3353  
3343 3354  /*
3344 3355   * Searches for the current delmap caller (based on curthread) in the list of
3345 3356   * callers.  If it is found, we remove it and free the delmap caller.
3346 3357   * Returns:
3347 3358   *      0 if the caller wasn't found
3348 3359   *      1 if the caller was found, removed and freed.  *errp is set to what
3349      - *      the result of the delmap was.
     3360 + *      the result of the delmap was.
3350 3361   */
3351 3362  int
3352 3363  nfs_find_and_delete_delmapcall(rnode_t *rp, int *errp)
3353 3364  {
3354 3365          nfs_delmapcall_t        *delmap_call;
3355 3366  
3356 3367          /*
3357 3368           * If the list doesn't exist yet, we create it and return
3358 3369           * that the caller wasn't found.  No list = no callers.
3359 3370           */
↓ open down ↓ 26 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX