From 8c48e7bab19025e52b14af5d7dff5f8cfecf1e67 Mon Sep 17 00:00:00 2001 From: jh Date: Sat, 18 Sep 2010 18:37:41 +0000 Subject: [PATCH] - For consistency, remove "." and ".." entries from de_dlist before calling devfs_delete() (and thus possibly dropping dm_lock) in devfs_rmdir_empty(). - Assert that we don't return doomed entries from devfs_find(). [1] Suggested by: kib [1] Reviewed by: kib --- sys/fs/devfs/devfs_devs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/fs/devfs/devfs_devs.c b/sys/fs/devfs/devfs_devs.c index eaaea6876a86..60c296b0b006 100644 --- a/sys/fs/devfs/devfs_devs.c +++ b/sys/fs/devfs/devfs_devs.c @@ -171,6 +171,8 @@ devfs_find(struct devfs_dirent *dd, const char *name, int namelen, int type) continue; break; } + KASSERT(de == NULL || (de->de_flags & DE_DOOMED) == 0, + ("devfs_find: returning a doomed entry")); return (de); } @@ -302,6 +304,8 @@ devfs_rmdir_empty(struct devfs_mount *dm, struct devfs_dirent *de) dd = devfs_parent_dirent(de); KASSERT(dd != NULL, ("devfs_rmdir_empty: NULL dd")); + TAILQ_REMOVE(&de->de_dlist, de_dot, de_list); + TAILQ_REMOVE(&de->de_dlist, de_dotdot, de_list); TAILQ_REMOVE(&dd->de_dlist, de, de_list); DEVFS_DE_HOLD(dd); devfs_delete(dm, de, DEVFS_DEL_NORECURSE);