From: Kent Overstreet Date: Fri, 5 Aug 2022 21:08:35 +0000 (-0400) Subject: bcachefs: Fix incorrectly freeing btree_path in alloc path X-Git-Tag: v6.7-rc1~201^2~852 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=17047fbced563cf5abe5aa546f6a92af48900b69;p=thirdparty%2Fkernel%2Flinux.git bcachefs: Fix incorrectly freeing btree_path in alloc path Clearing path->preserve means the path will be dropping in bch2_trans_begin() - but on transaction restart, we're likely to need that path again. This fixes a livelock in the allocation path. Signed-off-by: Kent Overstreet --- diff --git a/fs/bcachefs/btree_iter.h b/fs/bcachefs/btree_iter.h index 9a3287da9a120..5ca92b6bb3977 100644 --- a/fs/bcachefs/btree_iter.h +++ b/fs/bcachefs/btree_iter.h @@ -335,7 +335,8 @@ void bch2_trans_copy_iter(struct btree_iter *, struct btree_iter *); static inline void set_btree_iter_dontneed(struct btree_iter *iter) { - iter->path->preserve = false; + if (!iter->trans->restarted) + iter->path->preserve = false; } void *bch2_trans_kmalloc(struct btree_trans *, size_t);