[Ocfs2-tools-commits] zab commits r894 - in trunk/fsck.ocfs2: . include

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue May 17 17:43:14 CDT 2005


Author: zab
Date: 2005-05-17 17:43:12 -0500 (Tue, 17 May 2005)
New Revision: 894

Modified:
   trunk/fsck.ocfs2/fsck.c
   trunk/fsck.ocfs2/fsck.ocfs2.8.in
   trunk/fsck.ocfs2/include/fsck.h
Log:
o provide fsck -F to avoid cluster locking


Modified: trunk/fsck.ocfs2/fsck.c
===================================================================
--- trunk/fsck.ocfs2/fsck.c	2005-05-17 21:55:42 UTC (rev 893)
+++ trunk/fsck.ocfs2/fsck.c	2005-05-17 22:43:12 UTC (rev 894)
@@ -80,6 +80,7 @@
 		" -n		Check but don't change the file system\n"
 		" -y		Answer 'yes' to all repair questions\n"
 		" -f		Force checking even if file system is clean\n"
+		" -F		Ignore cluster locking (dangerous!)\n"
 		"\n"
 		"Less critical flags:\n"
 		" -b superblock	Treat given block as the super block\n"
@@ -432,7 +433,7 @@
 	setlinebuf(stderr);
 	setlinebuf(stdout);
 
-	while((c = getopt(argc, argv, "b:B:fGnuvVy")) != EOF) {
+	while((c = getopt(argc, argv, "b:B:fFGnuvVy")) != EOF) {
 		switch (c) {
 			case 'b':
 				blkno = read_number(optarg);
@@ -458,6 +459,10 @@
 				}
 				break;
 
+			case 'F':
+				ost->ost_skip_o2cb = 1;
+				break;
+
 			case 'f':
 				ost->ost_force = 1;
 				break;
@@ -498,11 +503,15 @@
 		}
 	}
 
-	ret = o2cb_init();
-	if (ret) {
-		com_err(whoami, ret, "Cannot initialize cluster\n");
-		fsck_mask |= FSCK_ERROR;
-		goto out;
+	if (ost->ost_skip_o2cb)
+		printf("-F given, *not* checking with the cluster DLM.\n");
+	else {
+		ret = o2cb_init();
+		if (ret) {
+			com_err(whoami, ret, "Cannot initialize cluster\n");
+			fsck_mask |= FSCK_ERROR;
+			goto out;
+		}
 	}
 
 	if (blksize % OCFS2_MIN_BLOCKSIZE) {
@@ -527,7 +536,7 @@
 		goto out;
 	}
 
-	if (open_flags & OCFS2_FLAG_RW) {
+	if (open_flags & OCFS2_FLAG_RW && !ost->ost_skip_o2cb) {
 		ret = ocfs2_initialize_dlm(ost->ost_fs);
 		if (ret) {
 			com_err(whoami, ret, "while initializing the DLM");

Modified: trunk/fsck.ocfs2/fsck.ocfs2.8.in
===================================================================
--- trunk/fsck.ocfs2/fsck.ocfs2.8.in	2005-05-17 21:55:42 UTC (rev 893)
+++ trunk/fsck.ocfs2/fsck.ocfs2.8.in	2005-05-17 22:43:12 UTC (rev 894)
@@ -2,7 +2,7 @@
 .SH "NAME"
 fsck.ocfs2 \- Check an OCFS2 file system.
 .SH "SYNOPSIS"
-\fBfsck.ocfs2\fR [ \fB\-fGnuvVy\fR ] [ \fB\-b\fR \fIsuperblock block\fR ] [ \fB\-B\fR \fIblock size\fR ] \fIdevice\fR
+\fBfsck.ocfs2\fR [ \fB\-fFGnuvVy\fR ] [ \fB\-b\fR \fIsuperblock block\fR ] [ \fB\-B\fR \fIblock size\fR ] \fIdevice\fR
 .SH "DESCRIPTION"
 .PP 
 \fBfsck.ocfs2\fR is used to check an OCFS2 file system.
@@ -26,6 +26,14 @@
 effect as the file system is always checked.
 
 .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.
+
+.TP
 \fB\-G\fR
 Usually \fBfsck.ocfs2\fR will silently assume inodes whose generation number
 does not match the generation number of the super block are unused inodes.

Modified: trunk/fsck.ocfs2/include/fsck.h
===================================================================
--- trunk/fsck.ocfs2/include/fsck.h	2005-05-17 21:55:42 UTC (rev 893)
+++ trunk/fsck.ocfs2/include/fsck.h	2005-05-17 22:43:12 UTC (rev 894)
@@ -57,6 +57,7 @@
 	unsigned	ost_ask:1,	/* confirm with the user */
 			ost_answer:1,	/* answer if we don't ask the user */
 			ost_force:1,	/* -f supplied; force check */
+			ost_skip_o2cb:1,/* -F: ignore cluster services */
 			ost_write_inode_alloc_asked:1,
 			ost_write_inode_alloc:1,
 			ost_write_error:1,



More information about the Ocfs2-tools-commits mailing list