Add a lktype flags argument to nfscl_nget() and ncl_nget() in the
experimental NFS client so that its nfs_lookup() function can use cn_lkflags in a manner analagous to the regular NFS client. MFC after: 2 weeks
This commit is contained in:
parent
8ae8da4156
commit
d77942ccd4
@ -487,7 +487,7 @@ void nfscl_cleanup(NFSPROC_T *);
|
||||
|
||||
/* nfs_clport.c */
|
||||
int nfscl_nget(mount_t, vnode_t, struct nfsfh *,
|
||||
struct componentname *, NFSPROC_T *, struct nfsnode **, void *);
|
||||
struct componentname *, NFSPROC_T *, struct nfsnode **, void *, int);
|
||||
NFSPROC_T *nfscl_getparent(NFSPROC_T *);
|
||||
void nfscl_start_renewthread(struct nfsclclient *);
|
||||
void nfscl_loadsbinfo(struct nfsmount *, struct nfsstatfs *, void *);
|
||||
|
@ -86,7 +86,8 @@ ncl_nhuninit(void)
|
||||
* nfsnode structure is returned.
|
||||
*/
|
||||
int
|
||||
ncl_nget(struct mount *mntp, u_int8_t *fhp, int fhsize, struct nfsnode **npp)
|
||||
ncl_nget(struct mount *mntp, u_int8_t *fhp, int fhsize, struct nfsnode **npp,
|
||||
int lkflags)
|
||||
{
|
||||
struct thread *td = curthread; /* XXX */
|
||||
struct nfsnode *np;
|
||||
@ -106,7 +107,7 @@ ncl_nget(struct mount *mntp, u_int8_t *fhp, int fhsize, struct nfsnode **npp)
|
||||
M_NFSFH, M_WAITOK);
|
||||
bcopy(fhp, &nfhp->nfh_fh[0], fhsize);
|
||||
nfhp->nfh_len = fhsize;
|
||||
error = vfs_hash_get(mntp, hash, LK_EXCLUSIVE,
|
||||
error = vfs_hash_get(mntp, hash, lkflags,
|
||||
td, &nvp, newnfs_vncmpf, nfhp);
|
||||
FREE(nfhp, M_NFSFH);
|
||||
if (error)
|
||||
@ -168,7 +169,7 @@ ncl_nget(struct mount *mntp, u_int8_t *fhp, int fhsize, struct nfsnode **npp)
|
||||
uma_zfree(newnfsnode_zone, np);
|
||||
return (error);
|
||||
}
|
||||
error = vfs_hash_insert(vp, hash, LK_EXCLUSIVE,
|
||||
error = vfs_hash_insert(vp, hash, lkflags,
|
||||
td, &nvp, newnfs_vncmpf, np->n_fhp);
|
||||
if (error)
|
||||
return (error);
|
||||
|
@ -85,7 +85,7 @@ newnfs_vncmpf(struct vnode *vp, void *arg)
|
||||
int
|
||||
nfscl_nget(struct mount *mntp, struct vnode *dvp, struct nfsfh *nfhp,
|
||||
struct componentname *cnp, struct thread *td, struct nfsnode **npp,
|
||||
void *stuff)
|
||||
void *stuff, int lkflags)
|
||||
{
|
||||
struct nfsnode *np, *dnp;
|
||||
struct vnode *vp, *nvp;
|
||||
@ -100,7 +100,7 @@ nfscl_nget(struct mount *mntp, struct vnode *dvp, struct nfsfh *nfhp,
|
||||
|
||||
hash = fnv_32_buf(nfhp->nfh_fh, nfhp->nfh_len, FNV1_32_INIT);
|
||||
|
||||
error = vfs_hash_get(mntp, hash, LK_EXCLUSIVE,
|
||||
error = vfs_hash_get(mntp, hash, lkflags,
|
||||
td, &nvp, newnfs_vncmpf, nfhp);
|
||||
if (error == 0 && nvp != NULL) {
|
||||
/*
|
||||
@ -244,7 +244,7 @@ nfscl_nget(struct mount *mntp, struct vnode *dvp, struct nfsfh *nfhp,
|
||||
uma_zfree(newnfsnode_zone, np);
|
||||
return (error);
|
||||
}
|
||||
error = vfs_hash_insert(vp, hash, LK_EXCLUSIVE,
|
||||
error = vfs_hash_insert(vp, hash, lkflags,
|
||||
td, &nvp, newnfs_vncmpf, nfhp);
|
||||
if (error)
|
||||
return (error);
|
||||
|
@ -3271,7 +3271,7 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep,
|
||||
np = dnp;
|
||||
} else {
|
||||
error = nfscl_nget(vnode_mount(vp), vp,
|
||||
nfhp, cnp, p, &np, NULL);
|
||||
nfhp, cnp, p, &np, NULL, LK_EXCLUSIVE);
|
||||
if (!error) {
|
||||
newvp = NFSTOV(np);
|
||||
unlocknewvp = 1;
|
||||
|
@ -273,7 +273,7 @@ nfs_statfs(struct mount *mp, struct statfs *sbp)
|
||||
error = vfs_busy(mp, MBF_NOWAIT);
|
||||
if (error)
|
||||
return (error);
|
||||
error = ncl_nget(mp, nmp->nm_fh, nmp->nm_fhsize, &np);
|
||||
error = ncl_nget(mp, nmp->nm_fh, nmp->nm_fhsize, &np, LK_EXCLUSIVE);
|
||||
if (error) {
|
||||
vfs_unbusy(mp);
|
||||
return (error);
|
||||
@ -1221,7 +1221,8 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam,
|
||||
* by nfs_statfs() before any I/O occurs.
|
||||
*/
|
||||
mp->mnt_stat.f_iosize = NFS_DIRBLKSIZ;
|
||||
error = ncl_nget(mp, nmp->nm_fh, nmp->nm_fhsize, &np);
|
||||
error = ncl_nget(mp, nmp->nm_fh, nmp->nm_fhsize, &np,
|
||||
LK_EXCLUSIVE);
|
||||
if (error)
|
||||
goto bad;
|
||||
*vpp = NFSTOV(np);
|
||||
@ -1336,7 +1337,7 @@ nfs_root(struct mount *mp, int flags, struct vnode **vpp)
|
||||
int error;
|
||||
|
||||
nmp = VFSTONFS(mp);
|
||||
error = ncl_nget(mp, nmp->nm_fh, nmp->nm_fhsize, &np);
|
||||
error = ncl_nget(mp, nmp->nm_fh, nmp->nm_fhsize, &np, flags);
|
||||
if (error)
|
||||
return error;
|
||||
vp = NFSTOV(np);
|
||||
|
@ -1156,7 +1156,8 @@ nfs_lookup(struct vop_lookup_args *ap)
|
||||
FREE((caddr_t)nfhp, M_NFSFH);
|
||||
return (EISDIR);
|
||||
}
|
||||
error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, NULL);
|
||||
error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, NULL,
|
||||
LK_EXCLUSIVE);
|
||||
if (error)
|
||||
return (error);
|
||||
newvp = NFSTOV(np);
|
||||
@ -1185,7 +1186,8 @@ nfs_lookup(struct vop_lookup_args *ap)
|
||||
return (error);
|
||||
}
|
||||
VOP_UNLOCK(dvp, 0);
|
||||
error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, NULL);
|
||||
error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, NULL,
|
||||
cnp->cn_lkflags);
|
||||
if (error == 0)
|
||||
newvp = NFSTOV(np);
|
||||
vfs_unbusy(mp);
|
||||
@ -1213,7 +1215,8 @@ nfs_lookup(struct vop_lookup_args *ap)
|
||||
(void) nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL,
|
||||
0, 1);
|
||||
} else {
|
||||
error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, NULL);
|
||||
error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, NULL,
|
||||
cnp->cn_lkflags);
|
||||
if (error)
|
||||
return (error);
|
||||
newvp = NFSTOV(np);
|
||||
@ -1395,7 +1398,7 @@ nfs_mknodrpc(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp,
|
||||
NULL);
|
||||
if (nfhp)
|
||||
error = nfscl_nget(dvp->v_mount, dvp, nfhp, cnp,
|
||||
cnp->cn_thread, &np, NULL);
|
||||
cnp->cn_thread, &np, NULL, LK_EXCLUSIVE);
|
||||
}
|
||||
if (dattrflag)
|
||||
(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1);
|
||||
@ -1508,7 +1511,7 @@ nfs_create(struct vop_create_args *ap)
|
||||
NULL);
|
||||
if (nfhp != NULL)
|
||||
error = nfscl_nget(dvp->v_mount, dvp, nfhp, cnp,
|
||||
cnp->cn_thread, &np, NULL);
|
||||
cnp->cn_thread, &np, NULL, LK_EXCLUSIVE);
|
||||
}
|
||||
if (dattrflag)
|
||||
(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1);
|
||||
@ -1931,7 +1934,7 @@ nfs_symlink(struct vop_symlink_args *ap)
|
||||
&nfsva, &nfhp, &attrflag, &dattrflag, NULL);
|
||||
if (nfhp) {
|
||||
ret = nfscl_nget(dvp->v_mount, dvp, nfhp, cnp, cnp->cn_thread,
|
||||
&np, NULL);
|
||||
&np, NULL, LK_EXCLUSIVE);
|
||||
if (!ret)
|
||||
newvp = NFSTOV(np);
|
||||
else if (!error)
|
||||
@ -2014,7 +2017,7 @@ nfs_mkdir(struct vop_mkdir_args *ap)
|
||||
dnp->n_attrstamp = 0;
|
||||
if (nfhp) {
|
||||
ret = nfscl_nget(dvp->v_mount, dvp, nfhp, cnp, cnp->cn_thread,
|
||||
&np, NULL);
|
||||
&np, NULL, LK_EXCLUSIVE);
|
||||
if (!ret) {
|
||||
newvp = NFSTOV(np);
|
||||
if (attrflag)
|
||||
@ -2389,7 +2392,7 @@ printf("replace=%s\n",nnn);
|
||||
cn.cn_nameptr = name;
|
||||
cn.cn_namelen = len;
|
||||
error = nfscl_nget(dvp->v_mount, dvp, nfhp, &cn, td,
|
||||
&np, NULL);
|
||||
&np, NULL, LK_EXCLUSIVE);
|
||||
if (error)
|
||||
return (error);
|
||||
newvp = NFSTOV(np);
|
||||
|
@ -176,7 +176,7 @@ int ncl_reclaim(struct vop_reclaim_args *);
|
||||
|
||||
/* other stuff */
|
||||
int ncl_removeit(struct sillyrename *, struct vnode *);
|
||||
int ncl_nget(struct mount *, u_int8_t *, int, struct nfsnode **);
|
||||
int ncl_nget(struct mount *, u_int8_t *, int, struct nfsnode **, int);
|
||||
nfsuint64 *ncl_getcookie(struct nfsnode *, off_t, int);
|
||||
void ncl_invaldir(struct vnode *);
|
||||
int ncl_upgrade_vnlock(struct vnode *);
|
||||
|
Loading…
Reference in New Issue
Block a user