Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Jan 2012 16:50:12 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r229505 - in stable/9/sys: fs/devfs kern
Message-ID:  <201201041650.q04GoCmw087594@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Wed Jan  4 16:50:12 2012
New Revision: 229505
URL: http://svn.freebsd.org/changeset/base/229505

Log:
  MFC 227069:
  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.

Modified:
  stable/9/sys/fs/devfs/devfs_vnops.c
  stable/9/sys/kern/kern_descrip.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)

Modified: stable/9/sys/fs/devfs/devfs_vnops.c
==============================================================================
--- stable/9/sys/fs/devfs/devfs_vnops.c	Wed Jan  4 16:45:12 2012	(r229504)
+++ stable/9/sys/fs/devfs/devfs_vnops.c	Wed Jan  4 16:50:12 2012	(r229505)
@@ -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: stable/9/sys/kern/kern_descrip.c
==============================================================================
--- stable/9/sys/kern/kern_descrip.c	Wed Jan  4 16:45:12 2012	(r229504)
+++ stable/9/sys/kern/kern_descrip.c	Wed Jan  4 16:50:12 2012	(r229505)
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201041650.q04GoCmw087594>