libext2fs: openfs() musn't allow bigalloc without EXT2_FLAGS_64BITS

Currently, only the new 64-bit bitmap implementation supports the
block<->cluster conversions that bigalloc requires.  Therefore, if we
have a bigalloc filesystem, require EXT2_FLAGS_64BITS be passed in to
ext2fs_open().  This does not mean that bigalloc file systems have to
be 64-bits; just that the userspace utilities have to be able to use
the new 64-bit capable library functions.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
debian-1.42.9
Darrick J. Wong 2013-10-11 21:20:54 -04:00 committed by Theodore Ts'o
parent 27b2297d57
commit 57bde59a06
1 changed files with 12 additions and 0 deletions

View File

@ -253,6 +253,18 @@ errcode_t ext2fs_open2(const char *name, const char *io_options,
retval = EXT2_ET_CORRUPT_SUPERBLOCK;
goto cleanup;
}
/*
* bigalloc requires cluster-aware bitfield operations, which at the
* moment means we need EXT2_FLAG_64BITS.
*/
if (EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
EXT4_FEATURE_RO_COMPAT_BIGALLOC) &&
!(flags & EXT2_FLAG_64BITS)) {
retval = EXT2_ET_CANT_USE_LEGACY_BITMAPS;
goto cleanup;
}
if (!EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
EXT4_FEATURE_RO_COMPAT_BIGALLOC) &&
(fs->super->s_log_block_size != fs->super->s_log_cluster_size)) {