Changeset View
Changeset View
Standalone View
Standalone View
fs/nfsclient/nfs_clvnops.c
Show First 20 Lines • Show All 277 Lines • ▼ Show 20 Lines | |||||
#define NFSACCESS_ALL (NFSACCESS_READ | NFSACCESS_MODIFY \ | #define NFSACCESS_ALL (NFSACCESS_READ | NFSACCESS_MODIFY \ | ||||
| NFSACCESS_EXTEND | NFSACCESS_EXECUTE \ | | NFSACCESS_EXTEND | NFSACCESS_EXECUTE \ | ||||
| NFSACCESS_DELETE | NFSACCESS_LOOKUP) | | NFSACCESS_DELETE | NFSACCESS_LOOKUP) | ||||
/* | /* | ||||
* SMP Locking Note : | * SMP Locking Note : | ||||
* The list of locks after the description of the lock is the ordering | * The list of locks after the description of the lock is the ordering | ||||
* of other locks acquired with the lock held. | * of other locks acquired with the lock held. | ||||
* np->n_mtx : Protects the fields in the nfsnode. | * np->n_sx : Protects the fields in the nfsnode. | ||||
VM Object Lock | VM Object Lock | ||||
VI_MTX (acquired indirectly) | VI_MTX (acquired indirectly) | ||||
* nmp->nm_mtx : Protects the fields in the nfsmount. | * nmp->nm_mtx : Protects the fields in the nfsmount. | ||||
rep->r_mtx | rep->r_mtx | ||||
* ncl_iod_mutex : Global lock, protects shared nfsiod state. | * ncl_iod_sx : Global lock, protects shared nfsiod state. | ||||
* nfs_reqq_mtx : Global lock, protects the nfs_reqq list. | * nfs_reqq_mtx : Global lock, protects the nfs_reqq list. | ||||
nmp->nm_mtx | nmp->nm_mtx | ||||
rep->r_mtx | rep->r_mtx | ||||
* rep->r_mtx : Protects the fields in an nfsreq. | * rep->r_mtx : Protects the fields in an nfsreq. | ||||
*/ | */ | ||||
static int | static int | ||||
nfs34_access_otw(struct vnode *vp, int wmode, struct thread *td, | nfs34_access_otw(struct vnode *vp, int wmode, struct thread *td, | ||||
▲ Show 20 Lines • Show All 790 Lines • ▼ Show 20 Lines | if (dvp->v_type != VDIR) | ||||
return (ENOTDIR); | return (ENOTDIR); | ||||
nmp = VFSTONFS(mp); | nmp = VFSTONFS(mp); | ||||
np = VTONFS(dvp); | np = VTONFS(dvp); | ||||
/* For NFSv4, wait until any remove is done. */ | /* For NFSv4, wait until any remove is done. */ | ||||
NFSLOCKNODE(np); | NFSLOCKNODE(np); | ||||
while (NFSHASNFSV4(nmp) && (np->n_flag & NREMOVEINPROG)) { | while (NFSHASNFSV4(nmp) && (np->n_flag & NREMOVEINPROG)) { | ||||
np->n_flag |= NREMOVEWANT; | np->n_flag |= NREMOVEWANT; | ||||
(void) msleep((caddr_t)np, &np->n_mtx, PZERO, "nfslkup", 0); | sx_sleep(np, &np->n_sx, PZERO, "nfslkup", 0); | ||||
} | } | ||||
NFSUNLOCKNODE(np); | NFSUNLOCKNODE(np); | ||||
if ((error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, td)) != 0) | if ((error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, td)) != 0) | ||||
return (error); | return (error); | ||||
error = cache_lookup(dvp, vpp, cnp, &nctime, &ncticks); | error = cache_lookup(dvp, vpp, cnp, &nctime, &ncticks); | ||||
if (error > 0 && error != ENOENT) | if (error > 0 && error != ENOENT) | ||||
return (error); | return (error); | ||||
▲ Show 20 Lines • Show All 484 Lines • ▼ Show 20 Lines | if (vap->va_vaflags & VA_EXCLUSIVE) | ||||
fmode |= O_EXCL; | fmode |= O_EXCL; | ||||
dnp = VTONFS(dvp); | dnp = VTONFS(dvp); | ||||
nmp = VFSTONFS(vnode_mount(dvp)); | nmp = VFSTONFS(vnode_mount(dvp)); | ||||
again: | again: | ||||
/* For NFSv4, wait until any remove is done. */ | /* For NFSv4, wait until any remove is done. */ | ||||
NFSLOCKNODE(dnp); | NFSLOCKNODE(dnp); | ||||
while (NFSHASNFSV4(nmp) && (dnp->n_flag & NREMOVEINPROG)) { | while (NFSHASNFSV4(nmp) && (dnp->n_flag & NREMOVEINPROG)) { | ||||
dnp->n_flag |= NREMOVEWANT; | dnp->n_flag |= NREMOVEWANT; | ||||
(void) msleep((caddr_t)dnp, &dnp->n_mtx, PZERO, "nfscrt", 0); | sx_sleep(dnp, &dnp->n_sx, PZERO, "nfscrt", 0); | ||||
} | } | ||||
NFSUNLOCKNODE(dnp); | NFSUNLOCKNODE(dnp); | ||||
cverf = nfs_get_cverf(); | cverf = nfs_get_cverf(); | ||||
error = nfsrpc_create(dvp, cnp->cn_nameptr, cnp->cn_namelen, | error = nfsrpc_create(dvp, cnp->cn_nameptr, cnp->cn_namelen, | ||||
vap, cverf, fmode, cnp->cn_cred, cnp->cn_thread, &dnfsva, &nfsva, | vap, cverf, fmode, cnp->cn_cred, cnp->cn_thread, &dnfsva, &nfsva, | ||||
&nfhp, &attrflag, &dattrflag, NULL); | &nfhp, &attrflag, &dattrflag, NULL); | ||||
if (!error) { | if (!error) { | ||||
▲ Show 20 Lines • Show All 1,372 Lines • ▼ Show 20 Lines | if (waitfor == MNT_WAIT) { | ||||
} | } | ||||
/* | /* | ||||
* Wait for all the async IO requests to drain | * Wait for all the async IO requests to drain | ||||
*/ | */ | ||||
BO_UNLOCK(bo); | BO_UNLOCK(bo); | ||||
NFSLOCKNODE(np); | NFSLOCKNODE(np); | ||||
while (np->n_directio_asyncwr > 0) { | while (np->n_directio_asyncwr > 0) { | ||||
np->n_flag |= NFSYNCWAIT; | np->n_flag |= NFSYNCWAIT; | ||||
error = newnfs_msleep(td, &np->n_directio_asyncwr, | error = newnfs_sxsleep(td, &np->n_directio_asyncwr, | ||||
&np->n_mtx, slpflag | (PRIBIO + 1), | &np->n_sx, slpflag | (PRIBIO + 1), | ||||
"nfsfsync", 0); | "nfsfsync", 0); | ||||
if (error) { | if (error) { | ||||
if (newnfs_sigintr(nmp, td)) { | if (newnfs_sigintr(nmp, td)) { | ||||
NFSUNLOCKNODE(np); | NFSUNLOCKNODE(np); | ||||
error = EINTR; | error = EINTR; | ||||
goto done; | goto done; | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 551 Lines • Show Last 20 Lines |