gfs2-utils: master - fsck.gfs2: Once an indirect ea error is found, flag all that follow

Bob Peterson rpeterso at fedoraproject.org
Tue Sep 29 18:38:08 UTC 2015


Gitweb:        http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=f44e9910a604ae4d81b4e7acb8e8e1248fb3dddc
Commit:        f44e9910a604ae4d81b4e7acb8e8e1248fb3dddc
Parent:        9944c79285b7a1bd65c7b5a27d0e682ed0fd9da3
Author:        Bob Peterson <rpeterso at redhat.com>
AuthorDate:    Wed Sep 23 14:28:00 2015 -0500
Committer:     Bob Peterson <rpeterso at redhat.com>
CommitterDate: Tue Sep 29 13:23:24 2015 -0500

fsck.gfs2: Once an indirect ea error is found, flag all that follow

Before this patch, function check_indirect_eattr could find an error
with an indirect extended attribute, but it would ignore subsequent
EA errors and return a good return code. That's bad. Once you find
an EA error in an indirect list, all the ones that follow should be
flagged as errors and subsequently cleared. The return code should
also reflect that an error was found during the processing. This
patch adds a second "err" variable to keep track of whether new errors
were found as opposed to whether _any_ errors were found in the list.
It also prints new error messages where the error was found and on all
pointers following the original error.
---
 gfs2/fsck/metawalk.c |   28 +++++++++++++++++++++++-----
 1 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index b4330fb..bf187f9 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -1081,7 +1081,7 @@ static int check_indirect_eattr(struct gfs2_inode *ip, uint64_t indirect,
 				struct gfs2_buffer_head *indirect_buf,
 				struct metawalk_fxns *pass)
 {
-	int error = 0;
+	int error = 0, err;
 	uint64_t *ea_leaf_ptr, *end;
 	uint64_t block;
 	struct gfs2_sbd *sdp = ip->i_sbd;
@@ -1096,11 +1096,29 @@ static int check_indirect_eattr(struct gfs2_inode *ip, uint64_t indirect,
 	while (*ea_leaf_ptr && (ea_leaf_ptr < end)){
 		block = be64_to_cpu(*ea_leaf_ptr);
 		leaf_pointers++;
-		error = check_leaf_eattr(ip, block, indirect, pass);
-		if (error) {
+		err = check_leaf_eattr(ip, block, indirect, pass);
+		if (err) {
+			error = err;
+			log_err(_("Error detected in leaf block %lld (0x%llx) "
+				  "referenced by indirect block %lld (0x%llx)"
+				  ".\n"),
+				(unsigned long long)block,
+				(unsigned long long)block,
+				(unsigned long long)indirect,
+				(unsigned long long)indirect);
+			log_err(_("Subsequent leaf block pointers should be "
+				  "cleared.\n"));
+		}
+		if (error) { /* leaf blocks following an error must also be
+				treated as error blocks and cleared. */
 			leaf_pointer_errors++;
-			if (query( _("Fix the indirect block too? (y/n) ")))
-				*ea_leaf_ptr = 0;
+			log_err(_("Pointer to EA leaf block %lld (0x%llx) in "
+				  "indirect block %lld (0x%llx) should be "
+				  "cleared.\n"),
+				(unsigned long long)block,
+				(unsigned long long)block,
+				(unsigned long long)indirect,
+				(unsigned long long)indirect);
 		}
 		/* If the first eattr lead is bad, we can't have a hole, so we
 		   have to treat this as an unrecoverable eattr error and


More information about the cluster-commits mailing list