Author: jhb Date: Fri Nov 4 03:39:31 2011 New Revision: 227069 URL: http://svn.freebsd.org/changeset/base/227069
Log: 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 Modified: head/sys/fs/devfs/devfs_vnops.c head/sys/kern/kern_descrip.c Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Fri Nov 4 02:34:52 2011 (r227068) +++ head/sys/fs/devfs/devfs_vnops.c Fri Nov 4 03:39:31 2011 (r227069) @@ -604,6 +604,13 @@ devfs_close_f(struct file *fp, struct th 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); } Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Fri Nov 4 02:34:52 2011 (r227068) +++ head/sys/kern/kern_descrip.c Fri Nov 4 03:39:31 2011 (r227069) @@ -2575,12 +2575,6 @@ _fdrop(struct file *fp, struct thread *t 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); _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"