Skip to content

Commit 81e0b6c

Browse files
author
Kent Overstreet
committed
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 <[email protected]>
1 parent 4007bbb commit 81e0b6c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/bcachefs/fs-io-pagecache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,9 @@ int bch2_folio_reservation_get(struct bch_fs *c,
431431
ret = bch2_quota_reservation_add(c, inode, &res->quota, quota_sectors, true);
432432
if (unlikely(ret)) {
433433
struct disk_reservation tmp = { .sectors = disk_sectors };
434+
res->disk.sectors -= disk_sectors;
434435

435436
bch2_disk_reservation_put(c, &tmp);
436-
res->disk.sectors -= disk_sectors;
437437
return ret;
438438
}
439439
}

0 commit comments

Comments
 (0)