On Thu, Jun 13, 2019 at 03:36:04PM +0200, David Sterba wrote: > Add an assertion that a lock is not held, suitable for the following > (simplified) usecase in filesystems: > > - filesystem write > - lock(&big_filesystem_lock) > - kmalloc(GFP_KERNEL) > - trigger dirty data write to get more memory > - find dirty pages > - call filesystem write > - lock(&big_filesystem_lock) > deadlock > > The cause here is the use of GFP_KERNEL that does not exclude poking > filesystems to allow freeing some memory. Such scenario is a bug, so the > use of GFP_NOFS is the right flag. > > The annotation can help catch such bugs during development because > the actual deadlock could be hard to hit in practice. > > Signed-off-by: David Sterba <[email protected]>
Any comments on that? I just found another case with convoluted callstacks where the lockdep assertion would catch the potential lock up earlier than under the testing load.

