forked from pool/ocfs2-tools
76184cf7b3
- Updated to 1.8.2 - o2cluster: change cluster stack stamped on ocfs2 filesystem - added man pages ocfs2, ocfs2.cluster.conf, o2hbmonitor - fsck: faster fsck times because of aio; progress - fix-indexed-dirs.patch: Fix corrupt indexed directories through fsck OBS-URL: https://build.opensuse.org/request/show/131534 OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/ocfs2-tools?expand=0&rev=40
71 lines
2.2 KiB
Diff
71 lines
2.2 KiB
Diff
commit 1a5af4e8a91e106261e1552821b19b425d6adfd3
|
|
Author: Goldwyn Rodrigues <rgoldwyn@suse.de>
|
|
Date: Thu Jul 5 11:41:14 2012 -0500
|
|
|
|
fsck.ocfs2 fix indexed dirs
|
|
|
|
diff --git a/fsck.ocfs2/fsck.ocfs2.checks.8.in b/fsck.ocfs2/fsck.ocfs2.checks.8.in
|
|
index 45f9336..788c89b 100644
|
|
--- a/fsck.ocfs2/fsck.ocfs2.checks.8.in
|
|
+++ b/fsck.ocfs2/fsck.ocfs2.checks.8.in
|
|
@@ -1149,6 +1149,17 @@ possible data for a particular offset for the file.
|
|
|
|
Answering yes will serialize the extents.
|
|
|
|
+.SS "DX_TREE_CORRUPT"
|
|
+The index tree of the directory is corrupt.
|
|
+
|
|
+Answering yes will rebuild the directory index, in pass 2.
|
|
+
|
|
+
|
|
+.SS "DX_TREE_MISSING"
|
|
+The index of this directory is missing.
|
|
+
|
|
+Answering yes will rebuild the directory index.
|
|
+
|
|
.SH "SEE ALSO"
|
|
.BR debugfs.ocfs2(8)
|
|
.BR fsck.ocfs2(8)
|
|
diff --git a/fsck.ocfs2/pass1.c b/fsck.ocfs2/pass1.c
|
|
index 3590a2d..c076e28 100644
|
|
--- a/fsck.ocfs2/pass1.c
|
|
+++ b/fsck.ocfs2/pass1.c
|
|
@@ -917,10 +917,14 @@ static errcode_t o2fsck_check_blocks(ocfs2_filesys *fs, o2fsck_state *ost,
|
|
}
|
|
|
|
ret = o2fsck_check_dx_dir(ost, di);
|
|
- if (ret) {
|
|
- com_err(whoami, ret, "while iterating over the dir indexed "
|
|
- "tree for directory inode %"PRIu64, (uint64_t)di->i_blkno);
|
|
- goto out;
|
|
+ if (ret && prompt(ost, PY, PR_DX_TREE_CORRUPT,
|
|
+ "Inode %"PRIu64" has invalid dx tree. "
|
|
+ "Reset for later rebuild?", (uint64_t)di->i_blkno)) {
|
|
+ ocfs2_dx_dir_truncate(fs, di->i_blkno);
|
|
+ di->i_dx_root = 0ULL;
|
|
+ di->i_dyn_features &= ~OCFS2_INDEXED_DIR_FL;
|
|
+ o2fsck_write_inode(ost, di->i_blkno, di);
|
|
+ ret = 0;
|
|
}
|
|
|
|
if (S_ISLNK(di->i_mode))
|
|
diff --git a/fsck.ocfs2/pass2.c b/fsck.ocfs2/pass2.c
|
|
index 96c4eaf..681e817 100644
|
|
--- a/fsck.ocfs2/pass2.c
|
|
+++ b/fsck.ocfs2/pass2.c
|
|
@@ -735,9 +735,11 @@ static unsigned pass2_dir_block_iterate(o2fsck_dirblock_entry *dbe,
|
|
/* Set the flag for index rebuilding */
|
|
if (ocfs2_supports_indexed_dirs(OCFS2_RAW_SB(dd->fs->fs_super))
|
|
&& !(di->i_dyn_features & OCFS2_INLINE_DATA_FL)
|
|
- && !(di->i_dyn_features & OCFS2_INDEXED_DIR_FL)) {
|
|
- ret_flags |= OCFS2_DIRENT_CHANGED;
|
|
- }
|
|
+ && !(di->i_dyn_features & OCFS2_INDEXED_DIR_FL)
|
|
+ && prompt(dd->ost, PY, PR_DX_TREE_MISSING,
|
|
+ "Directory %"PRIu64" is missing index. "
|
|
+ "Rebuild?", dbe->e_ino))
|
|
+ ret_flags |= OCFS2_DIRENT_CHANGED;
|
|
|
|
}
|
|
|