ocfs2-devel.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: "heming.zhao--- via Ocfs2-devel" <ocfs2-devel@oss.oracle.com>
To: Joseph Qi <joseph.qi@linux.alibaba.com>,
	Junxiao Bi <junxiao.bi@oracle.com>
Cc: "ocfs2-devel@oss.oracle.com" <ocfs2-devel@oss.oracle.com>
Subject: Re: [Ocfs2-devel] [PATCH 1/1] ocfs2: fix ocfs2_find_slot repeats alloc same slot issue
Date: Wed, 15 Jun 2022 12:37:41 +0800	[thread overview]
Message-ID: <cd812972-f596-9635-64a2-3291a0f30605@suse.com> (raw)
In-Reply-To: <eab76c68-2dfa-bead-ece9-4baa6cb82ef6@linux.alibaba.com>

On 6/15/22 10:03, Joseph Qi wrote:
> 
> 
> On 6/14/22 8:13 PM, heming.zhao@suse.com wrote:
>> On 6/14/22 11:27, Joseph Qi wrote:
>>>
>>>
>>> On 6/14/22 10:59 AM, heming.zhao@suse.com wrote:
>>>> On 6/13/22 23:43, Junxiao Bi wrote:
>>>>>
>>>>>> 在 2022年6月13日,上午1:48,heming.zhao@suse.com 写道:
>>>>>>
>>>>>> On 6/13/22 16:21, Joseph Qi wrote:
>>>>>>>> On 6/13/22 3:59 PM, heming.zhao@suse.com wrote:
>>>>>>>> On 6/12/22 22:16, Joseph Qi wrote:
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> Why can't use local mount? I don't remember if we discuss about this.
>>>>>>>>>
>>>>>>>> Sorry, I can't follow your question.
>>>>>>>> Do you mean why revert commit 912f655d78c5?
>>>>>>>>
>>>>>>>> or you are interest with the feature local mount?
>>>>>>>> the local mount is created by mkfs.ocfs2, which can't be converted to clustered.
>>>>>>>> see mkfs.ocfs2(8) '-M' option.
>>>>>>>>
>>>>>>> What Junxiao's main concern is data corruption, so I'm afraid we have to
>>>>>>> introduce an ondisk feature bit to prevent mixed nocluster and cluster
>>>>>>> mount, similar to local mount.
>>>>>>
>>>>>> this patch defined two new variants/flags:
>>>>>> #define OCFS2_SLOTMAP_CLUSTER   1
>>>>>> #define OCFS2_SLOTMAP_NOCLUSTER 2
>>>>>>
>>>>>> (I expect) Under OCFS2_SLOTMAP_CLUSTER, for clustered mount mode and for compatibility,
>>>>>> anything doesn't need to be changed.
>>>>>>
>>>>>> OCFS2_SLOTMAP_NOCLUSTER will introduce a new value for slotmap area.
>>>>>> this new value only take effect after a successfully nocluster mount.
>>>>>> (pls fix me), existed kernel/user space code don't do any special handle for
>>>>>> noclustered mount mode in slotmap area. So the new value is also compatibility.
>>>>>>
>>>>>> And the patch can also prevent mixed mount, the related code is in ocfs2_find_slot().
>>>>>> code logic:
>>>>>> - noclustered mount condition: slotmap is empty or already mounted with noclustered
>>>>>> - clustered mount condition: slotmap is empty or already mounted with clustered.
>>>>>> - all other conditions will be denied.
>>>>> Finding slot required reading slot map and then  update slot map. It is not atomic , you can’t prevent mixed mount until you have a cluster lock.
>>>>
>>>> Could I say your mentioned use case is invalid.
>>>> I believe all (yes, *all*) the ocfs2 users use this fs under cluster mode in
>>>> their product env.
>>>> The nocluster mount is only used on maintained env (eg. backup, fsck).
>>>>
>>>> We only concern two ways:
>>>> 1. user forgets to unmount (eg crash) before using another mount mode.
>>>> 2. when ocfs2 volume is working, which should deny volume is mounted by another mode.
>>>>      this may happened user mistakenly runs command or script.
>>>>
>>>> Base on above 1 & 2, Junxiao above mentioned use case only happens on one scenario:
>>>> the volume doesn't be mounted by any node, then user mistakenly mounts volume
>>>> with [no]cluster mode at same time. I believe this use case is invalid. And I guess
>>>> gfs2 may also has the same issue.
>>>>
>>>> With this patch, ocfs2 has more sanity check ability than other fs, eg: xfs, ext4.
>>>> SUSE HA stack with corosync+pacemaker also supports running xfs/ext4 with A/P mode.
>>>> The xfs/ext4 never have detecting mount status code, Junxiao mentioned mixed mount
>>>> can also happens on these fs. How do xfs/ext4/HA maintainers handle it? Under these
>>>> fs mounting behavior, these fields maintainers also treat the mixed mount as
>>>> invalid use case and ignore handle it.
>>>
>>> Ext4 has a feature mmp (multiple mount protection) to do this.
>>> More details please refer to:
>>> https://ext4.wiki.kernel.org/index.php/Ext4_Disk_Layout
>>>
>>
>> Hi Joseph,
>>
>> I checked mmp feature related code, it can help ext4 to avoid multiple mount issue.
>>
>>  From my code reading:
>> - the mmp feature did mmp check when mouting.
>> - the mmp feature will start a kernel thread (kmmpd) to monitor mount status.
>> - kmmpd does detecting underlying dev IOs task.
>>
>> We could re-use mmp feature idea for ocfs2, do you plan to add it?
>> If yes, I could take this feature porting job.
>>
> Umm... I refer it just for your information.
> ocfs2 is cluster filesystem, for normal user scenarios, we intend to
> mount on multiple nodes.
> For use it as local filesystem, we have local mount mode.

