Print this page
NEX-19996 exi_id_get_next() calls should be WRITER locked
NEX-20014 NFS v4 state lock mutex exited before entered (on error path)
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by: Joyce McIntosh <joyce.mcintosh@nexenta.com>
NEX-15279 support NFS server in zone
NEX-15520 online NFS shares cause zoneadm halt to hang in nfs_export_zone_fini
Portions contributed by: Dan Kruchinin dan.kruchinin@nexenta.com
Portions contributed by: Stepan Zastupov stepan.zastupov@gmail.com
Reviewed by: Joyce McIntosh <joyce.mcintosh@nexenta.com>
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
NEX-9275 Got "bad mutex" panic when run IO to nfs share from clients
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
NEX-6778 NFS kstats leak and cause system to hang
Revert "NEX-4261 Per-client NFS server IOPS, bandwidth, and latency kstats"
This reverts commit 586c3ab1927647487f01c337ddc011c642575a52.
Revert "NEX-5354 Aggregated IOPS, bandwidth, and latency kstats for NFS server"
This reverts commit c91d7614da8618ef48018102b077f60ecbbac8c2.
Revert "NEX-5667 nfssrv_stats_flags does not work for aggregated kstats"
This reverts commit 3dcf42618be7dd5f408c327f429c81e07ca08e74.
Revert "NEX-5750 Time values for aggregated NFS server kstats should be normalized"
This reverts commit 1f4d4f901153b0191027969fa4a8064f9d3b9ee1.
Revert "NEX-5942 Panic in rfs4_minorvers_mismatch() with NFSv4.1 client"
This reverts commit 40766417094a162f5e4cc8786c0fa0a7e5871cd9.
Revert "NEX-5752 NFS server: namespace collision in kstats"
This reverts commit ae81e668db86050da8e483264acb0cce0444a132.
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
NEX-5667 nfssrv_stats_flags does not work for aggregated kstats
NEX-4472 nfsauth_retrieve() flood caused by NFS clients with personal identity problems
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
NEX-4261 Per-client NFS server IOPS, bandwidth, and latency kstats
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
NEX-3097 IOPS, bandwidth, and latency kstats for NFS server
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
NEX-2345 nfsauth_cache_get() could spend a lot of time walking exi_cache
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
NEX-1974 Support for more than 16 groups with AUTH_SYS
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
NEX-1128 NFS server: Generic uid and gid remapping for AUTH_SYS
Reviewed by: Jan Kryl <jan.kryl@nexenta.com>
re #3541 rb11254 - nfs nohide - "nfssrv: need ability to go to submounts for v3 and v2 protocols"

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/nfs/export.h
          +++ new/usr/src/uts/common/nfs/export.h
