Move the cleanup of f_cdevpriv when the reference count of a devfs
file descriptor drops to zero out of _fdrop() and into devfs_close_f() as it is only relevant for devfs file descriptors. Reviewed by: kib MFC after: 1 week
This commit is contained in:
parent
fd2aad9556
commit
1e2d8c9d67
@ -604,6 +604,13 @@ devfs_close_f(struct file *fp, struct thread *td)
|
||||
td->td_fpop = fp;
|
||||
error = vnops.fo_close(fp, td);
|
||||
td->td_fpop = fpop;
|
||||
|
||||
/*
|
||||
* The f_cdevpriv cannot be assigned non-NULL value while we
|
||||
* are destroying the file.
|
||||
*/
|
||||
if (fp->f_cdevpriv != NULL)
|
||||
devfs_fpdrop(fp);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -2575,12 +2575,6 @@ _fdrop(struct file *fp, struct thread *td)
|
||||
panic("fdrop: count %d", fp->f_count);
|
||||
if (fp->f_ops != &badfileops)
|
||||
error = fo_close(fp, td);
|
||||
/*
|
||||
* The f_cdevpriv cannot be assigned non-NULL value while we
|
||||
* are destroying the file.
|
||||
*/
|
||||
if (fp->f_cdevpriv != NULL)
|
||||
devfs_fpdrop(fp);
|
||||
atomic_subtract_int(&openfiles, 1);
|
||||
crfree(fp->f_cred);
|
||||
uma_zfree(file_zone, fp);
|
||||
|
Loading…
Reference in New Issue
Block a user