[Ocfs2-tools-commits] jlbec commits r666 - in branches/usysfsify: fsck.ocfs2 mkfs.ocfs2 ocfs2console/ocfs2interface tunefs.ocfs2

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Thu Mar 17 23:09:27 CST 2005


Author: jlbec
Date: 2005-03-17 23:09:25 -0600 (Thu, 17 Mar 2005)
New Revision: 666

Added:
   branches/usysfsify/mkfs.ocfs2/check.c
   branches/usysfsify/mkfs.ocfs2/mkfs.h
   branches/usysfsify/ocfs2console/ocfs2interface/fsck.py
Modified:
   branches/usysfsify/fsck.ocfs2/Makefile
   branches/usysfsify/fsck.ocfs2/fsck.c
   branches/usysfsify/mkfs.ocfs2/Makefile
   branches/usysfsify/mkfs.ocfs2/mkfs.c
   branches/usysfsify/ocfs2console/ocfs2interface/about.py
   branches/usysfsify/ocfs2console/ocfs2interface/main.py
   branches/usysfsify/ocfs2console/ocfs2interface/menu.py
   branches/usysfsify/ocfs2console/ocfs2interface/ocfs2module.c
   branches/usysfsify/tunefs.ocfs2/Makefile
   branches/usysfsify/tunefs.ocfs2/tunefs.c
Log:

o Merge revisions 645:663 from trunk
	- [650] DLMify fsck.ocfs2
	- [652] DLMify tunefs.ocfs2
	- [657] Use vte widget for fsck in ocfs2console 
	- [659] Teach ocfs2console to fsck
	- [661] About modification
	- [662] Spelling fix
	- [663] Better timeout value for fsck in ocfs2console



Modified: branches/usysfsify/fsck.ocfs2/Makefile
===================================================================
--- branches/usysfsify/fsck.ocfs2/Makefile	2005-03-18 04:14:02 UTC (rev 665)
+++ branches/usysfsify/fsck.ocfs2/Makefile	2005-03-18 05:09:25 UTC (rev 666)
@@ -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: branches/usysfsify/fsck.ocfs2/fsck.c
===================================================================
--- branches/usysfsify/fsck.ocfs2/fsck.c	2005-03-18 04:14:02 UTC (rev 665)
+++ branches/usysfsify/fsck.ocfs2/fsck.c	2005-03-18 05:09:25 UTC (rev 666)
@@ -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);

Modified: branches/usysfsify/mkfs.ocfs2/Makefile
===================================================================
--- branches/usysfsify/mkfs.ocfs2/Makefile	2005-03-18 04:14:02 UTC (rev 665)
+++ branches/usysfsify/mkfs.ocfs2/Makefile	2005-03-18 05:09:25 UTC (rev 666)
@@ -23,18 +23,22 @@
 LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb
 LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a
 
-INCLUDES = $(LIBOCFS2_CFLAGS) $(LIBO2CB_CFLAGS) -I. -I$(TOPDIR)/libo2dlm/include
+LIBO2CB_CFLAGS = -I$(TOPDIR)/libo2dlm/include
+LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm
+LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a
+
+INCLUDES = $(LIBOCFS2_CFLAGS) $(LIBO2DLM_CFLAGS) $(LIBO2CB_CFLAGS) -I.
 DEFINES = -DOCFS2_FLAT_INCLUDES -DVERSION=\"$(VERSION)\" \
 	-DO2DLM_FLAT_INCLUDES -DO2CB_FLAT_INCLUDES
 
-CFILES = mkfs.c
+CFILES = mkfs.c check.c
 OBJS = $(subst .c,.o,$(CFILES))
 
 MANS = mkfs.ocfs2.8
 
 DIST_FILES = $(CFILES) mkfs.ocfs2.8.in
 
-mkfs.ocfs2: $(OBJS) $(LIBOCFS2_DEPS) $(LIBO2CB_DEPS)
-	$(LINK) $(LIBOCFS2_LIBS) $(LIBO2CB_LIBS) $(COM_ERR_LIBS)
+mkfs.ocfs2: $(OBJS) $(LIBOCFS2_DEPS) $(LIBO2DLM_DEPS) $(LIBO2CB_DEPS)
+	$(LINK) $(LIBOCFS2_LIBS) $(LIBO2DLM_LIBS) $(LIBO2CB_LIBS) $(COM_ERR_LIBS)
 
 include $(TOPDIR)/Postamble.make

