Skip to contentSkip to conversation

Add --force option in tunefs

Ocfs2-devel Goldwyn Rodrigues 3 participants 3 messages Jul 2, 2008 – Jul 3, 2008 OCFS2

lore
Share & tools
lore
#0 lore raw

This patch enable --force option in tunefs.ocfs2 Like mkfs, the --force option ignores cluster initialization and locking.

A force option is useless for local mounts and hence, to display the warning message, the check for force flag is checked after the check for local mount.

tunefs.ocfs2/tunefs.c +11 -2
index be10eb2..e238f1e 100644
@@ -44,7 +44,7 @@ static void usage(const char *progname)
 	fprintf(stderr, "usage: %s [-J journal-options] [-L volume-label]\n"
 			"\t\t[-M mount-type] [-N number-of-node-slots] [-Q query-fmt]\n"
 			"\t\t[--update-cluster-stack]\n"
-			"\t\t[-qSUvV] [--backup-super] [--list-sparse]\n"
+			"\t\t[-qSUvV] [--backup-super] [--list-sparse] [--force]\n"
 			"\t\t[--fs-features=[no]sparse,...]] device [blocks-count]\n",
 			progname);
 	exit(0);
@@ -202,6 +202,7 @@ static void get_options(int argc, char **argv)
 		{ "quiet", 0, 0, 'q' },
 		{ "query", 1, 0, 'Q' },
 		{ "version", 0, 0, 'V' },
+		{ "force", 0, 0, 'F' },
 		{ "journal-options", 0, 0, 'J'},
 		{ "volume-size", 0, 0, 'S'},
 		{ "uuid-reset", 0, 0, 'U'},
@@ -221,7 +222,7 @@ static void get_options(int argc, char **argv)
 	opts.prompt = 1;
 
 	while (1) {
-		c = getopt_long(argc, argv, "L:N:J:M:Q:SUvqVxb", long_options,
+		c = getopt_long(argc, argv, "L:N:J:M:Q:SUvqVFxb", long_options,
 				NULL);
 
 		if (c == -1)
@@ -292,6 +293,10 @@ static void get_options(int argc, char **argv)
 			opts.verbose = 1;
 			break;
 
+		case 'F':
+			opts.force = 1;
+			break;
+
 		case 'q':
 			opts.quiet = 1;
 			break;
@@ -1295,6 +1300,10 @@ int main(int argc, char **argv)
 		get_vol_size(fs);
 
 	if (!ocfs2_mount_local(fs)) {
+		if (opts.force) {
+			fprintf(stderr, "WARNING: Cluster check disabled.\n");
+			goto skip_cluster_start;
+		}
 		ret = o2cb_init();
 		if (ret) {
 			com_err(opts.progname, ret, "while initializing the cluster");
tunefs.ocfs2/tunefs.h +1 -0
index c7b4acf..819997b 100644
@@ -87,6 +87,7 @@ typedef struct _ocfs2_tune_opts {
 	int verbose;
 	int quiet;
 	int prompt;
+	int force;
 	int backup_super;
 	int update_cluster;
 	int list_sparse;
Signature · 1 line
Goldwyn
#1 lore raw

On Wed, Jul 02, 2008 at 03:18:04PM +0530, Goldwyn Rodrigues wrote:

Hey, there. Tools changes belong on
ocfs2-tools-devel at oss.oracle.com, so I've copied that mailing list.

Quoted 3 lines

This patch enable --force option in tunefs.ocfs2 Like mkfs, the --force option ignores cluster initialization and locking.

Thanks for the patch, but we decided long ago that we didn't
want tunefs run without the cluster. That's why there is no force option. It's intentional.

Joel

Signature · 10 lines
"Born under a bad sign.
 I been down since I began to crawl.
 If it wasn't for bad luck,
 I wouldn't have no luck at all."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127
#2 lore raw

Well, we need to have a --force override if only to allow users cloning ocfs2 volumes an easy way to change the uuid.

Goldwyn,
What is your justification for needing this feature? As in, allowing force override to change mount type from clustered to local. Is this a specific user requirement?

Our fear is that this override will allow some script author to hard code it leading to corruption. As in, click here to change the mount type. I mean, we already have a force override in mkfs, but format is something users understand wipes the data. I am not sure users will immediately understand that changing the mount type will corrupt the fs if it is mounted on another node.

Sunil

Quoted 18 lines · Joel Becker

On Wed, Jul 02, 2008 at 03:18:04PM +0530, Goldwyn Rodrigues wrote:

Hey, there. Tools changes belong on
ocfs2-tools-devel at oss.oracle.com, so I've copied that mailing list.

Quoted 4 lines

This patch enable --force option in tunefs.ocfs2 Like mkfs, the --force option ignores cluster initialization and locking.

Thanks for the patch, but we decided long ago that we didn't
want tunefs run without the cluster. That's why there is no force option. It's intentional.

Joel