# Re: \[RFC PATCH 11/18\] jffs2: Convert jffs2\_gcd\_mtd kthread into the iterant API

- From: Oleg Nesterov \<hidden\>
- Date: 2015-06-06 21:18:00 
- List: linux-api
- Page: https://ratatoskr.run/linux-api/2015/06/4510560
- Thread: https://ratatoskr.run/linux-nfs/2015/06/4510097/t.md

```text
On 06/05, Petr Mladek wrote:
>
> [*] In fact, there was a bug in the original code. It tried to process
>     a non-existing signal when the system was freezing. See the common
>     check for pending signal and freezing.

And another bug afaics:

> -			case SIGSTOP:
> -				jffs2_dbg(1, "%s(): SIGSTOP received\n",
> -					  __func__);
> -				set_current_state(TASK_STOPPED);
> -				schedule();
> -				break;

This is obviously racy, we can miss SIGCONT.

Still I personally dislike the new kthread_sigaction() API. I agree,
a couple if signal helpers for kthreads make sense. Say,

	void kthread_do_signal_stop(void)
	{
		spin_lock_irq(&curtent->sighand->siglock);
		if (current->jobctl & JOBCTL_STOP_DEQUEUED)
			__set_current_state(TASK_STOPPED);
		spin_unlock_irq(&current->sighand->siglock);

		schedule();
	}

and probably even "int kthread_signal_deque(void)".

But personally I do not think kthread_do_signal() makes a lot of sense...

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
```
