There is a race happens in btree_flush_write() which may cause system hang or panic. This patch set is an effor to fix such race, and it is also necessary for the jouranl-no-space deadlock fixes. Any review or comments is welcome. Thanks in advance. Coly Li --- Coly Li (6): bcache: Revert "bcache: fix high CPU occupancy during journal" bcache: Revert "bcache: free heap cache_set->flush_btree in bch_journal_free" bcache: set largest seq to ja->seq[bucket_index] in journal_read_bucket() bcache: remove retry_flush_write from struct cache_set bcache: fix race in btree_flush_write() bcache: add reclaimed_journal_buckets to struct cache_set drivers/md/bcache/bcache.h | 4 +- drivers/md/bcache/btree.c | 15 +++++- drivers/md/bcache/btree.h | 2 + drivers/md/bcache/journal.c | 111 ++++++++++++++++++++++++++++---------------- drivers/md/bcache/journal.h | 4 ++ drivers/md/bcache/sysfs.c | 10 ++-- drivers/md/bcache/util.h | 2 - 7 files changed, 97 insertions(+), 51 deletions(-) -- 2.16.4