Merge branch 'maint' into next

This commit is contained in:
Theodore Ts'o 2022-08-13 23:50:46 -04:00
commit 915c3c1e05
6 changed files with 15 additions and 9 deletions

View File

@ -150,6 +150,7 @@ void e2fsck_pass2(e2fsck_t ctx)
mtrace_print("Pass 2");
#endif
fs->flags |= EXT2_FLAG_IGNORE_SWAP_DIRENT;
if (!(ctx->options & E2F_OPT_PREEN))
fix_problem(ctx, PR_2_PASS_HEADER, &cd.pctx);
@ -317,6 +318,7 @@ void e2fsck_pass2(e2fsck_t ctx)
print_resource_track(ctx, _("Pass 2"), &rtrack, fs->io);
cleanup:
ext2fs_free_mem(&buf);
fs->flags &= ~EXT2_FLAG_IGNORE_SWAP_DIRENT;
}
#define MAX_DEPTH 32000

View File

@ -75,15 +75,11 @@ int journal_enable_debug = -1;
static void usage(e2fsck_t ctx)
{
char *program_name = "e2fsck";
if (ctx && ctx->program_name)
program_name = ctx>program_name;
fprintf(stderr,
_("Usage: %s [-panyrcdfktvDFV] [-b superblock] [-B blocksize]\n"
"\t\t[-l|-L bad_blocks_file] [-C fd] [-j external_journal]\n"
"\t\t[-E extended-options] [-z undo_file] device\n"),
program_name);
ctx->program_name ? ctx->program_name : "e2fsck");
fprintf(stderr, "%s", _("\nEmergency help:\n"
" -p Automatic repair (no questions)\n"

View File

@ -219,6 +219,7 @@ typedef struct ext2_file *ext2_file_t;
#define EXT2_FLAG_BBITMAP_TAIL_PROBLEM 0x1000000
#define EXT2_FLAG_IBITMAP_TAIL_PROBLEM 0x2000000
#define EXT2_FLAG_THREADS 0x4000000
#define EXT2_FLAG_IGNORE_SWAP_DIRENT 0x8000000
/*
* Special flag in the ext2 inode i_flag field that means that this is

View File

@ -372,6 +372,8 @@ errcode_t ext2fs_image_bitmap_write(ext2_filsys fs, int fd, int flags)
size = sizeof(buf);
if (size > (cnt >> 3))
size = (cnt >> 3);
if (size == 0)
break;
retval = ext2fs_get_generic_bmap_range(bmap, itr,
size << 3, buf);
@ -447,6 +449,8 @@ errcode_t ext2fs_image_bitmap_read(ext2_filsys fs, int fd, int flags)
size = sizeof(buf);
if (size > (cnt >> 3))
size = (cnt >> 3);
if (size == 0)
break;
actual = read(fd, buf, size);
if (actual == -1)

View File

@ -435,10 +435,13 @@ errcode_t ext2fs_dirent_swab_in2(ext2_filsys fs, char *buf,
return retval;
if ((rec_len < 8) || (rec_len % 4)) {
rec_len = 8;
retval = EXT2_ET_DIR_CORRUPTED;
if (!(fs->flags & EXT2_FLAG_IGNORE_SWAP_DIRENT))
return EXT2_ET_DIR_CORRUPTED;
} else if (((name_len & 0xFF) + 8) > rec_len)
retval = EXT2_ET_DIR_CORRUPTED;
if (!(fs->flags & EXT2_FLAG_IGNORE_SWAP_DIRENT))
return EXT2_ET_DIR_CORRUPTED;
if (rec_len > left)
if (!(fs->flags & EXT2_FLAG_IGNORE_SWAP_DIRENT))
return EXT2_ET_DIR_CORRUPTED;
left -= rec_len;
p += rec_len;

View File

@ -1263,7 +1263,7 @@ static void output_qcow2_meta_data_blocks(ext2_filsys fs, int fd)
offset += img->cluster_size;
}
}
update_refcount(fd, img, offset, offset);
(void) update_refcount(fd, img, offset, offset);
flush_l2_cache(img);
sync_refcount(fd, img);