summaryrefslogtreecommitdiff
path: root/fs/bcachefs/quota.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-05-27 20:00:13 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:10:02 -0400
commite7ffda565a762a6bdf782b4978af5ccfe4ab5d0d (patch)
tree01524b097eca71d22f81caf551a3e7b11a379a43 /fs/bcachefs/quota.c
parentc26463ce9940d150dfeaac0a1a0747db9b1ca600 (diff)
bcachefs: Fix a quota read bug
bch2_fs_quota_read() could see an inode that's been deleted (KEY_TYPE_inode_generation) - bch2_fs_quota_read_inode() needs to check for that instead of erroring. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/quota.c')
-rw-r--r--fs/bcachefs/quota.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/bcachefs/quota.c b/fs/bcachefs/quota.c
index 310eb9d26571..56ba82cae19d 100644
--- a/fs/bcachefs/quota.c
+++ b/fs/bcachefs/quota.c
@@ -576,6 +576,13 @@ static int bch2_fs_quota_read_inode(struct btree_trans *trans,
le32_to_cpu(s_t.master_subvol),
k.k->p.offset,
}, &u);
+ /*
+ * Inode might be deleted in this snapshot - the easiest way to handle
+ * that is to just skip it here:
+ */
+ if (bch2_err_matches(ret, ENOENT))
+ goto advance;
+
if (ret)
return ret;
@@ -615,7 +622,7 @@ int bch2_fs_quota_read(struct bch_fs *c)
POS_MIN, BTREE_ITER_PREFETCH|BTREE_ITER_ALL_SNAPSHOTS, k,
bch2_fs_quota_read_inode(&trans, &iter, k));
if (ret)
- bch_err(c, "err in quota_read: %s", bch2_err_str(ret));
+ bch_err(c, "%s: err %s", __func__, bch2_err_str(ret));
bch2_trans_exit(&trans);
return ret;