All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joseph Qi <joseph.qi@linux.alibaba.com>
To: Jan Kara <jack@suse.cz>, akpm <akpm@linux-foundation.org>
Cc: ocfs2-devel@lists.linux.dev, Heming Zhao <heming.zhao@suse.com>,
	Murad Masimov <m.masimov@mt-integration.ru>,
	Shichangkuo <shi.changkuo@h3c.com>
Subject: Re: [PATCH v2 1/3] ocfs2: Switch osb->disable_recovery to enum
Date: Thu, 24 Apr 2025 08:59:59 +0800	[thread overview]
Message-ID: <0b4d7927-e8cd-46c8-b751-ac6bc7fc82c2@linux.alibaba.com> (raw)
In-Reply-To: <20250422124138.26027-4-jack@suse.cz>



On 2025/4/22 20:41, Jan Kara wrote:
> We will need more recovery states than just pure enable / disable to fix
> deadlocks with quota recovery. Switch osb->disable_recovery to enum.
> 
> Reviewed-by: Heming Zhao <heming.zhao@suse.com>
> Tested-by: Heming Zhao <heming.zhao@suse.com>
> Signed-off-by: Jan Kara <jack@suse.cz>

Acked-by: Joseph Qi <joseph.qi@linux.alibaba.com>
> ---
>  fs/ocfs2/journal.c | 14 ++++++++------
>  fs/ocfs2/ocfs2.h   |  7 ++++++-
>  2 files changed, 14 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
> index f1b4b3e611cb..8986e813ab2c 100644
> --- a/fs/ocfs2/journal.c
> +++ b/fs/ocfs2/journal.c
> @@ -174,7 +174,7 @@ int ocfs2_recovery_init(struct ocfs2_super *osb)
>  	struct ocfs2_recovery_map *rm;
>  
>  	mutex_init(&osb->recovery_lock);
> -	osb->disable_recovery = 0;
> +	osb->recovery_state = OCFS2_REC_ENABLED;
>  	osb->recovery_thread_task = NULL;
>  	init_waitqueue_head(&osb->recovery_event);
>  
> @@ -206,7 +206,7 @@ void ocfs2_recovery_exit(struct ocfs2_super *osb)
>  	/* disable any new recovery threads and wait for any currently
>  	 * running ones to exit. Do this before setting the vol_state. */
>  	mutex_lock(&osb->recovery_lock);
> -	osb->disable_recovery = 1;
> +	osb->recovery_state = OCFS2_REC_DISABLED;
>  	mutex_unlock(&osb->recovery_lock);
>  	wait_event(osb->recovery_event, !ocfs2_recovery_thread_running(osb));
>  
> @@ -1582,14 +1582,16 @@ static int __ocfs2_recovery_thread(void *arg)
>  
>  void ocfs2_recovery_thread(struct ocfs2_super *osb, int node_num)
>  {
> +	int was_set = -1;
> +
>  	mutex_lock(&osb->recovery_lock);
> +	if (osb->recovery_state < OCFS2_REC_DISABLED)
> +		was_set = ocfs2_recovery_map_set(osb, node_num);
>  
>  	trace_ocfs2_recovery_thread(node_num, osb->node_num,
> -		osb->disable_recovery, osb->recovery_thread_task,
> -		osb->disable_recovery ?
> -		-1 : ocfs2_recovery_map_set(osb, node_num));
> +		osb->recovery_state, osb->recovery_thread_task, was_set);
>  
> -	if (osb->disable_recovery)
> +	if (osb->recovery_state == OCFS2_REC_DISABLED)
>  		goto out;
>  
>  	if (osb->recovery_thread_task)
> diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
> index 51c52768132d..e713361939f0 100644
> --- a/fs/ocfs2/ocfs2.h
> +++ b/fs/ocfs2/ocfs2.h
> @@ -308,6 +308,11 @@ enum ocfs2_journal_trigger_type {
>  void ocfs2_initialize_journal_triggers(struct super_block *sb,
>  				       struct ocfs2_triggers triggers[]);
>  
> +enum ocfs2_recovery_state {
> +	OCFS2_REC_ENABLED = 0,
> +	OCFS2_REC_DISABLED,
> +};
> +
>  struct ocfs2_journal;
>  struct ocfs2_slot_info;
>  struct ocfs2_recovery_map;
> @@ -370,7 +375,7 @@ struct ocfs2_super
>  	struct ocfs2_recovery_map *recovery_map;
>  	struct ocfs2_replay_map *replay_map;
>  	struct task_struct *recovery_thread_task;
> -	int disable_recovery;
> +	enum ocfs2_recovery_state recovery_state;
>  	wait_queue_head_t checkpoint_event;
>  	struct ocfs2_journal *journal;
>  	unsigned long osb_commit_interval;


  reply	other threads:[~2025-04-24  1:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-22 12:41 [PATCH v2 0/3] ocfs2: Fix deadlocks in quota recovery Jan Kara
2025-04-22 12:41 ` [PATCH v2 1/3] ocfs2: Switch osb->disable_recovery to enum Jan Kara
2025-04-24  0:59   ` Joseph Qi [this message]
2025-04-24 13:42     ` Jan Kara
2025-04-22 12:41 ` [PATCH v2 2/3] ocfs2: Implement handshaking with ocfs2 recovery thread Jan Kara
2025-04-22 14:45   ` Heming Zhao
2025-04-24  1:03     ` Joseph Qi
2025-04-22 12:41 ` [PATCH v2 3/3] ocfs2: Stop quota recovery before disabling quotas Jan Kara
2025-04-24  1:05   ` Joseph Qi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0b4d7927-e8cd-46c8-b751-ac6bc7fc82c2@linux.alibaba.com \
    --to=joseph.qi@linux.alibaba.com \
    --cc=akpm@linux-foundation.org \
    --cc=heming.zhao@suse.com \
    --cc=jack@suse.cz \
    --cc=m.masimov@mt-integration.ru \
    --cc=ocfs2-devel@lists.linux.dev \
    --cc=shi.changkuo@h3c.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.