summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-08-16 18:41:46 +0200
committerKent Overstreet <kent.overstreet@linux.dev>2024-08-16 18:46:40 +0200
commit9482f3b05332a624508a91c2ab2cf3527328a6a4 (patch)
treedc068002690c4ee91ec1646a486d389e7760a566 /fs
parentbcachefs: Fix forgetting to pass trans to fsck_err() (diff)
downloadlinux-9482f3b05332a624508a91c2ab2cf3527328a6a4.tar.xz
linux-9482f3b05332a624508a91c2ab2cf3527328a6a4.zip
bcachefs: avoid overflowing LRU_TIME_BITS for cached data lru
Reported-by: syzbot+510b0b28f8e6de64d307@syzkaller.appspotmail.com Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r--fs/bcachefs/alloc_background.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/bcachefs/alloc_background.h b/fs/bcachefs/alloc_background.h
index 260e7fa83d05..fd790b03fbe1 100644
--- a/fs/bcachefs/alloc_background.h
+++ b/fs/bcachefs/alloc_background.h
@@ -150,7 +150,9 @@ static inline void alloc_data_type_set(struct bch_alloc_v4 *a, enum bch_data_typ
static inline u64 alloc_lru_idx_read(struct bch_alloc_v4 a)
{
- return a.data_type == BCH_DATA_cached ? a.io_time[READ] : 0;
+ return a.data_type == BCH_DATA_cached
+ ? a.io_time[READ] & LRU_TIME_MAX
+ : 0;
}
#define DATA_TYPES_MOVABLE \