In closef(), remove the assumption that there is a thread associated
with the file descriptor. When a file descriptor is closed as a result of garbage collecting a UNIX domain socket, the file descriptor will not have any associated thread, so the logic to identify advisory locks held by that thread is not appropriate. Check the thread for NULL to avoid this scenario. Expand an existing comment to say a bit more about this. MFC after: 1 week
This commit is contained in:
parent
73c0fce2e1
commit
923633b4b5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=152250
@ -1880,9 +1880,13 @@ closef(struct file *fp, struct thread *td)
|
||||
* a flag in the unlock to free ONLY locks obeying POSIX
|
||||
* semantics, and not to free BSD-style file locks.
|
||||
* If the descriptor was in a message, POSIX-style locks
|
||||
* aren't passed with the descriptor.
|
||||
* aren't passed with the descripto, and the thread pointer
|
||||
* will be NULL. Callers should be careful only to pass a
|
||||
* NULL thread pointer when there really is no owning
|
||||
* context that might have locks, or the locks will be
|
||||
* leaked.
|
||||
*/
|
||||
if (fp->f_type == DTYPE_VNODE) {
|
||||
if (fp->f_type == DTYPE_VNODE && td != NULL) {
|
||||
int vfslocked;
|
||||
|
||||
vp = fp->f_vnode;
|
||||
|
Loading…
Reference in New Issue
Block a user