Do you think anyone uses ocfs2 with local mount mode?
In my view, there are many FSs power than ocfs2 under local mount mode. They are
very likely to choose other fs (eg. xfs, ext4, btrfs).

The local mount mode is fixed when mkfs.ocfs2 and won't be changed later.
(please correct me if above line is wrong.)
nocluster feature is based on local mount feature, and nocluster mount mode
is more useful than local mount.
I even have a bold idea, ocfs2 could drop local mount feature support, and
only support cluster & nocluster mount mode.

> So it seems 'nocluster' mode looks a bit weird. I'm not sure if this is
> a frequently happened user case. Or can we do it in cluster stack as
> Junxiao suggested? Oracle and I (before) only use o2cb, so we don't have
> much experience on corosync + pacemaker.

I had explained the usecases of nocluster in previous mails. SUSE's customer
uses this feature to maintainer (eg fsck) or backup. Do you remember ocfs-tools
commit 7085e9177adc7197250d872c50a05dfc9c531bdc, which came from real world.
I also agree customer can do all the nocluster operations in cluster stack.
The key of nocluster is to bypass setting ha stack.

For minimal code change, this patch [1/1] is enough.
And for fixing (Junxiao concerned) multi mount simultaneously, we could partly use
ext4 mmp feature/idea. mmp mounting phase (before creating kmmp thread) code is
enough for fixing this issue. and I estimates the mmp for ocfs2 code is about ~100
lines.

Thanks,
Heming

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

  reply	other threads:[~2022-06-15  4:38 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-08 10:48 [Ocfs2-devel] [PATCH 0/1] test case for patch 1/1 Heming Zhao via Ocfs2-devel
2022-06-08 10:48 ` [Ocfs2-devel] [PATCH 1/1] ocfs2: fix ocfs2_find_slot repeats alloc same slot issue Heming Zhao via Ocfs2-devel
2022-06-12 14:16   ` Joseph Qi via Ocfs2-devel
2022-06-13  7:59     ` heming.zhao--- via Ocfs2-devel
2022-06-13  8:21       ` Joseph Qi via Ocfs2-devel
2022-06-13  8:48         ` heming.zhao--- via Ocfs2-devel
2022-06-13 15:43           ` Junxiao Bi via Ocfs2-devel
2022-06-14  2:59             ` heming.zhao--- via Ocfs2-devel
2022-06-14  3:27               ` Joseph Qi via Ocfs2-devel
2022-06-14 12:13                 ` heming.zhao--- via Ocfs2-devel
2022-06-15  2:03                   ` Joseph Qi via Ocfs2-devel
2022-06-15  4:37                     ` heming.zhao--- via Ocfs2-devel [this message]
2022-06-14  6:22               ` Junxiao Bi via Ocfs2-devel
2022-06-18  2:35 ` [Ocfs2-devel] [PATCH 0/1] test case for patch 1/1 Joseph Qi via Ocfs2-devel
2022-06-18 10:18   ` heming.zhao--- via Ocfs2-devel
2022-06-25 12:47     ` Joseph Qi via Ocfs2-devel
2022-06-25 15:02       ` heming.zhao--- 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=cd812972-f596-9635-64a2-3291a0f30605@suse.com \
    --to=ocfs2-devel@oss.oracle.com \
    --cc=heming.zhao@suse.com \
    --cc=joseph.qi@linux.alibaba.com \
    --cc=junxiao.bi@oracle.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 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).