All of lore.kernel.org
 help / color / mirror / Atom feed
From: "heming.zhao--- via Ocfs2-devel" <ocfs2-devel@oss.oracle.com>
To: ocfs2-devel@oss.oracle.com, joseph.qi@linux.alibaba.com
Subject: Re: [Ocfs2-devel] [PATCH 4/4] ocfs2: introduce ext4 MMP feature
Date: Sun, 31 Jul 2022 17:13:56 +0800	[thread overview]
Message-ID: <55dbb308-873c-6433-c1f2-8ca176a17be2@suse.com> (raw)
In-Reply-To: <20220730011411.11214-5-heming.zhao@suse.com>

On 7/30/22 09:14, Heming Zhao wrote:
> MMP (multiple mount protection) gives filesystem ability to prevent
> from being mounted multiple times.
> 
> For avoiding data corruption when non-clustered and/or clustered mount
> are happening at same time, this commit introduced MMP feature. MMP
> idea is from ext4 MMP (fs/ext4/mmp.c) code. For ocfs2 is a clustered
> fs and also for compatible with existing slotmap feature, I did some
> optimization and modification when porting from ext4 to ocfs2.
> 
> For optimization:
> mmp has a kthread kmmpd-<dev>, which is only created in non-clustered
> mode.
> 
> We set a rule:
> If last mount didn't do unmount, (eg: crash), the next mount MUST be
> same mount type.
> 
> At last, this commit also fix commit c80af0c250c8 ("Revert "ocfs2:
> mount shared volume without ha stack") mentioned issue.
> 
> Signed-off-by: Heming Zhao <heming.zhao@suse.com>
> ---
>   fs/ocfs2/ocfs2.h    |   2 +
>   fs/ocfs2/ocfs2_fs.h |  13 +-
>   fs/ocfs2/slot_map.c | 459 ++++++++++++++++++++++++++++++++++++++++++--
>   fs/ocfs2/slot_map.h |   3 +
>   fs/ocfs2/super.c    |  23 ++-
>   5 files changed, 479 insertions(+), 21 deletions(-)
> ... ...
>   /*C0*/  __le64 s_reserved2[15];		/* Fill out superblock */
> diff --git a/fs/ocfs2/slot_map.c b/fs/ocfs2/slot_map.c
> index 0b0ae3ebb0cf..86a21140ead6 100644
> --- a/fs/ocfs2/slot_map.c
> +++ b/fs/ocfs2/slot_map.c
> ... ...
> +void ocfs2_stop_mmpd(struct ocfs2_super *osb)
> +{
> +	if (osb->mmp_task) {
> +		kthread_stop(osb->mmp_task);
> +		osb->mmp_task = NULL;
> +	}
> +}
> +
> +/*
> + * Protect the filesystem from being mounted more than once.
> + *
> + * This function was inspired by ext4 MMP feature. Because HA stack
> + * helps ocfs2 to manage nodes join/leave, so we only focus on MMP
> + * under nocluster mode.
> + * Another info is ocfs2 only uses slot 0 on nocuster mode.
> + *
> + * es_valid:
> + *  0: not available
> + *  1: valid, cluster mode
> + *  2: valid, nocluster mod> + *
> + * parameters:
> + *  osb: the struct ocfs2_super
> + *  noclustered: under noclustered mount
> + *  slot: prefer slot number

Sorry, above es_valid & parameters comments are outdated. I will remove them on next version.

> + */
> +int ocfs2_multi_mount_protect(struct ocfs2_super *osb, int noclustered)


I forgot to run checkpatch.pl for all 4 patches. And checkpatch.pl reported many
format warning. I prefer these patches as draft version, let's discuss the mmp+noncluster
idea is workable/acceptable. If no one reject these code, I will file v1.

(For test cases, I put them in cover letter.)

Thanks,
Heming

_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel@oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel

  reply	other threads:[~2022-07-31  9:14 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-30  1:14 [Ocfs2-devel] [PATCH 0/4] re-enable non-clustered mount & add MMP support Heming Zhao via Ocfs2-devel
2022-07-30  1:14 ` [Ocfs2-devel] [PATCH 1/4] ocfs2: Fix freeing uninitialized resource on ocfs2_dlm_shutdown Heming Zhao via Ocfs2-devel
2022-08-08  6:51   ` Joseph Qi via Ocfs2-devel
2022-08-08 12:09     ` Heming Zhao via Ocfs2-devel
2022-08-10  1:31       ` Joseph Qi via Ocfs2-devel
2022-08-10 23:52         ` heming.zhao--- via Ocfs2-devel
2022-07-30  1:14 ` [Ocfs2-devel] [PATCH 2/4] ocfs2: add mlog ML_WARNING support Heming Zhao via Ocfs2-devel
2022-07-30  1:14 ` [Ocfs2-devel] [PATCH 3/4] re-enable "ocfs2: mount shared volume without ha stack" Heming Zhao via Ocfs2-devel
2022-07-31 17:42   ` Mark Fasheh via Ocfs2-devel
2022-08-01  1:01     ` heming.zhao--- via Ocfs2-devel
2022-08-01  2:25       ` heming.zhao--- via Ocfs2-devel
2022-08-04 23:53       ` Mark Fasheh via Ocfs2-devel
2022-08-05  4:11         ` Mark Fasheh via Ocfs2-devel
2022-08-06 15:53           ` heming.zhao--- via Ocfs2-devel
2022-08-06 16:20           ` Heming Zhao via Ocfs2-devel
2022-08-06 15:44         ` heming.zhao--- via Ocfs2-devel
2022-08-06 16:15         ` Heming Zhao via Ocfs2-devel
2022-07-30  1:14 ` [Ocfs2-devel] [PATCH 4/4] ocfs2: introduce ext4 MMP feature Heming Zhao via Ocfs2-devel
2022-07-31  9:13   ` heming.zhao--- via Ocfs2-devel [this message]
2022-08-08  8:19   ` Joseph Qi via Ocfs2-devel
2022-08-08  9:07     ` Heming Zhao via Ocfs2-devel
2022-08-08  9:26       ` Heming Zhao via Ocfs2-devel
2022-08-08  9:29       ` Joseph Qi via Ocfs2-devel

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=55dbb308-873c-6433-c1f2-8ca176a17be2@suse.com \
    --to=ocfs2-devel@oss.oracle.com \
    --cc=heming.zhao@suse.com \
    --cc=joseph.qi@linux.alibaba.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.