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)
committerJens Axboe <axboe@kernel.dk>
Fri, 28 Jun 2019 13:39:15 +0000 (07:39 -0600)
commite775339e1ae1205b47d94881db124c11385e597c
tree8b898a7b1ab8eeef2b131e8d86bde507eeea0462
parentbd9026c8a7f33ebe25543b7b7e6276b49db60f7e
bcache: check CACHE_SET_IO_DISABLE in allocator code

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