[Ocfs2-tools-devel] [PATCH 1/3] fsck.ocfs2: Print bold warning message when run with -F

Sunil Mushran sunil.mushran at ORACLE.COM
Fri Jul 24 17:04:25 PDT 2009


Print a bold warning if the user runs fsck.ocfs2 with cluster check
disabled. The man page has also been updated to highlight the risk
when running with this check disabled.

Signed-off-by: Sunil Mushran <sunil.mushran at oracle.com>
---
 fsck.ocfs2/fsck.c          |   16 +++++++++++++---
 fsck.ocfs2/fsck.ocfs2.8.in |   11 ++++++-----
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/fsck.ocfs2/fsck.c b/fsck.ocfs2/fsck.c
index f8c8a33..37a6c49 100644
--- a/fsck.ocfs2/fsck.c
+++ b/fsck.ocfs2/fsck.c
@@ -742,9 +742,6 @@ int main(int argc, char **argv)
 		}
 	}
 
-	if (ost->ost_skip_o2cb)
-		printf("-F given, *not* checking with the cluster DLM.\n");
-
 	if (blksize % OCFS2_MIN_BLOCKSIZE) {
 		fprintf(stderr, "Invalid blocksize: %"PRId64"\n", blksize);
 		fsck_mask |= FSCK_USAGE;
@@ -761,6 +758,19 @@ int main(int argc, char **argv)
 
 	filename = argv[optind];
 
+	if (ost->ost_skip_o2cb) {
+		fprintf(stdout, "\nWARNING: YOU HAVE DISABLED THE CLUSTER CHECK. "
+			"CONTINUE ONLY IF YOU\nARE ABSOLUTELY SURE THAT NO "
+			"NODE HAS THIS FILESYSTEM MOUNTED OR IS\nOTHERWISE "
+			"ACCESSING IT. IF UNSURE, DO NOT PROCEED.\n\n");
+		fprintf(stdout, "Proceed (y/N): ");
+		if (toupper(getchar()) != 'Y') {
+			printf("Aborting operation.\n");
+			fsck_mask |= FSCK_CANCELED;
+			goto out;
+		}
+	}
+
 	if (signal(SIGTERM, handle_signal) == SIG_ERR) {
 		com_err(whoami, 0, "Could not set SIGTERM");
 		exit(1);
diff --git a/fsck.ocfs2/fsck.ocfs2.8.in b/fsck.ocfs2/fsck.ocfs2.8.in
index bbde948..f93c15a 100644
--- a/fsck.ocfs2/fsck.ocfs2.8.in
+++ b/fsck.ocfs2/fsck.ocfs2.8.in
@@ -28,11 +28,12 @@ Force checking even if the file system is clean.
 
 .TP
 \fB\-F\fR
-Usually \fBfsck.ocfs2\fR will check with cluster services and the DLM to
-make sure that no one else in the cluster is actively using the device
-before proceeding.  \fB-F\fR skips this check and should only be used
-when it can be guaranteed that there can be no other users of the
-device while \fBfsck.ocfs2\fR is running.
+By default \fBfsck.ocfs2\fR will check with the cluster services to ensure that
+the volume is not in-use (mounted) on any node in the cluster before proceeding.
+\fB-F\fR skips this check and should only be used when it can be guaranteed that
+the volume is not mounted on any node in the cluster. \fBWARNING: If the cluster
+check is disabled and the volume is mounted on one or more nodes, file system
+corruption is very likely. If unsure, do not use this option.\fR
 
 .TP
 \fB\-G\fR
-- 
1.6.0.4




More information about the Ocfs2-tools-devel mailing list