linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tcmu: Fix module removal due to stuck unmap_thread thread again
@ 2017-06-15  7:05 lixiubo
  2017-06-15 19:00 ` Mike Christie
  2017-06-25 19:38 ` Nicholas A. Bellinger
  0 siblings, 2 replies; 3+ messages in thread
From: lixiubo @ 2017-06-15  7:05 UTC (permalink / raw)
  To: nab, mchristi; +Cc: linux-scsi, target-devel, Xiubo Li

From: Xiubo Li <lixiubo@cmss.chinamobile.com>

Because the unmap code just after the schdule() returned may take
a long time and if the kthread_stop() is fired just when in this
routine, the module removal maybe stuck too.

Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
---
 drivers/target/target_core_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index beb5f09..203bff1 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1573,7 +1573,7 @@ static int unmap_thread_fn(void *data)
 	struct page *page;
 	int i;
 
-	while (1) {
+	while (!kthread_should_stop()) {
 		DEFINE_WAIT(__wait);
 
 		prepare_to_wait(&unmap_wait, &__wait, TASK_INTERRUPTIBLE);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] tcmu: Fix module removal due to stuck unmap_thread thread again
  2017-06-15  7:05 [PATCH] tcmu: Fix module removal due to stuck unmap_thread thread again lixiubo
@ 2017-06-15 19:00 ` Mike Christie
  2017-06-25 19:38 ` Nicholas A. Bellinger
  1 sibling, 0 replies; 3+ messages in thread
From: Mike Christie @ 2017-06-15 19:00 UTC (permalink / raw)
  To: lixiubo, nab; +Cc: linux-scsi, target-devel

On 06/15/2017 02:05 AM, lixiubo@cmss.chinamobile.com wrote:
> From: Xiubo Li <lixiubo@cmss.chinamobile.com>
> 
> Because the unmap code just after the schdule() returned may take
> a long time and if the kthread_stop() is fired just when in this
> routine, the module removal maybe stuck too.
> 
> Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
> ---
>  drivers/target/target_core_user.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
> index beb5f09..203bff1 100644
> --- a/drivers/target/target_core_user.c
> +++ b/drivers/target/target_core_user.c
> @@ -1573,7 +1573,7 @@ static int unmap_thread_fn(void *data)
>  	struct page *page;
>  	int i;
>  
> -	while (1) {
> +	while (!kthread_should_stop()) {
>  		DEFINE_WAIT(__wait);
>  
>  		prepare_to_wait(&unmap_wait, &__wait, TASK_INTERRUPTIBLE);
> 

Looks ok to me

Reviewed-by: Mike Christie <mchristi@redhat.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] tcmu: Fix module removal due to stuck unmap_thread thread again
  2017-06-15  7:05 [PATCH] tcmu: Fix module removal due to stuck unmap_thread thread again lixiubo
  2017-06-15 19:00 ` Mike Christie
@ 2017-06-25 19:38 ` Nicholas A. Bellinger
  1 sibling, 0 replies; 3+ messages in thread
From: Nicholas A. Bellinger @ 2017-06-25 19:38 UTC (permalink / raw)
  To: lixiubo; +Cc: mchristi, linux-scsi, target-devel

On Thu, 2017-06-15 at 15:05 +0800, lixiubo@cmss.chinamobile.com wrote:
> From: Xiubo Li <lixiubo@cmss.chinamobile.com>
> 
> Because the unmap code just after the schdule() returned may take
> a long time and if the kthread_stop() is fired just when in this
> routine, the module removal maybe stuck too.
> 
> Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
> ---
>  drivers/target/target_core_user.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
> index beb5f09..203bff1 100644
> --- a/drivers/target/target_core_user.c
> +++ b/drivers/target/target_core_user.c
> @@ -1573,7 +1573,7 @@ static int unmap_thread_fn(void *data)
>  	struct page *page;
>  	int i;
>  
> -	while (1) {
> +	while (!kthread_should_stop()) {
>  		DEFINE_WAIT(__wait);
>  
>  		prepare_to_wait(&unmap_wait, &__wait, TASK_INTERRUPTIBLE);

Applied to target-pending/for-next.

Thanks Xiubo + MNC.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-25 19:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-15  7:05 [PATCH] tcmu: Fix module removal due to stuck unmap_thread thread again lixiubo
2017-06-15 19:00 ` Mike Christie
2017-06-25 19:38 ` Nicholas A. Bellinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).