mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-04 07:31:11 +00:00
Push Giant down through select and poll.
Don't grab Giant in the upper syscall/wrapper code NET_LOCK_GIANT in the socket code (sockets/fifos). mtx_lock(&Giant) in the vnode code. Devfs grabs Giant if the driver is marked as needing Giant.
This commit is contained in:
parent
d533c6e9a5
commit
db446e30cc
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=137805
|
@ -625,11 +625,7 @@ kern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou,
|
|||
if (nd < 0)
|
||||
return (EINVAL);
|
||||
fdp = td->td_proc->p_fd;
|
||||
/*
|
||||
* XXX: kern_select() currently requires that we acquire Giant
|
||||
* even if none of the file descriptors we poll requires Giant.
|
||||
*/
|
||||
mtx_lock(&Giant);
|
||||
|
||||
FILEDESC_LOCK_FAST(fdp);
|
||||
|
||||
if (nd > td->td_proc->p_fd->fd_nfiles)
|
||||
|
@ -764,7 +760,6 @@ kern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou,
|
|||
if (selbits != &s_selbits[0])
|
||||
free(selbits, M_SELECT);
|
||||
|
||||
mtx_unlock(&Giant);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -837,11 +832,6 @@ poll(td, uap)
|
|||
|
||||
nfds = uap->nfds;
|
||||
|
||||
/*
|
||||
* XXX: poll() currently requires that we acquire Giant even if
|
||||
* none of the file descriptors we poll requires Giant.
|
||||
*/
|
||||
mtx_lock(&Giant);
|
||||
/*
|
||||
* This is kinda bogus. We have fd limits, but that is not
|
||||
* really related to the size of the pollfd array. Make sure
|
||||
|
@ -943,7 +933,6 @@ poll(td, uap)
|
|||
if (ni > sizeof(smallbits))
|
||||
free(bits, M_TEMP);
|
||||
done2:
|
||||
mtx_unlock(&Giant);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
|
|
@ -223,8 +223,10 @@ soo_poll(fp, events, active_cred, td)
|
|||
struct socket *so = fp->f_data;
|
||||
int error;
|
||||
|
||||
NET_LOCK_GIANT();
|
||||
error = (so->so_proto->pr_usrreqs->pru_sopoll)
|
||||
(so, events, fp->f_cred, td);
|
||||
NET_UNLOCK_GIANT();
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
|
|
@ -850,7 +850,7 @@ vn_poll(fp, events, active_cred, td)
|
|||
struct vnode *vp;
|
||||
int error;
|
||||
|
||||
GIANT_REQUIRED;
|
||||
mtx_lock(&Giant);
|
||||
|
||||
vp = fp->f_vnode;
|
||||
#ifdef MAC
|
||||
|
@ -861,6 +861,7 @@ vn_poll(fp, events, active_cred, td)
|
|||
#endif
|
||||
|
||||
error = VOP_POLL(vp, events, fp->f_cred, td);
|
||||
mtx_unlock(&Giant);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue