Skip to contentSkip to conversation

Fix DRBD regression

PATCH New Philipp Reisner 2 participants 5 messages Jul 9, 2014 – Jul 10, 2014

Subsystems (2)
lore
Share & tools
lore

Philipp Reisner

author maintainer
#0 lore raw

PATCH 1/1 Fix DRBD regression

Hi Jens,

In 3.13 the commit 786235eeb 'kthread: make kthread_create() killable' broke DRBD's fence peer mechanism in a subtle way. Since only a part of our user base has fencing properly configured this regression was unnoticed until now. Please consider to submit this for 3.16-rc5.

Thanks,
Phil

Lars Ellenberg (1):
drbd: fix regression 'out of mem, failed to invoke fence-peer helper'

 drivers/block/drbd/drbd_nl.c | 6 ++++++
 1 file changed, 6 insertions(+)
Signature · 1 line
1.9.1
author maintainer
#1 lore raw

PATCH 1/1 drbd: fix regression 'out of mem, failed to invoke fence-peer helper'

From: Lars Ellenberg <[email protected]>

Since linux kernel 3.13, kthread_run() internally uses wait_for_completion_killable(). We sometimes may use kthread_run() while we still have a signal pending, which we used to kick our threads out of potentially blocking network functions, causing kthread_run() to mistake that as a new fatal signal and fail.

Fix: flush_signals() before kthread_run().

---
 drivers/block/drbd/drbd_nl.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/block/drbd/drbd_nl.c +6 -0
index 1b35c45..3f2e167 100644
@@ -544,6 +544,12 @@ void conn_try_outdate_peer_async(struct drbd_connection *connection)
 	struct task_struct *opa;
 
 	kref_get(&connection->kref);
+	/* We may just have force_sig()'ed this thread
+	 * to get it out of some blocking network function.
+	 * Clear signals; otherwise kthread_run(), which internally uses
+	 * wait_on_completion_killable(), will mistake our pending signal
+	 * for a new fatal signal and fail. */
+	flush_signals(current);
 	opa = kthread_run(_try_outdate_peer_async, connection, "drbd_async_h");
 	if (IS_ERR(opa)) {
 		drbd_err(connection, "out of mem, failed to invoke fence-peer helper\n");
Signature · 1 line
1.9.1
maintainer
#2 lore raw

Re: [PATCH] drbd: fix regression 'out of mem, failed to invoke fence-peer helper'

Quoted 9 lines · Philipp Reisner

From: Lars Ellenberg <[email protected]>

Since linux kernel 3.13, kthread_run() internally uses wait_for_completion_killable(). We sometimes may use kthread_run() while we still have a signal pending, which we used to kick our threads out of potentially blocking network functions, causing kthread_run() to mistake that as a new fatal signal and fail.

Fix: flush_signals() before kthread_run().

Applied - should this have been marked stable, if it affects 3..13+ kernels?

Signature · 1 line
Jens Axboe
author maintainer
#3 lore raw

Re: [PATCH] drbd: fix regression 'out of mem, failed to invoke fence-peer helper'

Am Donnerstag, 10. Juli 2014, 11:07:22 schrieb Jens Axboe:

Quoted 9 lines · Philipp Reisner
Quoted 8 lines

From: Lars Ellenberg <[email protected]>

Since linux kernel 3.13, kthread_run() internally uses wait_for_completion_killable(). We sometimes may use kthread_run() while we still have a signal pending, which we used to kick our threads out of potentially blocking network functions, causing kthread_run() to mistake that as a new fatal signal and fail.

Quoted 3 lines
Quoted 1 line

Fix: flush_signals() before kthread_run().

Applied - should this have been marked stable, if it affects 3..13+ kernels?

Yes, you are right. It should go to the stable kernels since 3.13 as well.

What is the correct way for me to mark it as stable when sending a patch?

-phil

maintainer
#4 lore raw

Re: [PATCH] drbd: fix regression 'out of mem, failed to invoke fence-peer helper'

Quoted 10 lines · Philipp Reisner

Am Donnerstag, 10. Juli 2014, 11:07:22 schrieb Jens Axboe:

Quoted 9 lines · Philipp Reisner
Quoted 8 lines

From: Lars Ellenberg <[email protected]>

Since linux kernel 3.13, kthread_run() internally uses wait_for_completion_killable(). We sometimes may use kthread_run() while we still have a signal pending, which we used to kick our threads out of potentially blocking network functions, causing kthread_run() to mistake that as a new fatal signal and fail.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Fix: flush_signals() before kthread_run().

Applied - should this have been marked stable, if it affects 3..13+ kernels?

Yes, you are right. It should go to the stable kernels since 3.13 as well.

Alright, we'll have to notify Greg/stable when it goes in.

Quoted 1 line

What is the correct way for me to mark it as stable when sending a patch?

You just add a:

where the signed-off-by is. If you know the versions it should be applied to, you can add that information as well. For this case, you would have done:

Cc [email protected] # v3.13+

to get it into 3.13 stable and later.

Signature · 1 line
Jens Axboe