diff options
Diffstat (limited to 'fs/ext2')
| -rw-r--r-- | fs/ext2/balloc.c | 4 | ||||
| -rw-r--r-- | fs/ext2/inode.c | 17 | ||||
| -rw-r--r-- | fs/ext2/namei.c | 7 | ||||
| -rw-r--r-- | fs/ext2/super.c | 2 |
4 files changed, 20 insertions, 10 deletions
diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c index 007eee794bd1..adf0f31fbddd 100644 --- a/fs/ext2/balloc.c +++ b/fs/ext2/balloc.c @@ -201,7 +201,7 @@ static void group_adjust_blocks(struct super_block *sb, int group_no, * windows(start, end). Otherwise, it will only print out the "bad" windows, * those windows that overlap with their immediate neighbors. */ -#if 1 +#ifdef EXT2FS_DEBUG static void __rsv_window_dump(struct rb_root *root, int verbose, const char *fn) { @@ -248,7 +248,7 @@ restart: __rsv_window_dump((root), (verbose), __func__) #else #define rsv_window_dump(root, verbose) do {} while (0) -#endif +#endif /* EXT2FS_DEBUG */ /** * goal_in_my_reservation() diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index 6443c298c105..74aca5eb572d 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c @@ -639,7 +639,8 @@ static int ext2_get_blocks(struct inode *inode, int count = 0; ext2_fsblk_t first_block = 0; - BUG_ON(maxblocks == 0); + if (WARN_ON_ONCE(maxblocks == 0)) + return -EINVAL; depth = ext2_block_to_path(inode,iblock,offsets,&blocks_to_boundary); @@ -1433,9 +1434,17 @@ struct inode *ext2_iget (struct super_block *sb, unsigned long ino) * the test is that same one that e2fsck uses * NeilBrown 1999oct15 */ - if (inode->i_nlink == 0 && (inode->i_mode == 0 || ei->i_dtime)) { - /* this inode is deleted */ - ret = -ESTALE; + if (inode->i_nlink == 0) { + if (inode->i_mode == 0 || ei->i_dtime) { + /* this inode is deleted */ + ret = -ESTALE; + } else { + ext2_error(sb, __func__, + "inode %lu has zero i_nlink with mode 0%o and no dtime, " + "filesystem may be corrupt", + ino, inode->i_mode); + ret = -EFSCORRUPTED; + } goto bad_inode; } inode->i_blocks = le32_to_cpu(raw_inode->i_blocks); diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c index bde617a66cec..0d09d22fe708 100644 --- a/fs/ext2/namei.c +++ b/fs/ext2/namei.c @@ -14,8 +14,6 @@ * * The only non-static object here is ext2_dir_inode_operations. * - * TODO: get rid of kmap() use, add readahead. - * * Copyright (C) 1992, 1993, 1994, 1995 * Remy Card (card@masi.ibp.fr) * Laboratoire MASI - Institut Blaise Pascal @@ -293,7 +291,10 @@ static int ext2_unlink(struct inode *dir, struct dentry *dentry) goto out; inode_set_ctime_to_ts(inode, inode_get_ctime(dir)); - inode_dec_link_count(inode); + + if (inode->i_nlink) + inode_dec_link_count(inode); + err = 0; out: return err; diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 4118a3a1f620..19f76d8cb473 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -1152,7 +1152,7 @@ static int ext2_fill_super(struct super_block *sb, struct fs_context *fc) goto failed_mount2; } sbi->s_gdb_count = db_count; - get_random_bytes(&sbi->s_next_generation, sizeof(u32)); + sbi->s_next_generation = get_random_u32(); spin_lock_init(&sbi->s_next_gen_lock); /* per filesystem reservation list head & lock */ |
