Date: Thu, 5 Nov 2020 02:12:08 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367357 - head/sys/kern Message-ID: <202011050212.0A52C8xL062087@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mjg Date: Thu Nov 5 02:12:08 2020 New Revision: 367357 URL: https://svnweb.freebsd.org/changeset/base/367357 Log: fd: hide _fdrop 0 count check behind INVARIANTS While here use refcount_load and make sure to report the tested value. Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Thu Nov 5 00:52:52 2020 (r367356) +++ head/sys/kern/kern_descrip.c Thu Nov 5 02:12:08 2020 (r367357) @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202011050212.0A52C8xL062087>