summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1998-09-29 08:07:32 +0000
committerbde <bde@FreeBSD.org>1998-09-29 08:07:32 +0000
commitfd94b4c9202cb4f8b7cc274794e7945b65d067ae (patch)
tree360c459889dc67874ac0f7cc146f84561a0e3639 /sys
parent8385e77a9c3022a2abcb3ed5cad0bb6c8c2f864b (diff)
downloadFreeBSD-src-fd94b4c9202cb4f8b7cc274794e7945b65d067ae.zip
FreeBSD-src-fd94b4c9202cb4f8b7cc274794e7945b65d067ae.tar.gz
Fixed initialization of new inodes. ext2fs doesn't clear inodes when
they are deleted, so inodes must be cleared when they are reused, but we didn't clear the indirect blocks. This caused serious filesystem corruption.
Diffstat (limited to 'sys')
-rw-r--r--sys/gnu/ext2fs/ext2_alloc.c4
-rw-r--r--sys/gnu/fs/ext2fs/ext2_alloc.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/sys/gnu/ext2fs/ext2_alloc.c b/sys/gnu/ext2fs/ext2_alloc.c
index c47f597..21b9165 100644
--- a/sys/gnu/ext2fs/ext2_alloc.c
+++ b/sys/gnu/ext2fs/ext2_alloc.c
@@ -416,8 +416,10 @@ ext2_valloc(pvp, mode, cred, vpp)
ip->i_blocks = 0;
ip->i_flags = 0;
/* now we want to make sure that the block pointers are zeroed out */
- for(i = 0; i < EXT2_NDIR_BLOCKS; i++)
+ for (i = 0; i < NDADDR; i++)
ip->i_db[i] = 0;
+ for (i = 0; i < NIADDR; i++)
+ ip->i_ib[i] = 0;
/*
* Set up a new generation number for this inode.
diff --git a/sys/gnu/fs/ext2fs/ext2_alloc.c b/sys/gnu/fs/ext2fs/ext2_alloc.c
index c47f597..21b9165 100644
--- a/sys/gnu/fs/ext2fs/ext2_alloc.c
+++ b/sys/gnu/fs/ext2fs/ext2_alloc.c
@@ -416,8 +416,10 @@ ext2_valloc(pvp, mode, cred, vpp)
ip->i_blocks = 0;
ip->i_flags = 0;
/* now we want to make sure that the block pointers are zeroed out */
- for(i = 0; i < EXT2_NDIR_BLOCKS; i++)
+ for (i = 0; i < NDADDR; i++)
ip->i_db[i] = 0;
+ for (i = 0; i < NIADDR; i++)
+ ip->i_ib[i] = 0;
/*
* Set up a new generation number for this inode.
OpenPOWER on IntegriCloud