Module Name:    src
Committed By:   manu
Date:           Tue May 10 08:29:32 UTC 2011

Modified Files:
        src/sys/ufs/ufs: ufs_extattr.c

Log Message:
Fix filesystem root leaked lock when using UFS_EXTATTR_AUTOSTART.
This way, statvfs(2) calls obtained by df(1) or umount(8) will no
longer sleep forever in the kernel to acquire the lock.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/ufs/ufs/ufs_extattr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/ufs/ufs/ufs_extattr.c
diff -u src/sys/ufs/ufs/ufs_extattr.c:1.28 src/sys/ufs/ufs/ufs_extattr.c:1.29
--- src/sys/ufs/ufs/ufs_extattr.c:1.28	Tue Nov 30 10:30:04 2010
+++ src/sys/ufs/ufs/ufs_extattr.c	Tue May 10 08:29:32 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_extattr.c,v 1.28 2010/11/30 10:30:04 dholland Exp $	*/
+/*	$NetBSD: ufs_extattr.c,v 1.29 2011/05/10 08:29:32 manu Exp $	*/
 
 /*-
  * Copyright (c) 1999-2002 Robert N. M. Watson
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_extattr.c,v 1.28 2010/11/30 10:30:04 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_extattr.c,v 1.29 2011/05/10 08:29:32 manu Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ffs.h"
@@ -287,7 +287,9 @@
 	error = ufs_lookup(&vargs);
 	PNBUF_PUT(pnbuf);
 	if (error) {
-		VOP_UNLOCK(start_dvp);
+		if (lockparent == 0) {
+			VOP_UNLOCK(start_dvp);
+		}
 		return (error);
 	}
 #if 0
@@ -295,6 +297,9 @@
 		panic("ufs_extattr_lookup: target_vp == start_dvp");
 #endif
 
+	if ((target_vp != start_dvp) && (lockparent == 0))
+		 VOP_UNLOCK(start_dvp);
+
 	KASSERT(VOP_ISLOCKED(target_vp) == LK_EXCLUSIVE);
 	*vp = target_vp;
 	return (0);

Reply via email to