projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8e877ca
)
bcachefs: Fix divide by zero in rebalance_work()
author
Kent Overstreet
<kent.overstreet@linux.dev>
Thu, 17 Aug 2023 20:35:58 +0000
(16:35 -0400)
committer
Kent Overstreet
<kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:10:11 +0000
(17:10 -0400)
This fixes https://github.com/koverstreet/bcachefs-tools/issues/159
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/rebalance.c
patch
|
blob
|
history
diff --git
a/fs/bcachefs/rebalance.c
b/fs/bcachefs/rebalance.c
index c3d577236ce2b1f22932eed06484062cc6e9e678..15ce3ecba0baf2e08412bff7f5601a183dbf636f 100644
(file)
--- a/
fs/bcachefs/rebalance.c
+++ b/
fs/bcachefs/rebalance.c
@@
-113,6
+113,10
@@
static void rebalance_work_accumulate(struct rebalance_work *w,
unsigned percent_full;
u64 work = dev_work + unknown_dev;
+ /* avoid divide by 0 */
+ if (!capacity)
+ return;
+
if (work < dev_work || work < unknown_dev)
work = U64_MAX;
work = min(work, capacity);