|
|
1f0cb0 |
From fc9ed72f64b0e6689eaed1faa33e3a333b995bf7 Mon Sep 17 00:00:00 2001
|
|
|
1f0cb0 |
From: Kazuya Mio <k-mio@sx.jp.nec.com>
|
|
|
1f0cb0 |
Date: Sat, 17 Mar 2018 14:56:15 -0400
|
|
|
1f0cb0 |
Subject: [PATCH 05/16] libext2fs: fix ext2fs_open2() error for meta_bg image
|
|
|
1f0cb0 |
file
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
commit 8b061a641dff1a0becf645f8e6002de79b997b95
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
dumpe2fs/debugfs can examine the image file by using the -i option.
|
|
|
1f0cb0 |
However, if meta_bg feature is enabled, dumpe2fs/debugfs cannot open
|
|
|
1f0cb0 |
the image file.
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
$ dumpe2fs -i test.img
|
|
|
1f0cb0 |
dumpe2fs: Attempt to read block from filesystem resulted in short read while trying to open test.img
|
|
|
1f0cb0 |
Couldn't find valid filesystem superblock.
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
In case of specifying an image file, the location of block group descriptors
|
|
|
1f0cb0 |
is the same as the case of default filesystem regardless of meta_bg feature.
|
|
|
1f0cb0 |
So if EXT2_FLAG_IMAGE_FILE flag is set in ext2fs_open2(),
|
|
|
1f0cb0 |
don't use the meta_bg handling.
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
|
|
|
1f0cb0 |
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
|
|
|
1f0cb0 |
---
|
|
|
1f0cb0 |
lib/ext2fs/openfs.c | 3 ++-
|
|
|
1f0cb0 |
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
1f0cb0 |
|
|
|
1f0cb0 |
diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c
|
|
|
1f0cb0 |
index ba501e6a..200f7815 100644
|
|
|
1f0cb0 |
--- a/lib/ext2fs/openfs.c
|
|
|
1f0cb0 |
+++ b/lib/ext2fs/openfs.c
|
|
|
1f0cb0 |
@@ -378,7 +378,8 @@ errcode_t ext2fs_open2(const char *name, const char *io_options,
|
|
|
1f0cb0 |
#ifdef WORDS_BIGENDIAN
|
|
|
1f0cb0 |
groups_per_block = EXT2_DESC_PER_BLOCK(fs->super);
|
|
|
1f0cb0 |
#endif
|
|
|
1f0cb0 |
- if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) {
|
|
|
1f0cb0 |
+ if ((fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) &&
|
|
|
1f0cb0 |
+ !(flags & EXT2_FLAG_IMAGE_FILE)) {
|
|
|
1f0cb0 |
first_meta_bg = fs->super->s_first_meta_bg;
|
|
|
1f0cb0 |
if (first_meta_bg > fs->desc_blocks)
|
|
|
1f0cb0 |
first_meta_bg = fs->desc_blocks;
|
|
|
1f0cb0 |
--
|
|
|
1f0cb0 |
2.20.1
|
|
|
1f0cb0 |
|