From 8810386f6bd55cf3287a1219901c2993b3bac959 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Sun, 21 Nov 2021 22:34:26 -0500 Subject: [PATCH] bcachefs: Fix an i_sectors accounting bug We weren't checking for errors before calling i_sectors_acct() Signed-off-by: Kent Overstreet --- fs/bcachefs/fs-io.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c index ac013bb99a43..dff6d7547212 100644 --- a/fs/bcachefs/fs-io.c +++ b/fs/bcachefs/fs-io.c @@ -2806,6 +2806,8 @@ static int __bchfs_fallocate(struct bch_inode_info *inode, int mode, &reservation.k_i, &disk_res, NULL, 0, &i_sectors_delta, true); + if (ret) + goto bkey_err; i_sectors_acct(c, inode, "a_res, i_sectors_delta); bkey_err: bch2_quota_reservation_put(c, inode, "a_res);