All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] erofs: Wake up all waiters after z_erofs_lzma_head ready.
@ 2022-06-25 14:50 ` Yuwen Chen
  0 siblings, 0 replies; 18+ messages in thread
From: Yuwen Chen @ 2022-06-25 14:50 UTC (permalink / raw)
  To: xiang; +Cc: chao, linux-erofs, linux-kernel, Yuwen Chen

When the user mounts the erofs second times, the decompression thread
may hung. The problem happens due to a sequence of steps like the
following:

1) Task A called z_erofs_load_lzma_config which obtain all of the node
   from the z_erofs_lzma_head.

2) At this time, task B called the z_erofs_lzma_decompress and wanted to
   get a node. But the z_erofs_lzma_head was empty, the Task B had to
   sleep.

3) Task A release nodes and push nodes into the z_erofs_lzma_head. But
   task B was still sleeping.

One example report when the hung happens:
task:kworker/u3:1 state:D stack:14384 pid: 86 ppid: 2 flags:0x00004000
Workqueue: erofs_unzipd z_erofs_decompressqueue_work
Call Trace:
 <TASK>
 __schedule+0x281/0x760
 schedule+0x49/0xb0
 z_erofs_lzma_decompress+0x4bc/0x580
 ? cpu_core_flags+0x10/0x10
 z_erofs_decompress_pcluster+0x49b/0xba0
 ? __update_load_avg_se+0x2b0/0x330
 ? __update_load_avg_se+0x2b0/0x330
 ? update_load_avg+0x5f/0x690
 ? update_load_avg+0x5f/0x690
 ? set_next_entity+0xbd/0x110
 ? _raw_spin_unlock+0xd/0x20
 z_erofs_decompress_queue.isra.0+0x2e/0x50
 z_erofs_decompressqueue_work+0x30/0x60
 process_one_work+0x1d3/0x3a0
 worker_thread+0x45/0x3a0
 ? process_one_work+0x3a0/0x3a0
 kthread+0xe2/0x110
 ? kthread_complete_and_exit+0x20/0x20
 ret_from_fork+0x22/0x30
 </TASK>

Signed-off-by: Yuwen Chen <chenyuwen1@meizu.com>
---
 fs/erofs/decompressor_lzma.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/erofs/decompressor_lzma.c b/fs/erofs/decompressor_lzma.c
index 05a3063cf2bc..5e59b3f523eb 100644
--- a/fs/erofs/decompressor_lzma.c
+++ b/fs/erofs/decompressor_lzma.c
@@ -143,6 +143,7 @@ int z_erofs_load_lzma_config(struct super_block *sb,
 	DBG_BUGON(z_erofs_lzma_head);
 	z_erofs_lzma_head = head;
 	spin_unlock(&z_erofs_lzma_lock);
+	wake_up_all(&z_erofs_lzma_wq);
 
 	z_erofs_lzma_max_dictsize = dict_size;
 	mutex_unlock(&lzma_resize_mutex);
-- 
2.25.1


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

* [PATCH] erofs: Wake up all waiters after z_erofs_lzma_head ready.
@ 2022-06-25 14:50 ` Yuwen Chen
  0 siblings, 0 replies; 18+ messages in thread
From: Yuwen Chen @ 2022-06-25 14:50 UTC (permalink / raw)
  To: xiang; +Cc: Yuwen Chen, linux-erofs, linux-kernel

When the user mounts the erofs second times, the decompression thread
may hung. The problem happens due to a sequence of steps like the
following:

1) Task A called z_erofs_load_lzma_config which obtain all of the node
   from the z_erofs_lzma_head.

2) At this time, task B called the z_erofs_lzma_decompress and wanted to
   get a node. But the z_erofs_lzma_head was empty, the Task B had to
   sleep.

3) Task A release nodes and push nodes into the z_erofs_lzma_head. But
   task B was still sleeping.

One example report when the hung happens:
task:kworker/u3:1 state:D stack:14384 pid: 86 ppid: 2 flags:0x00004000
Workqueue: erofs_unzipd z_erofs_decompressqueue_work
Call Trace:
 <TASK>
 __schedule+0x281/0x760
 schedule+0x49/0xb0
 z_erofs_lzma_decompress+0x4bc/0x580
 ? cpu_core_flags+0x10/0x10
 z_erofs_decompress_pcluster+0x49b/0xba0
 ? __update_load_avg_se+0x2b0/0x330
 ? __update_load_avg_se+0x2b0/0x330
 ? update_load_avg+0x5f/0x690
 ? update_load_avg+0x5f/0x690
 ? set_next_entity+0xbd/0x110
 ? _raw_spin_unlock+0xd/0x20
 z_erofs_decompress_queue.isra.0+0x2e/0x50
 z_erofs_decompressqueue_work+0x30/0x60
 process_one_work+0x1d3/0x3a0
 worker_thread+0x45/0x3a0
 ? process_one_work+0x3a0/0x3a0
 kthread+0xe2/0x110
 ? kthread_complete_and_exit+0x20/0x20
 ret_from_fork+0x22/0x30
 </TASK>

Signed-off-by: Yuwen Chen <chenyuwen1@meizu.com>
---
 fs/erofs/decompressor_lzma.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/erofs/decompressor_lzma.c b/fs/erofs/decompressor_lzma.c
index 05a3063cf2bc..5e59b3f523eb 100644
--- a/fs/erofs/decompressor_lzma.c
+++ b/fs/erofs/decompressor_lzma.c
@@ -143,6 +143,7 @@ int z_erofs_load_lzma_config(struct super_block *sb,
 	DBG_BUGON(z_erofs_lzma_head);
 	z_erofs_lzma_head = head;
 	spin_unlock(&z_erofs_lzma_lock);
+	wake_up_all(&z_erofs_lzma_wq);
 
 	z_erofs_lzma_max_dictsize = dict_size;
 	mutex_unlock(&lzma_resize_mutex);
-- 
2.25.1


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

* [PATCH] erofs: wake up all waiters after z_erofs_lzma_head ready
  2022-06-27  6:15     ` Gao Xiang
@ 2022-06-26 22:40       ` Yuwen Chen
  -1 siblings, 0 replies; 18+ messages in thread
From: Yuwen Chen @ 2022-06-26 22:40 UTC (permalink / raw)
  To: hsiangkao; +Cc: chenyuwen1, linux-erofs, linux-kernel, xiang, zbestahu

When the user mounts the erofs second times, the decompression thread
may hung. The problem happens due to a sequence of steps like the
following:

1) Task A called z_erofs_load_lzma_config which obtain all of the node
   from the z_erofs_lzma_head.

