kthread_worker: split code for canceling the delayed work timer
authorPetr Mladek <pmladek@suse.com>
Fri, 25 Jun 2021 01:39:45 +0000 (18:39 -0700)
committerSasha Levin <sashal@kernel.org>
Wed, 30 Jun 2021 12:47:25 +0000 (08:47 -0400)
commitbfe28af78a2021cfa93f26634a9bbd3a56577745
tree1ce807f61efd16c1aff559a5db84f49bfdbc5451
parent02c303f3b9fbc5ad9c1f50f971304ef86b69f29b
kthread_worker: split code for canceling the delayed work timer

commit 34b3d5344719d14fd2185b2d9459b3abcb8cf9d8 upstream.

Patch series "kthread_worker: Fix race between kthread_mod_delayed_work()
and kthread_cancel_delayed_work_sync()".

This patchset fixes the race between kthread_mod_delayed_work() and
kthread_cancel_delayed_work_sync() including proper return value
handling.

This patch (of 2):

Simple code refactoring as a preparation step for fixing a race between
kthread_mod_delayed_work() and kthread_cancel_delayed_work_sync().

It does not modify the existing behavior.

Link: https://lkml.kernel.org/r/20210610133051.15337-2-pmladek@suse.com
Signed-off-by: Petr Mladek <pmladek@suse.com>
Cc: <jenhaochen@google.com>
Cc: Martin Liu <liumartin@google.com>
Cc: Minchan Kim <minchan@google.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/kthread.c