bcache: check CACHE_SET_IO_DISABLE bit in bch_journal()
authorColy Li <colyli@suse.de>
Fri, 28 Jun 2019 11:59:36 +0000 (19:59 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Jul 2019 07:14:13 +0000 (09:14 +0200)
commitd81080a0bcf88e8a7d23736f74e24fd4529d7348
tree582001e31a72f0c742ff574e074f1ea80546bc00
parent57cfb755c356a256daae7a78d6358f3d4f0d0e75
bcache: check CACHE_SET_IO_DISABLE bit in bch_journal()

[ Upstream commit 383ff2183ad16a8842d1fbd9dd3e1cbd66813e64 ]

When too many I/O errors happen on cache set and CACHE_SET_IO_DISABLE
bit is set, bch_journal() may continue to work because the journaling
bkey might be still in write set yet. The caller of bch_journal() may
believe the journal still work but the truth is in-memory journal write
set won't be written into cache device any more. This behavior may
introduce potential inconsistent metadata status.

This patch checks CACHE_SET_IO_DISABLE bit at the head of bch_journal(),
if the bit is set, bch_journal() returns NULL immediately to notice
caller to know journal does not work.

Signed-off-by: Coly Li <colyli@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/md/bcache/journal.c