Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/msdosfs msdosfs_reclaim(): add missing fstrans and pr...



details:   https://anonhg.NetBSD.org/src/rev/3fb737833d8e
branches:  trunk
changeset: 329599:3fb737833d8e
user:      hannken <hannken%NetBSD.org@localhost>
date:      Fri May 30 08:42:35 2014 +0000

description:
msdosfs_reclaim(): add missing fstrans and protect change
of v_data with v_interlock as msdosfs_sync() now needs it.

diffstat:

 sys/fs/msdosfs/msdosfs_denode.c |  14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diffs (46 lines):

diff -r 8e6502df8f99 -r 3fb737833d8e sys/fs/msdosfs/msdosfs_denode.c
--- a/sys/fs/msdosfs/msdosfs_denode.c   Fri May 30 08:40:09 2014 +0000
+++ b/sys/fs/msdosfs/msdosfs_denode.c   Fri May 30 08:42:35 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msdosfs_denode.c,v 1.48 2012/12/20 08:03:42 hannken Exp $      */
+/*     $NetBSD: msdosfs_denode.c,v 1.49 2014/05/30 08:42:35 hannken Exp $      */
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_denode.c,v 1.48 2012/12/20 08:03:42 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_denode.c,v 1.49 2014/05/30 08:42:35 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -671,8 +671,10 @@
                struct vnode *a_vp;
        } */ *ap = v;
        struct vnode *vp = ap->a_vp;
+       struct mount *mp = vp->v_mount;
        struct denode *dep = VTODE(vp);
 
+       fstrans_start(mp, FSTRANS_LAZY);
 #ifdef MSDOSFS_DEBUG
        printf("msdosfs_reclaim(): dep %p, file %s, refcnt %ld\n",
            dep, dep->de_Name, dep->de_refcnt);
@@ -694,9 +696,15 @@
 #if 0 /* XXX */
        dep->de_flag = 0;
 #endif
+       /*
+        * To interlock with msdosfs_sync().
+        */
        genfs_node_destroy(vp);
+       mutex_enter(vp->v_interlock);
+       vp->v_data = NULL;
+       mutex_exit(vp->v_interlock);
        pool_put(&msdosfs_denode_pool, dep);
-       vp->v_data = NULL;
+       fstrans_done(mp);
        return (0);
 }
 



Home | Main Index | Thread Index | Old Index