diff options
author | jeff <jeff@FreeBSD.org> | 2008-03-22 09:15:16 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2008-03-22 09:15:16 +0000 |
commit | a9d123c3ab34baa9fe2c8c25bd9acfbfb31b381e (patch) | |
tree | 5fedc50643363d96cefce7e3cd6edbdbf2d7fb2b /sys/nfsserver/nfs_serv.c | |
parent | b283b3e59a3e18ec4e7cf225a3a9922139733a73 (diff) | |
download | FreeBSD-src-a9d123c3ab34baa9fe2c8c25bd9acfbfb31b381e.zip FreeBSD-src-a9d123c3ab34baa9fe2c8c25bd9acfbfb31b381e.tar.gz |
- Complete part of the unfinished bufobj work by consistently using
BO_LOCK/UNLOCK/MTX when manipulating the bufobj.
- Create a new lock in the bufobj to lock bufobj fields independently.
This leaves the vnode interlock as an 'identity' lock while the bufobj
is an io lock. The bufobj lock is ordered before the vnode interlock
and also before the mnt ilock.
- Exploit this new lock order to simplify softdep_check_suspend().
- A few sync related functions are marked with a new XXX to note that
we may not properly interlock against a non-zero bv_cnt when
attempting to sync all vnodes on a mountlist. I do not believe this
race is important. If I'm wrong this will make these locations easier
to find.
Reviewed by: kib (earlier diff)
Tested by: kris, pho (earlier diff)
Diffstat (limited to 'sys/nfsserver/nfs_serv.c')
-rw-r--r-- | sys/nfsserver/nfs_serv.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/sys/nfsserver/nfs_serv.c b/sys/nfsserver/nfs_serv.c index 8f5b0d5..67a0a7f 100644 --- a/sys/nfsserver/nfs_serv.c +++ b/sys/nfsserver/nfs_serv.c @@ -3847,7 +3847,7 @@ nfsrv_commit(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, */ int iosize = vp->v_mount->mnt_stat.f_iosize; int iomask = iosize - 1; - int s; + struct bufobj *bo; daddr_t lblkno; /* @@ -3870,8 +3870,8 @@ nfsrv_commit(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, VM_OBJECT_UNLOCK(vp->v_object); } - s = splbio(); - VI_LOCK(vp); + bo = &vp->v_bufobj; + BO_LOCK(bo); while (cnt > 0) { struct buf *bp; @@ -3887,8 +3887,8 @@ nfsrv_commit(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, */ if ((bp = gbincore(&vp->v_bufobj, lblkno)) != NULL) { if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_SLEEPFAIL | - LK_INTERLOCK, VI_MTX(vp)) == ENOLCK) { - VI_LOCK(vp); + LK_INTERLOCK, BO_MTX(bo)) == ENOLCK) { + BO_LOCK(bo); continue; /* retry */ } if ((bp->b_flags & (B_DELWRI|B_INVAL)) == @@ -3899,7 +3899,7 @@ nfsrv_commit(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, ++nfs_commit_miss; } else BUF_UNLOCK(bp); - VI_LOCK(vp); + BO_LOCK(bo); } ++nfs_commit_blks; if (cnt < iosize) @@ -3907,8 +3907,7 @@ nfsrv_commit(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, cnt -= iosize; ++lblkno; } - VI_UNLOCK(vp); - splx(s); + BO_UNLOCK(bo); } aft_ret = VOP_GETATTR(vp, &aft, cred, td); |