Changeset View
Changeset View
Standalone View
Standalone View
fs/nfsclient/nfs_clnode.c
Show First 20 Lines • Show All 137 Lines • ▼ Show 20 Lines | ncl_nget(struct mount *mntp, u_int8_t *fhp, int fhsize, struct nfsnode **npp, | ||||
np->n_vnode = vp; | np->n_vnode = vp; | ||||
/* | /* | ||||
* Initialize the mutex even if the vnode is going to be a loser. | * Initialize the mutex even if the vnode is going to be a loser. | ||||
* This simplifies the logic in reclaim, which can then unconditionally | * This simplifies the logic in reclaim, which can then unconditionally | ||||
* destroy the mutex (in the case of the loser, or if hash_insert | * destroy the mutex (in the case of the loser, or if hash_insert | ||||
* happened to return an error no special casing is needed). | * happened to return an error no special casing is needed). | ||||
*/ | */ | ||||
mtx_init(&np->n_mtx, "NEWNFSnode lock", NULL, MTX_DEF | MTX_DUPOK); | mtx_init(&np->n_mtx, "NEWNFSnode lock", NULL, MTX_DEF | MTX_DUPOK); | ||||
sx_init(&np->n_slock, "NEWNFSnode slock"); | |||||
lockinit(&np->n_excl, PVFS, "nfsupg", VLKTIMEOUT, LK_NOSHARE | | lockinit(&np->n_excl, PVFS, "nfsupg", VLKTIMEOUT, LK_NOSHARE | | ||||
LK_CANRECURSE); | LK_CANRECURSE); | ||||
/* | /* | ||||
* NFS supports recursive and shared locking. | * NFS supports recursive and shared locking. | ||||
*/ | */ | ||||
lockmgr(vp->v_vnlock, LK_EXCLUSIVE | LK_NOWITNESS, NULL); | lockmgr(vp->v_vnlock, LK_EXCLUSIVE | LK_NOWITNESS, NULL); | ||||
VN_LOCK_AREC(vp); | VN_LOCK_AREC(vp); | ||||
Show All 13 Lines | np->n_fhp = malloc(sizeof (struct nfsfh) + fhsize, | ||||
M_NFSFH, M_WAITOK); | M_NFSFH, M_WAITOK); | ||||
bcopy(fhp, np->n_fhp->nfh_fh, fhsize); | bcopy(fhp, np->n_fhp->nfh_fh, fhsize); | ||||
np->n_fhp->nfh_len = fhsize; | np->n_fhp->nfh_len = fhsize; | ||||
error = insmntque(vp, mntp); | error = insmntque(vp, mntp); | ||||
if (error != 0) { | if (error != 0) { | ||||
*npp = NULL; | *npp = NULL; | ||||
free(np->n_fhp, M_NFSFH); | free(np->n_fhp, M_NFSFH); | ||||
mtx_destroy(&np->n_mtx); | mtx_destroy(&np->n_mtx); | ||||
sx_destroy(&np->n_slock); | |||||
lockdestroy(&np->n_excl); | lockdestroy(&np->n_excl); | ||||
uma_zfree(newnfsnode_zone, np); | uma_zfree(newnfsnode_zone, np); | ||||
return (error); | return (error); | ||||
} | } | ||||
error = vfs_hash_insert(vp, hash, lkflags, | error = vfs_hash_insert(vp, hash, lkflags, | ||||
td, &nvp, newnfs_vncmpf, np->n_fhp); | td, &nvp, newnfs_vncmpf, np->n_fhp); | ||||
if (error) | if (error) | ||||
return (error); | return (error); | ||||
▲ Show 20 Lines • Show All 145 Lines • ▼ Show 20 Lines | if (vp->v_type == VDIR) { | ||||
} | } | ||||
} | } | ||||
if (np->n_writecred != NULL) | if (np->n_writecred != NULL) | ||||
crfree(np->n_writecred); | crfree(np->n_writecred); | ||||
free(np->n_fhp, M_NFSFH); | free(np->n_fhp, M_NFSFH); | ||||
if (np->n_v4 != NULL) | if (np->n_v4 != NULL) | ||||
free(np->n_v4, M_NFSV4NODE); | free(np->n_v4, M_NFSV4NODE); | ||||
mtx_destroy(&np->n_mtx); | mtx_destroy(&np->n_mtx); | ||||
sx_destroy(&np->n_slock); | |||||
lockdestroy(&np->n_excl); | lockdestroy(&np->n_excl); | ||||
uma_zfree(newnfsnode_zone, vp->v_data); | uma_zfree(newnfsnode_zone, vp->v_data); | ||||
vp->v_data = NULL; | vp->v_data = NULL; | ||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* Invalidate both the access and attribute caches for this vnode. | * Invalidate both the access and attribute caches for this vnode. | ||||
Show All 15 Lines |