Print this page
NEX-16818 Add fksmbcl development tool
NEX-17264 SMB client test tp_smbutil_013 fails after NEX-14666
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Matt Barden <matt.barden@nexenta.com>
and: (fix ref leaks)
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>


  18  *    without specific prior written permission.
  19  *
  20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  23  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  24  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  25  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  26  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  30  * SUCH DAMAGE.
  31  *
  32  * $Id: smbfs_node.c,v 1.54.52.1 2005/05/27 02:35:28 lindak Exp $
  33  */
  34 
  35 /*
  36  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  37  * Use is subject to license terms.


  38  */
  39 
  40 #include <sys/param.h>
  41 #include <sys/systm.h>
  42 #include <sys/cred.h>

  43 #include <sys/time.h>
  44 #include <sys/vfs.h>
  45 #include <sys/vnode.h>
  46 #include <sys/kmem.h>
  47 #include <sys/stat.h>
  48 #include <sys/atomic.h>
  49 #include <sys/cmn_err.h>
  50 #include <sys/sysmacros.h>
  51 #include <sys/bitmap.h>
  52 
  53 #include <netsmb/smb_osdep.h>
  54 
  55 #include <netsmb/smb.h>
  56 #include <netsmb/smb_conn.h>
  57 #include <netsmb/smb_subr.h>
  58 
  59 #include <smbfs/smbfs.h>
  60 #include <smbfs/smbfs_node.h>
  61 #include <smbfs/smbfs_subr.h>
  62 


 185         ASSERT(np != NULL);
 186         vp = SMBTOV(np);
 187 
 188         /*
 189          * Files in an XATTR dir are also XATTR.
 190          */
 191         if (dnp->n_flag & N_XATTR) {
 192                 mutex_enter(&np->r_statelock);
 193                 np->n_flag |= N_XATTR;
 194                 mutex_exit(&np->r_statelock);
 195         }
 196 
 197         /* BSD symlink hack removed (smb_symmagic) */
 198 
 199         *vpp = vp;
 200 
 201         return (0);
 202 }
 203 
 204 /*
 205  * smbfs_attrcache_enter, smbfs_attrcache_lookup replaced by
 206  * code more closely resembling NFS.  See smbfs_client.c
 207  */
 208 
 209 /*
 210  * Update the local notion of the mtime of some directory.
 211  * See comments re. r_mtime in smbfs_node.h
 212  */
 213 void
 214 smbfs_attr_touchdir(struct smbnode *dnp)
 215 {
 216 
 217         mutex_enter(&dnp->r_statelock);
 218 
 219         /*
 220          * Now that we keep the client's notion of mtime
 221          * separately from the server, this is easy.
 222          */
 223         dnp->r_mtime = gethrtime();
 224 
 225         /*
 226          * Invalidate the cache, so that we go to the wire
 227          * to check that the server doesn't have a better
 228          * timestamp next time we care.
 229          */




  18  *    without specific prior written permission.
  19  *
  20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  23  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  24  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  25  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  26  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  30  * SUCH DAMAGE.
  31  *
  32  * $Id: smbfs_node.c,v 1.54.52.1 2005/05/27 02:35:28 lindak Exp $
  33  */
  34 
  35 /*
  36  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  37  * Use is subject to license terms.
  38  *
  39  * Copyright 2017 Nexenta Systems, Inc.  All rights reserved.
  40  */
  41 
  42 #include <sys/param.h>
  43 #include <sys/systm.h>
  44 #include <sys/cred.h>
  45 #include <sys/errno.h>
  46 #include <sys/time.h>
  47 #include <sys/vfs.h>
  48 #include <sys/vnode.h>
  49 #include <sys/kmem.h>
  50 #include <sys/stat.h>
  51 #include <sys/atomic.h>
  52 #include <sys/cmn_err.h>
  53 #include <sys/sysmacros.h>
  54 #include <sys/bitmap.h>
  55 
  56 #include <netsmb/smb_osdep.h>
  57 
  58 #include <netsmb/smb.h>
  59 #include <netsmb/smb_conn.h>
  60 #include <netsmb/smb_subr.h>
  61 
  62 #include <smbfs/smbfs.h>
  63 #include <smbfs/smbfs_node.h>
  64 #include <smbfs/smbfs_subr.h>
  65 


 188         ASSERT(np != NULL);
 189         vp = SMBTOV(np);
 190 
 191         /*
 192          * Files in an XATTR dir are also XATTR.
 193          */
 194         if (dnp->n_flag & N_XATTR) {
 195                 mutex_enter(&np->r_statelock);
 196                 np->n_flag |= N_XATTR;
 197                 mutex_exit(&np->r_statelock);
 198         }
 199 
 200         /* BSD symlink hack removed (smb_symmagic) */
 201 
 202         *vpp = vp;
 203 
 204         return (0);
 205 }
 206 
 207 /*





 208  * Update the local notion of the mtime of some directory.
 209  * See comments re. r_mtime in smbfs_node.h
 210  */
 211 void
 212 smbfs_attr_touchdir(struct smbnode *dnp)
 213 {
 214 
 215         mutex_enter(&dnp->r_statelock);
 216 
 217         /*
 218          * Now that we keep the client's notion of mtime
 219          * separately from the server, this is easy.
 220          */
 221         dnp->r_mtime = gethrtime();
 222 
 223         /*
 224          * Invalidate the cache, so that we go to the wire
 225          * to check that the server doesn't have a better
 226          * timestamp next time we care.
 227          */