Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Mar 2019 11:49:46 +0000 (UTC)
From:      Fedor Uporov <fsu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r345179 - head/sys/fs/ext2fs
Message-ID:  <201903151149.x2FBnkV2081699@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: fsu
Date: Fri Mar 15 11:49:46 2019
New Revision: 345179
URL: https://svnweb.freebsd.org/changeset/base/345179

Log:
  Remove unneeded mount point unlock function calls.
  
  The ext2_nodealloccg() function unlocks the mount point
  in case of successful node allocation.
  The additional unlocks are not required and should be removed.
  
  PR:		236452
  Reported by:	pho
  MFC after:	3 days

Modified:
  head/sys/fs/ext2fs/ext2_alloc.c

Modified: head/sys/fs/ext2fs/ext2_alloc.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_alloc.c	Fri Mar 15 11:21:20 2019	(r345178)
+++ head/sys/fs/ext2fs/ext2_alloc.c	Fri Mar 15 11:49:46 2019	(r345179)
@@ -412,23 +412,21 @@ ext2_valloc(struct vnode *pvp, int mode, struct ucred 
 	td = curthread;
 	error = vfs_hash_get(ump->um_mountp, ino, LK_EXCLUSIVE, td, vpp, NULL, NULL);
 	if (error || *vpp != NULL) {
-		EXT2_UNLOCK(ump);
 		return (error);
 	}
 
 	ip = malloc(sizeof(struct inode), M_EXT2NODE, M_WAITOK | M_ZERO);
 	if (ip == NULL) {
-		EXT2_UNLOCK(ump);
 		return (ENOMEM);
 	}
 
 	/* Allocate a new vnode/inode. */
 	if ((error = getnewvnode("ext2fs", ump->um_mountp, &ext2_vnodeops, &vp)) != 0) {
 		free(ip, M_EXT2NODE);
-		EXT2_UNLOCK(ump);
 		return (error);
 	}
 
+	lockmgr(vp->v_vnlock, LK_EXCLUSIVE, NULL);
 	vp->v_data = ip;
 	ip->i_vnode = vp;
 	ip->i_e2fs = fs = ump->um_e2fs;
@@ -438,11 +436,9 @@ ext2_valloc(struct vnode *pvp, int mode, struct ucred 
 	ip->i_next_alloc_block = 0;
 	ip->i_next_alloc_goal = 0;
 
-	lockmgr(vp->v_vnlock, LK_EXCLUSIVE, NULL);
 	error = insmntque(vp, ump->um_mountp);
 	if (error) {
 		free(ip, M_EXT2NODE);
-		EXT2_UNLOCK(ump);
 		return (error);
 	}
 
@@ -450,7 +446,6 @@ ext2_valloc(struct vnode *pvp, int mode, struct ucred 
 	if (error || *vpp != NULL) {
 		*vpp = NULL;
 		free(ip, M_EXT2NODE);
-		EXT2_UNLOCK(ump);
 		return (error);
 	}
 
@@ -458,7 +453,6 @@ ext2_valloc(struct vnode *pvp, int mode, struct ucred 
 		vput(vp);
 		*vpp = NULL;
 		free(ip, M_EXT2NODE);
-		EXT2_UNLOCK(ump);
 		return (error);
 	}
 



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