From: Andrew Morton - Optimise inode number comparison - Repair coding style. Cc: Neil Brown Signed-off-by: Andrew Morton --- fs/ext2/super.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff -puN fs/ext2/super.c~knfsd-have-ext2-reject-file-handles-with-bad-inode-numbers-early-tidy fs/ext2/super.c --- a/fs/ext2/super.c~knfsd-have-ext2-reject-file-handles-with-bad-inode-numbers-early-tidy +++ a/fs/ext2/super.c @@ -258,7 +258,7 @@ static struct dentry *ext2_get_dentry(st struct inode *inode; struct dentry *result; - if (ino != EXT2_ROOT_INO && ino < EXT2_FIRST_INO(sb)) + if (ino < EXT2_FIRST_INO(sb) && ino != EXT2_ROOT_INO) return ERR_PTR(-ESTALE); if (ino > le32_to_cpu(EXT2_SB(sb)->s_es->s_inodes_count)) return ERR_PTR(-ESTALE); @@ -271,9 +271,8 @@ static struct dentry *ext2_get_dentry(st inode = iget(sb, ino); if (inode == NULL) return ERR_PTR(-ENOMEM); - if (is_bad_inode(inode) - || (generation && inode->i_generation != generation) - ) { + if (is_bad_inode(inode) || + (generation && inode->i_generation != generation)) { /* we didn't find the right inode.. */ iput(inode); return ERR_PTR(-ESTALE); @@ -289,7 +288,6 @@ static struct dentry *ext2_get_dentry(st return result; } - /* Yes, most of these are left as NULL!! * A NULL value implies the default, which works with ext2-like file * systems, but can be improved upon. _