lkml.org 
[lkml]   [2021]   [May]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] locking/mutex: clear MUTEX_FLAGS if wait_list is empty due to signal
Date
From: Zqiang <qiang.zhang@windriver.com>

Clear MUTEX_FLAGS when call mutex_lock_interruptible()
interrupted by a signal and the lock->wait_list is empty.

Signed-off-by: Zqiang <qiang.zhang@windriver.com>
---
kernel/locking/mutex.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c
index cb6b112ce155..4ac354ca092b 100644
--- a/kernel/locking/mutex.c
+++ b/kernel/locking/mutex.c
@@ -1081,6 +1081,8 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
err:
__set_current_state(TASK_RUNNING);
mutex_remove_waiter(lock, &waiter, current);
+ if (likely(list_empty(&lock->wait_list)))
+ __mutex_clear_flag(lock, MUTEX_FLAGS);
err_early_kill:
spin_unlock(&lock->wait_lock);
debug_mutex_free_waiter(&waiter);
--
2.25.1
\
 
 \ /
  Last update: 2021-05-15 04:31    [W:0.047 / U:1.508 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site