[Ocfs2-tools-devel] [PATCH] fsck: Rebuild index tree if lookup returns corrupted index

Goldwyn Rodrigues rgoldwyn at suse.de
Mon Sep 30 06:57:08 PDT 2013


Signed-off-by: Goldwyn Rodrigues <rgoldwyn at suse.com>
---
 fsck.ocfs2/pass2.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/fsck.ocfs2/pass2.c b/fsck.ocfs2/pass2.c
index 15d3302..308ff29 100644
--- a/fsck.ocfs2/pass2.c
+++ b/fsck.ocfs2/pass2.c
@@ -664,6 +664,15 @@ static errcode_t fix_dirent_index(o2fsck_dirblock_entry *dbe,
 		ret = ocfs2_lookup(dd->fs, dbe->e_ino, dirent->name,
 				   dirent->name_len, NULL, &ino);
 		if (ret) {
+			if ((ret == OCFS2_ET_DIR_CORRUPTED) &&
+			    prompt(dd->ost, PY, PR_DX_LOOKUP_FAILED,
+				"Directory inode %"PRIu64" has invalid index. "
+				"Rebuild index tree?", dbe->e_ino)) {
+					*flags |= OCFS2_DIRENT_CHANGED;
+					ret = 0;
+					goto out;
+			}
+
 			if (ret != OCFS2_ET_FILE_NOT_FOUND)
 				goto out;
 			ret = 0;
-- 
1.8.1.4


-- 
Goldwyn



More information about the Ocfs2-tools-devel mailing list