diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2001-11-30 00:32:59 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2001-11-30 00:32:59 +0000 |
commit | cea9b12525fdd9c175f2141eacfcb1a79cc56fe5 (patch) | |
tree | 68bb11701696ec463f7026a9f9f0e5185f812167 | |
parent | a2c8b5977ff11b8f875fcff248cd04bfd37e6778 (diff) |
Fix a mergeo and don't truncate a 0 length file when freeing it.
-rw-r--r-- | sys/ufs/ufs/ufs_inode.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/ufs/ufs/ufs_inode.c b/sys/ufs/ufs/ufs_inode.c index 6696e932e63..c86f6d7d274 100644 --- a/sys/ufs/ufs/ufs_inode.c +++ b/sys/ufs/ufs/ufs_inode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_inode.c,v 1.12 2001/11/28 00:45:40 art Exp $ */ +/* $OpenBSD: ufs_inode.c,v 1.13 2001/11/30 00:32:58 art Exp $ */ /* $NetBSD: ufs_inode.c,v 1.7 1996/05/11 18:27:52 mycroft Exp $ */ /* @@ -101,7 +101,9 @@ ufs_inactive(v) if (getinoquota(ip) != 0) (void)ufs_quota_free_inode(ip, NOCRED); - (void) UFS_TRUNCATE(ip, (off_t)0, 0, NOCRED); + if (ip->i_ffs_size != 0) { + (void) UFS_TRUNCATE(ip, (off_t)0, 0, NOCRED); + } ip->i_ffs_rdev = 0; mode = ip->i_ffs_mode; ip->i_ffs_mode = 0; @@ -292,9 +294,10 @@ out: * We need to flush pages to the new disk locations. */ - (uobj->pgops->pgo_flush)(uobj, oldeof & ~(bsize - 1), - MIN((oldeof + bsize) & ~(bsize - 1), neweof), - PGO_CLEANIT | PGO_SYNCIO); + if ((flags & B_SYNC) == 0) + (*uobj->pgops->pgo_flush)(uobj, oldeof & ~(bsize - 1), + MIN((oldeof + bsize) & ~(bsize - 1), neweof), + PGO_CLEANIT | PGO_SYNCIO); } if (pgs2[0] != NULL) { for (i = 0; i < npages2; i++) { |