svn commit: r353388 - stable/11/sys/fs/tmpfs

Konstantin Belousov kib at FreeBSD.org
Thu Oct 10 08:50:42 UTC 2019


Author: kib
Date: Thu Oct 10 08:50:41 2019
New Revision: 353388
URL: https://svnweb.freebsd.org/changeset/base/353388

Log:
  MFC r353065:
  tmpfs_readdir(): unlock the locked node.

Modified:
  stable/11/sys/fs/tmpfs/tmpfs_subr.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/tmpfs/tmpfs_subr.c
==============================================================================
--- stable/11/sys/fs/tmpfs/tmpfs_subr.c	Thu Oct 10 08:49:09 2019	(r353387)
+++ stable/11/sys/fs/tmpfs/tmpfs_subr.c	Thu Oct 10 08:50:41 2019	(r353388)
@@ -1143,8 +1143,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);
@@ -1153,12 +1154,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;


More information about the svn-src-all mailing list