2) At this time, task B called the z_erofs_lzma_decompress and wanted to
   get a node. But the z_erofs_lzma_head was empty, the Task B had to
   sleep.

3) Task A release nodes and push nodes into the z_erofs_lzma_head. But
   task B was still sleeping.

One example report when the hung happens:
task:kworker/u3:1 state:D stack:14384 pid: 86 ppid: 2 flags:0x00004000
Workqueue: erofs_unzipd z_erofs_decompressqueue_work
Call Trace:
 <TASK>
 __schedule+0x281/0x760
 schedule+0x49/0xb0
 z_erofs_lzma_decompress+0x4bc/0x580
 ? cpu_core_flags+0x10/0x10
 z_erofs_decompress_pcluster+0x49b/0xba0
 ? __update_load_avg_se+0x2b0/0x330
 ? __update_load_avg_se+0x2b0/0x330
 ? update_load_avg+0x5f/0x690
 ? update_load_avg+0x5f/0x690
 ? set_next_entity+0xbd/0x110
 ? _raw_spin_unlock+0xd/0x20
 z_erofs_decompress_queue.isra.0+0x2e/0x50
 z_erofs_decompressqueue_work+0x30/0x60
 process_one_work+0x1d3/0x3a0
 worker_thread+0x45/0x3a0
 ? process_one_work+0x3a0/0x3a0
 kthread+0xe2/0x110
 ? kthread_complete_and_exit+0x20/0x20
 ret_from_fork+0x22/0x30
 </TASK>

Signed-off-by: Yuwen Chen <chenyuwen1@meizu.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
 fs/erofs/decompressor_lzma.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/erofs/decompressor_lzma.c b/fs/erofs/decompressor_lzma.c
index 05a3063cf2bc..5e59b3f523eb 100644
--- a/fs/erofs/decompressor_lzma.c
+++ b/fs/erofs/decompressor_lzma.c
@@ -143,6 +143,7 @@ int z_erofs_load_lzma_config(struct super_block *sb,
 	DBG_BUGON(z_erofs_lzma_head);
 	z_erofs_lzma_head = head;
 	spin_unlock(&z_erofs_lzma_lock);
+	wake_up_all(&z_erofs_lzma_wq);
 
 	z_erofs_lzma_max_dictsize = dict_size;
 	mutex_unlock(&lzma_resize_mutex);
-- 
2.25.1


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

* [PATCH] erofs: wake up all waiters after z_erofs_lzma_head ready
@ 2022-06-26 22:40       ` Yuwen Chen
  0 siblings, 0 replies; 18+ messages in thread
From: Yuwen Chen @ 2022-06-26 22:40 UTC (permalink / raw)
  To: hsiangkao; +Cc: linux-erofs, chenyuwen1, linux-kernel

When the user mounts the erofs second times, the decompression thread
may hung. The problem happens due to a sequence of steps like the
following:

1) Task A called z_erofs_load_lzma_config which obtain all of the node
   from the z_erofs_lzma_head.

2) At this time, task B called the z_erofs_lzma_decompress and wanted to
   get a node. But the z_erofs_lzma_head was empty, the Task B had to
   sleep.

3) Task A release nodes and push nodes into the z_erofs_lzma_head. But
   task B was still sleeping.

One example report when the hung happens:
task:kworker/u3:1 state:D stack:14384 pid: 86 ppid: 2 flags:0x00004000
Workqueue: erofs_unzipd z_erofs_decompressqueue_work
Call Trace:
 <TASK>
 __schedule+0x281/0x760
 schedule+0x49/0xb0
 z_erofs_lzma_decompress+0x4bc/0x580
 ? cpu_core_flags+0x10/0x10
 z_erofs_decompress_pcluster+0x49b/0xba0
 ? __update_load_avg_se+0x2b0/0x330
 ? __update_load_avg_se+0x2b0/0x330
 ? update_load_avg+0x5f/0x690
 ? update_load_avg+0x5f/0x690
 ? set_next_entity+0xbd/0x110
 ? _raw_spin_unlock+0xd/0x20
 z_erofs_decompress_queue.isra.0+0x2e/0x50
 z_erofs_decompressqueue_work+0x30/0x60
 process_one_work+0x1d3/0x3a0
 worker_thread+0x45/0x3a0
 ? process_one_work+0x3a0/0x3a0
 kthread+0xe2/0x110
 ? kthread_complete_and_exit+0x20/0x20
 ret_from_fork+0x22/0x30
 </TASK>

Signed-off-by: Yuwen Chen <chenyuwen1@meizu.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
 fs/erofs/decompressor_lzma.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/erofs/decompressor_lzma.c b/fs/erofs/decompressor_lzma.c
index 05a3063cf2bc..5e59b3f523eb 100644
--- a/fs/erofs/decompressor_lzma.c
+++ b/fs/erofs/decompressor_lzma.c
@@ -143,6 +143,7 @@ int z_erofs_load_lzma_config(struct super_block *sb,
 	DBG_BUGON(z_erofs_lzma_head);
 	z_erofs_lzma_head = head;
 	spin_unlock(&z_erofs_lzma_lock);
+	wake_up_all(&z_erofs_lzma_wq);
 
 	z_erofs_lzma_max_dictsize = dict_size;
 	mutex_unlock(&lzma_resize_mutex);
-- 
2.25.1


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

* Re: [PATCH] erofs: Wake up all waiters after z_erofs_lzma_head ready.
  2022-06-25 14:50 ` Yuwen Chen
@ 2022-06-27  2:56   ` Gao Xiang
  -1 siblings, 0 replies; 18+ messages in thread
From: Gao Xiang @ 2022-06-27  2:56 UTC (permalink / raw)
  To: Yuwen Chen; +Cc: xiang, chao, linux-erofs, linux-kernel

On Sat, Jun 25, 2022 at 10:50:00PM +0800, Yuwen Chen wrote:
> When the user mounts the erofs second times, the decompression thread
> may hung. The problem happens due to a sequence of steps like the
> following:
> 
> 1) Task A called z_erofs_load_lzma_config which obtain all of the node
>    from the z_erofs_lzma_head.
> 
> 2) At this time, task B called the z_erofs_lzma_decompress and wanted to
>    get a node. But the z_erofs_lzma_head was empty, the Task B had to
>    sleep.
> 
> 3) Task A release nodes and push nodes into the z_erofs_lzma_head. But
>    task B was still sleeping.
> 
> One example report when the hung happens:
> task:kworker/u3:1 state:D stack:14384 pid: 86 ppid: 2 flags:0x00004000
> Workqueue: erofs_unzipd z_erofs_decompressqueue_work
> Call Trace:
>  <TASK>
>  __schedule+0x281/0x760
>  schedule+0x49/0xb0
>  z_erofs_lzma_decompress+0x4bc/0x580
>  ? cpu_core_flags+0x10/0x10
>  z_erofs_decompress_pcluster+0x49b/0xba0
>  ? __update_load_avg_se+0x2b0/0x330
>  ? __update_load_avg_se+0x2b0/0x330
>  ? update_load_avg+0x5f/0x690
>  ? update_load_avg+0x5f/0x690
>  ? set_next_entity+0xbd/0x110
>  ? _raw_spin_unlock+0xd/0x20
>  z_erofs_decompress_queue.isra.0+0x2e/0x50
>  z_erofs_decompressqueue_work+0x30/0x60
>  process_one_work+0x1d3/0x3a0
>  worker_thread+0x45/0x3a0
>  ? process_one_work+0x3a0/0x3a0
>  kthread+0xe2/0x110
>  ? kthread_complete_and_exit+0x20/0x20
>  ret_from_fork+0x22/0x30
>  </TASK>
> 
> Signed-off-by: Yuwen Chen <chenyuwen1@meizu.com>

Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>

Thanks,
Gao Xiang

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

* Re: [PATCH] erofs: Wake up all waiters after z_erofs_lzma_head ready.
@ 2022-06-27  2:56   ` Gao Xiang
  0 siblings, 0 replies; 18+ messages in thread
From: Gao Xiang @ 2022-06-27  2:56 UTC (permalink / raw)
  To: Yuwen Chen; +Cc: linux-erofs, linux-kernel

On Sat, Jun 25, 2022 at 10:50:00PM +0800, Yuwen Chen wrote:
> When the user mounts the erofs second times, the decompression thread
> may hung. The problem happens due to a sequence of steps like the
> following:
> 
> 1) Task A called z_erofs_load_lzma_config which obtain all of the node
>    from the z_erofs_lzma_head.
> 
> 2) At this time, task B called the z_erofs_lzma_decompress and wanted to
>    get a node. But the z_erofs_lzma_head was empty, the Task B had to
>    sleep.
> 
> 3) Task A release nodes and push nodes into the z_erofs_lzma_head. But
>    task B was still sleeping.
> 
> One example report when the hung happens:
> task:kworker/u3:1 state:D stack:14384 pid: 86 ppid: 2 flags:0x00004000
> Workqueue: erofs_unzipd z_erofs_decompressqueue_work
> Call Trace:
>  <TASK>
>  __schedule+0x281/0x760
>  schedule+0x49/0xb0
>  z_erofs_lzma_decompress+0x4bc/0x580
>  ? cpu_core_flags+0x10/0x10
>  z_erofs_decompress_pcluster+0x49b/0xba0
>  ? __update_load_avg_se+0x2b0/0x330
>  ? __update_load_avg_se+0x2b0/0x330
>  ? update_load_avg+0x5f/0x690
>  ? update_load_avg+0x5f/0x690
>  ? set_next_entity+0xbd/0x110
>  ? _raw_spin_unlock+0xd/0x20
>  z_erofs_decompress_queue.isra.0+0x2e/0x50
>  z_erofs_decompressqueue_work+0x30/0x60
>  process_one_work+0x1d3/0x3a0
>  worker_thread+0x45/0x3a0
>  ? process_one_work+0x3a0/0x3a0
>  kthread+0xe2/0x110
>  ? kthread_complete_and_exit+0x20/0x20
>  ret_from_fork+0x22/0x30
>  </TASK>
> 
> Signed-off-by: Yuwen Chen <chenyuwen1@meizu.com>

Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>

