All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next v3 0/5] Fix some issues about mmp
@ 2021-10-19  6:49 Ye Bin
  2021-10-19  6:49 ` [PATCH -next v3 1/5] ext4: init 'seq' with the value which set in 'ext4_multi_mount_protect' Ye Bin
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Ye Bin @ 2021-10-19  6:49 UTC (permalink / raw)
  To: tytso, adilger.kernel, linux-ext4; +Cc: linux-kernel, jack, Ye Bin

I test mmp function as follow steps:
1. Inject delay 5s in ext4_multi_mount_protect function after
"skip:" label.
2. Share HostA block device(sda) with HostB(nbd0) by NBD.
3. Enable mmp feature when mkfs.ext4 sda.
4. Mount sda and nbd0 at the same time.

I found kmmpd never trigger detect multi-mount. Reason is as follow:
1. Kmmpd init seq with 0, if two host have same nodename, will lead to
detect confliction very slow, even never detect confliction.
2. When detect confliction in kmmpd, we get 'check_bh' is same with 'bh'.
so we compare data with itself.
3. We only trigger detect when ”diff > mmp_check_interval * HZ“,
'mmp_check_interval' is double of 'mmp_update_interval', 'diff' is
about 'mmp_update_interval'. So 'diff' is little than 'mmp_check_interval * HZ'
normaly. As Jan Kara explain as follows:
"I think the check is there only for the case where write_mmp_block() +
sleep took longer than mmp_check_interval. I agree that should rarely
happen but on a really busy system it is possible and in that case we would
miss updating mmp block for too long and so another node could have started
using the filesystem. "

v1->v2:
Fix 'last_check_time' not initialized before checking.

v3->v2:
1. drop commit "ext4: introduce last_check_time record previous check time"
As Ted explain as follows:
"I'd like Andreas to comment here.  My understanding is that MMP
originally intended as a safety mechanism which would be used as part
of a primary/backup high availability system, but not as the *primary*
system where you might try to have two servers simultaneously try to
mount the file system and use MMP as the "election" mechanism to
decide which server is going to be the primary system, and which would
be the backup system.

The cost of being able to handle this particular race is it would slow
down the mounts of cleanly unmounted systems.

There *are* better systems to implement leader elections[1] than using
MMP.  Most of these more efficient leader elections assume that you
have a working IP network, and so if you have a separate storage
network (including a shared SCSI bus) from your standard IP network,
then MMP is a useful failsafe in the face of a network partition of
your IP network.  The question is whether MMP should be useful for
more than that.  And if it isn't, then we should probably document
what MMP is and isn't good for, and give advice in the form of an
application note for how MMP should be used in the context of a larger
system."
2. drop commit "ext4: fix possible store wrong check interval value in disk when umount"
3. simplify read_mmp_block fucntion to avoid UAF


Ye Bin (5):
  ext4: init 'seq' with the value which set in
    'ext4_multi_mount_protect'
  ext4: compare to local seq and nodename when check conflict
  ext4: get buffer head before read_mmp_block
  ext4: simplify read_mmp_block fucntion
  ext4: avoid to re-read mmp check data get from page cache

 fs/ext4/ext4.h |  5 +++-
 fs/ext4/mmp.c  | 67 ++++++++++++++++++++++----------------------------
 2 files changed, 33 insertions(+), 39 deletions(-)

-- 
2.31.1


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

end of thread, other threads:[~2021-10-19 13:46 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-19  6:49 [PATCH -next v3 0/5] Fix some issues about mmp Ye Bin
2021-10-19  6:49 ` [PATCH -next v3 1/5] ext4: init 'seq' with the value which set in 'ext4_multi_mount_protect' Ye Bin
2021-10-19  8:53   ` Jan Kara
2021-10-19  6:49 ` [PATCH -next v3 2/5] ext4: compare to local seq and nodename when check conflict Ye Bin
2021-10-19  8:54   ` Jan Kara
2021-10-19  6:49 ` [PATCH -next v3 3/5] ext4: get buffer head before read_mmp_block Ye Bin
2021-10-19  9:12   ` Jan Kara
2021-10-19  6:49 ` [PATCH -next v3 4/5] ext4: simplify read_mmp_block fucntion Ye Bin
2021-10-19 13:13   ` kernel test robot
2021-10-19 13:13     ` kernel test robot
2021-10-19  6:49 ` [PATCH -next v3 5/5] ext4: avoid to re-read mmp check data get from page cache Ye Bin
2021-10-19  9:10   ` Jan Kara

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.