↓ open down ↓ 12 lines elided ↑ open up ↑
  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 2016 Nexenta Systems, Inc.  All rights reserved.
       23 + * Copyright 2018 Nexenta Systems, Inc.
  24   24   * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
  25   25   * Copyright 2016 Jason King.
  26   26   */
  27   27  
  28   28  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  29   29  /*        All Rights Reserved   */
  30   30  
  31   31  #ifndef _NFS_EXPORT_H
  32   32  #define _NFS_EXPORT_H
  33   33  
  34   34  #include <nfs/nfs_sec.h>
  35   35  #include <nfs/auth.h>
  36   36  #include <sys/vnode.h>
  37   37  #include <nfs/nfs4.h>
  38   38  #include <sys/kiconv.h>
  39   39  #include <sys/avl.h>
  40   40  
       41 +#ifdef _KERNEL
       42 +#include <sys/pkp_hash.h> /* for PKP_HASH_SIZE */
       43 +#endif /* _KERNEL */
       44 +
  41   45  #ifdef  __cplusplus
  42   46  extern "C" {
  43   47  #endif
  44   48  
  45   49  /*
  46   50   * nfs pseudo flavor number is owned by IANA. Need to make sure the
  47   51   * Solaris specific NFS_FLAVOR_NOMAP number will not overlap with any
  48   52   * new IANA defined pseudo flavor numbers. The chance for the overlap
  49   53   * is very small since the growth of new flavor numbers is expected
  50   54   * to be limited.
↓ open down ↓ 131 lines elided ↑ open up ↑
 182  186  #define EX_VOLFH        0x100   /* XXX nfsv4 fh may expire anytime */
 183  187  #define EX_VOLRNM       0x200   /* XXX nfsv4 fh expire at rename */
 184  188  #define EX_VOLMIG       0x400   /* XXX nfsv4 fh expire at migration */
 185  189  #define EX_NOEXPOPEN    0x800   /* XXX nfsv4 fh no expire with open */
 186  190  #endif /* VOLATILE_FH_TEST */
 187  191  
 188  192  #define EX_CHARMAP      0x1000  /* NFS may need a character set conversion */
 189  193  #define EX_NOACLFAB     0x2000  /* If set, NFSv2 and v3 servers won't */
 190  194                                  /* fabricate an aclent_t ACL on file systems */
 191  195                                  /* that don't support aclent_t ACLs */
      196 +#define EX_NOHIDE       0x4000  /* traversable from exported parent */
 192  197  
 193  198  #ifdef  _KERNEL
 194  199  
 195  200  #define RPC_IDEMPOTENT  0x1     /* idempotent or not */
 196  201  /*
 197  202   * Be very careful about which NFS procedures get the RPC_ALLOWANON bit.
 198  203   * Right now, if this bit is on, we ignore the results of per NFS request
 199  204   * access control.
 200  205   */
 201  206  #define RPC_ALLOWANON   0x2     /* allow anonymous access */
↓ open down ↓ 267 lines elided ↑ open up ↑
 469  474   * TREE_ROOT checks if the node corresponds to a filesystem root
 470  475   * TREE_EXPORTED checks if the node is explicitly shared
 471  476   */
 472  477  
 473  478  #define TREE_ROOT(t) \
 474  479          ((t)->tree_exi && (t)->tree_exi->exi_vp->v_flag & VROOT)
 475  480  
 476  481  #define TREE_EXPORTED(t) \
 477  482          ((t)->tree_exi && !PSEUDO((t)->tree_exi))
 478  483  
 479      -/* Root of nfs pseudo namespace */
 480      -extern treenode_t *ns_root;
 481      -
 482  484  #define EXPTABLESIZE   256
 483  485  
 484  486  struct exp_hash {
 485  487          struct exportinfo       *prev;  /* ptr to the previous exportinfo */
 486  488          struct exportinfo       *next;  /* ptr to the next exportinfo */
 487  489          struct exportinfo       **bckt; /* backpointer to the hash bucket */
 488  490  };
 489  491  
 490  492  /*
 491  493   * A node associated with an export entry on the
↓ open down ↓ 30 lines elided ↑ open up ↑
 522  524          struct log_buffer       *exi_logbuffer;
 523  525          struct exp_visible      *exi_visible;
 524  526          struct charset_cache    *exi_charset;
 525  527          unsigned                exi_volatile_dev:1;
 526  528          unsigned                exi_moved:1;
 527  529  #ifdef VOLATILE_FH_TEST
 528  530          uint32_t                exi_volatile_id;
 529  531          struct ex_vol_rename    *exi_vol_rename;
 530  532          kmutex_t                exi_vol_rename_lock;
 531  533  #endif /* VOLATILE_FH_TEST */
      534 +        int                     exi_id;
      535 +        avl_node_t              exi_id_link;
      536 +        struct exp_kstats       *exi_kstats;
      537 +        zoneid_t                exi_zoneid;
 532  538  };
 533  539  
 534  540  typedef struct exportinfo exportinfo_t;
 535  541  typedef struct exportdata exportdata_t;
 536  542  typedef struct secinfo secinfo_t;
 537  543  
 538  544  /*
 539  545   * exp_visible is a visible list per filesystem. It is for filesystems
 540  546   * that may need a limited view of its contents. A pseudo export and
 541  547   * a real export at the mount point (VROOT) which has a subtree shared
↓ open down ↓ 58 lines elided ↑ open up ↑
 600  606          (vn_is_readonly((cs)->vp) || \
 601  607              (nfsauth4_access((cs)->exi, (cs)->vp, (req), (cs)->basecr, NULL, \
 602  608              NULL, NULL, NULL) & (NFSAUTH_RO | NFSAUTH_LIMITED)))
 603  609  
 604  610  extern int      nfsauth4_access(struct exportinfo *, vnode_t *,
 605  611      struct svc_req *, cred_t *, uid_t *, gid_t *, uint_t *, gid_t **);
 606  612  extern int      nfsauth4_secinfo_access(struct exportinfo *,
 607  613      struct svc_req *, int, int, cred_t *);
 608  614  extern int      nfsauth_cache_clnt_compar(const void *, const void *);
 609  615  extern int      nfs_fhbcmp(char *, char *, int);
 610      -extern int      nfs_exportinit(void);
      616 +extern void     nfs_exportinit(void);
 611  617  extern void     nfs_exportfini(void);
 612  618  extern int      chk_clnt_sec(struct exportinfo *, struct svc_req *);
 613  619  extern int      makefh(fhandle_t *, struct vnode *, struct exportinfo *);
 614  620  extern int      makefh_ol(fhandle_t *, struct exportinfo *, uint_t);
 615  621  extern int      makefh3(nfs_fh3 *, struct vnode *, struct exportinfo *);
 616  622  extern int      makefh3_ol(nfs_fh3 *, struct exportinfo *, uint_t);
 617  623  extern vnode_t *nfs_fhtovp(fhandle_t *, struct exportinfo *);
 618  624  extern vnode_t *nfs3_fhtovp(nfs_fh3 *, struct exportinfo *);
 619  625  extern struct   exportinfo *checkexport(fsid_t *, struct fid *);
 620  626  extern struct   exportinfo *checkexport4(fsid_t *, struct fid *, vnode_t *);
 621  627  extern void     exi_hold(struct exportinfo *);
 622      -extern void     exi_rele(struct exportinfo *);
      628 +extern void     exi_rele(struct exportinfo **);
 623  629  extern struct exportinfo *nfs_vptoexi(vnode_t *, vnode_t *, cred_t *, int *,
 624  630      int *, bool_t);
 625  631  extern int      nfs_check_vpexi(vnode_t *, vnode_t *, cred_t *,
 626  632                          struct exportinfo **);
 627      -extern void     export_link(struct exportinfo *);
 628      -extern void     export_unlink(struct exportinfo *);
 629  633  extern vnode_t *untraverse(vnode_t *);
 630  634  extern int      vn_is_nfs_reparse(vnode_t *, cred_t *);
 631  635  extern int      client_is_downrev(struct svc_req *);
 632  636  extern char    *build_symlink(vnode_t *, cred_t *, size_t *);
 633  637  
      638 +extern fhandle_t nullfh2;       /* for comparing V2 filehandles */
      639 +
      640 +typedef struct nfs_export {
      641 +        /* Root of nfs pseudo namespace */
      642 +        treenode_t *ns_root;
      643 +
      644 +        struct exportinfo *exptable_path_hash[PKP_HASH_SIZE];
      645 +        struct exportinfo *exptable[EXPTABLESIZE];
      646 +
      647 +        /*
      648 +         * Read/Write lock that protects the exportinfo list.  This lock
      649 +         * must be held when searching or modifiying the exportinfo list.
      650 +         */
      651 +        krwlock_t exported_lock;
      652 +
      653 +        /* "public" and default (root) location for public filehandle */
      654 +        struct exportinfo *exi_public, *exi_root;
      655 +        /* For checking default public file handle */
      656 +        fid_t exi_rootfid;
      657 +        /* For comparing V2 filehandles */
      658 +        fhandle_t nullfh2;
      659 +
      660 +        /* The change attribute value of the root of nfs pseudo namespace */
      661 +        timespec_t ns_root_change;
      662 +} nfs_export_t;
      663 +
 634  664  /*
 635  665   * Functions that handle the NFSv4 server namespace
 636  666   */
 637  667  extern exportinfo_t *vis2exi(treenode_t *);
 638  668  extern int      treeclimb_export(struct exportinfo *);
 639      -extern void     treeclimb_unexport(struct exportinfo *);
      669 +extern void     treeclimb_unexport(nfs_export_t *, struct exportinfo *);
 640  670  extern int      nfs_visible(struct exportinfo *, vnode_t *, int *);
 641  671  extern int      nfs_visible_inode(struct exportinfo *, ino64_t,
 642      -    struct exp_visible **);
      672 +                    struct exp_visible **);
 643  673  extern int      has_visible(struct exportinfo *, vnode_t *);
 644  674  extern void     free_visible(struct exp_visible *);
 645  675  extern int      nfs_exported(struct exportinfo *, vnode_t *);
 646      -extern struct exportinfo *pseudo_exportfs(vnode_t *, fid_t *,
 647      -    struct exp_visible *, struct exportdata *);
      676 +extern struct exportinfo *pseudo_exportfs(nfs_export_t *, vnode_t *, fid_t *,
      677 +                    struct exp_visible *, struct exportdata *);
 648  678  extern int      vop_fid_pseudo(vnode_t *, fid_t *);
 649  679  extern int      nfs4_vget_pseudo(struct exportinfo *, vnode_t **, fid_t *);
 650  680  extern bool_t   nfs_visible_change(struct exportinfo *, vnode_t *,
 651      -    timespec_t *);
 652      -extern void     tree_update_change(treenode_t *, timespec_t *);
      681 +                    timespec_t *);
      682 +extern void     tree_update_change(nfs_export_t *, treenode_t *, timespec_t *);
      683 +
 653  684  /*
 654  685   * Functions that handle the NFSv4 server namespace security flavors
 655  686   * information.
 656  687   */
 657  688  extern void     srv_secinfo_exp2pseu(struct exportdata *, struct exportdata *);
 658  689  extern void     srv_secinfo_list_free(struct secinfo *, int);
 659  690  
      691 +extern nfs_export_t *nfs_get_export();
      692 +extern void     export_link(nfs_export_t *, struct exportinfo *);
      693 +extern void     export_unlink(nfs_export_t *, struct exportinfo *);
      694 +
 660  695  /*
 661      - * "public" and default (root) location for public filehandle
      696 + * exi_id support
 662  697   */
 663      -extern struct exportinfo *exi_public, *exi_root;
 664      -extern fhandle_t nullfh2;       /* for comparing V2 filehandles */
 665      -extern krwlock_t exported_lock;
 666      -extern struct exportinfo *exptable[];
      698 +extern kmutex_t  nfs_exi_id_lock;
      699 +extern avl_tree_t exi_id_tree;
      700 +extern int exi_id_get_next(void);
 667  701  
 668  702  /*
 669  703   * Two macros for identifying public filehandles.
 670  704   * A v2 public filehandle is 32 zero bytes.
 671  705   * A v3 public filehandle is zero length.
 672  706   */
 673  707  #define PUBLIC_FH2(fh) \
 674  708          ((fh)->fh_fsid.val[1] == 0 && \
 675  709          bcmp((fh), &nullfh2, sizeof (fhandle_t)) == 0)
 676  710  
↓ open down ↓ 13 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX