scoutfs: add btree corruption messages

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2018-04-26 14:54:19 -07:00
committed by Zach Brown
parent 3efcc87413
commit fe8b155061
3 changed files with 23 additions and 0 deletions

View File

@@ -27,6 +27,7 @@
#include "counters.h"
#include "triggers.h"
#include "options.h"
#include "msg.h"
#include "scoutfs_trace.h"
@@ -1145,6 +1146,15 @@ restart:
/* XXX more aggressive block verification, before ref updates? */
if (bt->level != level) {
scoutfs_corruption(sb, SC_BTREE_BLOCK_LEVEL,
corrupt_btree_block_level,
"root_height %u root_blkno %llu root_seq %llu blkno %llu seq %llu level %u expected %u",
root->height,
le64_to_cpu(root->ref.blkno),
le64_to_cpu(root->ref.seq),
le64_to_cpu(bt->blkno),
le64_to_cpu(bt->seq), bt->level,
level);
ret = -EIO;
break;
}
@@ -1177,6 +1187,15 @@ restart:
/* Find the next child block for the search key. */
pos = find_pos(bt, key, key_len, &cmp);
if (pos >= nr) {
scoutfs_corruption(sb, SC_BTREE_NO_CHILD_REF,
corrupt_btree_block_level,
"root_height %u root_blkno %llu root_seq %llu blkno %llu seq %llu level %u nr %u pos %u cmp %d",
root->height,
le64_to_cpu(root->ref.blkno),
le64_to_cpu(root->ref.seq),
le64_to_cpu(bt->blkno),
le64_to_cpu(bt->seq), bt->level,
nr, pos, cmp);
ret = -EIO;
break;
}

View File

@@ -23,6 +23,8 @@
EXPAND_COUNTER(compact_stale_error) \
EXPAND_COUNTER(compact_sticky_upper) \
EXPAND_COUNTER(compact_sticky_written) \
EXPAND_COUNTER(corrupt_btree_block_level) \
EXPAND_COUNTER(corrupt_btree_no_child_ref) \
EXPAND_COUNTER(corrupt_dirent_backref_name_len) \
EXPAND_COUNTER(corrupt_dirent_name_len) \
EXPAND_COUNTER(corrupt_dirent_readdir_name_len) \

View File

@@ -655,6 +655,8 @@ enum {
SC_SYMLINK_INODE_SIZE,
SC_SYMLINK_MISSING_ITEM,
SC_SYMLINK_NOT_NULL_TERM,
SC_BTREE_BLOCK_LEVEL,
SC_BTREE_NO_CHILD_REF,
SC_NR_SOURCES,
};