Thanks,
Gao Xiang

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

* Re: [PATCH] erofs: Wake up all waiters after z_erofs_lzma_head ready.
  2022-06-25 14:50 ` Yuwen Chen
@ 2022-06-27  5:57   ` Yue Hu
  -1 siblings, 0 replies; 18+ messages in thread
From: Yue Hu @ 2022-06-27  5:57 UTC (permalink / raw)
  To: Yuwen Chen; +Cc: xiang, linux-erofs, linux-kernel

On Sat, 25 Jun 2022 22:50:00 +0800
Yuwen Chen <chenyuwen1@meizu.com> wrote:

> When the user mounts the erofs second times, the decompression thread
> may hung. The problem happens due to a sequence of steps like the
> following:
> 
> 1) Task A called z_erofs_load_lzma_config which obtain all of the node
>    from the z_erofs_lzma_head.
> 
> 2) At this time, task B called the z_erofs_lzma_decompress and wanted to
>    get a node. But the z_erofs_lzma_head was empty, the Task B had to
>    sleep.
> 
> 3) Task A release nodes and push nodes into the z_erofs_lzma_head. But
>    task B was still sleeping.
> 
> One example report when the hung happens:
> task:kworker/u3:1 state:D stack:14384 pid: 86 ppid: 2 flags:0x00004000
> Workqueue: erofs_unzipd z_erofs_decompressqueue_work
> Call Trace:
>  <TASK>
>  __schedule+0x281/0x760
>  schedule+0x49/0xb0
>  z_erofs_lzma_decompress+0x4bc/0x580
>  ? cpu_core_flags+0x10/0x10
>  z_erofs_decompress_pcluster+0x49b/0xba0
>  ? __update_load_avg_se+0x2b0/0x330
>  ? __update_load_avg_se+0x2b0/0x330
>  ? update_load_avg+0x5f/0x690
>  ? update_load_avg+0x5f/0x690
>  ? set_next_entity+0xbd/0x110
>  ? _raw_spin_unlock+0xd/0x20
>  z_erofs_decompress_queue.isra.0+0x2e/0x50
>  z_erofs_decompressqueue_work+0x30/0x60
>  process_one_work+0x1d3/0x3a0
>  worker_thread+0x45/0x3a0
>  ? process_one_work+0x3a0/0x3a0
>  kthread+0xe2/0x110
>  ? kthread_complete_and_exit+0x20/0x20
>  ret_from_fork+0x22/0x30
>  </TASK>
> 
> Signed-off-by: Yuwen Chen <chenyuwen1@meizu.com>
> ---
>  fs/erofs/decompressor_lzma.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/erofs/decompressor_lzma.c b/fs/erofs/decompressor_lzma.c
> index 05a3063cf2bc..5e59b3f523eb 100644
> --- a/fs/erofs/decompressor_lzma.c
> +++ b/fs/erofs/decompressor_lzma.c
> @@ -143,6 +143,7 @@ int z_erofs_load_lzma_config(struct super_block *sb,
>  	DBG_BUGON(z_erofs_lzma_head);
>  	z_erofs_lzma_head = head;
>  	spin_unlock(&z_erofs_lzma_lock);
> +	wake_up_all(&z_erofs_lzma_wq);
>  
>  	z_erofs_lzma_max_dictsize = dict_size;
>  	mutex_unlock(&lzma_resize_mutex);

Please do not end the summary line(title) with a period.

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

* Re: [PATCH] erofs: Wake up all waiters after z_erofs_lzma_head ready.
@ 2022-06-27  5:57   ` Yue Hu
  0 siblings, 0 replies; 18+ messages in thread
From: Yue Hu @ 2022-06-27  5:57 UTC (permalink / raw)
  To: Yuwen Chen; +Cc: linux-erofs, linux-kernel

On Sat, 25 Jun 2022 22:50:00 +0800
Yuwen Chen <chenyuwen1@meizu.com> wrote:

> When the user mounts the erofs second times, the decompression thread
> may hung. The problem happens due to a sequence of steps like the
> following:
> 
> 1) Task A called z_erofs_load_lzma_config which obtain all of the node
>    from the z_erofs_lzma_head.
> 
> 2) At this time, task B called the z_erofs_lzma_decompress and wanted to
>    get a node. But the z_erofs_lzma_head was empty, the Task B had to
>    sleep.
> 
> 3) Task A release nodes and push nodes into the z_erofs_lzma_head. But
>    task B was still sleeping.
> 
> One example report when the hung happens:
> task:kworker/u3:1 state:D stack:14384 pid: 86 ppid: 2 flags:0x00004000
> Workqueue: erofs_unzipd z_erofs_decompressqueue_work
> Call Trace:
>  <TASK>
>  __schedule+0x281/0x760
>  schedule+0x49/0xb0
>  z_erofs_lzma_decompress+0x4bc/0x580
>  ? cpu_core_flags+0x10/0x10
>  z_erofs_decompress_pcluster+0x49b/0xba0
>  ? __update_load_avg_se+0x2b0/0x330
>  ? __update_load_avg_se+0x2b0/0x330
>  ? update_load_avg+0x5f/0x690
>  ? update_load_avg+0x5f/0x690
>  ? set_next_entity+0xbd/0x110
>  ? _raw_spin_unlock+0xd/0x20
>  z_erofs_decompress_queue.isra.0+0x2e/0x50
>  z_erofs_decompressqueue_work+0x30/0x60
>  process_one_work+0x1d3/0x3a0
>  worker_thread+0x45/0x3a0
>  ? process_one_work+0x3a0/0x3a0
>  kthread+0xe2/0x110
>  ? kthread_complete_and_exit+0x20/0x20
>  ret_from_fork+0x22/0x30
>  </TASK>
> 
> Signed-off-by: Yuwen Chen <chenyuwen1@meizu.com>
> ---
>  fs/erofs/decompressor_lzma.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/erofs/decompressor_lzma.c b/fs/erofs/decompressor_lzma.c
> index 05a3063cf2bc..5e59b3f523eb 100644
> --- a/fs/erofs/decompressor_lzma.c
> +++ b/fs/erofs/decompressor_lzma.c
> @@ -143,6 +143,7 @@ int z_erofs_load_lzma_config(struct super_block *sb,
>  	DBG_BUGON(z_erofs_lzma_head);
>  	z_erofs_lzma_head = head;
>  	spin_unlock(&z_erofs_lzma_lock);
> +	wake_up_all(&z_erofs_lzma_wq);
>  
>  	z_erofs_lzma_max_dictsize = dict_size;
>  	mutex_unlock(&lzma_resize_mutex);

Please do not end the summary line(title) with a period.

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

* Re: [PATCH] erofs: Wake up all waiters after z_erofs_lzma_head ready.
  2022-06-27  5:57   ` Yue Hu
@ 2022-06-27  6:15     ` Gao Xiang
  -1 siblings, 0 replies; 18+ messages in thread
From: Gao Xiang @ 2022-06-27  6:15 UTC (permalink / raw)
  To: Yue Hu, Yuwen Chen; +Cc: xiang, linux-erofs, linux-kernel

On Mon, Jun 27, 2022 at 01:57:54PM +0800, Yue Hu wrote:
> On Sat, 25 Jun 2022 22:50:00 +0800
> Yuwen Chen <chenyuwen1@meizu.com> wrote:
> 

...

> > 
> > Signed-off-by: Yuwen Chen <chenyuwen1@meizu.com>
> > ---
> >  fs/erofs/decompressor_lzma.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/fs/erofs/decompressor_lzma.c b/fs/erofs/decompressor_lzma.c
> > index 05a3063cf2bc..5e59b3f523eb 100644
> > --- a/fs/erofs/decompressor_lzma.c
> > +++ b/fs/erofs/decompressor_lzma.c
> > @@ -143,6 +143,7 @@ int z_erofs_load_lzma_config(struct super_block *sb,
> >  	DBG_BUGON(z_erofs_lzma_head);
> >  	z_erofs_lzma_head = head;
> >  	spin_unlock(&z_erofs_lzma_lock);
> > +	wake_up_all(&z_erofs_lzma_wq);
> >  
> >  	z_erofs_lzma_max_dictsize = dict_size;
> >  	mutex_unlock(&lzma_resize_mutex);
> 
> Please do not end the summary line(title) with a period.

Okay, that is a good point, also it'd be better to de-capitalize the 'W'
in "Wake" since they are common practices for kernel patches.

If it's convenient to you to send another version, please go with my
r-v-b tag.

Thanks,
Gao Xiang

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

* Re: [PATCH] erofs: Wake up all waiters after z_erofs_lzma_head ready.
@ 2022-06-27  6:15     ` Gao Xiang
  0 siblings, 0 replies; 18+ messages in thread
From: Gao Xiang @ 2022-06-27  6:15 UTC (permalink / raw)
  To: Yue Hu, Yuwen Chen; +Cc: linux-erofs, linux-kernel

On Mon, Jun 27, 2022 at 01:57:54PM +0800, Yue Hu wrote:
> On Sat, 25 Jun 2022 22:50:00 +0800
> Yuwen Chen <chenyuwen1@meizu.com> wrote:
> 

...

> > 
> > Signed-off-by: Yuwen Chen <chenyuwen1@meizu.com>
> > ---
> >  fs/erofs/decompressor_lzma.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/fs/erofs/decompressor_lzma.c b/fs/erofs/decompressor_lzma.c
> > index 05a3063cf2bc..5e59b3f523eb 100644
> > --- a/fs/erofs/decompressor_lzma.c
> > +++ b/fs/erofs/decompressor_lzma.c
> > @@ -143,6 +143,7 @@ int z_erofs_load_lzma_config(struct super_block *sb,
> >  	DBG_BUGON(z_erofs_lzma_head);
> >  	z_erofs_lzma_head = head;
> >  	spin_unlock(&z_erofs_lzma_lock);
> > +	wake_up_all(&z_erofs_lzma_wq);
> >  
> >  	z_erofs_lzma_max_dictsize = dict_size;
> >  	mutex_unlock(&lzma_resize_mutex);
> 
> Please do not end the summary line(title) with a period.

Okay, that is a good point, also it'd be better to de-capitalize the 'W'
in "Wake" since they are common practices for kernel patches.

If it's convenient to you to send another version, please go with my
r-v-b tag.

Thanks,
Gao Xiang

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

* Re: [PATCH] erofs: wake up all waiters after z_erofs_lzma_head ready
  2022-06-26 22:40       ` Yuwen Chen
@ 2022-06-27  7:11         ` Yuwen Chen
  -1 siblings, 0 replies; 18+ messages in thread
From: Yuwen Chen @ 2022-06-27  7:11 UTC (permalink / raw)
  To: hsiangkao; +Cc: linux-erofs, linux-kernel, xiang, zbestahu

The new patch has been upload. The modification points are as follower:

1. delete the period.

2. change 'W' to lowercase.

3. add a Reviewed-by tag.

On 6/27/22 06:40, Yuwen Chen wrote:
> When the user mounts the erofs second times, the decompression thread
> may hung. The problem happens due to a sequence of steps like the
> following:
>
> 1) Task A called z_erofs_load_lzma_config which obtain all of the node
>     from the z_erofs_lzma_head.
>
> 2) At this time, task B called the z_erofs_lzma_decompress and wanted to
>     get a node. But the z_erofs_lzma_head was empty, the Task B had to
>     sleep.
>
> 3) Task A release nodes and push nodes into the z_erofs_lzma_head. But
>     task B was still sleeping.
>
> One example report when the hung happens:
> task:kworker/u3:1 state:D stack:14384 pid: 86 ppid: 2 flags:0x00004000
> Workqueue: erofs_unzipd z_erofs_decompressqueue_work
> Call Trace:
>   <TASK>
>   __schedule+0x281/0x760
>   schedule+0x49/0xb0
>   z_erofs_lzma_decompress+0x4bc/0x580
>   ? cpu_core_flags+0x10/0x10
>   z_erofs_decompress_pcluster+0x49b/0xba0
>   ? __update_load_avg_se+0x2b0/0x330
>   ? __update_load_avg_se+0x2b0/0x330
>   ? update_load_avg+0x5f/0x690
>   ? update_load_avg+0x5f/0x690
>   ? set_next_entity+0xbd/0x110
>   ? _raw_spin_unlock+0xd/0x20
>   z_erofs_decompress_queue.isra.0+0x2e/0x50
>   z_erofs_decompressqueue_work+0x30/0x60
>   process_one_work+0x1d3/0x3a0
>   worker_thread+0x45/0x3a0
>   ? process_one_work+0x3a0/0x3a0
>   kthread+0xe2/0x110
>   ? kthread_complete_and_exit+0x20/0x20
>   ret_from_fork+0x22/0x30
>   </TASK>
>
> Signed-off-by: Yuwen Chen <chenyuwen1@meizu.com>
> Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
> ---
>   fs/erofs/decompressor_lzma.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/fs/erofs/decompressor_lzma.c b/fs/erofs/decompressor_lzma.c
> index 05a3063cf2bc..5e59b3f523eb 100644
> --- a/fs/erofs/decompressor_lzma.c
> +++ b/fs/erofs/decompressor_lzma.c
> @@ -143,6 +143,7 @@ int z_erofs_load_lzma_config(struct super_block *sb,
>   	DBG_BUGON(z_erofs_lzma_head);
>   	z_erofs_lzma_head = head;
>   	spin_unlock(&z_erofs_lzma_lock);
> +	wake_up_all(&z_erofs_lzma_wq);
>   
>   	z_erofs_lzma_max_dictsize = dict_size;
>   	mutex_unlock(&lzma_resize_mutex);

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

* Re: [PATCH] erofs: wake up all waiters after z_erofs_lzma_head ready
@ 2022-06-27  7:11         ` Yuwen Chen
  0 siblings, 0 replies; 18+ messages in thread
From: Yuwen Chen @ 2022-06-27  7:11 UTC (permalink / raw)
  To: hsiangkao; +Cc: linux-erofs, linux-kernel

The new patch has been upload. The modification points are as follower:

1. delete the period.

2. change 'W' to lowercase.

3. add a Reviewed-by tag.

On 6/27/22 06:40, Yuwen Chen wrote:
> When the user mounts the erofs second times, the decompression thread
> may hung. The problem happens due to a sequence of steps like the
> following:
>
> 1) Task A called z_erofs_load_lzma_config which obtain all of the node
>     from the z_erofs_lzma_head.
>
> 2) At this time, task B called the z_erofs_lzma_decompress and wanted to
>     get a node. But the z_erofs_lzma_head was empty, the Task B had to
>     sleep.
>
> 3) Task A release nodes and push nodes into the z_erofs_lzma_head. But
>     task B was still sleeping.
>
> One example report when the hung happens:
> task:kworker/u3:1 state:D stack:14384 pid: 86 ppid: 2 flags:0x00004000
> Workqueue: erofs_unzipd z_erofs_decompressqueue_work
> Call Trace:
>   <TASK>
>   __schedule+0x281/0x760
>   schedule+0x49/0xb0
>   z_erofs_lzma_decompress+0x4bc/0x580
>   ? cpu_core_flags+0x10/0x10
>   z_erofs_decompress_pcluster+0x49b/0xba0
>   ? __update_load_avg_se+0x2b0/0x330
>   ? __update_load_avg_se+0x2b0/0x330
>   ? update_load_avg+0x5f/0x690
>   ? update_load_avg+0x5f/0x690
>   ? set_next_entity+0xbd/0x110
>   ? _raw_spin_unlock+0xd/0x20
>   z_erofs_decompress_queue.isra.0+0x2e/0x50
>   z_erofs_decompressqueue_work+0x30/0x60
>   process_one_work+0x1d3/0x3a0
>   worker_thread+0x45/0x3a0
>   ? process_one_work+0x3a0/0x3a0
>   kthread+0xe2/0x110
>   ? kthread_complete_and_exit+0x20/0x20
>   ret_from_fork+0x22/0x30
>   </TASK>
>
> Signed-off-by: Yuwen Chen <chenyuwen1@meizu.com>
> Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
> ---
>   fs/erofs/decompressor_lzma.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/fs/erofs/decompressor_lzma.c b/fs/erofs/decompressor_lzma.c
> index 05a3063cf2bc..5e59b3f523eb 100644
> --- a/fs/erofs/decompressor_lzma.c
> +++ b/fs/erofs/decompressor_lzma.c
> @@ -143,6 +143,7 @@ int z_erofs_load_lzma_config(struct super_block *sb,
>   	DBG_BUGON(z_erofs_lzma_head);
>   	z_erofs_lzma_head = head;
>   	spin_unlock(&z_erofs_lzma_lock);
> +	wake_up_all(&z_erofs_lzma_wq);
>   
>   	z_erofs_lzma_max_dictsize = dict_size;
>   	mutex_unlock(&lzma_resize_mutex);

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

* [PATCH] erofs: Wake up all waiters after z_erofs_lzma_head ready.
@ 2022-06-25 13:18 ` Even
  0 siblings, 0 replies; 18+ messages in thread
From: Even @ 2022-06-25 13:18 UTC (permalink / raw)
  To: xiang; +Cc: chao, linux-erofs, linux-kernel, Even

When the user mounts the erofs second times, the decompression thread
may hung. The problem happens due to a sequence of steps like the
following:

1) Task A called z_erofs_load_lzma_config which obtain all of the node
   from the z_erofs_lzma_head.

