nfs_clvnops.c (234742) | nfs_clvnops.c (235332) |
---|---|
1/*- 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Rick Macklem at The University of Guelph. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 19 unchanged lines hidden (view full) --- 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 * from nfs_vnops.c 8.16 (Berkeley) 5/27/95 33 */ 34 35#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Rick Macklem at The University of Guelph. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 19 unchanged lines hidden (view full) --- 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 * from nfs_vnops.c 8.16 (Berkeley) 5/27/95 33 */ 34 35#include <sys/cdefs.h> |
36__FBSDID("$FreeBSD: head/sys/fs/nfsclient/nfs_clvnops.c 234742 2012-04-27 22:23:06Z rmacklem $"); | 36__FBSDID("$FreeBSD: head/sys/fs/nfsclient/nfs_clvnops.c 235332 2012-05-12 12:02:51Z rmacklem $"); |
37 38/* 39 * vnode op calls for Sun NFS version 2, 3 and 4 40 */ 41 42#include "opt_kdtrace.h" 43#include "opt_inet.h" 44 --- 463 unchanged lines hidden (view full) --- 508static int 509nfs_open(struct vop_open_args *ap) 510{ 511 struct vnode *vp = ap->a_vp; 512 struct nfsnode *np = VTONFS(vp); 513 struct vattr vattr; 514 int error; 515 int fmode = ap->a_mode; | 37 38/* 39 * vnode op calls for Sun NFS version 2, 3 and 4 40 */ 41 42#include "opt_kdtrace.h" 43#include "opt_inet.h" 44 --- 463 unchanged lines hidden (view full) --- 508static int 509nfs_open(struct vop_open_args *ap) 510{ 511 struct vnode *vp = ap->a_vp; 512 struct nfsnode *np = VTONFS(vp); 513 struct vattr vattr; 514 int error; 515 int fmode = ap->a_mode; |
516 struct ucred *cred; |
|
516 517 if (vp->v_type != VREG && vp->v_type != VDIR && vp->v_type != VLNK) 518 return (EOPNOTSUPP); 519 520 /* 521 * For NFSv4, we need to do the Open Op before cache validation, 522 * so that we conform to RFC3530 Sec. 9.3.1. 523 */ --- 75 unchanged lines hidden (view full) --- 599 (void) nfsrpc_close(vp, 0, ap->a_td); 600 return (error); 601 } 602 mtx_lock(&np->n_mtx); 603 np->n_flag |= NNONCACHE; 604 } 605 np->n_directio_opens++; 606 } | 517 518 if (vp->v_type != VREG && vp->v_type != VDIR && vp->v_type != VLNK) 519 return (EOPNOTSUPP); 520 521 /* 522 * For NFSv4, we need to do the Open Op before cache validation, 523 * so that we conform to RFC3530 Sec. 9.3.1. 524 */ --- 75 unchanged lines hidden (view full) --- 600 (void) nfsrpc_close(vp, 0, ap->a_td); 601 return (error); 602 } 603 mtx_lock(&np->n_mtx); 604 np->n_flag |= NNONCACHE; 605 } 606 np->n_directio_opens++; 607 } |
608 609 /* 610 * If this is an open for writing, capture a reference to the 611 * credentials, so they can be used by ncl_putpages(). Using 612 * these write credentials is preferable to the credentials of 613 * whatever thread happens to be doing the VOP_PUTPAGES() since 614 * the write RPCs are less likely to fail with EACCES. 615 */ 616 if ((fmode & FWRITE) != 0) { 617 cred = np->n_writecred; 618 np->n_writecred = crhold(ap->a_cred); 619 } else 620 cred = NULL; |
|
607 mtx_unlock(&np->n_mtx); | 621 mtx_unlock(&np->n_mtx); |
622 if (cred != NULL) 623 crfree(cred); |
|
608 vnode_create_vobject(vp, vattr.va_size, ap->a_td); 609 return (0); 610} 611 612/* 613 * nfs close vnode op 614 * What an NFS client should do upon close after writing is a debatable issue. 615 * Most NFS clients push delayed writes to the server upon close, basically for --- 2865 unchanged lines hidden --- | 624 vnode_create_vobject(vp, vattr.va_size, ap->a_td); 625 return (0); 626} 627 628/* 629 * nfs close vnode op 630 * What an NFS client should do upon close after writing is a debatable issue. 631 * Most NFS clients push delayed writes to the server upon close, basically for --- 2865 unchanged lines hidden --- |