From: Peter Zijlstra Date: Thu, 9 Sep 2021 10:59:17 +0000 (+0200) Subject: locking/rwbase: Properly match set_and_save_state() to restore_state() X-Git-Tag: v5.15~225^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7687201e37fabf2b7cf2b828f7ca46bf30e2948f;p=platform%2Fkernel%2Flinux-starfive.git locking/rwbase: Properly match set_and_save_state() to restore_state() Noticed while looking at the readers race. Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Thomas Gleixner Acked-by: Will Deacon Link: https://lkml.kernel.org/r/20210909110203.828203010@infradead.org --- diff --git a/kernel/locking/rwbase_rt.c b/kernel/locking/rwbase_rt.c index 4ba1508..542b017 100644 --- a/kernel/locking/rwbase_rt.c +++ b/kernel/locking/rwbase_rt.c @@ -220,7 +220,7 @@ static int __sched rwbase_write_lock(struct rwbase_rt *rwb, for (; atomic_read(&rwb->readers);) { /* Optimized out for rwlocks */ if (rwbase_signal_pending_state(state, current)) { - __set_current_state(TASK_RUNNING); + rwbase_restore_current_state(); __rwbase_write_unlock(rwb, 0, flags); return -EINTR; }