bcachefs: nocow locking: Fix lock leak

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2023-09-24 21:05:50 -04:00
parent 793a06d984
commit efedfc2ece

View file

@ -1376,10 +1376,12 @@ static void bch2_nocow_write(struct bch_write_op *op)
/* Fall back to COW path: */
goto out;
err_bucket_stale:
while (--i >= 0)
while (i >= 0) {
bch2_bucket_nocow_unlock(&c->nocow_locks,
buckets[i].b,
BUCKET_NOCOW_LOCK_UPDATE);
--i;
}
for (i = 0; i < nr_buckets; i++)
percpu_ref_put(&bch_dev_bkey_exists(c, buckets[i].b.inode)->io_ref);