Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/lfs Fix locking panic on ufs_hashlock



details:   https://anonhg.NetBSD.org/src/rev/25750b874a37
branches:  trunk
changeset: 471950:25750b874a37
user:      perseant <perseant%NetBSD.org@localhost>
date:      Fri Apr 16 00:41:58 1999 +0000

description:
Fix locking panic on ufs_hashlock

diffstat:

 sys/ufs/lfs/lfs_alloc.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r b9a341f90937 -r 25750b874a37 sys/ufs/lfs/lfs_alloc.c
--- a/sys/ufs/lfs/lfs_alloc.c   Thu Apr 15 23:51:44 1999 +0000
+++ b/sys/ufs/lfs/lfs_alloc.c   Fri Apr 16 00:41:58 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_alloc.c,v 1.19 1999/04/11 23:24:04 perseant Exp $  */
+/*     $NetBSD: lfs_alloc.c,v 1.20 1999/04/16 00:41:58 perseant Exp $  */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -292,15 +292,18 @@
        struct lfs *fs;
        ufs_daddr_t old_iaddr;
        ino_t ino;
+       int already_locked;
        
        /* Get the inode number and file system. */
        ip = VTOI(ap->a_pvp);
        fs = ip->i_lfs;
        ino = ip->i_number;
        
+       /* If we already hold ufs_hashlock, don't panic, just do it anyway */
+       already_locked = lockstatus(&ufs_hashlock) && ufs_hashlock.lk_lockholder == curproc->p_pid;
        while(WRITEINPROG(ap->a_pvp)
              || fs->lfs_seglock
-             || lockmgr(&ufs_hashlock, LK_EXCLUSIVE|LK_SLEEPFAIL, 0))
+             || (!already_locked && lockmgr(&ufs_hashlock, LK_EXCLUSIVE|LK_SLEEPFAIL, 0)))
        {
                if (WRITEINPROG(ap->a_pvp)) {
                        tsleep(ap->a_pvp, (PRIBIO+1), "lfs_vfree", 0);



Home | Main Index | Thread Index | Old Index