Print this page
    
NEX-16783 Panic in smbfs_delmap_callback (fix leak)
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Dan Fields <dan.fields@nexenta.com>
5404 smbfs needs mmap support
Portions contributed by: Gordon Ross <gordon.w.ross@gmail.com>
Reviewed by: C Fraire <cfraire@me.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Jason King <jason.brian.king@gmail.com>
Reviewed by: Andrew Stormont <andyjstormont@gmail.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
    
      
        | Split | 
	Close | 
      
      | Expand all | 
      | Collapse all | 
    
    
          --- old/usr/src/uts/common/fs/smbclnt/smbfs/smbfs.h
          +++ new/usr/src/uts/common/fs/smbclnt/smbfs/smbfs.h
   1    1  /*
   2    2   * Copyright (c) 2000-2001, Boris Popov
   3    3   * All rights reserved.
   4    4   *
   5    5   * Redistribution and use in source and binary forms, with or without
   6    6   * modification, are permitted provided that the following conditions
   7    7   * are met:
   8    8   * 1. Redistributions of source code must retain the above copyright
   9    9   *    notice, this list of conditions and the following disclaimer.
  10   10   * 2. Redistributions in binary form must reproduce the above copyright
  11   11   *    notice, this list of conditions and the following disclaimer in the
  12   12   *    documentation and/or other materials provided with the distribution.
  13   13   * 3. All advertising materials mentioning features or use of this software
  14   14   *    must display the following acknowledgement:
  15   15   *    This product includes software developed by Boris Popov.
  16   16   * 4. Neither the name of the author nor the names of any co-contributors
  17   17   *    may be used to endorse or promote products derived from this software
  18   18   *    without specific prior written permission.
  19   19   *
  20   20   * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  21   21   * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  22   22   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  23   23   * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  24   24   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  25   25   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  26   26   * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  27   27   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  28   28   * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  29   29   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  30   30   * SUCH DAMAGE.
  31   31   *
  32   32   * $Id: smbfs.h,v 1.30.100.1 2005/05/27 02:35:28 lindak Exp $
  33   33   */
  34   34  
  35   35  /*
  36   36   * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  37   37   */
  38   38  
  39   39  #ifndef _SMBFS_SMBFS_H
  40   40  #define _SMBFS_SMBFS_H
  41   41  
  42   42  /*
  43   43   * FS-specific VFS structures for smbfs.
  44   44   * (per-mount stuff, etc.)
  45   45   *
  46   46   * This file used to have mount args stuff,
  47   47   * but that's now in sys/fs/smbfs_mount.h
  48   48   */
  49   49  
  50   50  #include <sys/param.h>
  51   51  #include <sys/fstyp.h>
  52   52  #include <sys/avl.h>
  53   53  #include <sys/list.h>
  54   54  #include <sys/t_lock.h>
  55   55  #include <sys/vfs.h>
  56   56  #include <sys/vfs_opreg.h>
  57   57  #include <sys/fs/smbfs_mount.h>
  58   58  #include <sys/zone.h>
  59   59  
  60   60  /*
  61   61   * Path component length
  62   62   *
  63   63   * The generic fs code uses MAXNAMELEN to represent
  64   64   * what the largest component length is, but note:
  65   65   * that length DOES include the terminating NULL.
  66   66   * SMB_MAXFNAMELEN does NOT include the NULL.
  67   67   */
  68   68  #define SMB_MAXFNAMELEN         (MAXNAMELEN-1)  /* 255 */
  69   69  
  70   70  /*
  71   71   * SM_MAX_STATFSTIME is the maximum time to cache statvfs data. Since this
  72   72   * should be a fast call on the server, the time the data cached is short.
  73   73   * That lets the cache handle bursts of statvfs() requests without generating
  74   74   * lots of network traffic.
  75   75   */
  76   76  #define SM_MAX_STATFSTIME 2
  77   77  
  78   78  /* Mask values for smbmount structure sm_status field */
  79   79  #define SM_STATUS_STATFS_BUSY 0x00000001 /* statvfs is in progress */
  80   80  #define SM_STATUS_STATFS_WANT 0x00000002 /* statvfs wakeup is wanted */
  81   81  #define SM_STATUS_TIMEO 0x00000004 /* this mount is not responding */
  82   82  #define SM_STATUS_DEAD  0x00000010 /* connection gone - unmount this */
  83   83  
  84   84  extern const struct fs_operation_def    smbfs_vnodeops_template[];
  85   85  extern struct vnodeops                  *smbfs_vnodeops;
  86   86  
  
    | 
      ↓ open down ↓ | 
    86 lines elided | 
    
      ↑ open up ↑ | 
  
  87   87  struct smbnode;
  88   88  struct smb_share;
  89   89  
  90   90  /*
  91   91   * The values for smi_flags (from nfs_clnt.h)
  92   92   */
  93   93  #define SMI_INT         0x04            /* interrupts allowed */
  94   94  #define SMI_NOAC        0x10            /* don't cache attributes */
  95   95  #define SMI_LLOCK       0x80            /* local locking only */
  96   96  #define SMI_ACL         0x2000          /* share supports ACLs */
       97 +#define SMI_DIRECTIO    0x40000         /* do direct I/O */
  97   98  #define SMI_EXTATTR     0x80000         /* share supports ext. attrs */
  98   99  #define SMI_DEAD        0x200000        /* mount has been terminated */
  99  100  
 100  101  /*
 101  102   * Stuff returned by smbfs_smb_qfsattr
 102  103   * See [CIFS] SMB_QUERY_FS_ATTRIBUTE_INFO
 103  104   */
 104  105  typedef struct smb_fs_attr_info {
 105  106          uint32_t        fsa_aflags;     /* Attr. flags [CIFS 4.1.6.6] */
 106  107          uint32_t        fsa_maxname;    /* max. component length */
 107  108          char            fsa_tname[FSTYPSZ]; /* type name, i.e. "NTFS" */
 108  109  } smb_fs_attr_info_t;
 109  110  
 110  111  /*
 111  112   * Corresponds to Darwin: struct smbmount
 112  113   */
 113  114  typedef struct smbmntinfo {
 114  115          struct vfs              *smi_vfsp;      /* mount back pointer to vfs */
 115  116          struct smbnode          *smi_root;      /* the root node */
 116  117          struct smb_share        *smi_share;     /* netsmb SMB share conn data */
      118 +        struct taskq            *smi_taskq;     /* for async work */
 117  119          kmutex_t                smi_lock;       /* mutex for flags, etc. */
 118  120          uint32_t                smi_flags;      /* NFS-derived flag bits */
 119  121          uint32_t                smi_status;     /* status bits for this mount */
 120  122          hrtime_t                smi_statfstime; /* sm_statvfsbuf cache time */
 121  123          statvfs64_t             smi_statvfsbuf; /* cached statvfs data */
 122  124          kcondvar_t              smi_statvfs_cv;
 123  125          smb_fs_attr_info_t      smi_fsa;        /* SMB FS attributes. */
 124  126  #define smi_fsattr              smi_fsa.fsa_aflags
 125  127  
 126  128          /*
 127  129           * The smbfs node cache for this mount.
 128  130           * Named "hash" for historical reasons.
 129  131           * See smbfs_node.h for details.
 130  132           */
 131  133          avl_tree_t              smi_hash_avl;
 132  134          krwlock_t               smi_hash_lk;
 133  135  
 134  136          /*
 135  137           * Kstat statistics
 136  138           */
 137  139          struct kstat    *smi_io_kstats;
 138  140          struct kstat    *smi_ro_kstats;
 139  141  
 140  142          /*
 141  143           * Zones support.
 142  144           */
 143  145          zone_ref_t              smi_zone_ref;   /* Zone FS is mounted in */
 144  146          list_node_t             smi_zone_node;  /* Link to per-zone smi list */
 145  147          /* Lock for the list is: smi_globals_t -> smg_lock */
 146  148  
 147  149          /*
 148  150           * Stuff copied or derived from the mount args
 149  151           */
 150  152          uid_t           smi_uid;                /* user id */
 151  153          gid_t           smi_gid;                /* group id */
 152  154          mode_t          smi_fmode;              /* mode for files */
 153  155          mode_t          smi_dmode;              /* mode for dirs */
 154  156  
 155  157          hrtime_t        smi_acregmin;   /* min time to hold cached file attr */
 156  158          hrtime_t        smi_acregmax;   /* max time to hold cached file attr */
 157  159          hrtime_t        smi_acdirmin;   /* min time to hold cached dir attr */
 158  160          hrtime_t        smi_acdirmax;   /* max time to hold cached dir attr */
 159  161  } smbmntinfo_t;
 160  162  
 161  163  /*
 162  164   * Attribute cache timeout defaults (in seconds).
 163  165   */
 164  166  #define SMBFS_ACREGMIN  3       /* min secs to hold cached file attr */
 165  167  #define SMBFS_ACREGMAX  60      /* max secs to hold cached file attr */
 166  168  #define SMBFS_ACDIRMIN  30      /* min secs to hold cached dir attr */
 167  169  #define SMBFS_ACDIRMAX  60      /* max secs to hold cached dir attr */
 168  170  /* and limits for the mount options */
 169  171  #define SMBFS_ACMINMAX  600     /* 10 min. is longest min timeout */
 170  172  #define SMBFS_ACMAXMAX  3600    /* 1 hr is longest max timeout */
 171  173  
 172  174  /*
 173  175   * High-res time is nanoseconds.
 174  176   */
 175  177  #define SEC2HR(sec)     ((sec) * (hrtime_t)NANOSEC)
 176  178  
 177  179  /*
 178  180   * vnode pointer to mount info
 179  181   */
 180  182  #define VTOSMI(vp)      ((smbmntinfo_t *)(((vp)->v_vfsp)->vfs_data))
 181  183  #define VFTOSMI(vfsp)   ((smbmntinfo_t *)((vfsp)->vfs_data))
 182  184  #define SMBINTR(vp)     (VTOSMI(vp)->smi_flags & SMI_INT)
 183  185  
 184  186  #endif  /* _SMBFS_SMBFS_H */
  
    | 
      ↓ open down ↓ | 
    58 lines elided | 
    
      ↑ open up ↑ | 
  
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX