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

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