mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-15 15:15:47 +00:00
bcachefs: btree_update_nodes_written() requires alloc reserve
Also, in the btree_update_start() path, if we already have a journal pre-reservation we don't want to take another - that's a deadlock. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
8c9eef95cd
commit
40ca39b564
1 changed files with 6 additions and 3 deletions
|
@ -529,6 +529,8 @@ static void btree_update_nodes_written(struct btree_update *as)
|
|||
*/
|
||||
ret = bch2_trans_do(c, &as->disk_res, &journal_seq,
|
||||
BTREE_INSERT_NOFAIL|
|
||||
BTREE_INSERT_USE_RESERVE|
|
||||
BTREE_INSERT_USE_ALLOC_RESERVE|
|
||||
BTREE_INSERT_NOCHECK_RW|
|
||||
BTREE_INSERT_JOURNAL_RESERVED,
|
||||
btree_update_nodes_written_trans(&trans, as));
|
||||
|
@ -886,9 +888,10 @@ bch2_btree_update_start(struct btree_trans *trans, enum btree_id id,
|
|||
bch2_keylist_init(&as->new_keys, as->_new_keys);
|
||||
bch2_keylist_init(&as->parent_keys, as->inline_keys);
|
||||
|
||||
ret = bch2_journal_preres_get(&c->journal, &as->journal_preres,
|
||||
BTREE_UPDATE_JOURNAL_RES,
|
||||
JOURNAL_RES_GET_NONBLOCK);
|
||||
if (!(flags & BTREE_INSERT_JOURNAL_RESERVED))
|
||||
ret = bch2_journal_preres_get(&c->journal, &as->journal_preres,
|
||||
BTREE_UPDATE_JOURNAL_RES,
|
||||
JOURNAL_RES_GET_NONBLOCK);
|
||||
if (ret == -EAGAIN) {
|
||||
if (flags & BTREE_INSERT_NOUNLOCK)
|
||||
return ERR_PTR(-EINTR);
|
||||
|
|
Loading…
Reference in a new issue