Copied: branches/usysfsify/mkfs.ocfs2/check.c (from rev 665, trunk/mkfs.ocfs2/check.c)

Modified: branches/usysfsify/mkfs.ocfs2/mkfs.c
===================================================================
--- branches/usysfsify/mkfs.ocfs2/mkfs.c	2005-03-18 04:14:02 UTC (rev 665)
+++ branches/usysfsify/mkfs.ocfs2/mkfs.c	2005-03-18 05:09:25 UTC (rev 666)
@@ -1,7 +1,7 @@
 /* -*- mode: c; c-basic-offset: 8; -*-
  * vim: noexpandtab sw=8 ts=8 sts=0:
  *
- * mkfs2.c
+ * mkfs.c
  *
  * OCFS2 format utility
  *
@@ -21,216 +21,10 @@
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 021110-1307, USA.
  *
- * Authors: Manish Singh, Kurt Hackel
  */
 
-#define _LARGEFILE64_SOURCE
+#include "mkfs.h"
 
-#define _GNU_SOURCE
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <getopt.h>
-#include <errno.h>
-#include <malloc.h>
-#include <time.h>
-#include <libgen.h>
-#include <netinet/in.h>
-#include <inttypes.h>
-
-#include "ocfs2.h"
-#include "bitops.h"
-
-/* jfs_compat.h defines these */
-#undef cpu_to_be32
-#undef be32_to_cpu
-
-#include "ocfs1_fs_compat.h"
-
-typedef unsigned short kdev_t;
-
-#include <signal.h>
-#include <libgen.h>
-
-#include "kernel-jbd.h"
-
-
-#ifndef MAX
-#define MAX(a, b) (((a) > (b)) ? (a) : (b))
-#endif
-
-#define MIN_RESERVED_TAIL_BLOCKS    8
-
-#define LEADING_SPACE_BLOCKS    2
-#define SLOP_BLOCKS             0
-#define FILE_ENTRY_BLOCKS       8
-#define SUPERBLOCK_BLOCKS       1
-#define PUBLISH_BLOCKS(i,min)   (i<min ? min : i)
-#define VOTE_BLOCKS(i,min)      (i<min ? min : i)
-#define AUTOCONF_BLOCKS(i,min)  ((2+4) + (i<min ? min : i))
-#define NUM_LOCAL_SYSTEM_FILES  6
-
-#define OCFS2_OS_LINUX           0
-#define OCFS2_OS_HURD            1
-#define OCFS2_OS_MASIX           2
-#define OCFS2_OS_FREEBSD         3
-#define OCFS2_OS_LITES           4
-
-#define OCFS2_DFL_MAX_MNT_COUNT          20
-#define OCFS2_DFL_CHECKINTERVAL          0
-
-#define SYSTEM_FILE_NAME_MAX   40
-
-#define ONE_GB_SHIFT           30
-
-#define BITMAP_WARNING_LEN     1572864
-#define BITMAP_AUTO_MAX        786432
-
-#define MAX_CLUSTER_SIZE       1048576
-#define MIN_CLUSTER_SIZE       4096
-#define AUTO_CLUSTER_SIZE      65536
-
-
-enum {
-	SFI_JOURNAL,
-	SFI_CLUSTER,
-	SFI_LOCAL_ALLOC,
-	SFI_HEARTBEAT,
-	SFI_CHAIN,
-	SFI_OTHER
-};
-
-
-typedef struct _SystemFileInfo SystemFileInfo;
-
-struct _SystemFileInfo {
-	char *name;
-	int type;
-	int global;
-	int mode;
-};
-
-struct BitInfo {
-	uint32_t used_bits;
-	uint32_t total_bits;
-};
-
-typedef struct _AllocGroup AllocGroup;
-typedef struct _SystemFileDiskRecord SystemFileDiskRecord;
-
-struct _AllocGroup {
-	char *name;
-	ocfs2_group_desc *gd;
-	SystemFileDiskRecord *alloc_inode;
-	uint32_t chain_free;
-	uint32_t chain_total;
-	struct _AllocGroup *next;
-};
-
-
-struct _SystemFileDiskRecord {
-	uint64_t fe_off;
-        uint16_t suballoc_bit;
-	uint64_t extent_off;
-	uint64_t extent_len;
-	uint64_t file_size;
-
-	uint64_t chain_off;
-	AllocGroup *group;
-
-	struct BitInfo bi;
-	struct _AllocBitmap *bitmap;
-
-	int flags;
-	int links;
-	int mode;
-	int cluster_bitmap;
-};
-
-typedef struct _AllocBitmap AllocBitmap;
-
-struct _AllocBitmap {
-	AllocGroup **groups;
-
-	uint32_t valid_bits;
-	uint32_t unit;
-	uint32_t unit_bits;
-
-	char *name;
-
-	uint64_t fe_disk_off;
-
-	SystemFileDiskRecord *bm_record;
-	SystemFileDiskRecord *alloc_record;
-	int num_chains;
-};
-
-typedef struct _DirData DirData;
-
-struct _DirData {
-	uint64_t disk_off;
-	uint64_t disk_len;
-
-	void *buf;
-	int buf_len;
-
-	int last_off;
-	uint64_t fe_disk_off;
-
-	int link_count;
-
-	SystemFileDiskRecord *record;
-};
-
-typedef struct _State State;
-
-struct _State {
-  	char *progname;
-
-	int verbose;
-	int quiet;
-
-	uint32_t blocksize;
-	uint32_t blocksize_bits;
-
-	uint32_t cluster_size;
-	uint32_t cluster_size_bits;
-
-	uint64_t specified_size_in_blocks;
-	uint64_t volume_size_in_bytes;
-	uint32_t volume_size_in_clusters;
-	uint64_t volume_size_in_blocks;
-
-	uint32_t pagesize_bits;
-
-	uint64_t reserved_tail_size;
-
-	unsigned int initial_nodes;
-
-	uint64_t journal_size_in_bytes;
-
-	char *vol_label;
-	char *device_name;
-	char *uuid;
-	uint32_t vol_generation;
-
-	int fd;
-
-	time_t format_time;
-
-	AllocBitmap *global_bm;
-	AllocGroup *system_group;
-	uint32_t nr_cluster_groups;
-	uint16_t global_cpg;
-	uint16_t tail_group_bits;
-	uint32_t first_cluster_group;
-	uint64_t first_cluster_group_blkno;
-};
-
-
 static State *get_state(int argc, char **argv);
 static int get_number(char *arg, uint64_t *res);
 static void usage(const char *progname);
