bcache: ignore pending signals in run_cache_set()
Now we have c->btree_cache_shrink_thread to restrict memory consumption
of in-memory btree node cache from bch_btree_check() when running a
cache set, but kernel thread creating may still fail for allocator or
gc thread. Finally it is because current process has pending signal to
make kthread_create() fail and return -EINTR. The pending signal is from
OOM killer because c->btree_cache_shrink_thread shrinks btree node cache
in parallel and the peak memory consumption by bch_btree_check() may
still triger OOM killer temporarily.
Such failure only happens when starting a cache set, especially when
the cache set registration is triggered by udev rules during system boot
up time. Therefore ignore OOM killer's signal only once for such peak
memory consumption when starting a cache set is safe.
This patch adds flush_signals(current) right after bch_btree_check()
returns, to flush and ignore all pending signals which are received
during bch_btree_check(). Then following kthread_create() or
kthread_run() for other bcache kthreads will not failure.
Signed-off-by: Coly Li <colyli@suse.de>
1 file changed