From 44c8d0014aa3e708c8983c46b03ae875a7315d63 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Thu, 10 Oct 2019 15:19:49 +0000 Subject: [PATCH] MFC r353065, MFS12 353385: tmpfs_readdir(): unlock the locked node. Approved by: re (gjb) --- sys/fs/tmpfs/tmpfs_subr.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index d8d152c2287..4727564de96 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -1149,8 +1149,9 @@ static int tmpfs_dir_getdotdotdent(struct tmpfs_mount *tm, struct tmpfs_node *node, struct uio *uio) { - int error; + struct tmpfs_node *parent; struct dirent dent; + int error; TMPFS_VALIDATE_DIR(node); MPASS(uio->uio_offset == TMPFS_DIRCOOKIE_DOTDOT); @@ -1159,12 +1160,13 @@ tmpfs_dir_getdotdotdent(struct tmpfs_mount *tm, struct tmpfs_node *node, * Return ENOENT if the current node is already removed. */ TMPFS_ASSERT_LOCKED(node); - if (node->tn_dir.tn_parent == NULL) + parent = node->tn_dir.tn_parent; + if (parent == NULL) return (ENOENT); - TMPFS_NODE_LOCK(node->tn_dir.tn_parent); - dent.d_fileno = node->tn_dir.tn_parent->tn_id; - TMPFS_NODE_UNLOCK(node->tn_dir.tn_parent); + TMPFS_NODE_LOCK(parent); + dent.d_fileno = parent->tn_id; + TMPFS_NODE_UNLOCK(parent); dent.d_type = DT_DIR; dent.d_namlen = 2; -- 2.45.0