Skip to content

Commit f90f173

Browse files
fdmananakdave
authored andcommitted
btrfs: dump detailed info and specific messages on log replay failures
Currently debugging log replay failures can be harder than needed, since all we do now is abort a transaction, which gives us a line number, a stack trace and an error code. But that is most of the times not enough to give some clue about what went wrong. So add a new helper to abort log replay and provide contextual information: 1) Dump the current leaf of the log tree being processed and print the slot we are currently at and the key at that slot; 2) Dump the current subvolume tree leaf if we have any; 3) Print the current stage of log replay; 4) Print the id of the subvolume root associated with the log tree we are currently processing (as we can have multiple); 5) Print some error message to mention what we were trying to do when we got an error. Replace all transaction abort calls (btrfs_abort_transaction()) with the new helper btrfs_abort_log_replay(), which besides dumping all that extra information, it also aborts the current transaction. Signed-off-by: Filipe Manana <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent b18f3cb commit f90f173

File tree

3 files changed

+349
-86
lines changed

3 files changed

+349
-86
lines changed

fs/btrfs/fs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ enum {
104104
BTRFS_FS_STATE_RO,
105105
/* Track if a transaction abort has been reported on this filesystem */
106106
BTRFS_FS_STATE_TRANS_ABORTED,
107+
/* Track if log replay has failed. */
108+
BTRFS_FS_STATE_LOG_REPLAY_ABORTED,
107109
/*
108110
* Bio operations should be blocked on this filesystem because a source
109111
* or target device is being destroyed as part of a device replace

fs/btrfs/messages.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ static const char fs_state_chars[] = {
1818
[BTRFS_FS_STATE_REMOUNTING] = 'M',
1919
[BTRFS_FS_STATE_RO] = 0,
2020
[BTRFS_FS_STATE_TRANS_ABORTED] = 'A',
21+
[BTRFS_FS_STATE_LOG_REPLAY_ABORTED] = 'O',
2122
[BTRFS_FS_STATE_DEV_REPLACING] = 'R',
2223
[BTRFS_FS_STATE_DUMMY_FS_INFO] = 0,
2324
[BTRFS_FS_STATE_NO_DATA_CSUMS] = 'C',

0 commit comments

Comments
 (0)