diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-02-18 08:47:45 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:09:24 +0300 |
commit | 8f9ad91a02c4fd1391ce852cadd9a0227fdd624a (patch) | |
tree | 179397fe5647fc5ea9ada7c5db34809e5e8be433 /fs/bcachefs/btree_cache.c | |
parent | bf7e49a4ae564108d08d314e514a6f802748d73b (diff) | |
download | linux-8f9ad91a02c4fd1391ce852cadd9a0227fdd624a.tar.xz |
bcachefs: Fix failure to allocate btree node in cache
The error code when we fail to allocate a node in the btree node cache
doesn't make it to bch2_btree_path_traverse_all(). Instead, we need to
stash a flag in btree_trans so we know we have to take the cannibalize
lock.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/btree_cache.c')
-rw-r--r-- | fs/bcachefs/btree_cache.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/bcachefs/btree_cache.c b/fs/bcachefs/btree_cache.c index 36b82df79fc2..c17db1d07187 100644 --- a/fs/bcachefs/btree_cache.c +++ b/fs/bcachefs/btree_cache.c @@ -672,6 +672,15 @@ static noinline struct btree *bch2_btree_node_fill(struct bch_fs *c, } b = bch2_btree_node_mem_alloc(c); + + if (trans && b == ERR_PTR(-ENOMEM)) { + trans->memory_allocation_failure = true; + trace_trans_restart_memory_allocation_failure(trans->fn, + _THIS_IP_, btree_id, &path->pos); + btree_trans_restart(trans); + return ERR_PTR(-EINTR); + } + if (IS_ERR(b)) return b; |