2) At this time, task B called the z_erofs_lzma_decompress and wanted to
   get a node. But the z_erofs_lzma_head was empty, the Task B had to
   sleep.

3) Task A release nodes and push nodes into the z_erofs_lzma_head. But
   task B was still sleeping.

One example report when the hung happens:
task:kworker/u3:1 state:D stack:14384 pid: 86 ppid: 2 flags:0x00004000
Workqueue: erofs_unzipd z_erofs_decompressqueue_work
Call Trace:
 <TASK>
 __schedule+0x281/0x760
 schedule+0x49/0xb0
 z_erofs_lzma_decompress+0x4bc/0x580
 ? cpu_core_flags+0x10/0x10
 z_erofs_decompress_pcluster+0x49b/0xba0
 ? __update_load_avg_se+0x2b0/0x330
 ? __update_load_avg_se+0x2b0/0x330
 ? update_load_avg+0x5f/0x690
 ? update_load_avg+0x5f/0x690
 ? set_next_entity+0xbd/0x110
 ? _raw_spin_unlock+0xd/0x20
 z_erofs_decompress_queue.isra.0+0x2e/0x50
 z_erofs_decompressqueue_work+0x30/0x60
 process_one_work+0x1d3/0x3a0
 worker_thread+0x45/0x3a0
 ? process_one_work+0x3a0/0x3a0
 kthread+0xe2/0x110
 ? kthread_complete_and_exit+0x20/0x20
 ret_from_fork+0x22/0x30
 </TASK>

