aboutsummaryrefslogtreecommitdiff
path: root/sys/fs/nfsclient/nfs_clvnops.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/fs/nfsclient/nfs_clvnops.c')
-rw-r--r--sys/fs/nfsclient/nfs_clvnops.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c
index 52f72dc43c3f..e9ae91e046e7 100644
--- a/sys/fs/nfsclient/nfs_clvnops.c
+++ b/sys/fs/nfsclient/nfs_clvnops.c
@@ -1026,7 +1026,7 @@ nfs_getattr(struct vop_getattr_args *ap)
* cached attributes should be ignored.
*/
if (nmp->nm_fhsize > 0 && ncl_getattrcache(vp, &vattr) == 0) {
- ncl_copy_vattr(vap, &vattr);
+ ncl_copy_vattr(vp, vap, &vattr);
/*
* Get the local modify time for the case of a write
@@ -1284,7 +1284,7 @@ nfs_lookup(struct vop_lookup_args *ap)
bool is_nameddir, needs_nameddir, opennamed;
dattrflag = 0;
- *vpp = NULLVP;
+ *vpp = NULL;
nmp = VFSTONFS(mp);
opennamed = (flags & (OPENNAMED | ISLASTCN)) == (OPENNAMED | ISLASTCN);
if (opennamed && (!NFSHASNFSV4(nmp) || !NFSHASNFSV4N(nmp)))
@@ -1309,7 +1309,7 @@ nfs_lookup(struct vop_lookup_args *ap)
/*
* If the named attribute directory is needed, acquire it now.
*/
- newvp = NULLVP;
+ newvp = NULL;
if (needs_nameddir) {
KASSERT(np->n_v4 == NULL, ("nfs_lookup: O_NAMEDATTR when"
" n_v4 not NULL"));
@@ -1322,10 +1322,10 @@ nfs_lookup(struct vop_lookup_args *ap)
}
dvp = newvp;
np = VTONFS(dvp);
- newvp = NULLVP;
+ newvp = NULL;
} else if (opennamed && cnp->cn_namelen == 1 &&
*cnp->cn_nameptr == '.') {
- VREF(dvp);
+ vref(dvp);
*vpp = dvp;
return (0);
}
@@ -1399,7 +1399,7 @@ nfs_lookup(struct vop_lookup_args *ap)
vput(newvp);
else
vrele(newvp);
- *vpp = NULLVP;
+ *vpp = NULL;
} else if (error == ENOENT) {
if (VN_IS_DOOMED(dvp))
return (ENOENT);
@@ -1450,7 +1450,7 @@ nfs_lookup(struct vop_lookup_args *ap)
NFSUNLOCKMNT(nmp);
#endif
- newvp = NULLVP;
+ newvp = NULL;
NFSINCRGLOBAL(nfsstatsv1.lookupcache_misses);
nanouptime(&ts);
error = nfsrpc_lookup(dvp, cnp->cn_nameptr, cnp->cn_namelen,
@@ -1464,9 +1464,9 @@ nfs_lookup(struct vop_lookup_args *ap)
}
handle_error:
if (error) {
- if (newvp != NULLVP) {
+ if (newvp != NULL) {
vput(newvp);
- *vpp = NULLVP;
+ *vpp = NULL;
}
if (error != ENOENT) {
@@ -1587,7 +1587,7 @@ handle_error:
0, 1);
} else if (NFS_CMPFH(np, nfhp->nfh_fh, nfhp->nfh_len)) {
free(nfhp, M_NFSFH);
- VREF(dvp);
+ vref(dvp);
newvp = dvp;
if (attrflag)
(void) nfscl_loadattrcache(&newvp, &nfsva, NULL,
@@ -2863,7 +2863,7 @@ nfs_sillyrename(struct vnode *dvp, struct vnode *vp, struct componentname *cnp)
M_NEWNFSREQ, M_WAITOK);
sp->s_cred = crhold(cnp->cn_cred);
sp->s_dvp = dvp;
- VREF(dvp);
+ vref(dvp);
/*
* Fudge together a funny name.
@@ -2961,7 +2961,7 @@ nfs_lookitup(struct vnode *dvp, char *name, int len, struct ucred *cred,
newvp = NFSTOV(np);
} else if (NFS_CMPFH(dnp, nfhp->nfh_fh, nfhp->nfh_len)) {
free(nfhp, M_NFSFH);
- VREF(dvp);
+ vref(dvp);
newvp = dvp;
} else {
cn.cn_nameptr = name;
@@ -3474,7 +3474,7 @@ nfs_advlock(struct vop_advlock_args *ap)
u_quad_t size;
struct nfsmount *nmp;
- error = NFSVOPLOCK(vp, LK_SHARED);
+ error = NFSVOPLOCK(vp, LK_EXCLUSIVE);
if (error != 0)
return (EBADF);
nmp = VFSTONFS(vp->v_mount);
@@ -3511,11 +3511,6 @@ nfs_advlock(struct vop_advlock_args *ap)
cred = p->p_ucred;
else
cred = td->td_ucred;
- NFSVOPLOCK(vp, LK_UPGRADE | LK_RETRY);
- if (VN_IS_DOOMED(vp)) {
- error = EBADF;
- goto out;
- }
/*
* If this is unlocking a write locked region, flush and