]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commit
misc: add e2mmpstatus utility via dumpe2fs
authorShuichi Ihara <sihara@ddn.com>
Wed, 2 May 2018 04:26:06 +0000 (22:26 -0600)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 22 Jun 2018 22:22:37 +0000 (18:22 -0400)
commit32b8802aa5d867a0497cd6135c5f48039b0ba71c
treee218dca1498c064e25470cb5f8ce30cf583fd6c7
parent1a8015773a9316ee90f713c275fb3a38731735e4
misc: add e2mmpstatus utility via dumpe2fs

e2mmpstatus is a Multi-Mount Protection (MMP) helper utility to read
an MMP block to see if it is being updated.  It can also output the
latest update time, nodename, and device from the MMP block.

This is useful for HA and other maintenance scripts to determine if
the filesystem is in use on another node, and which node it is.

Signed-off-by: Shuichi Ihara <sihara@ddn.com>
Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Moved e2mmpstatus checking/dumping code to be part of dumpe2fs rather
than a standalone program, using the "-m" option to check MMP status,
and "-i" to dump info.  If dumpe2fs is called as "e2mmpstatus" (and
also "mmpstatus" for compatibility reasons), assume "-m" is specified.

Re-use the existing MMP block handing routines (with some changes) to
check and dump the MMP block, rather than adding duplicate versions.

Modify dumpe2fs to exit with a non-zero error code if there is an
error while reading the filesystem metadata or MMP block, or if
"-m" is used with the "mmp" feature and is in use by another node.

Add a configure check for gethostname() rather than depending on
_BSD_SOURCE or _XOPEN_SOURCE to be set.

Update the f_mmp, m_mmp, m_mmp_bad_csum, and m_mmp_bad_magic tests
to use e2mmpstatus to check and dump the MMP state before and after
e2fsck is run to verify that the tool is working correctly.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
22 files changed:
.gitignore
configure
configure.ac
e2fsck/e2fsck.h
e2fsck/problem.c
e2fsck/unix.c
e2fsck/util.c
e2fsprogs.spec.in
lib/config.h.in
lib/ext2fs/ext2_err.et.in
lib/ext2fs/mmp.c
misc/Makefile.in
misc/dumpe2fs.8.in
misc/dumpe2fs.c
misc/e2mmpstatus.8.in [new file with mode: 0644]
tests/f_mmp/script
tests/m_mmp/expect.1
tests/m_mmp_bad_csum/expect
tests/m_mmp_bad_csum/script
tests/m_mmp_bad_magic/expect
tests/m_mmp_bad_magic/script
tests/test_config