[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220309110705.1616783-1-huteng.ht@bytedance.com>
Date: Wed, 9 Mar 2022 19:07:05 +0800
From: huteng.ht@...edance.com
To: peterz@...radead.org, mingo@...hat.com, will@...nel.org
Cc: linux-kernel@...r.kernel.org, huteng.ht@...edance.com
Subject: [PATCH] kernel/locking: Return proper value in __down_common()
From: Teng Hu <huteng.ht@...edance.com>
Return -ETIME when a process waiting on a semaphore woken up
due to timedout, while return -EINTR when woken up by a signal.
Signed-off-by: Teng Hu <huteng.ht@...edance.com>
---
kernel/locking/semaphore.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/locking/semaphore.c b/kernel/locking/semaphore.c
index 9ee381e4d2a4..97ad6a747d2f 100644
--- a/kernel/locking/semaphore.c
+++ b/kernel/locking/semaphore.c
@@ -225,6 +225,8 @@ static inline int __sched __down_common(struct semaphore *sem, long state,
raw_spin_lock_irq(&sem->lock);
if (waiter.up)
return 0;
+ if (timeout)
+ goto interrupted;
}
timed_out:
--
2.20.1
Powered by blists - more mailing lists