]> git.baikalelectronics.ru Git - kernel.git/commit
dm: fix inflight IO check
authorJens Axboe <axboe@kernel.dk>
Mon, 10 Dec 2018 22:45:53 +0000 (15:45 -0700)
committerJens Axboe <axboe@kernel.dk>
Tue, 11 Dec 2018 01:10:34 +0000 (18:10 -0700)
commitf3ae22380a5fc8eb1016e9d6bc008b7a89b28ba3
tree54917292e4e39a04f4d2aba88f32bc92f4042e23
parentd5b817150f259046054c16ae663190f3d19df480
dm: fix inflight IO check

After switching to percpu inflight counters, the inflight check
is totally buggy. It's perfectly valid for some counters to be
non-zero while having a total inflight IO count of 0, that's how
these kinds of counters work (inc on one CPU, dec on another).
Fix the md_in_flight() check to sum all counters before returning
a false positive, potentially.

While at it, remove the inflight read for IO completion. We don't
need it, just wake anyone that's waiting for the IO count to drop
to zero. The caller needs to re-check that value anyway when woken,
which it does.

Fixes: 4a151159a2b3 ("dm: remove the pending IO accounting")
Acked-by: Mike Snitzer <snitzer@redhat.com>
Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/md/dm.c