@@ -325,6 +119,17 @@
 
 	s = get_state(argc, argv);
 
+	/* bail if volume already mounted on cluster, etc. */
+	if (ocfs2_check_volume(s))
+		goto bail;
+
+	/* Abort? */
+	fprintf(stdout, "Proceed (y/N): ");
+	if (toupper(getchar()) != 'Y') {
+		printf("Aborting operation.\n");
+		goto bail;
+	}
+
 	open_device(s);
 
 	fill_defaults(s);
@@ -532,6 +337,7 @@
 	if (!s->quiet)
 		printf("%s successful\n\n", s->progname);
 
+bail:
 	return 0;
 }
 
@@ -546,7 +352,7 @@
 	char *dummy;
 	State *s;
 	int c;
-	int verbose = 0, quiet = 0;
+	int verbose = 0, quiet = 0, force = 0;
 	int show_version = 0;
 	char *device_name;
 	int ret;
@@ -563,6 +369,7 @@
 		{ "quiet", 0, 0, 'q' },
 		{ "version", 0, 0, 'V' },
 		{ "journalsize", 0, 0, 'j'},
+		{ "force", 0, 0, 'f'},
 		{ 0, 0, 0, 0}
 	};
 
@@ -572,7 +379,7 @@
 		progname = strdup("mkfs.ocfs2");
 
 	while (1) {
-		c = getopt_long(argc, argv, "b:c:L:n:j:vqV", long_options, 
+		c = getopt_long(argc, argv, "b:c:L:n:j:vqVf", long_options, 
 				NULL);
 
 		if (c == -1)
@@ -675,6 +482,10 @@
 			show_version = 1;
 			break;
 
+		case 'f':
+			force = 1;
+			break;
+
 		default:
 			usage(progname);
 			break;
@@ -716,6 +527,7 @@
 
 	s->verbose       = verbose;
 	s->quiet         = quiet;
+	s->force         = force;
 
 	s->blocksize     = blocksize;
 	s->cluster_size  = cluster_size;
@@ -780,7 +592,7 @@
 usage(const char *progname)
 {
 	fprintf(stderr, "Usage: %s [-b blocksize] [-c cluster-size] [-L volume-label]\n"
-			"\t[-n number-of-nodes] [-j journal-size] [-qvV] device [blocks-count]\n",
+			"\t[-n number-of-nodes] [-j journal-size] [-fqvV] device [blocks-count]\n",
 			progname);
 	exit(0);
 }

Copied: branches/usysfsify/mkfs.ocfs2/mkfs.h (from rev 665, trunk/mkfs.ocfs2/mkfs.h)

Modified: branches/usysfsify/ocfs2console/ocfs2interface/about.py
===================================================================
--- branches/usysfsify/ocfs2console/ocfs2interface/about.py	2005-03-18 04:14:02 UTC (rev 665)
+++ branches/usysfsify/ocfs2console/ocfs2interface/about.py	2005-03-18 05:09:25 UTC (rev 666)
@@ -67,7 +67,7 @@
 Software Foundation, Inc., 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.
 '''
-        blurb = 'GUI frontend for OCFS2 management and debugging'
+        blurb = 'GUI frontend for OCFS2 management'
 
         #logo = gtk.gdk.pixbuf_new_from_file('logo.png')
 

Copied: branches/usysfsify/ocfs2console/ocfs2interface/fsck.py (from rev 665, trunk/ocfs2console/ocfs2interface/fsck.py)

Modified: branches/usysfsify/ocfs2console/ocfs2interface/main.py
===================================================================
--- branches/usysfsify/ocfs2console/ocfs2interface/main.py	2005-03-18 04:14:02 UTC (rev 665)
+++ branches/usysfsify/ocfs2console/ocfs2interface/main.py	2005-03-18 05:09:25 UTC (rev 666)
@@ -30,6 +30,7 @@
 from nodemap import NodeMap
 from browser import Browser
 from clconfig import cluster_configurator
+from fsck import fsck
 
 COLUMN_DEVICE = 0
 COLUMN_MOUNTPOINT = 1
@@ -68,16 +69,12 @@
         if store and iter:
             return store[iter]
         else:
-            return None
+            return (None, None)
 
     def get_device(self):
         selection = self.get_sel_values()
+        return selection[COLUMN_DEVICE]
 
-        if selection:
-            return selection[COLUMN_DEVICE]
-        else:
-            return None
-
     def on_select(self, sel):
         self.selected = True
 
@@ -204,10 +201,10 @@
     pv.refresh_partitions()
 
 def check(pv):
-    pass
+    fsck(pv.toplevel, pv.get_device(), check=True)
 
 def repair(pv):
-    pass
+    fsck(pv.toplevel, pv.get_device(), check=False)
 
 def clconfig(pv):
     cluster_configurator(pv.toplevel)
@@ -272,6 +269,8 @@
         notebook.add_with_properties(frame, 'tab_label', desc)
 
     pv.refresh_partitions()
+    pv.grab_focus()
+   
 
     window.show_all()
 

Modified: branches/usysfsify/ocfs2console/ocfs2interface/menu.py
===================================================================
--- branches/usysfsify/ocfs2console/ocfs2interface/menu.py	2005-03-18 04:14:02 UTC (rev 665)
+++ branches/usysfsify/ocfs2console/ocfs2interface/menu.py	2005-03-18 05:09:25 UTC (rev 666)
@@ -17,27 +17,49 @@
 
 import gtk
 
+from fsck import fsck_ok
+
 try:
     stock_about = gtk.STOCK_ABOUT
 except AttributeError:
     stock_about = ''
 
-menu_data = (
+file_menu_data = (
     ('/_File',                     None,         None,      0, '<Branch>'),
     ('/File/_Quit',                None,         'cleanup', 0, '<StockItem>',
-     gtk.STOCK_QUIT),
-    ('/_Tasks',                    None,         None,      0, '<Branch>'),
-    ('/Tasks/_Format...',          '<control>F', 'format'),
-    ('/Tasks/---',                 None,         None,      0, '<Separator>'),
-    ('/Tasks/Chec_k...',           '<control>K', 'check'),
-    ('/Tasks/_Repair...',          '<control>R', 'repair'),
-    ('/Tasks/---',                 None,         None,      0, '<Separator>'),
-    ('/Tasks/_Cluster Config...',  '<control>C', 'clconfig'),
+     gtk.STOCK_QUIT)
+)
+
+help_menu_data = (
     ('/_Help',                     None,         None,      0, '<Branch>'),
     ('/Help/_About',               None,         'about',   0, '<StockItem>',
      stock_about)
 )
 
+if fsck_ok:
+    task_menu_fsck_data = (
+        ('/Tasks/---',                 None,         None,      0,
+         '<Separator>'),
+        ('/Tasks/Chec_k...',           '<control>K', 'check'),
+        ('/Tasks/_Repair...',          '<control>R', 'repair'),
+    )
+else:
+    task_menu_fsck_data = ()
+
+task_menu_head_data = (
+    ('/_Tasks',                    None,         None,      0, '<Branch>'),
+    ('/Tasks/_Format...',          '<control>F', 'format')
+)
+
+task_menu_tail_data = (
+    ('/Tasks/---',                 None,         None,      0, '<Separator>'),
+    ('/Tasks/_Cluster Config...',  '<control>C', 'clconfig'),
+)
+
+task_menu_data = task_menu_head_data + task_menu_fsck_data + task_menu_tail_data
+
+menu_data = file_menu_data + task_menu_data + help_menu_data
+
 class Menu:
     def __init__(self, **callbacks):
         self.items = []

Modified: branches/usysfsify/ocfs2console/ocfs2interface/ocfs2module.c
===================================================================
--- branches/usysfsify/ocfs2console/ocfs2interface/ocfs2module.c	2005-03-18 04:14:02 UTC (rev 665)
+++ branches/usysfsify/ocfs2console/ocfs2interface/ocfs2module.c	2005-03-18 05:09:25 UTC (rev 666)
@@ -265,5 +265,5 @@
   PyModule_AddIntConstant (m, "MAX_CLUSTER_SIZE", MAX_CLUSTER_SIZE);
 
   if (PyErr_Occurred ())
-    Py_FatalError ("can't initialise module ocfs2");
+    Py_FatalError ("can't initialize module ocfs2");
 }

Modified: branches/usysfsify/tunefs.ocfs2/Makefile
===================================================================
--- branches/usysfsify/tunefs.ocfs2/Makefile	2005-03-18 04:14:02 UTC (rev 665)
+++ branches/usysfsify/tunefs.ocfs2/Makefile	2005-03-18 05:09:25 UTC (rev 666)
@@ -16,6 +16,9 @@
 LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2
 LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a
 
+LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm
+LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a
+
 SBIN_PROGRAMS = tunefs.ocfs2
 
 INCLUDES = -I$(TOPDIR)/libocfs2/include $(GLIB_CFLAGS) -I$(TOPDIR)/libo2dlm/include
@@ -28,7 +31,7 @@
 
 DIST_FILES = $(CFILES)
 
-tunefs.ocfs2: $(OBJS) $(LIBOCFS2_DEPS)
-	$(LINK) $(LIBOCFS2_LIBS) $(GLIB_LIBS) $(COM_ERR_LIBS)
+tunefs.ocfs2: $(OBJS) $(LIBOCFS2_DEPS) $(LIBO2DLM_DEPS)
+	$(LINK) $(LIBOCFS2_LIBS) $(LIBO2DLM_LIBS) $(GLIB_LIBS) $(COM_ERR_LIBS)
 
 include $(TOPDIR)/Postamble.make

Modified: branches/usysfsify/tunefs.ocfs2/tunefs.c
===================================================================
--- branches/usysfsify/tunefs.ocfs2/tunefs.c	2005-03-18 04:14:02 UTC (rev 665)
+++ branches/usysfsify/tunefs.ocfs2/tunefs.c	2005-03-18 05:09:25 UTC (rev 666)
@@ -494,6 +494,7 @@
 	uint64_t vol_size = 0;
 
 	initialize_ocfs_error_table();
+	initialize_o2dl_error_table();
 
 	setbuf(stdout, NULL);
 	setbuf(stderr, NULL);
@@ -504,16 +505,28 @@
 
 	ret = ocfs2_open(opts.device, OCFS2_FLAG_RW, 0, 0, &fs);
 	if (ret) {
-		com_err(argv[0], ret, " ");
-		goto bail;
+		com_err(opts.progname, ret, " ");
+		goto close;
 	}
 
+	ret = ocfs2_initialize_dlm(fs);
+	if (ret) {
+		com_err(opts.progname, ret, " ");
+		goto close;
+	}
+
+	ret = ocfs2_lock_down_cluster(fs);
+	if (ret) {
+		com_err(opts.progname, ret, " ");
+		goto close;
+	}
+
 //	check_32bit_blocks (s);
 
 	/* get journal size of node 0 */
 	ret = get_default_journal_size(fs, &def_jrnl_size);
 	if (ret)
-		goto bail;
+		goto unlock;
 
 	/* validate volume label */
 	if (opts.vol_label) {
@@ -530,7 +543,7 @@
 		} else {
 			printf("ERROR: Nodes (%d) has to be larger than "
 			       "configured nodes (%d)\n", opts.num_nodes, tmp);
-			goto bail;
+			goto unlock;
 		}
 
 		if (!opts.jrnl_size)
@@ -552,7 +565,7 @@
 			if (!opts.num_nodes) {
 				printf("ERROR: Journal size %"PRIu64" has to be larger "
 				       "than %"PRIu64"\n", opts.jrnl_size, def_jrnl_size);
-				goto bail;
+				goto unlock;
 			}
 		}
 	}
@@ -575,7 +588,7 @@
 	printf("Proceed (y/N): ");
 	if (toupper(getchar()) != 'Y') {
 		printf("Aborting operation.\n");
-		goto bail;
+		goto unlock;
 	}
 
 	/* update volume label */
@@ -590,7 +603,7 @@
 		ret = update_nodes(fs, &upd_nodes);
 		if (ret) {
 			com_err(opts.progname, ret, "while updating nodes");
-			goto bail;
+			goto unlock;
 		}
 		if (upd_nodes)
 			printf("Added nodes\n");
@@ -601,7 +614,7 @@
 		ret = update_journal_size(fs, &upd_jrnls);
 		if (ret) {
 			com_err(opts.progname, ret, "while updating journal size");
-			goto bail;
+			goto unlock;
 		}
 		if (upd_jrnls)
 			printf("Resized journals\n");
@@ -612,7 +625,7 @@
 		ret = update_volume_size(fs, &upd_vsize);
 		if (ret) {
 			com_err(opts.progname, ret, "while updating volume size");
-			goto bail;
+			goto unlock;
 		}
 		if (upd_vsize)
 			printf("Resized volume\n");
@@ -623,12 +636,19 @@
 		ret = ocfs2_write_super(fs);
 		if (ret) {
 			com_err(opts.progname, ret, "while writing superblock");
-			goto bail;
+			goto unlock;
 		}
 		printf("Wrote Superblock\n");
 	}
 
-bail:
+unlock:
+	if (fs->fs_dlm_ctxt)
+		ocfs2_release_cluster(fs);
+
+close:
+	if (fs->fs_dlm_ctxt)
+		ocfs2_shutdown_dlm(fs);
+
 	if (fs)
 		ocfs2_close(fs);
 



More information about the Ocfs2-tools-commits mailing list