Signed-off-by: Even <chenyuwen1@meizu.com>
---
 fs/erofs/decompressor_lzma.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/erofs/decompressor_lzma.c b/fs/erofs/decompressor_lzma.c
index 05a3063cf2bc..5e59b3f523eb 100644
--- a/fs/erofs/decompressor_lzma.c
+++ b/fs/erofs/decompressor_lzma.c
@@ -143,6 +143,7 @@ int z_erofs_load_lzma_config(struct super_block *sb,
 	DBG_BUGON(z_erofs_lzma_head);
 	z_erofs_lzma_head = head;
 	spin_unlock(&z_erofs_lzma_lock);
+	wake_up_all(&z_erofs_lzma_wq);
 
 	z_erofs_lzma_max_dictsize = dict_size;
 	mutex_unlock(&lzma_resize_mutex);
-- 
2.25.1


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

* [PATCH] erofs: Wake up all waiters after z_erofs_lzma_head ready.
@ 2022-06-25 13:18 ` Even
  0 siblings, 0 replies; 18+ messages in thread
From: Even @ 2022-06-25 13:18 UTC (permalink / raw)
  To: xiang; +Cc: Even, linux-erofs, linux-kernel

When the user mounts the erofs second times, the decompression thread
may hung. The problem happens due to a sequence of steps like the
following:

1) Task A called z_erofs_load_lzma_config which obtain all of the node
   from the z_erofs_lzma_head.

2) At this time, task B called the z_erofs_lzma_decompress and wanted to
   get a node. But the z_erofs_lzma_head was empty, the Task B had to
   sleep.

3) Task A release nodes and push nodes into the z_erofs_lzma_head. But
   task B was still sleeping.

One example report when the hung happens:
task:kworker/u3:1 state:D stack:14384 pid: 86 ppid: 2 flags:0x00004000
Workqueue: erofs_unzipd z_erofs_decompressqueue_work
Call Trace:
 <TASK>
 __schedule+0x281/0x760
 schedule+0x49/0xb0
 z_erofs_lzma_decompress+0x4bc/0x580
 ? cpu_core_flags+0x10/0x10
 z_erofs_decompress_pcluster+0x49b/0xba0
 ? __update_load_avg_se+0x2b0/0x330
 ? __update_load_avg_se+0x2b0/0x330
 ? update_load_avg+0x5f/0x690
 ? update_load_avg+0x5f/0x690
 ? set_next_entity+0xbd/0x110
 ? _raw_spin_unlock+0xd/0x20
 z_erofs_decompress_queue.isra.0+0x2e/0x50
 z_erofs_decompressqueue_work+0x30/0x60
 process_one_work+0x1d3/0x3a0
 worker_thread+0x45/0x3a0
 ? process_one_work+0x3a0/0x3a0
 kthread+0xe2/0x110
 ? kthread_complete_and_exit+0x20/0x20
 ret_from_fork+0x22/0x30
 </TASK>

Signed-off-by: Even <chenyuwen1@meizu.com>
---
 fs/erofs/decompressor_lzma.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/erofs/decompressor_lzma.c b/fs/erofs/decompressor_lzma.c
index 05a3063cf2bc..5e59b3f523eb 100644
--- a/fs/erofs/decompressor_lzma.c
+++ b/fs/erofs/decompressor_lzma.c
@@ -143,6 +143,7 @@ int z_erofs_load_lzma_config(struct super_block *sb,
 	DBG_BUGON(z_erofs_lzma_head);
 	z_erofs_lzma_head = head;
 	spin_unlock(&z_erofs_lzma_lock);
+	wake_up_all(&z_erofs_lzma_wq);
 
 	z_erofs_lzma_max_dictsize = dict_size;
 	mutex_unlock(&lzma_resize_mutex);
-- 
2.25.1


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

* Re: [PATCH] erofs: Wake up all waiters after z_erofs_lzma_head ready.
  2022-06-25  8:57 ` Even
@ 2022-06-25  9:44   ` Gao Xiang
  -1 siblings, 0 replies; 18+ messages in thread
From: Gao Xiang @ 2022-06-25  9:44 UTC (permalink / raw)
  To: Even; +Cc: xiang, chao, linux-erofs, linux-kernel, Even

Hi,

On Sat, Jun 25, 2022 at 04:57:38PM +0800, Even wrote:
> From: Even <chenyuwen1@meizu.com>
> 
> When the user mounts the erofs second times, the decompression thread
> may hung. The problem happens due to a sequence of steps like the
> following:
> 
> 1) Task A called z_erofs_load_lzma_config which obtain all of the node
>    from the z_erofs_lzma_head.
> 
> 2) At this time, task B called the z_erofs_lzma_decompress and wanted to
>    get a node. But the z_erofs_lzma_head was empty, the Task B had to
>    sleep.
> 
> 3) Task A release nodes and push nodes into the z_erofs_lzma_head. But
>    task B was still sleeping.
> 
> One example report when the hung happens:
> task:kworker/u3:1 state:D stack:14384 pid: 86 ppid: 2 flags:0x00004000
> Workqueue: erofs_unzipd z_erofs_decompressqueue_work
> Call Trace:
>  <TASK>
>  __schedule+0x281/0x760
>  schedule+0x49/0xb0
>  z_erofs_lzma_decompress+0x4bc/0x580
>  ? cpu_core_flags+0x10/0x10
>  z_erofs_decompress_pcluster+0x49b/0xba0
>  ? __update_load_avg_se+0x2b0/0x330
>  ? __update_load_avg_se+0x2b0/0x330
>  ? update_load_avg+0x5f/0x690
>  ? update_load_avg+0x5f/0x690
>  ? set_next_entity+0xbd/0x110
>  ? _raw_spin_unlock+0xd/0x20
>  z_erofs_decompress_queue.isra.0+0x2e/0x50
>  z_erofs_decompressqueue_work+0x30/0x60
>  process_one_work+0x1d3/0x3a0
>  worker_thread+0x45/0x3a0
>  ? process_one_work+0x3a0/0x3a0
>  kthread+0xe2/0x110
>  ? kthread_complete_and_exit+0x20/0x20
>  ret_from_fork+0x22/0x30
>  </TASK>
> 
> Signed-off-by: Even <chenyuwen1@meizu.com>

Thanks a lot for catching this!

The patch itself looks good, but could you use your real name to sign
off the patch and resend a version? see,
https://www.kernel.org/doc/html/v4.17/process/submitting-patches.html#developer-s-certificate-of-origin-1-1

Otherwise it looks good to me,
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>

Thanks,
Gao Xiang

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

* Re: [PATCH] erofs: Wake up all waiters after z_erofs_lzma_head ready.
@ 2022-06-25  9:44   ` Gao Xiang
  0 siblings, 0 replies; 18+ messages in thread
From: Gao Xiang @ 2022-06-25  9:44 UTC (permalink / raw)
  To: Even; +Cc: Even, linux-erofs, linux-kernel

Hi,

On Sat, Jun 25, 2022 at 04:57:38PM +0800, Even wrote:
> From: Even <chenyuwen1@meizu.com>
> 
> When the user mounts the erofs second times, the decompression thread
> may hung. The problem happens due to a sequence of steps like the
> following:
> 
> 1) Task A called z_erofs_load_lzma_config which obtain all of the node
>    from the z_erofs_lzma_head.
> 
> 2) At this time, task B called the z_erofs_lzma_decompress and wanted to
>    get a node. But the z_erofs_lzma_head was empty, the Task B had to
>    sleep.
> 
> 3) Task A release nodes and push nodes into the z_erofs_lzma_head. But
>    task B was still sleeping.
> 
> One example report when the hung happens:
> task:kworker/u3:1 state:D stack:14384 pid: 86 ppid: 2 flags:0x00004000
> Workqueue: erofs_unzipd z_erofs_decompressqueue_work
> Call Trace:
>  <TASK>
>  __schedule+0x281/0x760
>  schedule+0x49/0xb0
>  z_erofs_lzma_decompress+0x4bc/0x580
>  ? cpu_core_flags+0x10/0x10
>  z_erofs_decompress_pcluster+0x49b/0xba0
>  ? __update_load_avg_se+0x2b0/0x330
>  ? __update_load_avg_se+0x2b0/0x330
>  ? update_load_avg+0x5f/0x690
>  ? update_load_avg+0x5f/0x690
>  ? set_next_entity+0xbd/0x110
>  ? _raw_spin_unlock+0xd/0x20
>  z_erofs_decompress_queue.isra.0+0x2e/0x50
>  z_erofs_decompressqueue_work+0x30/0x60
>  process_one_work+0x1d3/0x3a0
>  worker_thread+0x45/0x3a0
>  ? process_one_work+0x3a0/0x3a0
>  kthread+0xe2/0x110
>  ? kthread_complete_and_exit+0x20/0x20
>  ret_from_fork+0x22/0x30
>  </TASK>
> 
> Signed-off-by: Even <chenyuwen1@meizu.com>

