[Ocfs2-tools-commits] smushran commits r651 - trunk/tunefs.ocfs2
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Thu Mar 17 13:39:09 CST 2005
Author: smushran
Signed-off-by: mfasheh
Date: 2005-03-17 13:39:07 -0600 (Thu, 17 Mar 2005)
New Revision: 651
Modified:
trunk/tunefs.ocfs2/Makefile
trunk/tunefs.ocfs2/tunefs.c
Log:
cluser lock check added
Signed-off-by: mfasheh
Modified: trunk/tunefs.ocfs2/Makefile
===================================================================
--- trunk/tunefs.ocfs2/Makefile 2005-03-17 19:38:18 UTC (rev 650)
+++ trunk/tunefs.ocfs2/Makefile 2005-03-17 19:39:07 UTC (rev 651)
@@ -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: trunk/tunefs.ocfs2/tunefs.c
===================================================================
--- trunk/tunefs.ocfs2/tunefs.c 2005-03-17 19:38:18 UTC (rev 650)
+++ trunk/tunefs.ocfs2/tunefs.c 2005-03-17 19:39:07 UTC (rev 651)
@@ -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