request do_supported_features, "Print features supported by this version of e2fsprogs",
supported_features;
+request do_clear_mmp, "Reset MMP block",
+ clear_mmp, mmp_clear;
+
request do_dump_mmp, "Dump MMP information",
- dump_mmp;
+ dump_mmp, mmp_dump;
request do_set_mmp_value, "Set MMP value",
- set_mmp_value, smmp;
+ set_mmp_value, smmp, mmp_set_value;
request do_extent_open, "Open inode for extent manipulation",
extent_open, eo;
.SH SYNOPSIS
.B debugfs
[
-.B \-DVwcin
+.B \-cDimnwV
]
[
.B \-b
you believe the metadata to be correct despite the complaints of
e2fsprogs.
.TP
+.I \-m
+Disables MMP status verification on open. This should only be used if
+you are positive that the filesystem is not in use by another node and
+no other
+.BR e2fsck ,
+.BR tune2fs ,
+.BR debugfs ,
+.BR FUSE ,
+or other program or system is currently accessing it. Run
+.B "dump_mmp"
+with the filesystem opened read-only, or
+.BI "e2mmpstatus -i" " device"
+to check the current MMP status for the filesystem.
+.TP
.I \-c
Specifies that the file system should be opened in catastrophic mode, in
which the inode and group bitmaps are not read initially. This can be
Clear the contents of the inode
.IR filespec .
.TP
+.BI clear_mmp
+Reset the contents of the filesystem multi-mount protection block.
+Use with caution, as this may result in severe filesystem corruption if
+it is currently in use on another node or if e2fsck is running. Use
+.B \-m
+to override the MMP check at open if debugfs reports is e2fsck being run.
+.TP
.BI copy_inode " source_inode destination_inode"
Copy the contents of the inode structure in
.I source_inode
flag will enable checking the file type information in the directory
entry to make sure it matches the inode's type.
.TP
-.BI open " [-weficD] [-b blocksize] [-d image_filename] [-s superblock] [-z undo_file] device"
+.BI open " [-cDefimw] [-b blocksize] [-d image_filename] [-s superblock] [-z undo_file] device"
Open a file system for editing. The
.I -f
flag forces the file system to be opened even if there are some unknown
prevent the file system from being opened. The
.I -e
flag causes the file system to be opened in exclusive mode. The
-.IR -b ", " -c ", " -d ", " -i ", " -s ", " -w ", and " -D
+.IR -b ", " -c ", " -d ", " -i ", " -m ", " -s ", " -w ", and " -D
options behave the same as the command-line options to
.BR debugfs .
.TP
char *undo_file = NULL;
reset_getopt();
- while ((c = getopt(argc, argv, "iwfecb:s:d:Dz:")) != EOF) {
+ while ((c = getopt(argc, argv, "b:cd:Defims:wz:")) != EOF) {
switch (c) {
case 'i':
open_flags |= EXT2_FLAG_IMAGE_FILE;
if (err)
return;
break;
+ case 'm':
+ open_flags |= EXT2_FLAG_SKIP_MMP;
+ break;
case 's':
err = strtoblk(argv[0], optarg,
"superblock block number", &superblock);
print_usage:
fprintf(stderr, "%s: Usage: open [-s superblock] [-b blocksize] "
#ifdef READ_ONLY
- "[-d image_filename] [-z undo_file] [-c] [-i] [-f] [-e] [-D] "
+ "[-d image_filename] [-z undo_file] [-cDefim] "
#else
- "[-d image_filename] [-c] [-i] [-f] [-e] [-D] [-w] "
+ "[-d image_filename] [-cDefimw] "
#endif
"<device>\n", argv[0]);
}
fprintf(stdout, "magic: 0x%x\n", mmp_s->mmp_magic);
fprintf(stdout, "checksum: 0x%08x\n", mmp_s->mmp_checksum);
}
+
+void do_clear_mmp(int argc EXT2FS_ATTR((unused)), char *argv[],
+ int sci_idx EXT2FS_ATTR((unused)),
+ void *infop EXT2FS_ATTR((unused)))
+{
+ errcode_t retval = 0;
+
+ if (check_fs_open(argv[0]))
+ return;
+
+ retval = ext2fs_mmp_clear(current_fs);
+ if (retval)
+ com_err(argv[0], retval, "Error clearing MMP block.\n");
+}
#else
void do_dump_mmp(int argc EXT2FS_ATTR((unused)),
ss_argv_t argv EXT2FS_ATTR((unused)),
fprintf(stdout, "MMP is unsupported, please recompile with "
"--enable-mmp\n");
}
+
+void do_clear_mmp(int argc EXT2FS_ATTR((unused)),
+ char *argv[] EXT2FS_ATTR((unused)),
+ int sci_idx EXT2FS_ATTR((unused)),
+ void *infop EXT2FS_ATTR((unused)))
+{
+ do_dump_mmp(argc, argv, sci_idx, infop);
+}
#endif
static int source_file(const char *cmd_file, int ss_idx)
"Usage: %s [-b blocksize] [-s superblock] [-f cmd_file] "
"[-R request] [-d data_source_device] [-i] [-n] [-D] [-V] ["
#ifndef READ_ONLY
- "[-w] [-z undo_file] "
+ "[-m] [-w] [-z undo_file] "
#endif
"[-c]] [device]";
int c;
int catastrophic = 0;
char *data_filename = 0;
#ifdef READ_ONLY
- const char *opt_string = "nicR:f:b:s:Vd:D";
+ const char *opt_string = "b:cd:Df:inR:s:V";
#else
- const char *opt_string = "niwcR:f:b:s:Vd:Dz:";
+ const char *opt_string = "b:cd:Df:imnR:s:Vwz:";
#endif
char *undo_file = NULL;
#ifdef CONFIG_JBD_DEBUG
case 'i':
open_flags |= EXT2_FLAG_IMAGE_FILE;
break;
+ case 'm':
+ open_flags |= EXT2_FLAG_SKIP_MMP;
+ break;
case 'n':
open_flags |= EXT2_FLAG_IGNORE_CSUM_ERRORS;
break;
arg++;
}
if (strcmp(token, "clear-mmp") == 0 ||
- strcmp(token, "clear_mmp") == 0) {
+ strcmp(token, "clear_mmp") == 0 ||
+ strcmp(token, "mmp-clear") == 0 ||
+ strcmp(token, "mmp_clear") == 0) {
clear_mmp = 1;
} else if (strcmp(token, "mmp_update_interval") == 0) {
unsigned long intv;