Thanks a lot for catching this!

The patch itself looks good, but could you use your real name to sign
off the patch and resend a version? see,
https://www.kernel.org/doc/html/v4.17/process/submitting-patches.html#developer-s-certificate-of-origin-1-1

Otherwise it looks good to me,
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>

Thanks,
Gao Xiang

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

* [PATCH] erofs: Wake up all waiters after z_erofs_lzma_head ready.
@ 2022-06-25  8:57 ` Even
  0 siblings, 0 replies; 18+ messages in thread
From: Even @ 2022-06-25  8:57 UTC (permalink / raw)
  To: xiang; +Cc: chao, linux-erofs, linux-kernel, Even

From: Even <chenyuwen1@meizu.com>

When the user mounts the erofs second times, the decompression thread
may hung. The problem happens due to a sequence of steps like the
following:

1) Task A called z_erofs_load_lzma_config which obtain all of the node
   from the z_erofs_lzma_head.

2) At this time, task B called the z_erofs_lzma_decompress and wanted to
   get a node. But the z_erofs_lzma_head was empty, the Task B had to
   sleep.

3) Task A release nodes and push nodes into the z_erofs_lzma_head. But
   task B was still sleeping.

One example report when the hung happens:
task:kworker/u3:1 state:D stack:14384 pid: 86 ppid: 2 flags:0x00004000
Workqueue: erofs_unzipd z_erofs_decompressqueue_work
Call Trace:
 <TASK>
 __schedule+0x281/0x760
 schedule+0x49/0xb0
 z_erofs_lzma_decompress+0x4bc/0x580
 ? cpu_core_flags+0x10/0x10
 z_erofs_decompress_pcluster+0x49b/0xba0
 ? __update_load_avg_se+0x2b0/0x330
 ? __update_load_avg_se+0x2b0/0x330
 ? update_load_avg+0x5f/0x690
 ? update_load_avg+0x5f/0x690
 ? set_next_entity+0xbd/0x110
 ? _raw_spin_unlock+0xd/0x20
 z_erofs_decompress_queue.isra.0+0x2e/0x50
 z_erofs_decompressqueue_work+0x30/0x60
 process_one_work+0x1d3/0x3a0
 worker_thread+0x45/0x3a0
 ? process_one_work+0x3a0/0x3a0
 kthread+0xe2/0x110
 ? kthread_complete_and_exit+0x20/0x20
 ret_from_fork+0x22/0x30
 </TASK>

Signed-off-by: Even <chenyuwen1@meizu.com>
---
 fs/erofs/decompressor_lzma.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/erofs/decompressor_lzma.c b/fs/erofs/decompressor_lzma.c
index 05a3063cf2bc..5e59b3f523eb 100644
--- a/fs/erofs/decompressor_lzma.c
+++ b/fs/erofs/decompressor_lzma.c
@@ -143,6 +143,7 @@ int z_erofs_load_lzma_config(struct super_block *sb,
 	DBG_BUGON(z_erofs_lzma_head);
 	z_erofs_lzma_head = head;
 	spin_unlock(&z_erofs_lzma_lock);
+	wake_up_all(&z_erofs_lzma_wq);
 
 	z_erofs_lzma_max_dictsize = dict_size;
 	mutex_unlock(&lzma_resize_mutex);
-- 
2.25.1


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

* [PATCH] erofs: Wake up all waiters after z_erofs_lzma_head ready.
@ 2022-06-25  8:57 ` Even
  0 siblings, 0 replies; 18+ messages in thread
