diff -urN 2.4.5ac4/fs/ext2/ialloc.c 2.4.5ac5/fs/ext2/ialloc.c --- 2.4.5ac4/fs/ext2/ialloc.c Tue May 29 18:26:16 2001 +++ 2.4.5ac5/fs/ext2/ialloc.c Wed May 30 22:04:14 2001 @@ -199,10 +199,15 @@ lock_super (sb); es = sb->u.ext2_sb.s_es; - if (ino < EXT2_FIRST_INO(sb) || + is_directory = S_ISDIR(inode->i_mode); + + /* Do this BEFORE marking the inode not in use or returning an error */ + clear_inode (inode); + + if (ino < EXT2_FIRST_INO(sb) || ino > le32_to_cpu(es->s_inodes_count)) { - ext2_error (sb, "free_inode", - "reserved inode or nonexistent inode"); + ext2_error (sb, "ext2_free_inode", + "reserved or nonexistent inode %lu", ino); goto error_return; } block_group = (ino - 1) / EXT2_INODES_PER_GROUP(sb); @@ -210,13 +215,8 @@ bitmap_nr = load_inode_bitmap (sb, block_group); if (bitmap_nr < 0) goto error_return; - - bh = sb->u.ext2_sb.s_inode_bitmap[bitmap_nr]; - is_directory = S_ISDIR(inode->i_mode); - - /* Do this BEFORE marking the inode not in use */ - clear_inode (inode); + bh = sb->u.ext2_sb.s_inode_bitmap[bitmap_nr]; /* Ok, now we can actually update the inode bitmaps.. */ if (!ext2_clear_bit (bit, bh->b_data))