diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2020-06-09 15:59:03 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2020-06-09 21:32:47 -0400 |
commit | fb791949126456cee6232a45f8df2c3bcdc3a37e (patch) | |
tree | 377300f4911e3e37d89d9443dbe1e4c0ffbdc38c | |
parent | 71e099a067b35a7da3c4644563f8429928edc9a7 (diff) |
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>
-rw-r--r-- | fs/bcachefs/btree_update_interior.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/bcachefs/btree_update_interior.c b/fs/bcachefs/btree_update_interior.c index 455a7093af45..c21f87bb87db 100644 --- a/fs/bcachefs/btree_update_interior.c +++ b/fs/bcachefs/btree_update_interior.c @@ -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); |