From: Even @ 2022-06-25  8:57 UTC (permalink / raw)
  To: xiang; +Cc: Even, linux-erofs, linux-kernel

From: Even <chenyuwen1@meizu.com>

When the user mounts the erofs second times, the decompression thread
may hung. The problem happens due to a sequence of steps like the
following:

1) Task A called z_erofs_load_lzma_config which obtain all of the node
   from the z_erofs_lzma_head.

2) At this time, task B called the z_erofs_lzma_decompress and wanted to
   get a node. But the z_erofs_lzma_head was empty, the Task B had to
   sleep.

3) Task A release nodes and push nodes into the z_erofs_lzma_head. But
   task B was still sleeping.

One example report when the hung happens:
task:kworker/u3:1 state:D stack:14384 pid: 86 ppid: 2 flags:0x00004000
Workqueue: erofs_unzipd z_erofs_decompressqueue_work
Call Trace:
 <TASK>
 __schedule+0x281/0x760
 schedule+0x49/0xb0
 z_erofs_lzma_decompress+0x4bc/0x580
 ? cpu_core_flags+0x10/0x10
 z_erofs_decompress_pcluster+0x49b/0xba0
 ? __update_load_avg_se+0x2b0/0x330
 ? __update_load_avg_se+0x2b0/0x330
 ? update_load_avg+0x5f/0x690
 ? update_load_avg+0x5f/0x690
 ? set_next_entity+0xbd/0x110
 ? _raw_spin_unlock+0xd/0x20
 z_erofs_decompress_queue.isra.0+0x2e/0x50
 z_erofs_decompressqueue_work+0x30/0x60
 process_one_work+0x1d3/0x3a0
 worker_thread+0x45/0x3a0
 ? process_one_work+0x3a0/0x3a0
 kthread+0xe2/0x110
 ? kthread_complete_and_exit+0x20/0x20
 ret_from_fork+0x22/0x30
 </TASK>

