summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/io_write.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-09-25 03:05:50 +0200
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 23:10:15 +0200
commitefedfc2ece141389a9f522a298781cc929262701 (patch)
tree5366c14ae7f17e6e6ec1028e5c4412e67c7a0758 /fs/bcachefs/io_write.c
parentbcachefs: Fixes for building in userspace (diff)
downloadlinux-efedfc2ece141389a9f522a298781cc929262701.tar.xz
linux-efedfc2ece141389a9f522a298781cc929262701.zip
bcachefs: nocow locking: Fix lock leak
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/io_write.c')
-rw-r--r--fs/bcachefs/io_write.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/bcachefs/io_write.c b/fs/bcachefs/io_write.c
index d2a0de886c7a..6e4f85eb6ec8 100644
--- a/fs/bcachefs/io_write.c
+++ b/fs/bcachefs/io_write.c
@@ -1376,10 +1376,12 @@ err_get_ioref:
/* 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);