On 2024/10/18 12:40, Kent Overstreet wrote:
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]>
---
fs/bcachefs/fs-io-pagecache.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;
I am new to bcachefs, but seems bch2_disk_reservation_put zeros out
tmp->sectors, no affect to 'res' ?
return ret;
}
}
--
Regards