Use thread0.td_ucred instead of proc0.p_ucred. This change is cosmetic
and isn't strictly required. However, it lowers the number of false positives found when grep'ing the kernel sources for p_ucred to ensure proper locking.
This commit is contained in:
parent
bdd67d483c
commit
fdcc1cc09f
@ -156,7 +156,7 @@ nfs_dolock(struct vop_advlock_args *ap)
|
||||
NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, _PATH_LCKFIFO, td);
|
||||
|
||||
fmode = FFLAGS(O_WRONLY);
|
||||
error = vn_open_cred(&nd, &fmode, 0, proc0.p_ucred);
|
||||
error = vn_open_cred(&nd, &fmode, 0, thread0.td_ucred);
|
||||
if (error != 0) {
|
||||
return (error == ENOENT ? EOPNOTSUPP : error);
|
||||
}
|
||||
@ -166,10 +166,10 @@ nfs_dolock(struct vop_advlock_args *ap)
|
||||
|
||||
ioflg = IO_UNIT;
|
||||
for (;;) {
|
||||
VOP_LEASE(wvp, td, proc0.p_ucred, LEASE_WRITE);
|
||||
VOP_LEASE(wvp, td, thread0.td_ucred, LEASE_WRITE);
|
||||
|
||||
error = vn_rdwr(UIO_WRITE, wvp, (caddr_t)&msg, sizeof(msg), 0,
|
||||
UIO_SYSSPACE, ioflg, proc0.p_ucred, NULL, td);
|
||||
UIO_SYSSPACE, ioflg, thread0.td_ucred, NULL, td);
|
||||
|
||||
if (error && (((ioflg & IO_NDELAY) == 0) || error != EAGAIN)) {
|
||||
break;
|
||||
@ -219,7 +219,7 @@ nfs_dolock(struct vop_advlock_args *ap)
|
||||
break;
|
||||
}
|
||||
|
||||
if ((error1 = vn_close(wvp, FWRITE, proc0.p_ucred, td)) && error == 0)
|
||||
if ((error1 = vn_close(wvp, FWRITE, thread0.td_ucred, td)) && error == 0)
|
||||
return (error1);
|
||||
|
||||
return (error);
|
||||
|
@ -57,7 +57,7 @@
|
||||
#include <ufs/ffs/fs.h>
|
||||
#include <ufs/ffs/ffs_extern.h>
|
||||
|
||||
#define KERNCRED proc0.p_ucred
|
||||
#define KERNCRED thread0.td_ucred
|
||||
#define DEBUG 1
|
||||
|
||||
static int cgaccount __P((int, struct vnode *, struct buf *, int));
|
||||
|
@ -1135,8 +1135,8 @@ swap_pager_getpages(object, m, count, reqpage)
|
||||
|
||||
bp->b_iocmd = BIO_READ;
|
||||
bp->b_iodone = swp_pager_async_iodone;
|
||||
bp->b_rcred = crhold(proc0.p_ucred);
|
||||
bp->b_wcred = crhold(proc0.p_ucred);
|
||||
bp->b_rcred = crhold(thread0.td_ucred);
|
||||
bp->b_wcred = crhold(thread0.td_ucred);
|
||||
bp->b_data = (caddr_t) kva;
|
||||
bp->b_blkno = blk - (reqpage - i);
|
||||
bp->b_bcount = PAGE_SIZE * (j - i);
|
||||
@ -1386,8 +1386,8 @@ swap_pager_putpages(object, m, count, sync, rtvals)
|
||||
|
||||
pmap_qenter((vm_offset_t)bp->b_data, &m[i], n);
|
||||
|
||||
bp->b_rcred = crhold(proc0.p_ucred);
|
||||
bp->b_wcred = crhold(proc0.p_ucred);
|
||||
bp->b_rcred = crhold(thread0.td_ucred);
|
||||
bp->b_wcred = crhold(thread0.td_ucred);
|
||||
bp->b_bcount = PAGE_SIZE * n;
|
||||
bp->b_bufsize = PAGE_SIZE * n;
|
||||
bp->b_blkno = blk;
|
||||
@ -2080,8 +2080,8 @@ getchainbuf(struct bio *bp, struct vnode *vp, int flags)
|
||||
nbp->b_iocmd = bp->bio_cmd;
|
||||
nbp->b_ioflags = 0;
|
||||
nbp->b_flags = flags;
|
||||
nbp->b_rcred = crhold(proc0.p_ucred);
|
||||
nbp->b_wcred = crhold(proc0.p_ucred);
|
||||
nbp->b_rcred = crhold(thread0.td_ucred);
|
||||
nbp->b_wcred = crhold(thread0.td_ucred);
|
||||
nbp->b_iodone = vm_pager_chain_iodone;
|
||||
|
||||
if (vp)
|
||||
|
Loading…
x
Reference in New Issue
Block a user