summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-10-14 17:55:48 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2024-10-18 00:49:48 -0400
commit81e0b6c7c1f75c914dede330121391f57f216a6e (patch)
tree06b8cf4cd98db3bb55936f81c3b716c3e900e75e /fs
parent4007bbb203a0c36e66bb2e785e1b2cb7266179d5 (diff)
bcachefs: fix disk reservation accounting in bch2_folio_reservation_get()
bch2_disk_reservation_put() zeroes out the reservation - oops. This fixes a disk reservation leak when getting a quota reservation returned an error. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r--fs/bcachefs/fs-io-pagecache.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/bcachefs/fs-io-pagecache.c b/fs/bcachefs/fs-io-pagecache.c
index af3a24546aa3..cde3a0445ee9 100644
--- a/fs/bcachefs/fs-io-pagecache.c
+++ b/fs/bcachefs/fs-io-pagecache.c
@@ -431,9 +431,9 @@ int bch2_folio_reservation_get(struct bch_fs *c,
ret = bch2_quota_reservation_add(c, inode, &res->quota, quota_sectors, true);
if (unlikely(ret)) {
struct disk_reservation tmp = { .sectors = disk_sectors };
+ res->disk.sectors -= disk_sectors;
bch2_disk_reservation_put(c, &tmp);
- res->disk.sectors -= disk_sectors;
return ret;
}
}