Skip to content

Commit fee1099

Browse files
committed
signal/drbd: Use send_sig not force_sig
The drbd module exclusively sends signals to kernel threads it creates with kthread_create. These kernel threads do not block or ignore signals (only flush signals after they have been delivered), nor can drbd threads possibly be pid namespace init processes so the extra work that force_sig performs that send_sig does not is unnecessary. Further force_sig is for delivering synchronous signals (aka exceptions). The locking in force_sig is not prepared to deal with running processes, as tsk->sighand may change during exec for a running process. In short it is not only unnecessary for drbd to use force_sig it is semantically wrong. With drbd using send_sig it becomes easier to maintain force_sig as only synchronous signals need to be considered. Cc: Philipp Reisner <philipp.reisner@linbit.com> Cc: Lars Ellenberg <lars.ellenberg@linbit.com> Cc: drbd-dev@lists.linbit.com Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
1 parent 82e10af commit fee1099

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎drivers/block/drbd/drbd_int.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1972,7 +1972,7 @@ static inline void wake_ack_receiver(struct drbd_connection *connection)
19721972
{
19731973
struct task_struct *task = connection->ack_receiver.task;
19741974
if (task && get_t_state(&connection->ack_receiver) == RUNNING)
1975-
force_sig(SIGXCPU, task);
1975+
send_sig(SIGXCPU, task, 1);
19761976
}
19771977

19781978
static inline void request_ping(struct drbd_connection *connection)

‎drivers/block/drbd/drbd_main.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ void _drbd_thread_stop(struct drbd_thread *thi, int restart, int wait)
477477
smp_mb();
478478
init_completion(&thi->stop);
479479
if (thi->task != current)
480-
force_sig(DRBD_SIGKILL, thi->task);
480+
send_sig(DRBD_SIGKILL, thi->task, 1);
481481
}
482482

483483
spin_unlock_irqrestore(&thi->t_lock, flags);

‎drivers/block/drbd/drbd_nl.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ void conn_try_outdate_peer_async(struct drbd_connection *connection)
611611
struct task_struct *opa;
612612

613613
kref_get(&connection->kref);
614-
/* We may just have force_sig()'ed this thread
614+
/* We may have just sent a signal to this thread
615615
* to get it out of some blocking network function.
616616
* Clear signals; otherwise kthread_run(), which internally uses
617617
* wait_on_completion_killable(), will mistake our pending signal

0 commit comments

Comments
 (0)