summaryrefslogtreecommitdiff
path: root/libbcachefs/data_update.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbcachefs/data_update.c')
-rw-r--r--libbcachefs/data_update.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/libbcachefs/data_update.c b/libbcachefs/data_update.c
index 3edd7b77..d4cdfb48 100644
--- a/libbcachefs/data_update.c
+++ b/libbcachefs/data_update.c
@@ -349,7 +349,7 @@ void bch2_update_unwritten_extent(struct btree_trans *trans,
update->op.nr_replicas,
update->op.alloc_reserve,
0, &cl, &wp);
- if (ret == -EAGAIN) {
+ if (bch2_err_matches(ret, BCH_ERR_operation_blocked)) {
bch2_trans_unlock(trans);
closure_sync(&cl);
continue;
@@ -459,7 +459,7 @@ int bch2_data_update_init(struct bch_fs *c, struct data_update *m,
? 0
: BCH_DISK_RESERVATION_NOFAIL);
if (ret)
- return ret;
+ goto err;
}
m->op.nr_replicas = m->op.nr_replicas_required =
@@ -471,6 +471,14 @@ int bch2_data_update_init(struct bch_fs *c, struct data_update *m,
if (bkey_extent_is_unwritten(k))
return -BCH_ERR_unwritten_extent_update;
return 0;
+err:
+ bkey_for_each_ptr_decode(k.k, ptrs, p, entry)
+ bch2_bucket_nocow_unlock(&c->nocow_locks,
+ PTR_BUCKET_POS(c, &p.ptr), 0);
+
+ bch2_bkey_buf_exit(&m->k, c);
+ bch2_bio_free_pages_pool(c, &m->op.wbio.bio);
+ return ret;
}
void bch2_data_update_opts_normalize(struct bkey_s_c k, struct data_update_opts *opts)