[Ocfs2-tools-devel] [PATCH] mkfs.ocfs2: Don't overwrite filesystems with unknown features.
Joel Becker
Joel.Becker at oracle.com
Thu Aug 28 13:00:03 PDT 2008
If mkfs.ocfs2 encountered an ocfs2 filesystem with unknown features, it
would go ahead and overwrite it without checking the cluster first.
This is unsafe behavior.
Signed-off-by: Joel Becker <joel.becker at oracle.com>
---
mkfs.ocfs2/check.c | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/mkfs.ocfs2/check.c b/mkfs.ocfs2/check.c
index 5150bb3..471e6f0 100644
--- a/mkfs.ocfs2/check.c
+++ b/mkfs.ocfs2/check.c
@@ -269,7 +269,23 @@ int ocfs2_check_volume(State *s)
}
ret = ocfs2_open(s->device_name, OCFS2_FLAG_RW, 0, 0, &fs);
- if (ret) {
+ if ((ret == OCFS2_ET_UNSUPP_FEATURE) ||
+ (ret == OCFS2_ET_RO_UNSUPP_FEATURE)) {
+ com_err(s->progname, ret, "while opening device \"%s\"",
+ s->device_name);
+ if (!s->force) {
+ fprintf(stderr,
+ "As this is an existing OCFS2 volume, it could be mounted on an another node in the cluster.\n"
+ "However, as %s is unable to read the superblock, it cannot detect if the volume is in use or not.\n"
+ "To skip this check, use --force or -F.\n",
+ s->progname);
+ return -1;
+ } else {
+ fprintf(stderr,
+ "WARNING: Cluster check disabled.\n");
+ return 1;
+ }
+ } else if (ret) {
if (ret == OCFS2_ET_OCFS_REV)
fprintf(stdout, "Overwriting existing ocfs partition.\n");
return 0;
--
1.5.6.3
--
"Hell is oneself, hell is alone, the other figures in it, merely projections."
- T. S. Eliot
Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127
More information about the Ocfs2-tools-devel
mailing list