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

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