Now that the directory salvaging operation is fed the block size,
teach pass 2 that it should use the size of the inline data if the
directory is inline_data. Without this, it'll "fix" inline
directories by setting the rec_len to something approaching the FS
blocksize, which is clearly wrong.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
problem = 0;
if (!inline_data_size || dot_state > 1) {
+ size_t max_block_size = fs->blocksize - de_csum_size;
+
+ if (inline_data_size)
+ max_block_size = inline_data_size;
dirent = (struct ext2_dir_entry *) (buf + offset);
(void) ext2fs_get_rec_len(fs, dirent, &rec_len);
cd->pctx.dirent = dirent;
cd->pctx.num = offset;
if (((offset + rec_len) > fs->blocksize) ||
+ (inline_data_size > 0 &&
+ (offset + rec_len) > inline_data_size) ||
(rec_len < 12) ||
((rec_len % 4) != 0) ||
((ext2fs_dirent_name_len(dirent) + 8) > rec_len)) {
&cd->pctx)) {
salvage_directory(fs, dirent, prev,
&offset,
- fs->blocksize -
- de_csum_size);
+ max_block_size);
dir_modified++;
continue;
} else