Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Aug 2010 15:29:13 +0000 (UTC)
From:      Jaakko Heinonen <jh@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r211816 - head/sys/fs/devfs
Message-ID:  <201008251529.o7PFTDuK015512@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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) {



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