Blame SOURCES/e2fsprogs-1.45.6-libext2fs-teach-ext2fs_flush-to-check-if-group-descr.patch

f239de
From 4b74f91ad7480d71853ae1170d065917afc426a2 Mon Sep 17 00:00:00 2001
f239de
From: Theodore Ts'o <tytso@mit.edu>
f239de
Date: Thu, 16 Jan 2020 18:56:49 -0500
f239de
Subject: [PATCH 03/46] libext2fs: teach ext2fs_flush() to check if group
f239de
 descriptors are loaded
f239de
Content-Type: text/plain
f239de
f239de
If the EXT2_FLAG_SUPER_ONLY is not set, and the group descriptors are
f239de
not loaded, ext2fs_flush[2]() will return EXT2_ET_NO_GDESC.
f239de
f239de
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
f239de
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
f239de
---
f239de
 lib/ext2fs/closefs.c | 5 +++++
f239de
 1 file changed, 5 insertions(+)
f239de
f239de
diff --git a/lib/ext2fs/closefs.c b/lib/ext2fs/closefs.c
f239de
index 1d4d5b7f..6814cdc3 100644
f239de
--- a/lib/ext2fs/closefs.c
f239de
+++ b/lib/ext2fs/closefs.c
f239de
@@ -293,6 +293,11 @@ errcode_t ext2fs_flush2(ext2_filsys fs, int flags)
f239de
 
f239de
 	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
f239de
 
f239de
+	if ((fs->flags & EXT2_FLAG_SUPER_ONLY) == 0 &&
f239de
+	    !ext2fs_has_feature_journal_dev(fs->super) &&
f239de
+	    fs->group_desc == NULL)
f239de
+		return EXT2_ET_NO_GDESC;
f239de
+
f239de
 	fs_state = fs->super->s_state;
f239de
 	feature_incompat = fs->super->s_feature_incompat;
f239de
 
f239de
-- 
f239de
2.35.1
f239de