Skip to content

Commit 7cc47e6

Browse files
zoumingzheaxboe
authored andcommitted
bcache: fixup init dirty data errors
We found that after long run, the dirty_data of the bcache device will have errors. This error cannot be eliminated unless re-register. We also found that reattach after detach, this error can accumulate. In bch_sectors_dirty_init(), all inode <= d->id keys will be recounted again. This is wrong, we only need to count the keys of the current device. Fixes: b144e45 ("bcache: make bch_sectors_dirty_init() to be multithreaded") Signed-off-by: Mingzhe Zou <mingzhe.zou@easystack.cn> Cc: <stable@vger.kernel.org> Signed-off-by: Coly Li <colyli@suse.de> Link: https://lore.kernel.org/r/20231120052503.6122-6-colyli@suse.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 2c7f497 commit 7cc47e6

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/md/bcache/writeback.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -991,8 +991,11 @@ void bch_sectors_dirty_init(struct bcache_device *d)
991991
op.count = 0;
992992

993993
for_each_key_filter(&c->root->keys,
994-
k, &iter, bch_ptr_invalid)
994+
k, &iter, bch_ptr_invalid) {
995+
if (KEY_INODE(k) != op.inode)
996+
continue;
995997
sectors_dirty_init_fn(&op.op, c->root, k);
998+
}
996999

9971000
rw_unlock(0, c->root);
9981001
return;

0 commit comments

Comments
 (0)