Re: [PATCH 3/3] kernel/workqueue: Suppress a false positive lockdep complaint

From: Bart Van Assche
Date: Thu Oct 25 2018 - 13:11:57 EST


On Thu, 2018-10-25 at 19:02 +-0200, Johannes Berg wrote:
+AD4 On Thu, 2018-10-25 at 15:05 +-0000, Bart Van Assche wrote:
+AD4 +AD4 It can happen that the direct I/O queue creates and destroys an empty
+AD4 +AD4 workqueue from inside a work function.
+AD4
+AD4 So, thinking about this more, can you guarantee (somehow) that the
+AD4 workqueue is empty at this point?

In general, no. But for the direct I/O case this can be guaranteed. Please
have a look at the code in sb+AF8-init+AF8-dio+AF8-done+AF8-wq() if you would not yet have
done this.

+AD4 Do you know how to reproduce this?

The lockdep complaint in the patch description is easy to reproduce. The
way I reproduce it is as follows:

git clone https://github.com/osandov/blktests
(cd blktests +ACYAJg ./check -q nvmeof-mp)

Bart.