fd: hide _fdrop 0 count check behind INVARIANTS

While here use refcount_load and make sure to report the tested value.
This commit is contained in:
Mateusz Guzik 2020-11-05 02:12:08 +00:00
parent caaddb88e8
commit d737e9eaf5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=367357

View File

@ -3219,9 +3219,13 @@ int __noinline
_fdrop(struct file *fp, struct thread *td)
{
int error;
#ifdef INVARIANTS
int count;
if (fp->f_count != 0)
panic("fdrop: count %d", fp->f_count);
count = refcount_load(&fp->f_count);
if (count != 0)
panic("fdrop: fp %p count %d", fp, count);
#endif
error = fo_close(fp, td);
atomic_subtract_int(&openfiles, 1);
crfree(fp->f_cred);