bcache: check CACHE_SET_IO_DISABLE in allocator code
authorColy Li <colyli@suse.de>
Fri, 28 Jun 2019 11:59:35 +0000 (19:59 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Jul 2019 07:14:13 +0000 (09:14 +0200)
commit57cfb755c356a256daae7a78d6358f3d4f0d0e75
treef373b25b91a37eaf35287b97044dbda3bb05d8af
parente78d1d2344693ddcd8a2d0a66242f5bf394d6d98
bcache: check CACHE_SET_IO_DISABLE in allocator code

[ Upstream commit e775339e1ae1205b47d94881db124c11385e597c ]

If CACHE_SET_IO_DISABLE of a cache set flag is set by too many I/O
errors, currently allocator routines can still continue allocate
space which may introduce inconsistent metadata state.

This patch checkes CACHE_SET_IO_DISABLE bit in following allocator
routines,
- bch_bucket_alloc()
- __bch_bucket_alloc_set()
Once CACHE_SET_IO_DISABLE is set on cache set, the allocator routines
may reject allocation request earlier to avoid potential inconsistent
metadata.

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/alloc.c