We cannot merge a removed directory entry to just arbitrary previous
directory entry. The previous entry must be in the same block. So
really bad things can happen when are deleting the first directory
entry in a block where the last directory entry in the previous
directory block is not in use. We fix this bug by checking to see if
the current entry is not the first one in the block before trying to
merge it to the previous entry.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
#pragma argsused
#endif
static int unlink_proc(struct ext2_dir_entry *dirent,
- int offset EXT2FS_ATTR((unused)),
+ int offset,
int blocksize EXT2FS_ATTR((unused)),
char *buf EXT2FS_ATTR((unused)),
void *priv_data)
return 0;
}
- if (prev)
+ if (offset)
prev->rec_len += dirent->rec_len;
else
dirent->inode = 0;