ocfs2: properly clean task pointer before o2hb thread exits abnormally

Message ID 20221125031522.339-1-lihongweizz@inspur.com
State New
Headers
Series ocfs2: properly clean task pointer before o2hb thread exits abnormally |

Commit Message

lihongweizz Nov. 25, 2022, 3:15 a.m. UTC
  From: Rock Li <lihongweizz@inspur.com>

in case o2hb thread exits abnormally before stop o2cb service,
heartbeat_drop_group_item will try to stop a noexit thread cause
ret->hb_task was not clear properly.

Signed-off-by: Rock Li <lihongweizz@inspur.com>
---
 fs/ocfs2/cluster/heartbeat.c | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Joseph Qi Nov. 25, 2022, 9:28 a.m. UTC | #1
On 11/25/22 11:15 AM, lihongweizz wrote:
> From: Rock Li <lihongweizz@inspur.com>
> 
> in case o2hb thread exits abnormally before stop o2cb service,
> heartbeat_drop_group_item will try to stop a noexit thread cause
> ret->hb_task was not clear properly.
> 
Could you please describe the scenario in detail?

Thanks,
Joseph 

> Signed-off-by: Rock Li <lihongweizz@inspur.com>
> ---
>  fs/ocfs2/cluster/heartbeat.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
> index b13d344..9db448d 100644
> --- a/fs/ocfs2/cluster/heartbeat.c
> +++ b/fs/ocfs2/cluster/heartbeat.c
> @@ -1258,6 +1258,8 @@ static int o2hb_thread(void *data)
>  	/* Unpin node */
>  	o2nm_undepend_this_node();
>  
> +	reg->hr_task = NULL;
> +
>  	mlog(ML_HEARTBEAT|ML_KTHREAD, "o2hb thread exiting\n");
>  
>  	return 0;
  

Patch

diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index b13d344..9db448d 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -1258,6 +1258,8 @@  static int o2hb_thread(void *data)
 	/* Unpin node */
 	o2nm_undepend_this_node();
 
+	reg->hr_task = NULL;
+
 	mlog(ML_HEARTBEAT|ML_KTHREAD, "o2hb thread exiting\n");
 
 	return 0;