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 a problem in my changes of Dec 14th, that pr...



details:   https://anonhg.NetBSD.org/src/rev/d7dae460c3e5
branches:  trunk
changeset: 480570:d7dae460c3e5
user:      perseant <perseant%NetBSD.org@localhost>
date:      Sun Jan 16 05:56:14 2000 +0000

description:
Fix a problem in my changes of Dec 14th, that prevents removed vnodes
from being inactivated under some conditions.  Removed vnodes are now
inactivated when the VDIROP flag is cleared, and to prevent block
accounting problems this clearing has been postponed until
lfs_segunlock.

diffstat:

 sys/ufs/lfs/lfs_inode.c   |   4 ++--
 sys/ufs/lfs/lfs_segment.c |   9 +--------
 sys/ufs/lfs/lfs_subr.c    |  42 +++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 44 insertions(+), 11 deletions(-)

diffs (100 lines):

diff -r b05180d838da -r d7dae460c3e5 sys/ufs/lfs/lfs_inode.c
--- a/sys/ufs/lfs/lfs_inode.c   Sun Jan 16 04:57:08 2000 +0000
+++ b/sys/ufs/lfs/lfs_inode.c   Sun Jan 16 05:56:14 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_inode.c,v 1.28 1999/11/23 23:52:42 fvdl Exp $      */
+/*     $NetBSD: lfs_inode.c,v 1.29 2000/01/16 05:56:14 perseant Exp $  */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -269,7 +269,7 @@
         *
         * XXX KS - too restrictive?  Maybe only when cleaning?
         */
-       while(fs->lfs_seglock) {
+       while(fs->lfs_seglock && fs->lfs_lockpid != ap->a_p->p_pid) {
                tsleep(&fs->lfs_seglock, (PRIBIO+1), "lfs_truncate", 0);
        }
        
diff -r b05180d838da -r d7dae460c3e5 sys/ufs/lfs/lfs_segment.c
--- a/sys/ufs/lfs/lfs_segment.c Sun Jan 16 04:57:08 2000 +0000
+++ b/sys/ufs/lfs/lfs_segment.c Sun Jan 16 05:56:14 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_segment.c,v 1.38 2000/01/14 21:38:46 perseant Exp $        */
+/*     $NetBSD: lfs_segment.c,v 1.39 2000/01/16 05:56:14 perseant Exp $        */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -438,13 +438,6 @@
                        inodes_written++;
                }
 
-               if(vp->v_flag & VDIROP) {
-                       --lfs_dirvcount;
-                       vp->v_flag &= ~VDIROP;
-                       wakeup(&lfs_dirvcount);
-                       lfs_vunref(vp);
-               }
-
                if(lfs_clean_vnhead && only_cleaning)
                        lfs_vunref_head(vp);
                else
diff -r b05180d838da -r d7dae460c3e5 sys/ufs/lfs/lfs_subr.c
--- a/sys/ufs/lfs/lfs_subr.c    Sun Jan 16 04:57:08 2000 +0000
+++ b/sys/ufs/lfs/lfs_subr.c    Sun Jan 16 05:56:14 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_subr.c,v 1.9 1999/03/25 21:39:18 perseant Exp $    */
+/*     $NetBSD: lfs_subr.c,v 1.10 2000/01/16 05:56:14 perseant Exp $   */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -177,9 +177,49 @@
        struct segment *sp;
        unsigned long sync, ckp;
        int s;
+       struct vnode *vp;
+       struct mount *mp;
+       extern int lfs_dirvcount;
        
        if (fs->lfs_seglock == 1) {
 
+               mp = fs->lfs_ivnode->v_mount;
+               /*
+                * Go through and unmark all DIROP vnodes, possibly
+                * calling VOP_INACTIVE (through vrele).  This is
+                * delayed until now in order not to accidentally
+                * write a DIROP node through lfs_flush.
+                */
+#ifndef LFS_NO_BACKVP_HACK
+       /* BEGIN HACK */
+#define        VN_OFFSET       (((caddr_t)&vp->v_mntvnodes.le_next) - (caddr_t)vp)
+#define        BACK_VP(VP)     ((struct vnode *)(((caddr_t)VP->v_mntvnodes.le_prev) - VN_OFFSET))
+#define        BEG_OF_VLIST    ((struct vnode *)(((caddr_t)&mp->mnt_vnodelist.lh_first) - VN_OFFSET))
+       
+               /* Find last vnode. */
+       loop:   for (vp = mp->mnt_vnodelist.lh_first;
+                    vp && vp->v_mntvnodes.le_next != NULL;
+                    vp = vp->v_mntvnodes.le_next);
+               for (; vp && vp != BEG_OF_VLIST; vp = BACK_VP(vp)) {
+#else
+       loop:
+               for (vp = mp->mnt_vnodelist.lh_first;
+                    vp != NULL;
+                    vp = vp->v_mntvnodes.le_next) {
+#endif
+                       if (vp->v_mount != mp)
+                               goto loop;
+                       if (vp->v_type == VNON)
+                               continue;
+                       if(vp->v_flag & VDIROP) {
+                               /* No vref, it has one from before */
+                               --lfs_dirvcount;
+                               vp->v_flag &= ~VDIROP;
+                               wakeup(&lfs_dirvcount);
+                               vrele(vp);
+                       }
+               }
+
                sp = fs->lfs_sp;
                sync = sp->seg_flags & SEGM_SYNC;
                ckp = sp->seg_flags & SEGM_CKP;



Home | Main Index | Thread Index | Old Index