diff options
author | Theodore Ts'o <tytso@mit.edu> | 2020-01-16 18:56:49 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2020-01-16 19:47:54 -0500 |
commit | c8651b4bf6b31c975d92c4c056b8a1bc25a41f9e (patch) | |
tree | 1d162fdbf1248d45dafb289d34bba6f2e58bdd88 | |
parent | 0670fc20df4a4bbbeb0edb30d82628ea30a80598 (diff) | |
download | e2fsprogs-c8651b4bf6b31c975d92c4c056b8a1bc25a41f9e.tar.gz |
libext2fs: teach ext2fs_flush() to check if group descriptors are loaded
If the EXT2_FLAG_SUPER_ONLY is not set, and the group descriptors are
not loaded, ext2fs_flush[2]() will return EXT2_ET_NO_GDESC.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r-- | lib/ext2fs/closefs.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/ext2fs/closefs.c b/lib/ext2fs/closefs.c index 1d4d5b7fe..6814cdc32 100644 --- a/lib/ext2fs/closefs.c +++ b/lib/ext2fs/closefs.c @@ -293,6 +293,11 @@ errcode_t ext2fs_flush2(ext2_filsys fs, int flags) EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); + if ((fs->flags & EXT2_FLAG_SUPER_ONLY) == 0 && + !ext2fs_has_feature_journal_dev(fs->super) && + fs->group_desc == NULL) + return EXT2_ET_NO_GDESC; + fs_state = fs->super->s_state; feature_incompat = fs->super->s_feature_incompat; |