summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2003-07-06 09:02:12 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2003-07-06 09:02:12 +0000
commitfecd0955cb78a1252f2c567e8b13c46a22282efb (patch)
tree34955d83b79d12abc24139e3a16a3a7197c80505
parentbe1af9eaff15dbf6378146268cfdd36a4774f7c9 (diff)
reset inode fields if deleted, prevents a panic after deleting a device.
from netbsd via otto moerbeek
-rw-r--r--sys/ufs/ext2fs/ext2fs_vfsops.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/ufs/ext2fs/ext2fs_vfsops.c b/sys/ufs/ext2fs/ext2fs_vfsops.c
index ada8c0862b9..353caa470dd 100644
--- a/sys/ufs/ext2fs/ext2fs_vfsops.c
+++ b/sys/ufs/ext2fs/ext2fs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ext2fs_vfsops.c,v 1.27 2003/06/02 23:28:22 millert Exp $ */
+/* $OpenBSD: ext2fs_vfsops.c,v 1.28 2003/07/06 09:02:11 tedu Exp $ */
/* $NetBSD: ext2fs_vfsops.c,v 1.1 1997/06/11 09:34:07 bouyer Exp $ */
/*
@@ -896,6 +896,11 @@ ext2fs_vget(mp, ino, vpp)
ip->i_effnlink = ip->i_e2fs_nlink;
brelse(bp);
+ /* If the inode was deleted, reset all fields */
+ if (ip->i_e2fs_dtime != 0) {
+ ip->i_e2fs_mode = ip->i_e2fs_size = ip->i_e2fs_nblock = 0;
+ }
+
/*
* Initialize the vnode from the inode, check for aliases.
* Note that the underlying vnode may have changed.