Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Jan 2015 11:37:17 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r277746 - stable/10/sys/fs/devfs
Message-ID:  <201501261137.t0QBbHtc095930@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Mon Jan 26 11:37:16 2015
New Revision: 277746
URL: https://svnweb.freebsd.org/changeset/base/277746

Log:
  MFC r277390:
  Ignore devfs directory entries for devices being destroyed.

Modified:
  stable/10/sys/fs/devfs/devfs_devs.c
  stable/10/sys/fs/devfs/devfs_vnops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/devfs/devfs_devs.c
==============================================================================
--- stable/10/sys/fs/devfs/devfs_devs.c	Mon Jan 26 10:31:17 2015	(r277745)
+++ stable/10/sys/fs/devfs/devfs_devs.c	Mon Jan 26 11:37:16 2015	(r277746)
@@ -186,6 +186,16 @@ devfs_find(struct devfs_dirent *dd, cons
 			continue;
 		if (type != 0 && type != de->de_dirent->d_type)
 			continue;
+
+		/*
+		 * The race with finding non-active name is not
+		 * completely closed by the check, but it is similar
+		 * to the devfs_allocv() in making it unlikely enough.
+		 */
+		if (de->de_dirent->d_type == DT_CHR &&
+		    (de->de_cdp->cdp_flags & CDP_ACTIVE) == 0)
+			continue;
+
 		if (bcmp(name, de->de_dirent->d_name, namelen) != 0)
 			continue;
 		break;

Modified: stable/10/sys/fs/devfs/devfs_vnops.c
==============================================================================
--- stable/10/sys/fs/devfs/devfs_vnops.c	Mon Jan 26 10:31:17 2015	(r277745)
+++ stable/10/sys/fs/devfs/devfs_vnops.c	Mon Jan 26 11:37:16 2015	(r277746)
@@ -1023,6 +1023,9 @@ devfs_mknod(struct vop_mknod_args *ap)
 	TAILQ_FOREACH(de, &dd->de_dlist, de_list) {
 		if (cnp->cn_namelen != de->de_dirent->d_namlen)
 			continue;
+		if (de->de_dirent->d_type == DT_CHR &&
+		    (de->de_cdp->cdp_flags & CDP_ACTIVE) == 0)
+			continue;
 		if (bcmp(cnp->cn_nameptr, de->de_dirent->d_name,
 		    de->de_dirent->d_namlen) != 0)
 			continue;



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