Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/lfs Byebye deadlock.



details:   https://anonhg.NetBSD.org/src/rev/e32309caf39d
branches:  trunk
changeset: 759847:e32309caf39d
user:      eeh <eeh%NetBSD.org@localhost>
date:      Sat Dec 18 00:01:46 2010 +0000

description:
Byebye deadlock.

diffstat:

 sys/ufs/lfs/lfs_vnops.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (40 lines):

diff -r cbc60f37f01c -r e32309caf39d sys/ufs/lfs/lfs_vnops.c
--- a/sys/ufs/lfs/lfs_vnops.c   Fri Dec 17 23:57:07 2010 +0000
+++ b/sys/ufs/lfs/lfs_vnops.c   Sat Dec 18 00:01:46 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_vnops.c,v 1.231 2010/08/04 10:43:53 hannken Exp $  */
+/*     $NetBSD: lfs_vnops.c,v 1.232 2010/12/18 00:01:46 eeh Exp $      */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.231 2010/08/04 10:43:53 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.232 2010/12/18 00:01:46 eeh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -2205,16 +2205,19 @@
         * Pagedaemon can't actually write LFS pages; wake up
         * the writer to take care of that.  The writer will
         * notice the pager inode queue and act on that.
+        *
+        * XXX We must drop the vp->interlock before taking the lfs_lock or we
+        * get a nasty deadlock with lfs_flush_pchain().
         */
        if (pagedaemon) {
+               mutex_exit(&vp->v_interlock);
                mutex_enter(&lfs_lock);
                if (!(ip->i_flags & IN_PAGING)) {
                        ip->i_flags |= IN_PAGING;
                        TAILQ_INSERT_TAIL(&fs->lfs_pchainhd, ip, i_lfs_pchain);
-               }
+               } 
                wakeup(&lfs_writer_daemon);
                mutex_exit(&lfs_lock);
-               mutex_exit(&vp->v_interlock);
                preempt();
                return EWOULDBLOCK;
        }



Home | Main Index | Thread Index | Old Index