Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/lfs Take vp->v_interlock before vdead_check in lfs_b...



details:   https://anonhg.NetBSD.org/src/rev/561b6feaf40f
branches:  trunk
changeset: 795371:561b6feaf40f
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Apr 09 22:44:15 2014 +0000

description:
Take vp->v_interlock before vdead_check in lfs_bmapv.

XXX This code is a pile of bodge that needs a serious rototill anyway.

diffstat:

 sys/ufs/lfs/lfs_syscalls.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (38 lines):

diff -r 2233cc26fbda -r 561b6feaf40f sys/ufs/lfs/lfs_syscalls.c
--- a/sys/ufs/lfs/lfs_syscalls.c        Wed Apr 09 22:41:38 2014 +0000
+++ b/sys/ufs/lfs/lfs_syscalls.c        Wed Apr 09 22:44:15 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_syscalls.c,v 1.152 2014/03/24 13:42:40 hannken Exp $       */
+/*     $NetBSD: lfs_syscalls.c,v 1.153 2014/04/09 22:44:15 riastradh Exp $     */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007, 2008
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.152 2014/03/24 13:42:40 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.153 2014/04/09 22:44:15 riastradh Exp $");
 
 #ifndef LFS
 # define LFS           /* for prototypes in syscallargs.h */
@@ -743,9 +743,10 @@
                         */
                        mutex_enter(&ulfs_ihash_lock);
                        vp = ulfs_ihashlookup(ump->um_dev, blkp->bi_inode);
+                       if (vp != NULL)
+                               mutex_enter(vp->v_interlock);
                        if (vp != NULL && vdead_check(vp, VDEAD_NOWAIT) == 0) {
                                ip = VTOI(vp);
-                               mutex_enter(vp->v_interlock);
                                mutex_exit(&ulfs_ihash_lock);
                                if (lfs_vref(vp)) {
                                        v_daddr = LFS_UNUSED_DADDR;
@@ -753,6 +754,7 @@
                                }
                                numrefed++;
                        } else {
+                               mutex_exit(vp->v_interlock);
                                mutex_exit(&ulfs_ihash_lock);
                                /*
                                 * Don't VFS_VGET if we're being unmounted,



Home | Main Index | Thread Index | Old Index