summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs/xfs_log_recover.h
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2020-05-15 17:15:03 -0700
committerDarrick J. Wong <darrick.wong@oracle.com>2020-06-24 18:12:16 -0700
commitdba9435b226c01df4bcd3bd1fdd42a5c189968e5 (patch)
tree30b9ca166d9627b1269fa3b67e21d2910cb10a33 /fs/xfs/libxfs/xfs_log_recover.h
parente812e6bd89dc6489ca924756635fb81855091700 (diff)
xfs: proper replay of deferred ops queued during log recovery
When we replay unfinished intent items that have been recovered from the log, it's possible that the replay will cause the creation of more deferred work items. As outlined in commit 509955823cc9c ("xfs: log recovery should replay deferred ops in order"), later work items have an implicit ordering dependency on earlier work items. Therefore, recovery must replay the items (both recovered and created) in the same order that they would have been during normal operation. For log recovery, we enforce this ordering by using an empty transaction to collect deferred ops that get created in the process of recovering a log intent item to prevent them from being committed before the rest of the recovered intent items. After we finish committing all the recovered log items, we allocate a transaction with an enormous block reservation, splice our huge list of created deferred ops into that transaction, and commit it, thereby finishing all those ops. This is /really/ hokey -- it's the one place in XFS where we allow nested transactions; the splicing of the defer ops list is is inelegant and has to be done twice per recovery function; and the broken way we handle inode pointers and block reservations cause subtle use-after-free and allocator problems that will be fixed by this patch and the two patches after it. Therefore, replace the hokey empty transaction with a structure designed to capture each chain of deferred ops that are created as part of recovering a single unfinished log intent. Finally, refactor the loop that replays those chains to do so using one transaction per chain. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/libxfs/xfs_log_recover.h')
-rw-r--r--fs/xfs/libxfs/xfs_log_recover.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_log_recover.h b/fs/xfs/libxfs/xfs_log_recover.h
index 641132d0e39d..c3563c5c033c 100644
--- a/fs/xfs/libxfs/xfs_log_recover.h
+++ b/fs/xfs/libxfs/xfs_log_recover.h
@@ -6,6 +6,8 @@
#ifndef __XFS_LOG_RECOVER_H__
#define __XFS_LOG_RECOVER_H__
+struct xfs_defer_capture;
+
/*
* Each log item type (XFS_LI_*) gets its own xlog_recover_item_ops to
* define how recovery should work for that type of log item.
@@ -125,5 +127,7 @@ void xlog_recover_iodone(struct xfs_buf *bp);
void xlog_recover_release_intent(struct xlog *log, unsigned short intent_type,
uint64_t intent_id);
+int xlog_recover_trans_commit(struct xfs_trans *tp,
+ struct xfs_defer_capture **dfcp);
#endif /* __XFS_LOG_RECOVER_H__ */