Signed-off-by: Even <chenyuwen1@meizu.com>
---
 fs/erofs/decompressor_lzma.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/erofs/decompressor_lzma.c b/fs/erofs/decompressor_lzma.c
index 05a3063cf2bc..5e59b3f523eb 100644
--- a/fs/erofs/decompressor_lzma.c
+++ b/fs/erofs/decompressor_lzma.c
@@ -143,6 +143,7 @@ int z_erofs_load_lzma_config(struct super_block *sb,
 	DBG_BUGON(z_erofs_lzma_head);
 	z_erofs_lzma_head = head;
 	spin_unlock(&z_erofs_lzma_lock);
+	wake_up_all(&z_erofs_lzma_wq);
 
 	z_erofs_lzma_max_dictsize = dict_size;
 	mutex_unlock(&lzma_resize_mutex);
-- 
2.25.1


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

end of thread, other threads:[~2022-06-27  7:12 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-25 14:50 [PATCH] erofs: Wake up all waiters after z_erofs_lzma_head ready Yuwen Chen
2022-06-25 14:50 ` Yuwen Chen
2022-06-27  2:56 ` Gao Xiang
2022-06-27  2:56   ` Gao Xiang
2022-06-27  5:57 ` Yue Hu
2022-06-27  5:57   ` Yue Hu
2022-06-27  6:15   ` Gao Xiang
2022-06-27  6:15     ` Gao Xiang
2022-06-26 22:40     ` [PATCH] erofs: wake " Yuwen Chen
2022-06-26 22:40       ` Yuwen Chen
2022-06-27  7:11       ` Yuwen Chen
2022-06-27  7:11         ` Yuwen Chen
  -- strict thread matches above, loose matches on Subject: below --
2022-06-25 13:18 [PATCH] erofs: Wake " Even
2022-06-25 13:18 ` Even
2022-06-25  8:57 Even
2022-06-25  8:57 ` Even
2022-06-25  9:44 ` Gao Xiang
2022-06-25  9:44   ` Gao Xiang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.