mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-20 16:54:02 +00:00
Protect accesses to member of struct proc with the proc lock.
This commit is contained in:
parent
a263238c86
commit
f3a16450d0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=69652
|
@ -488,7 +488,7 @@ coda_call(mntinfo, inSize, outSize, buffer)
|
|||
int error;
|
||||
#ifdef CTL_C
|
||||
struct proc *p = curproc;
|
||||
sigset_t psig_omask = p->p_sigmask;
|
||||
sigset_t psig_omask;
|
||||
sigset_t tempset;
|
||||
int i;
|
||||
#endif
|
||||
|
@ -544,8 +544,10 @@ coda_call(mntinfo, inSize, outSize, buffer)
|
|||
can not do this. A better solution is necessary.
|
||||
*/
|
||||
i = 0;
|
||||
PROC_LOCK(p);
|
||||
psig_omask = p->p_sigmask;
|
||||
do {
|
||||
error = tsleep(&vmp->vm_sleep,
|
||||
error = msleep(&vmp->vm_sleep, &p->p_mtx,
|
||||
(coda_call_sleep|coda_pcatch), "coda_call",
|
||||
hz*2);
|
||||
if (error == 0)
|
||||
|
@ -597,6 +599,7 @@ coda_call(mntinfo, inSize, outSize, buffer)
|
|||
}
|
||||
} while (error && i++ < 128 && VC_OPEN(vcp));
|
||||
p->p_sigmask = psig_omask;
|
||||
PROC_UNLOCK(p);
|
||||
#else
|
||||
(void) tsleep(&vmp->vm_sleep, coda_call_sleep, "coda_call", 0);
|
||||
#endif
|
||||
|
|
|
@ -93,9 +93,13 @@
|
|||
|
||||
#define INIT_IN(in, op, ident, p) \
|
||||
(in)->opcode = (op); \
|
||||
if (p) \
|
||||
PROC_LOCK(p); \
|
||||
(in)->pid = p ? p->p_pid : -1; \
|
||||
(in)->pgid = p ? p->p_pgid : -1; \
|
||||
(in)->sid = (p && p->p_session && p->p_session->s_leader) ? (p->p_session->s_leader->p_pid) : -1; \
|
||||
if (p) \
|
||||
PROC_UNLOCK(p); \
|
||||
if (ident != NOCRED) { \
|
||||
(in)->cred.cr_uid = ident->cr_uid; \
|
||||
(in)->cred.cr_groupid = ident->cr_gid; \
|
||||
|
|
|
@ -431,7 +431,9 @@ coda_rdwr(vp, uiop, rw, ioflag, cred, p)
|
|||
* venus won't have the correct size of the core when
|
||||
* it's completely written.
|
||||
*/
|
||||
PROC_LOCK(p);
|
||||
if (cp->c_inode != 0 && !(p && (p->p_acflag & ACORE))) {
|
||||
PROC_UNLOCK(p);
|
||||
igot_internally = 1;
|
||||
error = coda_grab_vnode(cp->c_device, cp->c_inode, &cfvp);
|
||||
if (error) {
|
||||
|
@ -445,6 +447,7 @@ coda_rdwr(vp, uiop, rw, ioflag, cred, p)
|
|||
VOP_UNLOCK(cfvp, 0, p);
|
||||
}
|
||||
else {
|
||||
PROC_UNLOCK(p);
|
||||
opened_internally = 1;
|
||||
MARK_INT_GEN(CODA_OPEN_STATS);
|
||||
error = VOP_OPEN(vp, (rw == UIO_READ ? FREAD : FWRITE),
|
||||
|
|
|
@ -488,7 +488,7 @@ coda_call(mntinfo, inSize, outSize, buffer)
|
|||
int error;
|
||||
#ifdef CTL_C
|
||||
struct proc *p = curproc;
|
||||
sigset_t psig_omask = p->p_sigmask;
|
||||
sigset_t psig_omask;
|
||||
sigset_t tempset;
|
||||
int i;
|
||||
#endif
|
||||
|
@ -544,8 +544,10 @@ coda_call(mntinfo, inSize, outSize, buffer)
|
|||
can not do this. A better solution is necessary.
|
||||
*/
|
||||
i = 0;
|
||||
PROC_LOCK(p);
|
||||
psig_omask = p->p_sigmask;
|
||||
do {
|
||||
error = tsleep(&vmp->vm_sleep,
|
||||
error = msleep(&vmp->vm_sleep, &p->p_mtx,
|
||||
(coda_call_sleep|coda_pcatch), "coda_call",
|
||||
hz*2);
|
||||
if (error == 0)
|
||||
|
@ -597,6 +599,7 @@ coda_call(mntinfo, inSize, outSize, buffer)
|
|||
}
|
||||
} while (error && i++ < 128 && VC_OPEN(vcp));
|
||||
p->p_sigmask = psig_omask;
|
||||
PROC_UNLOCK(p);
|
||||
#else
|
||||
(void) tsleep(&vmp->vm_sleep, coda_call_sleep, "coda_call", 0);
|
||||
#endif
|
||||
|
|
|
@ -93,9 +93,13 @@
|
|||
|
||||
#define INIT_IN(in, op, ident, p) \
|
||||
(in)->opcode = (op); \
|
||||
if (p) \
|
||||
PROC_LOCK(p); \
|
||||
(in)->pid = p ? p->p_pid : -1; \
|
||||
(in)->pgid = p ? p->p_pgid : -1; \
|
||||
(in)->sid = (p && p->p_session && p->p_session->s_leader) ? (p->p_session->s_leader->p_pid) : -1; \
|
||||
if (p) \
|
||||
PROC_UNLOCK(p); \
|
||||
if (ident != NOCRED) { \
|
||||
(in)->cred.cr_uid = ident->cr_uid; \
|
||||
(in)->cred.cr_groupid = ident->cr_gid; \
|
||||
|
|
|
@ -431,7 +431,9 @@ coda_rdwr(vp, uiop, rw, ioflag, cred, p)
|
|||
* venus won't have the correct size of the core when
|
||||
* it's completely written.
|
||||
*/
|
||||
PROC_LOCK(p);
|
||||
if (cp->c_inode != 0 && !(p && (p->p_acflag & ACORE))) {
|
||||
PROC_UNLOCK(p);
|
||||
igot_internally = 1;
|
||||
error = coda_grab_vnode(cp->c_device, cp->c_inode, &cfvp);
|
||||
if (error) {
|
||||
|
@ -445,6 +447,7 @@ coda_rdwr(vp, uiop, rw, ioflag, cred, p)
|
|||
VOP_UNLOCK(cfvp, 0, p);
|
||||
}
|
||||
else {
|
||||
PROC_UNLOCK(p);
|
||||
opened_internally = 1;
|
||||
MARK_INT_GEN(CODA_OPEN_STATS);
|
||||
error = VOP_OPEN(vp, (rw == UIO_READ ? FREAD : FWRITE),
|
||||
|
|
Loading…
Reference in a new issue