summaryrefslogtreecommitdiffstats
path: root/drivers/ntb/core.c
diff options
context:
space:
mode:
authorDongsheng Yang <dongsheng.yang@easystack.cn>2020-12-08 00:39:15 +0800
committerJens Axboe <axboe@kernel.dk>2020-12-07 13:25:16 -0700
commitdf4ad53242158f9f1f97daf4feddbb4f8b77f080 (patch)
tree254fd64b672dcea3498c8ddc46e61fa57d8e0a78 /drivers/ntb/core.c
parent733c15bd3a944b8eeaacdddf061759b6a83dd3f4 (diff)
downloadlinux-df4ad53242158f9f1f97daf4feddbb4f8b77f080.tar.bz2
bcache: fix race between setting bdev state to none and new write request direct to backing
There is a race condition in detaching as below: A. detaching B. Write request (1) writing back (2) write back done, set bdev state to clean. (3) cached_dev_put() and schedule_work(&dc->detach); (4) write data [0 - 4K] directly into backing and ack to user. (5) power-failure... When we restart this bcache device, this bdev is clean but not detached, and read [0 - 4K], we will get unexpected old data from cache device. To fix this problem, set the bdev state to none when we writeback done in detaching, and then if power-failure happened as above, the data in cache will not be used in next bcache device starting, it's detached, we will read the correct data from backing derectly. Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn> Signed-off-by: Coly Li <colyli@suse.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/ntb/core.c')
0 files changed, 0 insertions, 0 deletions