From: Kent Overstreet Date: Tue, 20 Jun 2023 01:12:05 +0000 (-0400) Subject: bcachefs: fiemap: Fix a lockdep splat X-Git-Tag: io_uring-6.7-2023-11-10~119^2~257 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=a83e108fc1964b8273c6f51cc62588ee774a5a48;p=linux-block.git bcachefs: fiemap: Fix a lockdep splat As with the previous patch, we generally can't hold btree locks while copying to userspace, as that may incur a page fault and require mmap_lock. Signed-off-by: Kent Overstreet --- diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c index f417889eba08..9280f514bc9f 100644 --- a/fs/bcachefs/fs.c +++ b/fs/bcachefs/fs.c @@ -943,6 +943,7 @@ retry: cur.k->k.p.offset += cur.k->k.size; if (have_extent) { + bch2_trans_unlock(&trans); ret = bch2_fill_extent(c, info, bkey_i_to_s_c(prev.k), 0); if (ret) @@ -961,9 +962,11 @@ err: if (bch2_err_matches(ret, BCH_ERR_transaction_restart)) goto retry; - if (!ret && have_extent) + if (!ret && have_extent) { + bch2_trans_unlock(&trans); ret = bch2_fill_extent(c, info, bkey_i_to_s_c(prev.k), FIEMAP_EXTENT_LAST); + } bch2_trans_exit(&trans); bch2_bkey_buf_exit(&cur, c);