diff mbox

[RFC,v2,2/4] locks: Add lockdep assertion for blocked_lock_lock

Message ID 1425306313-7234-3-git-send-email-daniel.wagner@bmw-carit.de (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Wagner March 2, 2015, 2:25 p.m. UTC
Annonate insert, remove and iterate function that we need
blocked_lock_lock held.

Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
---
 fs/locks.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Jeff Layton March 3, 2015, 12:55 a.m. UTC | #1
On Mon,  2 Mar 2015 15:25:11 +0100
Daniel Wagner <daniel.wagner@bmw-carit.de> wrote:

> Annonate insert, remove and iterate function that we need
> blocked_lock_lock held.
> 
> Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
> ---
>  fs/locks.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/fs/locks.c b/fs/locks.c
> index f63aa92..4498da0 100644
> --- a/fs/locks.c
> +++ b/fs/locks.c
> @@ -592,11 +592,15 @@ posix_owner_key(struct file_lock *fl)
>  
>  static void locks_insert_global_blocked(struct file_lock *waiter)
>  {
> +	lockdep_assert_held(&blocked_lock_lock);
> +
>  	hash_add(blocked_hash, &waiter->fl_link, posix_owner_key(waiter));
>  }
>  
>  static void locks_delete_global_blocked(struct file_lock *waiter)
>  {
> +	lockdep_assert_held(&blocked_lock_lock);
> +
>  	hash_del(&waiter->fl_link);
>  }
>  
> @@ -838,6 +842,8 @@ static int posix_locks_deadlock(struct file_lock *caller_fl,
>  {
>  	int i = 0;
>  
> +	lockdep_assert_held(&blocked_lock_lock);
> +
>  	/*
>  	 * This deadlock detector can't reasonably detect deadlocks with
>  	 * FL_OFDLCK locks, since they aren't owned by a process, per-se.

Merged for v4.1.
diff mbox

Patch

diff --git a/fs/locks.c b/fs/locks.c
index f63aa92..4498da0 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -592,11 +592,15 @@  posix_owner_key(struct file_lock *fl)
 
 static void locks_insert_global_blocked(struct file_lock *waiter)
 {
+	lockdep_assert_held(&blocked_lock_lock);
+
 	hash_add(blocked_hash, &waiter->fl_link, posix_owner_key(waiter));
 }
 
 static void locks_delete_global_blocked(struct file_lock *waiter)
 {
+	lockdep_assert_held(&blocked_lock_lock);
+
 	hash_del(&waiter->fl_link);
 }
 
@@ -838,6 +842,8 @@  static int posix_locks_deadlock(struct file_lock *caller_fl,
 {
 	int i = 0;
 
+	lockdep_assert_held(&blocked_lock_lock);
+
 	/*
 	 * This deadlock detector can't reasonably detect deadlocks with
 	 * FL_OFDLCK locks, since they aren't owned by a process, per-se.