Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ufs/ufs Fix filesystem root leaked lock when using UFS_E...



details:   https://anonhg.NetBSD.org/src/rev/5480020b40d2
branches:  trunk
changeset: 764875:5480020b40d2
user:      manu <manu%NetBSD.org@localhost>
date:      Tue May 10 08:29:32 2011 +0000

description:
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.

diffstat:

 sys/ufs/ufs/ufs_extattr.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (39 lines):

diff -r a2ddaa15c7f6 -r 5480020b40d2 sys/ufs/ufs/ufs_extattr.c
--- a/sys/ufs/ufs/ufs_extattr.c Tue May 10 07:04:17 2011 +0000
+++ b/sys/ufs/ufs/ufs_extattr.c Tue May 10 08:29:32 2011 +0000
@@ -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);



Home | Main Index | Thread Index | Old Index