]> git.baikalelectronics.ru Git - kernel.git/commit
nbd: Aovid double completion of a request
authorXie Yongji <xieyongji@bytedance.com>
Fri, 13 Aug 2021 15:13:30 +0000 (23:13 +0800)
committerJens Axboe <axboe@kernel.dk>
Fri, 13 Aug 2021 15:46:48 +0000 (09:46 -0600)
commit6124b689a7176aecf77901e053d68ca1268f17a5
treee7615b6f592123a288f26ad9e64dd7381bafaf30
parent4a13a7d44b64db7ec8e20d178561845661689d75
nbd: Aovid double completion of a request

There is a race between iterating over requests in
nbd_clear_que() and completing requests in recv_work(),
which can lead to double completion of a request.

To fix it, flush the recv worker before iterating over
the requests and don't abort the completed request
while iterating.

Fixes: 330120c21991 ("nbd: clear_sock on netlink disconnect")
Reported-by: Jiang Yadong <jiangyadong@bytedance.com>
Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Link: https://lore.kernel.org/r/20210813151330.96-1-xieyongji@bytedance.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/nbd.c