diff options
author | jeff <jeff@FreeBSD.org> | 2002-09-23 05:20:00 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2002-09-23 05:20:00 +0000 |
commit | 4b760e8f2744b09218cb9f10691d68dbc408f756 (patch) | |
tree | 1ae0e99a1c491f6f755795ae72110d81b45597cb /sys/kern/kern_alq.c | |
parent | 8d27c78b066d6ca383196e414c2ce7657b9e6095 (diff) | |
download | FreeBSD-src-4b760e8f2744b09218cb9f10691d68dbc408f756.zip FreeBSD-src-4b760e8f2744b09218cb9f10691d68dbc408f756.tar.gz |
- Hold the credential of the caller and use it in all subsequent vn ops.
- Get rid of the ill conceived aq_td field.
Suggested by: rwatson
Diffstat (limited to 'sys/kern/kern_alq.c')
-rw-r--r-- | sys/kern/kern_alq.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/kern/kern_alq.c b/sys/kern/kern_alq.c index 394b6c7..ab0c7a0 100644 --- a/sys/kern/kern_alq.c +++ b/sys/kern/kern_alq.c @@ -50,7 +50,7 @@ struct alq { int aq_flags; /* Queue flags */ struct mtx aq_mtx; /* Queue lock */ struct vnode *aq_vp; /* Open vnode handle */ - struct thread *aq_td; /* Thread that opened the vnode */ + struct ucred *aq_cred; /* Credentials of the opening thread */ struct ale *aq_first; /* First ent */ struct ale *aq_entfree; /* First free ent */ struct ale *aq_entvalid; /* First ent valid for writing */ @@ -224,8 +224,9 @@ alq_shutdown(struct alq *alq) } ALQ_UNLOCK(alq); - vn_close(alq->aq_vp, FREAD|FWRITE, alq->aq_td->td_ucred, - alq->aq_td); + vn_close(alq->aq_vp, FREAD|FWRITE, alq->aq_cred, + curthread); + crfree(alq->aq_cred); } /* @@ -286,9 +287,9 @@ alq_doio(struct alq *alq) */ vn_start_write(vp, &mp, V_WAIT); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); - VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE); + VOP_LEASE(vp, td, alq->aq_cred, LEASE_WRITE); /* XXX error ignored */ - VOP_WRITE(vp, &auio, IO_UNIT | IO_APPEND, td->td_ucred); + VOP_WRITE(vp, &auio, IO_UNIT | IO_APPEND, alq->aq_cred); VOP_UNLOCK(vp, 0, td); vn_finished_write(mp); @@ -352,7 +353,7 @@ alq_open(struct alq **alqp, const char *file, int size, int count) alq->aq_entbuf = malloc(count * size, M_ALD, M_WAITOK|M_ZERO); alq->aq_first = malloc(sizeof(*ale) * count, M_ALD, M_WAITOK|M_ZERO); alq->aq_vp = nd.ni_vp; - alq->aq_td = td; + alq->aq_cred = crhold(td->td_ucred); alq->aq_entmax = count; alq->aq_entlen = size; alq->aq_entfree = alq->aq_first; |