From e242b92af5ef74cdf40b237c9e904034c081b144 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Thu, 15 Dec 2022 21:44:32 -0500 Subject: bcachefs: Fix for long running btree transactions & key cache While a btree transaction is running, we hold a SRCU read lock on the btree key cache that prevents btree key cache keys from being freed - this is so that relock() operations won't access freed memory. The downside of this is that long running btree transactions prevent memory from being freed from the key cache. This adds a check in bch2_trans_begin() - if the transaction has been running longer than 1 second, drop and retake the SRCU read lock and zero out pointers to unlock key cache paths. Signed-off-by: Kent Overstreet --- fs/bcachefs/errcode.h | 1 + 1 file changed, 1 insertion(+) (limited to 'fs/bcachefs/errcode.h') diff --git a/fs/bcachefs/errcode.h b/fs/bcachefs/errcode.h index dc388864be6f..5f0f75726784 100644 --- a/fs/bcachefs/errcode.h +++ b/fs/bcachefs/errcode.h @@ -53,6 +53,7 @@ x(BCH_ERR_no_btree_node, no_btree_node_down) \ x(BCH_ERR_no_btree_node, no_btree_node_init) \ x(BCH_ERR_no_btree_node, no_btree_node_cached) \ + x(BCH_ERR_no_btree_node, no_btree_node_srcu_reset) \ x(0, btree_insert_fail) \ x(BCH_ERR_btree_insert_fail, btree_insert_btree_node_full) \ x(BCH_ERR_btree_insert_fail, btree_insert_need_mark_replicas) \ -- cgit v1.2.3