Currently, the get_mmp_update_interval() in mmp.sh is implemented as follows:
The 'MMP Update Interval' string is incorrect now since debugfs has changed it to 'update_interval':
And after the patch for
LU-264 is landed, the default value for MMP update interval has been changed to 5 seconds instead of 1 second.
The 'MMP Check Interval' string in get_mmp_check_interval() is also needed to be updated to 'check_interval'.
In addition, after looking into e2fsck/unix.c and ldiskfs/kernel_patches/patches/ext4-mmp-rhel6.patch, I found there is a more simple and reliable way than using an extra expect script to fix the issue in
We can just run "tune2fs -E mmp_update_interval=$interval $device" to increase the time of "sleep(2 * mmp_check_interval + 1)" in ext2fs_mmp_start() (which is called by e2fsck in try_open_fs()->ext2fs_open2()). A new sequence number is written into the MMP block before that sleep. So, after e2fsck goes into ext2fs_mmp_start() and sets a new sequence number successfully, mount operation will always fail before e2fsck goes into ext2fs_mmp_stop() to set EXT4_MMP_SEQ_CLEAN into the MMP block.