summaryrefslogtreecommitdiffstats
path: root/sys/vm/vnode_pager.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2001-10-11 23:38:17 +0000
committerjhb <jhb@FreeBSD.org>2001-10-11 23:38:17 +0000
commit4806d88677d2a333254f9fc33d4e119cc56bb002 (patch)
treed3ca87a8ac917d5003235cc737cd5f76591f7c1b /sys/vm/vnode_pager.c
parent9f68054d87b5538c76f0b802ef8f7344eedd5647 (diff)
downloadFreeBSD-src-4806d88677d2a333254f9fc33d4e119cc56bb002.zip
FreeBSD-src-4806d88677d2a333254f9fc33d4e119cc56bb002.tar.gz
Change the kernel's ucred API as follows:
- crhold() returns a reference to the ucred whose refcount it bumps. - crcopy() now simply copies the credentials from one credential to another and has no return value. - a new crshared() primitive is added which returns true if a ucred's refcount is > 1 and false (0) otherwise.
Diffstat (limited to 'sys/vm/vnode_pager.c')
-rw-r--r--sys/vm/vnode_pager.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c
index bad9bcf..97e7039 100644
--- a/sys/vm/vnode_pager.c
+++ b/sys/vm/vnode_pager.c
@@ -434,11 +434,10 @@ vnode_pager_input_smlfs(object, m)
/* build a minimal buffer header */
bp->b_iocmd = BIO_READ;
bp->b_iodone = vnode_pager_iodone;
- bp->b_rcred = bp->b_wcred = curthread->td_proc->p_ucred;
- if (bp->b_rcred != NOCRED)
- crhold(bp->b_rcred);
- if (bp->b_wcred != NOCRED)
- crhold(bp->b_wcred);
+ KASSERT(bp->b_rcred == NOCRED, ("leaking read ucred"));
+ KASSERT(bp->b_wcred == NOCRED, ("leaking write ucred"));
+ bp->b_rcred = crhold(curthread->td_proc->p_ucred);
+ bp->b_wcred = crhold(curthread->td_proc->p_ucred);
bp->b_data = (caddr_t) kva + i * bsize;
bp->b_blkno = fileaddr;
pbgetvp(dp, bp);
@@ -754,11 +753,10 @@ vnode_pager_generic_getpages(vp, m, bytecount, reqpage)
bp->b_iocmd = BIO_READ;
bp->b_iodone = vnode_pager_iodone;
/* B_PHYS is not set, but it is nice to fill this in */
- bp->b_rcred = bp->b_wcred = curthread->td_proc->p_ucred;
- if (bp->b_rcred != NOCRED)
- crhold(bp->b_rcred);
- if (bp->b_wcred != NOCRED)
- crhold(bp->b_wcred);
+ KASSERT(bp->b_rcred == NOCRED, ("leaking read ucred"));
+ KASSERT(bp->b_wcred == NOCRED, ("leaking write ucred"));
+ bp->b_rcred = crhold(curthread->td_proc->p_ucred);
+ bp->b_wcred = crhold(curthread->td_proc->p_ucred);
bp->b_blkno = firstaddr;
pbgetvp(dp, bp);
bp->b_bcount = size;
OpenPOWER on IntegriCloud