fix a page locking deadlock problem for nfs.
add a flag that specify if the file can be truncated safely or not to nfsm_loadattr and friends. when it isn't safe, just mark the nfsnode as "should be truncated later". ok'ed by Frank van der Linden and Chuck Silvers. close kern/18036.
This commit is contained in:
parent
75a75e1d7a
commit
005c29fafb
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nfs_bio.c,v 1.82 2002/09/01 10:39:38 bouyer Exp $ */
|
||||
/* $NetBSD: nfs_bio.c,v 1.83 2002/10/21 12:52:32 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
|
@ -39,7 +39,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_bio.c,v 1.82 2002/09/01 10:39:38 bouyer Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_bio.c,v 1.83 2002/10/21 12:52:32 yamt Exp $");
|
||||
|
||||
#include "opt_nfs.h"
|
||||
#include "opt_ddb.h"
|
||||
|
@ -1133,6 +1133,14 @@ nfs_getpages(v)
|
|||
np->n_rcred = curproc->p_ucred;
|
||||
crhold(np->n_rcred);
|
||||
|
||||
/*
|
||||
* if we have delayed truncation and it's safe, do it now.
|
||||
*/
|
||||
|
||||
if (ap->a_flags & PGO_SYNCIO) {
|
||||
nfs_delayedtruncate(vp);
|
||||
}
|
||||
|
||||
/*
|
||||
* call the genfs code to get the pages. `pgs' may be NULL
|
||||
* when doing read-ahead.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nfs_nqlease.c,v 1.40 2002/05/12 23:04:35 matt Exp $ */
|
||||
/* $NetBSD: nfs_nqlease.c,v 1.41 2002/10/21 12:52:33 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -53,7 +53,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_nqlease.c,v 1.40 2002/05/12 23:04:35 matt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_nqlease.c,v 1.41 2002/10/21 12:52:33 yamt Exp $");
|
||||
|
||||
#include "fs_nfs.h"
|
||||
#include "opt_nfs.h"
|
||||
|
@ -880,7 +880,7 @@ nqnfs_getlease(vp, rwflag, cred, p)
|
|||
if (reqtime > time.tv_sec) {
|
||||
frev = fxdr_hyper(tl);
|
||||
nqnfs_clientlease(nmp, np, rwflag, cachable, reqtime, frev);
|
||||
nfsm_loadattr(vp, (struct vattr *)0);
|
||||
nfsm_loadattr(vp, (struct vattr *)0, 0);
|
||||
} else
|
||||
error = NQNFS_EXPIRED;
|
||||
nfsm_reqdone;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nfs_subs.c,v 1.104 2002/08/23 05:38:51 enami Exp $ */
|
||||
/* $NetBSD: nfs_subs.c,v 1.105 2002/10/21 12:52:33 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
|
@ -74,7 +74,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_subs.c,v 1.104 2002/08/23 05:38:51 enami Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_subs.c,v 1.105 2002/10/21 12:52:33 yamt Exp $");
|
||||
|
||||
#include "fs_nfs.h"
|
||||
#include "opt_nfs.h"
|
||||
|
@ -1527,11 +1527,12 @@ nfs_vfs_done()
|
|||
* copy the attributes to *vaper
|
||||
*/
|
||||
int
|
||||
nfsm_loadattrcache(vpp, mdp, dposp, vaper)
|
||||
nfsm_loadattrcache(vpp, mdp, dposp, vaper, flags)
|
||||
struct vnode **vpp;
|
||||
struct mbuf **mdp;
|
||||
caddr_t *dposp;
|
||||
struct vattr *vaper;
|
||||
int flags;
|
||||
{
|
||||
int32_t t1;
|
||||
caddr_t cp2;
|
||||
|
@ -1544,14 +1545,15 @@ nfsm_loadattrcache(vpp, mdp, dposp, vaper)
|
|||
error = nfsm_disct(mdp, dposp, NFSX_FATTR(v3), t1, &cp2);
|
||||
if (error)
|
||||
return (error);
|
||||
return nfs_loadattrcache(vpp, (struct nfs_fattr *)cp2, vaper);
|
||||
return nfs_loadattrcache(vpp, (struct nfs_fattr *)cp2, vaper, flags);
|
||||
}
|
||||
|
||||
int
|
||||
nfs_loadattrcache(vpp, fp, vaper)
|
||||
nfs_loadattrcache(vpp, fp, vaper, flags)
|
||||
struct vnode **vpp;
|
||||
struct nfs_fattr *fp;
|
||||
struct vattr *vaper;
|
||||
int flags;
|
||||
{
|
||||
struct vnode *vp = *vpp;
|
||||
struct vattr *vap;
|
||||
|
@ -1699,7 +1701,17 @@ nfs_loadattrcache(vpp, fp, vaper)
|
|||
} else {
|
||||
np->n_size = vap->va_size;
|
||||
if (vap->va_type == VREG) {
|
||||
uvm_vnp_setsize(vp, np->n_size);
|
||||
if ((flags & NAC_NOTRUNC)
|
||||
&& np->n_size < vp->v_size) {
|
||||
/*
|
||||
* we can't free pages now because
|
||||
* the pages can be owned by ourselves.
|
||||
*/
|
||||
np->n_flag |= NTRUNCDELAYED;
|
||||
}
|
||||
else {
|
||||
uvm_vnp_setsize(vp, np->n_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1758,6 +1770,18 @@ nfs_getattrcache(vp, vaper)
|
|||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
nfs_delayedtruncate(vp)
|
||||
struct vnode *vp;
|
||||
{
|
||||
struct nfsnode *np = VTONFS(vp);
|
||||
|
||||
if (np->n_flag & NTRUNCDELAYED) {
|
||||
np->n_flag &= ~NTRUNCDELAYED;
|
||||
uvm_vnp_setsize(vp, np->n_size);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Heuristic to see if the server XDR encodes directory cookies or not.
|
||||
* it is not supposed to, but a lot of servers may do this. Also, since
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nfs_var.h,v 1.23 2002/03/17 22:22:40 christos Exp $ */
|
||||
/* $NetBSD: nfs_var.h,v 1.24 2002/10/21 12:52:34 yamt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
|
@ -243,10 +243,11 @@ struct nfsdircache *nfs_enterdircache __P((struct vnode *, off_t, off_t,
|
|||
void nfs_invaldircache __P((struct vnode *, int));
|
||||
void nfs_init __P((void));
|
||||
int nfsm_loadattrcache __P((struct vnode **, struct mbuf **, caddr_t *,
|
||||
struct vattr *));
|
||||
struct vattr *, int flags));
|
||||
int nfs_loadattrcache __P((struct vnode **, struct nfs_fattr *,
|
||||
struct vattr *));
|
||||
struct vattr *, int flags));
|
||||
int nfs_getattrcache __P((struct vnode *, struct vattr *));
|
||||
void nfs_delayedtruncate __P((struct vnode *));
|
||||
int nfs_namei __P((struct nameidata *, fhandle_t *, int, struct nfssvc_sock *,
|
||||
struct mbuf *, struct mbuf **, caddr_t *, struct vnode **,
|
||||
struct proc *, int, int));
|
||||
|
@ -264,6 +265,9 @@ int nfsrv_setpublicfs __P((struct mount *, struct netexport *,
|
|||
int nfs_ispublicfh __P((fhandle_t *));
|
||||
int netaddr_match __P((int, union nethostaddr *, struct mbuf *));
|
||||
|
||||
/* flags for nfs_loadattrcache and friends */
|
||||
#define NAC_NOTRUNC 1 /* don't truncate file size */
|
||||
|
||||
void nfs_clearcommit __P((struct mount *));
|
||||
void nfs_merge_commit_ranges __P((struct vnode *));
|
||||
int nfs_in_committed_range __P((struct vnode *, off_t, off_t));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nfs_vfsops.c,v 1.118 2002/10/21 03:58:07 enami Exp $ */
|
||||
/* $NetBSD: nfs_vfsops.c,v 1.119 2002/10/21 12:52:34 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993, 1995
|
||||
|
@ -39,7 +39,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.118 2002/10/21 03:58:07 enami Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.119 2002/10/21 12:52:34 yamt Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_compat_netbsd.h"
|
||||
|
@ -169,7 +169,7 @@ nfs_statfs(mp, sbp, p)
|
|||
nfsm_fhtom(vp, v3);
|
||||
nfsm_request(vp, NFSPROC_FSSTAT, p, cred);
|
||||
if (v3)
|
||||
nfsm_postop_attr(vp, retattr);
|
||||
nfsm_postop_attr(vp, retattr, 0);
|
||||
if (error) {
|
||||
if (mrep != NULL)
|
||||
m_free(mrep);
|
||||
|
@ -237,7 +237,7 @@ nfs_fsinfo(nmp, vp, cred, p)
|
|||
nfsm_reqhead(vp, NFSPROC_FSINFO, NFSX_FH(1));
|
||||
nfsm_fhtom(vp, 1);
|
||||
nfsm_request(vp, NFSPROC_FSINFO, p, cred);
|
||||
nfsm_postop_attr(vp, retattr);
|
||||
nfsm_postop_attr(vp, retattr, 0);
|
||||
if (!error) {
|
||||
nfsm_dissect(fsp, struct nfsv3_fsinfo *, NFSX_V3FSINFO);
|
||||
pref = fxdr_unsigned(u_int32_t, fsp->fs_wtpref);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nfs_vnops.c,v 1.152 2002/10/18 19:08:15 thorpej Exp $ */
|
||||
/* $NetBSD: nfs_vnops.c,v 1.153 2002/10/21 12:52:35 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
|
@ -43,7 +43,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_vnops.c,v 1.152 2002/10/18 19:08:15 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_vnops.c,v 1.153 2002/10/21 12:52:35 yamt Exp $");
|
||||
|
||||
#include "opt_nfs.h"
|
||||
#include "opt_uvmhist.h"
|
||||
|
@ -364,7 +364,7 @@ nfs_access(v)
|
|||
}
|
||||
*tl = txdr_unsigned(mode);
|
||||
nfsm_request(vp, NFSPROC_ACCESS, ap->a_p, ap->a_cred);
|
||||
nfsm_postop_attr(vp, attrflag);
|
||||
nfsm_postop_attr(vp, attrflag, 0);
|
||||
if (!error) {
|
||||
nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED);
|
||||
rmode = fxdr_unsigned(u_int32_t, *tl);
|
||||
|
@ -628,7 +628,7 @@ nfs_getattr(v)
|
|||
nfsm_fhtom(vp, v3);
|
||||
nfsm_request(vp, NFSPROC_GETATTR, ap->a_p, ap->a_cred);
|
||||
if (!error) {
|
||||
nfsm_loadattr(vp, ap->a_vap);
|
||||
nfsm_loadattr(vp, ap->a_vap, 0);
|
||||
if (vp->v_type == VDIR &&
|
||||
ap->a_vap->va_blocksize < NFS_DIRFRAGSIZ)
|
||||
ap->a_vap->va_blocksize = NFS_DIRFRAGSIZ;
|
||||
|
@ -769,9 +769,9 @@ nfs_setattrrpc(vp, vap, cred, procp)
|
|||
}
|
||||
nfsm_request(vp, NFSPROC_SETATTR, procp, cred);
|
||||
if (v3) {
|
||||
nfsm_wcc_data(vp, wccflag);
|
||||
nfsm_wcc_data(vp, wccflag, 0);
|
||||
} else
|
||||
nfsm_loadattr(vp, (struct vattr *)0);
|
||||
nfsm_loadattr(vp, (struct vattr *)0, 0);
|
||||
nfsm_reqdone;
|
||||
return (error);
|
||||
}
|
||||
|
@ -910,7 +910,7 @@ dorpc:
|
|||
nfsm_strtom(cnp->cn_nameptr, len, NFS_MAXNAMLEN);
|
||||
nfsm_request(dvp, NFSPROC_LOOKUP, cnp->cn_proc, cnp->cn_cred);
|
||||
if (error) {
|
||||
nfsm_postop_attr(dvp, attrflag);
|
||||
nfsm_postop_attr(dvp, attrflag, 0);
|
||||
m_freem(mrep);
|
||||
goto nfsmout;
|
||||
}
|
||||
|
@ -931,10 +931,10 @@ dorpc:
|
|||
}
|
||||
newvp = NFSTOV(np);
|
||||
if (v3) {
|
||||
nfsm_postop_attr(newvp, attrflag);
|
||||
nfsm_postop_attr(dvp, attrflag);
|
||||
nfsm_postop_attr(newvp, attrflag, 0);
|
||||
nfsm_postop_attr(dvp, attrflag, 0);
|
||||
} else
|
||||
nfsm_loadattr(newvp, (struct vattr *)0);
|
||||
nfsm_loadattr(newvp, (struct vattr *)0, 0);
|
||||
*vpp = newvp;
|
||||
m_freem(mrep);
|
||||
cnp->cn_flags |= SAVENAME;
|
||||
|
@ -958,10 +958,10 @@ dorpc:
|
|||
VREF(dvp);
|
||||
newvp = dvp;
|
||||
if (v3) {
|
||||
nfsm_postop_attr(newvp, attrflag);
|
||||
nfsm_postop_attr(dvp, attrflag);
|
||||
nfsm_postop_attr(newvp, attrflag, 0);
|
||||
nfsm_postop_attr(dvp, attrflag, 0);
|
||||
} else
|
||||
nfsm_loadattr(newvp, (struct vattr *)0);
|
||||
nfsm_loadattr(newvp, (struct vattr *)0, 0);
|
||||
} else if (flags & ISDOTDOT) {
|
||||
/*
|
||||
* ".." lookup
|
||||
|
@ -979,10 +979,10 @@ dorpc:
|
|||
newvp = NFSTOV(np);
|
||||
|
||||
if (v3) {
|
||||
nfsm_postop_attr(newvp, attrflag);
|
||||
nfsm_postop_attr(dvp, attrflag);
|
||||
nfsm_postop_attr(newvp, attrflag, 0);
|
||||
nfsm_postop_attr(dvp, attrflag, 0);
|
||||
} else
|
||||
nfsm_loadattr(newvp, (struct vattr *)0);
|
||||
nfsm_loadattr(newvp, (struct vattr *)0, 0);
|
||||
|
||||
if (lockparent && (flags & ISLASTCN)) {
|
||||
if ((error = vn_lock(dvp, LK_EXCLUSIVE))) {
|
||||
|
@ -1003,10 +1003,10 @@ dorpc:
|
|||
}
|
||||
newvp = NFSTOV(np);
|
||||
if (v3) {
|
||||
nfsm_postop_attr(newvp, attrflag);
|
||||
nfsm_postop_attr(dvp, attrflag);
|
||||
nfsm_postop_attr(newvp, attrflag, 0);
|
||||
nfsm_postop_attr(dvp, attrflag, 0);
|
||||
} else
|
||||
nfsm_loadattr(newvp, (struct vattr *)0);
|
||||
nfsm_loadattr(newvp, (struct vattr *)0, 0);
|
||||
if (!lockparent || !(flags & ISLASTCN)) {
|
||||
VOP_UNLOCK(dvp, 0);
|
||||
cnp->cn_flags |= PDIRUNLOCK;
|
||||
|
@ -1118,7 +1118,7 @@ nfs_readlinkrpc(vp, uiop, cred)
|
|||
nfsm_fhtom(vp, v3);
|
||||
nfsm_request(vp, NFSPROC_READLINK, uiop->uio_procp, cred);
|
||||
if (v3)
|
||||
nfsm_postop_attr(vp, attrflag);
|
||||
nfsm_postop_attr(vp, attrflag, 0);
|
||||
if (!error) {
|
||||
nfsm_strsiz(len, NFS_MAXPATHLEN);
|
||||
nfsm_mtouio(uiop, len);
|
||||
|
@ -1169,7 +1169,7 @@ nfs_readrpc(vp, uiop)
|
|||
nfsm_request(vp, NFSPROC_READ, uiop->uio_procp,
|
||||
VTONFS(vp)->n_rcred);
|
||||
if (v3) {
|
||||
nfsm_postop_attr(vp, attrflag);
|
||||
nfsm_postop_attr(vp, attrflag, NAC_NOTRUNC);
|
||||
if (error) {
|
||||
m_freem(mrep);
|
||||
goto nfsmout;
|
||||
|
@ -1177,7 +1177,7 @@ nfs_readrpc(vp, uiop)
|
|||
nfsm_dissect(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
|
||||
eof = fxdr_unsigned(int, *(tl + 1));
|
||||
} else
|
||||
nfsm_loadattr(vp, (struct vattr *)0);
|
||||
nfsm_loadattr(vp, (struct vattr *)0, NAC_NOTRUNC);
|
||||
nfsm_strsiz(retlen, nmp->nm_rsize);
|
||||
nfsm_mtouio(uiop, retlen);
|
||||
m_freem(mrep);
|
||||
|
@ -1254,7 +1254,7 @@ nfs_writerpc(vp, uiop, iomode, must_commit)
|
|||
VTONFS(vp)->n_wcred);
|
||||
if (v3) {
|
||||
wccflag = NFSV3_WCCCHK;
|
||||
nfsm_wcc_data(vp, wccflag);
|
||||
nfsm_wcc_data(vp, wccflag, NAC_NOTRUNC);
|
||||
if (!error) {
|
||||
nfsm_dissect(tl, u_int32_t *, 2 * NFSX_UNSIGNED
|
||||
+ NFSX_V3WRITEVERF);
|
||||
|
@ -1296,7 +1296,7 @@ nfs_writerpc(vp, uiop, iomode, must_commit)
|
|||
}
|
||||
}
|
||||
} else
|
||||
nfsm_loadattr(vp, (struct vattr *)0);
|
||||
nfsm_loadattr(vp, (struct vattr *)0, NAC_NOTRUNC);
|
||||
if (wccflag)
|
||||
VTONFS(vp)->n_mtime = VTONFS(vp)->n_vattr->va_mtime.tv_sec;
|
||||
m_freem(mrep);
|
||||
|
@ -1379,7 +1379,7 @@ nfs_mknodrpc(dvp, vpp, cnp, vap)
|
|||
}
|
||||
}
|
||||
if (v3)
|
||||
nfsm_wcc_data(dvp, wccflag);
|
||||
nfsm_wcc_data(dvp, wccflag, 0);
|
||||
nfsm_reqdone;
|
||||
if (error) {
|
||||
if (newvp)
|
||||
|
@ -1501,7 +1501,7 @@ again:
|
|||
}
|
||||
}
|
||||
if (v3)
|
||||
nfsm_wcc_data(dvp, wccflag);
|
||||
nfsm_wcc_data(dvp, wccflag, 0);
|
||||
nfsm_reqdone;
|
||||
if (error) {
|
||||
if (v3 && (fmode & O_EXCL) && error == NFSERR_NOTSUPP) {
|
||||
|
@ -1639,7 +1639,7 @@ nfs_removerpc(dvp, name, namelen, cred, proc)
|
|||
nfsm_strtom(name, namelen, NFS_MAXNAMLEN);
|
||||
nfsm_request(dvp, NFSPROC_REMOVE, proc, cred);
|
||||
if (v3)
|
||||
nfsm_wcc_data(dvp, wccflag);
|
||||
nfsm_wcc_data(dvp, wccflag, 0);
|
||||
nfsm_reqdone;
|
||||
VTONFS(dvp)->n_flag |= NMODIFIED;
|
||||
if (!wccflag)
|
||||
|
@ -1763,8 +1763,8 @@ nfs_renamerpc(fdvp, fnameptr, fnamelen, tdvp, tnameptr, tnamelen, cred, proc)
|
|||
nfsm_strtom(tnameptr, tnamelen, NFS_MAXNAMLEN);
|
||||
nfsm_request(fdvp, NFSPROC_RENAME, proc, cred);
|
||||
if (v3) {
|
||||
nfsm_wcc_data(fdvp, fwccflag);
|
||||
nfsm_wcc_data(tdvp, twccflag);
|
||||
nfsm_wcc_data(fdvp, fwccflag, 0);
|
||||
nfsm_wcc_data(tdvp, twccflag, 0);
|
||||
}
|
||||
nfsm_reqdone;
|
||||
VTONFS(fdvp)->n_flag |= NMODIFIED;
|
||||
|
@ -1830,8 +1830,8 @@ nfs_link(v)
|
|||
nfsm_strtom(cnp->cn_nameptr, cnp->cn_namelen, NFS_MAXNAMLEN);
|
||||
nfsm_request(vp, NFSPROC_LINK, cnp->cn_proc, cnp->cn_cred);
|
||||
if (v3) {
|
||||
nfsm_postop_attr(vp, attrflag);
|
||||
nfsm_wcc_data(dvp, wccflag);
|
||||
nfsm_postop_attr(vp, attrflag, 0);
|
||||
nfsm_wcc_data(dvp, wccflag, 0);
|
||||
}
|
||||
nfsm_reqdone;
|
||||
PNBUF_PUT(cnp->cn_pnbuf);
|
||||
|
@ -1901,7 +1901,7 @@ nfs_symlink(v)
|
|||
if (v3) {
|
||||
if (!error)
|
||||
nfsm_mtofh(dvp, newvp, v3, gotvp);
|
||||
nfsm_wcc_data(dvp, wccflag);
|
||||
nfsm_wcc_data(dvp, wccflag, 0);
|
||||
}
|
||||
nfsm_reqdone;
|
||||
/*
|
||||
|
@ -1981,7 +1981,7 @@ nfs_mkdir(v)
|
|||
if (!error)
|
||||
nfsm_mtofh(dvp, newvp, v3, gotvp);
|
||||
if (v3)
|
||||
nfsm_wcc_data(dvp, wccflag);
|
||||
nfsm_wcc_data(dvp, wccflag, 0);
|
||||
nfsm_reqdone;
|
||||
VTONFS(dvp)->n_flag |= NMODIFIED;
|
||||
if (!wccflag)
|
||||
|
@ -2052,7 +2052,7 @@ nfs_rmdir(v)
|
|||
nfsm_strtom(cnp->cn_nameptr, cnp->cn_namelen, NFS_MAXNAMLEN);
|
||||
nfsm_request(dvp, NFSPROC_RMDIR, cnp->cn_proc, cnp->cn_cred);
|
||||
if (v3)
|
||||
nfsm_wcc_data(dvp, wccflag);
|
||||
nfsm_wcc_data(dvp, wccflag, 0);
|
||||
nfsm_reqdone;
|
||||
PNBUF_PUT(cnp->cn_pnbuf);
|
||||
VTONFS(dvp)->n_flag |= NMODIFIED;
|
||||
|
@ -2228,7 +2228,7 @@ nfs_readdirrpc(vp, uiop, cred)
|
|||
nfsm_request(vp, NFSPROC_READDIR, uiop->uio_procp, cred);
|
||||
nrpcs++;
|
||||
if (v3) {
|
||||
nfsm_postop_attr(vp, attrflag);
|
||||
nfsm_postop_attr(vp, attrflag, 0);
|
||||
if (!error) {
|
||||
nfsm_dissect(tl, u_int32_t *,
|
||||
2 * NFSX_UNSIGNED);
|
||||
|
@ -2422,7 +2422,7 @@ nfs_readdirplusrpc(vp, uiop, cred)
|
|||
*tl++ = txdr_unsigned(nmp->nm_readdirsize);
|
||||
*tl = txdr_unsigned(nmp->nm_rsize);
|
||||
nfsm_request(vp, NFSPROC_READDIRPLUS, uiop->uio_procp, cred);
|
||||
nfsm_postop_attr(vp, attrflag);
|
||||
nfsm_postop_attr(vp, attrflag, 0);
|
||||
if (error) {
|
||||
m_freem(mrep);
|
||||
goto nfsmout;
|
||||
|
@ -2529,7 +2529,7 @@ nfs_readdirplusrpc(vp, uiop, cred)
|
|||
if (!error) {
|
||||
const char *cp;
|
||||
|
||||
nfs_loadattrcache(&newvp, &fattr, 0);
|
||||
nfs_loadattrcache(&newvp, &fattr, 0, 0);
|
||||
dp->d_type =
|
||||
IFTODT(VTTOIF(np->n_vattr->va_type));
|
||||
ndp->ni_vp = newvp;
|
||||
|
@ -2717,14 +2717,14 @@ nfs_lookitup(dvp, name, len, cred, procp, npp)
|
|||
newvp = NFSTOV(np);
|
||||
}
|
||||
if (v3) {
|
||||
nfsm_postop_attr(newvp, attrflag);
|
||||
nfsm_postop_attr(newvp, attrflag, 0);
|
||||
if (!attrflag && *npp == NULL) {
|
||||
m_freem(mrep);
|
||||
vput(newvp);
|
||||
return (ENOENT);
|
||||
}
|
||||
} else
|
||||
nfsm_loadattr(newvp, (struct vattr *)0);
|
||||
nfsm_loadattr(newvp, (struct vattr *)0, 0);
|
||||
}
|
||||
nfsm_reqdone;
|
||||
if (npp && *npp == NULL) {
|
||||
|
@ -2770,7 +2770,7 @@ nfs_commit(vp, offset, cnt, procp)
|
|||
tl += 2;
|
||||
*tl = txdr_unsigned(cnt);
|
||||
nfsm_request(vp, NFSPROC_COMMIT, procp, VTONFS(vp)->n_wcred);
|
||||
nfsm_wcc_data(vp, wccflag);
|
||||
nfsm_wcc_data(vp, wccflag, 0);
|
||||
if (!error) {
|
||||
nfsm_dissect(tl, u_int32_t *, NFSX_V3WRITEVERF);
|
||||
if (memcmp((caddr_t)nmp->nm_verf, (caddr_t)tl,
|
||||
|
@ -2949,7 +2949,7 @@ nfs_pathconf(v)
|
|||
nfsm_fhtom(vp, 1);
|
||||
nfsm_request(vp, NFSPROC_PATHCONF,
|
||||
curproc, curproc->p_ucred); /* XXX */
|
||||
nfsm_postop_attr(vp, attrflag);
|
||||
nfsm_postop_attr(vp, attrflag, 0);
|
||||
if (!error) {
|
||||
nfsm_dissect(pcp, struct nfsv3_pathconf *,
|
||||
NFSX_V3PATHCONF);
|
||||
|
@ -3095,6 +3095,23 @@ nfs_bwrite(v)
|
|||
return (bwrite(ap->a_bp));
|
||||
}
|
||||
|
||||
/*
|
||||
* nfs unlock wrapper.
|
||||
*/
|
||||
int
|
||||
nfs_unlock(void *v)
|
||||
{
|
||||
struct vop_unlock_args /* {
|
||||
struct vnode *a_vp;
|
||||
int a_flags;
|
||||
} */ *ap = v;
|
||||
struct vnode *vp = ap->a_vp;
|
||||
|
||||
nfs_delayedtruncate(vp);
|
||||
|
||||
return genfs_unlock(v);
|
||||
}
|
||||
|
||||
/*
|
||||
* nfs special file access vnode op.
|
||||
* Essentially just get vattr and then imitate iaccess() since the device is
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nfsm_subs.h,v 1.21 2002/04/03 00:20:15 wrstuden Exp $ */
|
||||
/* $NetBSD: nfsm_subs.h,v 1.22 2002/10/21 12:52:36 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
|
@ -170,7 +170,7 @@
|
|||
nfsm_adv(NFSX_V3FATTR); \
|
||||
} \
|
||||
if (f) \
|
||||
nfsm_loadattr((v), (struct vattr *)0); \
|
||||
nfsm_loadattr((v), (struct vattr *)0, 0); \
|
||||
}
|
||||
|
||||
#define nfsm_getfh(f, s, v3) \
|
||||
|
@ -186,21 +186,22 @@
|
|||
(s) = NFSX_V2FH; \
|
||||
nfsm_dissect((f), nfsfh_t *, nfsm_rndup(s)); }
|
||||
|
||||
#define nfsm_loadattr(v, a) \
|
||||
#define nfsm_loadattr(v, a, flags) \
|
||||
{ struct vnode *ttvp = (v); \
|
||||
if ((t1 = nfsm_loadattrcache(&ttvp, &md, &dpos, (a))) != 0) { \
|
||||
if ((t1 = nfsm_loadattrcache(&ttvp, &md, &dpos, (a), (flags))) \
|
||||
!= 0) { \
|
||||
error = t1; \
|
||||
m_freem(mrep); \
|
||||
goto nfsmout; \
|
||||
} \
|
||||
(v) = ttvp; }
|
||||
|
||||
#define nfsm_postop_attr(v, f) \
|
||||
#define nfsm_postop_attr(v, f, flags) \
|
||||
{ struct vnode *ttvp = (v); \
|
||||
nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
if (((f) = fxdr_unsigned(int, *tl)) != 0) { \
|
||||
if ((t1 = nfsm_loadattrcache(&ttvp, &md, &dpos, \
|
||||
(struct vattr *)0)) != 0) { \
|
||||
(struct vattr *)0, (flags))) != 0) { \
|
||||
error = t1; \
|
||||
(f) = 0; \
|
||||
m_freem(mrep); \
|
||||
|
@ -213,7 +214,7 @@
|
|||
#define NFSV3_WCCRATTR 0
|
||||
#define NFSV3_WCCCHK 1
|
||||
|
||||
#define nfsm_wcc_data(v, f) \
|
||||
#define nfsm_wcc_data(v, f, flags) \
|
||||
{ int ttattrf, ttretf = 0; \
|
||||
nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
if (*tl == nfs_true) { \
|
||||
|
@ -222,7 +223,7 @@
|
|||
ttretf = (VTONFS(v)->n_mtime == \
|
||||
fxdr_unsigned(u_int32_t, *(tl + 2))); \
|
||||
} \
|
||||
nfsm_postop_attr((v), ttattrf); \
|
||||
nfsm_postop_attr((v), ttattrf, (flags)); \
|
||||
if (f) { \
|
||||
(f) = ttretf; \
|
||||
} else { \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nfsnode.h,v 1.34 2001/09/15 20:36:40 chs Exp $ */
|
||||
/* $NetBSD: nfsnode.h,v 1.35 2002/10/21 12:52:36 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
|
@ -173,6 +173,7 @@ struct nfsnode {
|
|||
#define NACC 0x0100 /* Special file accessed */
|
||||
#define NUPD 0x0200 /* Special file updated */
|
||||
#define NCHG 0x0400 /* Special file times changed */
|
||||
#define NTRUNCDELAYED 0x1000 /* Should be truncated later */
|
||||
|
||||
/*
|
||||
* Convert between nfsnode pointers and vnode pointers
|
||||
|
@ -226,7 +227,7 @@ int nfs_readlink __P((void *));
|
|||
int nfs_inactive __P((void *));
|
||||
int nfs_reclaim __P((void *));
|
||||
#define nfs_lock genfs_lock
|
||||
#define nfs_unlock genfs_unlock
|
||||
int nfs_unlock __P((void *));
|
||||
#define nfs_islocked genfs_islocked
|
||||
int nfs_bmap __P((void *));
|
||||
int nfs_strategy __P((void *));
|
||||
|
|
Loading…
Reference in New Issue