svn commit: r211816 - head/sys/fs/devfs

Jaakko Heinonen jh at FreeBSD.org
Wed Aug 25 15:29:13 UTC 2010


Author: jh
Date: Wed Aug 25 15:29:12 2010
New Revision: 211816
URL: http://svn.freebsd.org/changeset/base/211816

Log:
  Call devfs_populate_vp() from devfs_getattr(). It was possible that
  fstat(2) returned stale information through an open file descriptor.

Modified:
  head/sys/fs/devfs/devfs_vnops.c

Modified: head/sys/fs/devfs/devfs_vnops.c
==============================================================================
--- head/sys/fs/devfs/devfs_vnops.c	Wed Aug 25 15:21:26 2010	(r211815)
+++ head/sys/fs/devfs/devfs_vnops.c	Wed Aug 25 15:29:12 2010	(r211816)
@@ -618,10 +618,18 @@ devfs_getattr(struct vop_getattr_args *a
 {
 	struct vnode *vp = ap->a_vp;
 	struct vattr *vap = ap->a_vap;
-	int error = 0;
+	int error;
 	struct devfs_dirent *de;
+	struct devfs_mount *dmp;
 	struct cdev *dev;
 
+	error = devfs_populate_vp(vp);
+	if (error != 0)
+		return (error);
+
+	dmp = VFSTODEVFS(vp->v_mount);
+	sx_xunlock(&dmp->dm_lock);
+
 	de = vp->v_data;
 	KASSERT(de != NULL, ("Null dirent in devfs_getattr vp=%p", vp));
 	if (vp->v_type == VDIR) {


More information about the svn-src-all mailing list