Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Oct 2019 15:19:50 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org
Subject:   svn commit: r353404 - releng/12.1/sys/fs/tmpfs
Message-ID:  <201910101519.x9AFJogZ083564@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Thu Oct 10 15:19:49 2019
New Revision: 353404
URL: https://svnweb.freebsd.org/changeset/base/353404

Log:
  MFC r353065, MFS12 353385:
  tmpfs_readdir(): unlock the locked node.
  
  Approved by:	re (gjb)

Modified:
  releng/12.1/sys/fs/tmpfs/tmpfs_subr.c
Directory Properties:
  releng/12.1/   (props changed)

Modified: releng/12.1/sys/fs/tmpfs/tmpfs_subr.c
==============================================================================
--- releng/12.1/sys/fs/tmpfs/tmpfs_subr.c	Thu Oct 10 14:56:29 2019	(r353403)
+++ releng/12.1/sys/fs/tmpfs/tmpfs_subr.c	Thu Oct 10 15:19:49 2019	(r353404)
@@ -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
 	 * 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;



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