lkml.org 
[lkml]   [2019]   [Jun]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] lockdep: introduce lockdep_assert_not_held()
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 <dsterba@suse.com>

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.

\
 
 \ /
  Last update: 2019-06-28 14:21    [W:0.038 / U:0.456 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site