Commit a83e108f authored by Kent Overstreet's avatar Kent Overstreet

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: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent a5b696ee
......@@ -943,6 +943,7 @@ static int bch2_fiemap(struct inode *vinode, struct fiemap_extent_info *info,
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 @@ static int bch2_fiemap(struct inode *vinode, struct fiemap_extent_info *info,
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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment