[Ocfs-tools-commits] smushran commits r12 - trunk/fsck

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue Mar 16 18:01:28 CST 2004


Author: smushran
Date: 2004-03-16 18:01:25 -0600 (Tue, 16 Mar 2004)
New Revision: 12

Modified:
   trunk/fsck/
   trunk/fsck/Makefile
   trunk/fsck/fsck.c
   trunk/fsck/verify.c
Log:
fsck handles v1 and v2 vol hdrs
--static removed
never mounted before check added


Property changes on: trunk/fsck
___________________________________________________________________
Name: svn:ignore
   + cscope*
fsck.ocfs*
parse
classes.c
stamp-md5


Modified: trunk/fsck/Makefile
===================================================================
--- trunk/fsck/Makefile	2004-03-16 22:50:42 UTC (rev 11)
+++ trunk/fsck/Makefile	2004-03-17 00:01:25 UTC (rev 12)
@@ -62,6 +62,6 @@
 	$(CC) $(CFLAGS) $(INCLUDES) $(GLIB_CFLAGS) $(DEFINES) -DUSE_MALLOC_ALIGNED $(VERMAGIC) -o $@ -c $<
 
 fsck.ocfs: classes.o fsck.o $(GLIB_OBJS) ver.o
-	$(LINK) -static $(GLIB_LIBS) $(LIBOCFS_LIBS)
+	$(LINK) $(GLIB_LIBS) $(LIBOCFS_LIBS)
 
 include $(TOPDIR)/Postamble.make

Modified: trunk/fsck/fsck.c
===================================================================
--- trunk/fsck/fsck.c	2004-03-16 22:50:42 UTC (rev 11)
+++ trunk/fsck/fsck.c	2004-03-17 00:01:25 UTC (rev 12)
@@ -41,6 +41,9 @@
 __u32 debug_level = 0;
 __u32 debug_exclude = 0;
 
+bool never_mounted = false;
+__u32 fs_version = 0;
+
 ocfs_global_ctxt OcfsGlobalCtxt;
 ocfsck_context ctxt;
 extern void version(char *progname);
@@ -662,6 +665,11 @@
 				break;
 		}
 
+		if (i == 0 && never_mounted == true) {
+			LOG_PRINT("Volume has never been mounted on any node. Exiting");
+			goto bail;
+		}
+
 		if (option == 'q' || option == 'd')
 			break;
 

Modified: trunk/fsck/verify.c
===================================================================
--- trunk/fsck/verify.c	2004-03-16 22:50:42 UTC (rev 11)
+++ trunk/fsck/verify.c	2004-03-17 00:01:25 UTC (rev 12)
@@ -27,6 +27,8 @@
 
 
 extern ocfsck_context ctxt;
+extern bool never_mounted;
+extern __u32 fs_version;
 
 /*
  * test_member_range()
@@ -744,6 +746,7 @@
 		LOG_WARNING("nonzero bytes after the disk header structure");
 	}
 
+#if 0
 	if (hdr->minor_version != OCFS_MINOR_VERSION)
 	{
 		mbr = find_class_member(cl, "minor_version", &i);
@@ -754,6 +757,17 @@
 		mbr = find_class_member(cl, "major_version", &i);
 		g_hash_table_insert(*bad, GINT_TO_POINTER(i), GINT_TO_POINTER(1));
 	}
+#endif
+
+	if (hdr->major_version == 1)
+		fs_version = 1;
+	else if (hdr->major_version == 2)
+		fs_version = 2;
+	else {
+		mbr = find_class_member(cl, "major_version", &i);
+		g_hash_table_insert(*bad, GINT_TO_POINTER(i), GINT_TO_POINTER(1));
+	}
+
 	if (strncmp(hdr->signature, OCFS_VOLUME_SIGNATURE, MAX_VOL_SIGNATURE_LEN) != 0)
 	{
 		mbr = find_class_member(cl, "signature", &i);
@@ -800,7 +814,9 @@
 		mbr = find_class_member(cl, "data_start_off", &i);
 		g_hash_table_insert(*bad, GINT_TO_POINTER(i), GINT_TO_POINTER(1));
 	}
-	if (hdr->internal_off != OCFSCK_INTERNAL_OFF)
+	if (hdr->internal_off == 0)
+		never_mounted = true;
+	else if (hdr->internal_off != OCFSCK_INTERNAL_OFF)
 	{
 		mbr = find_class_member(cl, "internal_off", &i);
 		g_hash_table_insert(*bad, GINT_TO_POINTER(i), GINT_TO_POINTER(1));
@@ -884,7 +900,9 @@
 	/* the root off is *always* at OCFSCK_ROOT_OFF */
 	/* and we can no longer do the signature check because */
 	/* it may be bad and we want to be able to change it later */
-	if (hdr->root_off != OCFSCK_ROOT_OFF)
+	if (hdr->root_off == 0)
+		never_mounted = true;
+	else if (hdr->root_off != OCFSCK_ROOT_OFF)
 	{
 		mbr = find_class_member(cl, "root_off", &i);
 		g_hash_table_insert(*bad, GINT_TO_POINTER(i), GINT_TO_POINTER(1));



More information about the Ocfs-tools-commits mailing list