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 Pullup 1.45 [perseant, toshii]:
details: https://anonhg.NetBSD.org/src/rev/5d0eaa5dd79a
branches: netbsd-1-5
changeset: 490068:5d0eaa5dd79a
user: tv <tv%NetBSD.org@localhost>
date: Wed Nov 01 03:56:53 2000 +0000
description:
Pullup 1.45 [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_inode.c | 15 +++++----------
1 files changed, 5 insertions(+), 10 deletions(-)
diffs (40 lines):
diff -r 9c0c7a7b6464 -r 5d0eaa5dd79a sys/ufs/lfs/lfs_inode.c
--- a/sys/ufs/lfs/lfs_inode.c Wed Nov 01 03:53:38 2000 +0000
+++ b/sys/ufs/lfs/lfs_inode.c Wed Nov 01 03:56:53 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_inode.c,v 1.37.2.1 2000/09/14 18:50:18 perseant Exp $ */
+/* $NetBSD: lfs_inode.c,v 1.37.2.2 2000/11/01 03:56:53 tv Exp $ */
/*-
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -441,7 +441,8 @@
panic("itrunc: newspace");
if (oldspace - newspace > 0) {
lfs_blkfree(fs, bn, oldspace - newspace, &lastseg, &bc);
- real_released += btodb(oldspace - newspace);
+ if (bn > 0)
+ real_released += btodb(oldspace - newspace);
blocksreleased += btodb(oldspace - newspace);
}
}
@@ -468,18 +469,12 @@
oip->i_ffs_blocks -= real_released;
fs->lfs_bfree += blocksreleased;
#ifdef DIAGNOSTIC
- if (oip->i_ffs_size == 0 && oip->i_ffs_blocks > 0) {
- printf("lfs_tuncate: truncate to 0 but %d blocks on inode\n",
+ if (oip->i_ffs_size == 0 && oip->i_ffs_blocks != 0) {
+ printf("lfs_truncate: truncate to 0 but %d blocks on inode\n",
oip->i_ffs_blocks);
panic("lfs_truncate: persistent blocks\n");
}
#endif
- if (oip->i_ffs_blocks < 0) {
-#ifdef DIAGNOSTIC
- panic("lfs_truncate: negative block count\n");
-#endif
- oip->i_ffs_blocks = 0;
- }
oip->i_flag |= IN_CHANGE;
#ifdef QUOTA
(void) chkdq(oip, -blocksreleased, NOCRED, 0);
Home |
Main Index |
Thread Index |
Old Index