Skip to content

Commit f02d153

Browse files
author
Kent Overstreet
committed
bcachefs: Don't unlock trans before data_update_init()
data_update_init() does need to do btree operations, delay doing the unlock-before-io. Signed-off-by: Kent Overstreet <[email protected]>
1 parent 642c1aa commit f02d153

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

fs/bcachefs/data_update.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -980,6 +980,8 @@ int bch2_data_update_init(struct btree_trans *trans,
980980
goto out_nocow_unlock;
981981
}
982982

983+
bch2_trans_unlock(trans);
984+
983985
ret = __bch2_data_update_bios_init(m, c, io_opts, buf_bytes);
984986
if (ret)
985987
goto out_nocow_unlock;

fs/bcachefs/move.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -359,16 +359,14 @@ int bch2_move_extent(struct moving_context *ctxt,
359359
return 0;
360360
}
361361

362-
/*
363-
* Before memory allocations & taking nocow locks in
364-
* bch2_data_update_init():
365-
*/
366-
bch2_trans_unlock(trans);
367-
368-
struct moving_io *io = kzalloc(sizeof(struct moving_io), GFP_KERNEL);
362+
struct moving_io *io = allocate_dropping_locks(trans, ret,
363+
kzalloc(sizeof(struct moving_io), _gfp));
369364
if (!io)
370365
goto err;
371366

367+
if (ret)
368+
goto err_free;
369+
372370
INIT_LIST_HEAD(&io->io_list);
373371
io->write.ctxt = ctxt;
374372
io->read_sectors = k.k->size;
@@ -388,6 +386,8 @@ int bch2_move_extent(struct moving_context *ctxt,
388386
io->write.op.c = c;
389387
io->write.data_opts = data_opts;
390388

389+
bch2_trans_unlock(trans);
390+
391391
ret = bch2_data_update_bios_init(&io->write, c, &io_opts);
392392
if (ret)
393393
goto err_free;

0 commit comments

Comments
 (0)