[Ocfs2-tools-commits] smushran commits r650 - trunk/fsck.ocfs2

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Thu Mar 17 13:38:20 CST 2005


Author: smushran
Signed-off-by: mfasheh
Date: 2005-03-17 13:38:18 -0600 (Thu, 17 Mar 2005)
New Revision: 650

Modified:
   trunk/fsck.ocfs2/Makefile
   trunk/fsck.ocfs2/fsck.c
Log:
cluster lock check added
Signed-off-by: mfasheh

Modified: trunk/fsck.ocfs2/Makefile
===================================================================
--- trunk/fsck.ocfs2/Makefile	2005-03-17 19:37:58 UTC (rev 649)
+++ trunk/fsck.ocfs2/Makefile	2005-03-17 19:38:18 UTC (rev 650)
@@ -7,6 +7,8 @@
 INCLUDES = -Iinclude -I$(TOPDIR)/libocfs2/include -I$(TOPDIR)/libo2dlm/include
 LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2
 LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a
+LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm
+LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a
 
 ifdef OCFS_DEBUG
 OPTS += -ggdb
@@ -59,8 +61,8 @@
 dist-subdircreate:
 	$(TOPDIR)/mkinstalldirs $(DIST_DIR)/include
 
-fsck.ocfs2: $(OBJS) $(LIBOCFS2_DEPS)
-	$(LINK) $(LIBOCFS2_LIBS) $(COM_ERR_LIBS)
+fsck.ocfs2: $(OBJS) $(LIBOCFS2_DEPS) $(LIBO2DLM_DEPS)
+	$(LINK) $(LIBOCFS2_LIBS) $(LIBO2DLM_LIBS) $(COM_ERR_LIBS)
 
 $(OBJS): prompt-codes.h
 

Modified: trunk/fsck.ocfs2/fsck.c
===================================================================
--- trunk/fsck.ocfs2/fsck.c	2005-03-17 19:37:58 UTC (rev 649)
+++ trunk/fsck.ocfs2/fsck.c	2005-03-17 19:38:18 UTC (rev 650)
@@ -427,6 +427,7 @@
 	blkno = 0;
 
 	initialize_ocfs_error_table();
+	initialize_o2dl_error_table();
 	setlinebuf(stderr);
 	setlinebuf(stdout);
 
@@ -519,6 +520,20 @@
 		goto out;
 	}
 
+	if (open_flags & OCFS2_FLAG_RW) {
+		ret = ocfs2_initialize_dlm(ost->ost_fs);
+		if (ret) {
+			com_err(whoami, ret, " ");
+			goto close;
+		}
+
+		ret = ocfs2_lock_down_cluster(ost->ost_fs);
+		if (ret) {
+			com_err(whoami, ret, " ");
+			goto close;
+		}
+	}
+
 	printf("Checking OCFS2 filesystem in %s:\n", filename);
 	printf("  label:              ");
 	print_label(ost);
@@ -536,7 +551,7 @@
 		printf("fsck encountered unrecoverable errors while "
 		       "replaying the journals and will not continue\n");
 		fsck_mask |= FSCK_ERROR;
-		goto out;
+		goto unlock;
 	}
 
 	/* allocate all this junk after we've replayed the journal and the
@@ -544,12 +559,12 @@
 	if (o2fsck_state_init(ost->ost_fs, ost)) {
 		fprintf(stderr, "error allocating run-time state, exiting..\n");
 		fsck_mask |= FSCK_ERROR;
-		goto out;
+		goto unlock;
 	}
 
 	if (fs_is_clean(ost, filename)) {
 		fsck_mask = FSCK_OK;
-		goto out;
+		goto unlock;
 	}
 
 #if 0
@@ -609,6 +624,14 @@
 				"superblock");
 	}
 
+unlock:
+	if (ost->ost_fs->fs_dlm_ctxt)
+		ocfs2_release_cluster(ost->ost_fs);
+
+close:
+	if (ost->ost_fs->fs_dlm_ctxt)
+		ocfs2_shutdown_dlm(ost->ost_fs);
+
 	ret = ocfs2_close(ost->ost_fs);
 	if (ret) {
 		com_err(whoami, ret, "while closing file \"%s\"", filename);



More information about the Ocfs2-tools-commits mailing list