Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sys/ufs/lfs Fix pullup of 1.46 [perseant, toshii]:



details:   https://anonhg.NetBSD.org/src/rev/ce8592ae4890
branches:  netbsd-1-5
changeset: 490082:ce8592ae4890
user:      tv <tv%NetBSD.org@localhost>
date:      Wed Nov 01 16:34:31 2000 +0000

description:
Fix pullup of 1.46 [perseant, toshii]:
In lfs_truncate, don't overcount the real blocks removed from the inode,
when deallocating a fragment that has not made it to disk yet.

Also, during dirops, give the directory vnode an extra reference in
SET_DIROP, to ensure its continued existence during SET_ENDOP, preventing
a possible NULL-dereference there.

These two changes should close PR #11064.

diffstat:

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

diffs (55 lines):

diff -r 14418280acae -r ce8592ae4890 sys/ufs/lfs/lfs_vnops.c
--- a/sys/ufs/lfs/lfs_vnops.c   Wed Nov 01 16:31:35 2000 +0000
+++ b/sys/ufs/lfs/lfs_vnops.c   Wed Nov 01 16:34:31 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_vnops.c,v 1.38.2.3 2000/11/01 03:57:18 tv Exp $    */
+/*     $NetBSD: lfs_vnops.c,v 1.38.2.4 2000/11/01 16:34:31 tv Exp $    */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -284,8 +284,6 @@
                struct vnode *a_vp;
                struct ucred *a_cred;
                int a_flags;
-               off_t offlo;
-               off_t offhi;
                struct proc *a_p;
        } */ *ap = v;
        
@@ -328,7 +326,8 @@
 static int lfs_set_dirop __P((struct vnode *));
 extern int lfs_dirvcount;
 
-static int lfs_set_dirop(vp)
+static int
+lfs_set_dirop(vp)
        struct vnode *vp;
 {
        struct lfs *fs;
@@ -369,6 +368,9 @@
        ++fs->lfs_dirops;                                               
        fs->lfs_doifile = 1;                                            
 
+       /* Hold a reference so SET_ENDOP will be happy */
+       lfs_vref(vp);
+
        return 0;
 }
 
@@ -383,6 +385,7 @@
                lfs_check((vp),LFS_UNUSED_LBN,0);                       \
        }                                                               \
        lfs_reserve(fs, vp, -fsbtodb(fs, NIADDR + 3)); /* XXX */        \
+       lfs_vunref(vp);                                                 \
 }
 
 #define        MARK_VNODE(dvp)  do {                                           \
@@ -491,7 +494,7 @@
         * return.  But, that leaves this vnode in limbo, also not good.
         * Can this ever happen (barring hardware failure)?
         */
-       if ((error = VOP_FSYNC(*vpp, NOCRED, FSYNC_WAIT, 0, 0, curproc)) != 0) {
+       if ((error = VOP_FSYNC(*vpp, NOCRED, FSYNC_WAIT, curproc)) != 0) {
                printf("Couldn't fsync in mknod (ino %d)---what do I do?\n",
                       VTOI(*vpp)->i_number);
                return (error);



Home | Main Index | Thread Index | Old Index