From 57bde59a067c21ed924de4194344948f3c3ecb9a Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Fri, 11 Oct 2013 21:20:54 -0400 Subject: [PATCH] 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 Signed-off-by: "Theodore Ts'o" Reviewed-by: Lukas Czerner --- lib/ext2fs/openfs.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c index 113b80e7..9fe1645d 100644 --- a/lib/ext2fs/openfs.c +++ b/lib/ext2fs/openfs.c @@ -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)) {