Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Feb 2019 04:47:21 +0000 (UTC)
From:      Conrad Meyer <cem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r343762 - head/sys/kern
Message-ID:  <201902050447.x154lLvQ022618@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cem
Date: Tue Feb  5 04:47:21 2019
New Revision: 343762
URL: https://svnweb.freebsd.org/changeset/base/343762

Log:
  extattr_list_vp: Narrow locked section somewhat
  
  Suggested by:	mjg
  Reviewed by:	kib, mjg
  Sponsored by:	Dell EMC Isilon
  Differential Revision:	https://reviews.freebsd.org/D19083

Modified:
  head/sys/kern/vfs_extattr.c

Modified: head/sys/kern/vfs_extattr.c
==============================================================================
--- head/sys/kern/vfs_extattr.c	Tue Feb  5 03:32:58 2019	(r343761)
+++ head/sys/kern/vfs_extattr.c	Tue Feb  5 04:47:21 2019	(r343762)
@@ -633,8 +633,6 @@ extattr_list_vp(struct vnode *vp, int attrnamespace, v
 	if (nbytes > IOSIZE_MAX)
 		return (EINVAL);
 
-	vn_lock(vp, LK_SHARED | LK_RETRY);
-
 	auiop = NULL;
 	sizep = NULL;
 	cnt = 0;
@@ -653,24 +651,25 @@ extattr_list_vp(struct vnode *vp, int attrnamespace, v
 	} else
 		sizep = &size;
 
+	vn_lock(vp, LK_SHARED | LK_RETRY);
+
 #ifdef MAC
 	error = mac_vnode_check_listextattr(td->td_ucred, vp, attrnamespace);
-	if (error)
-		goto done;
+	if (error) {
+		VOP_UNLOCK(vp, 0);
+		return (error);
+	}
 #endif
 
 	error = VOP_LISTEXTATTR(vp, attrnamespace, auiop, sizep,
 	    td->td_ucred, td);
+	VOP_UNLOCK(vp, 0);
 
 	if (auiop != NULL) {
 		cnt -= auio.uio_resid;
 		td->td_retval[0] = cnt;
 	} else
 		td->td_retval[0] = size;
-#ifdef MAC
-done:
-#endif
-	VOP_UNLOCK(vp, 0);
 	return (error);
 }
 



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