All of lore.kernel.org
 help / color / mirror / Atom feed
* [Ocfs2-devel] ocfs2: Check heartbeat mode for kernel stacks only
@ 2011-01-31 19:31 Mark Fasheh
  2011-01-31 19:51 ` Sunil Mushran
  2011-02-20 10:41 ` Joel Becker
  0 siblings, 2 replies; 3+ messages in thread
From: Mark Fasheh @ 2011-01-31 19:31 UTC (permalink / raw)
  To: ocfs2-devel

Commit 2c442719e90a44a6982c033d69df4aae4b167cfa added some checks for proper
heartbeat mode when the o2cb stack is running.  Unfortunately, it didn't
take into account that a userpsace stack could be running. Fix this by only
doing the check if o2cb is in use. This patch allows userspace stacks to
mount the fs again.

Cc: stable at kernel.org
Signed-off-by: Mark Fasheh <mfasheh@suse.com>

Index: linux-2.6.32-SLE11-SP1/fs/ocfs2/super.c
===================================================================
--- linux-2.6.32-SLE11-SP1.orig/fs/ocfs2/super.c
+++ linux-2.6.32-SLE11-SP1/fs/ocfs2/super.c
@@ -1331,7 +1331,7 @@ static int ocfs2_parse_options(struct su
 			       struct mount_options *mopt,
 			       int is_remount)
 {
-	int status;
+	int status, user_stack = 0;
 	char *p;
 	u32 tmp;
 
@@ -1474,6 +1474,15 @@ static int ocfs2_parse_options(struct su
 			memcpy(mopt->cluster_stack, args[0].from,
 			       OCFS2_STACK_LABEL_LEN);
 			mopt->cluster_stack[OCFS2_STACK_LABEL_LEN] = '\0';
+			/*
+			 * Open code the memcmp here as we don't have
+			 * an osb to pass to
+			 * ocfs2_userspace_stack().
+			 */
+			if (memcmp(mopt->cluster_stack,
+				   OCFS2_CLASSIC_CLUSTER_STACK,
+				   OCFS2_STACK_LABEL_LEN))
+				user_stack = 1;
 			break;
 		case Opt_inode64:
 			mopt->mount_opt |= OCFS2_MOUNT_INODE64;
@@ -1529,13 +1538,16 @@ static int ocfs2_parse_options(struct su
 		}
 	}
 
-	/* Ensure only one heartbeat mode */
-	tmp = mopt->mount_opt & (OCFS2_MOUNT_HB_LOCAL | OCFS2_MOUNT_HB_GLOBAL |
-				 OCFS2_MOUNT_HB_NONE);
-	if (hweight32(tmp) != 1) {
-		mlog(ML_ERROR, "Invalid heartbeat mount options\n");
-		status = 0;
-		goto bail;
+	if (user_stack == 0) {
+		/* Ensure only one heartbeat mode */
+		tmp = mopt->mount_opt & (OCFS2_MOUNT_HB_LOCAL |
+					 OCFS2_MOUNT_HB_GLOBAL |
+					 OCFS2_MOUNT_HB_NONE);
+		if (hweight32(tmp) != 1) {
+			mlog(ML_ERROR, "Invalid heartbeat mount options\n");
+			status = 0;
+			goto bail;
+		}
 	}
 
 	status = 1;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Ocfs2-devel] ocfs2: Check heartbeat mode for kernel stacks only
  2011-01-31 19:31 [Ocfs2-devel] ocfs2: Check heartbeat mode for kernel stacks only Mark Fasheh
@ 2011-01-31 19:51 ` Sunil Mushran
  2011-02-20 10:41 ` Joel Becker
  1 sibling, 0 replies; 3+ messages in thread
From: Sunil Mushran @ 2011-01-31 19:51 UTC (permalink / raw)
  To: ocfs2-devel

Acked-by: Sunil Mushran <sunil.mushran@oracle.com>

On 01/31/2011 11:31 AM, Mark Fasheh wrote:
> Commit 2c442719e90a44a6982c033d69df4aae4b167cfa added some checks for proper
> heartbeat mode when the o2cb stack is running.  Unfortunately, it didn't
> take into account that a userpsace stack could be running. Fix this by only
> doing the check if o2cb is in use. This patch allows userspace stacks to
> mount the fs again.
>
> Cc: stable at kernel.org
> Signed-off-by: Mark Fasheh<mfasheh@suse.com>
>
> Index: linux-2.6.32-SLE11-SP1/fs/ocfs2/super.c
> ===================================================================
> --- linux-2.6.32-SLE11-SP1.orig/fs/ocfs2/super.c
> +++ linux-2.6.32-SLE11-SP1/fs/ocfs2/super.c
> @@ -1331,7 +1331,7 @@ static int ocfs2_parse_options(struct su
>   			       struct mount_options *mopt,
>   			       int is_remount)
>   {
> -	int status;
> +	int status, user_stack = 0;
>   	char *p;
>   	u32 tmp;
>
> @@ -1474,6 +1474,15 @@ static int ocfs2_parse_options(struct su
>   			memcpy(mopt->cluster_stack, args[0].from,
>   			       OCFS2_STACK_LABEL_LEN);
>   			mopt->cluster_stack[OCFS2_STACK_LABEL_LEN] = '\0';
> +			/*
> +			 * Open code the memcmp here as we don't have
> +			 * an osb to pass to
> +			 * ocfs2_userspace_stack().
> +			 */
> +			if (memcmp(mopt->cluster_stack,
> +				   OCFS2_CLASSIC_CLUSTER_STACK,
> +				   OCFS2_STACK_LABEL_LEN))
> +				user_stack = 1;
>   			break;
>   		case Opt_inode64:
>   			mopt->mount_opt |= OCFS2_MOUNT_INODE64;
> @@ -1529,13 +1538,16 @@ static int ocfs2_parse_options(struct su
>   		}
>   	}
>
> -	/* Ensure only one heartbeat mode */
> -	tmp = mopt->mount_opt&  (OCFS2_MOUNT_HB_LOCAL | OCFS2_MOUNT_HB_GLOBAL |
> -				 OCFS2_MOUNT_HB_NONE);
> -	if (hweight32(tmp) != 1) {
> -		mlog(ML_ERROR, "Invalid heartbeat mount options\n");
> -		status = 0;
> -		goto bail;
> +	if (user_stack == 0) {
> +		/* Ensure only one heartbeat mode */
> +		tmp = mopt->mount_opt&  (OCFS2_MOUNT_HB_LOCAL |
> +					 OCFS2_MOUNT_HB_GLOBAL |
> +					 OCFS2_MOUNT_HB_NONE);
> +		if (hweight32(tmp) != 1) {
> +			mlog(ML_ERROR, "Invalid heartbeat mount options\n");
> +			status = 0;
> +			goto bail;
> +		}
>   	}
>
>   	status = 1;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Ocfs2-devel] ocfs2: Check heartbeat mode for kernel stacks only
  2011-01-31 19:31 [Ocfs2-devel] ocfs2: Check heartbeat mode for kernel stacks only Mark Fasheh
  2011-01-31 19:51 ` Sunil Mushran
@ 2011-02-20 10:41 ` Joel Becker
  1 sibling, 0 replies; 3+ messages in thread
From: Joel Becker @ 2011-02-20 10:41 UTC (permalink / raw)
  To: ocfs2-devel

On Mon, Jan 31, 2011 at 11:31:04AM -0800, Mark Fasheh wrote:
> Commit 2c442719e90a44a6982c033d69df4aae4b167cfa added some checks for proper
> heartbeat mode when the o2cb stack is running.  Unfortunately, it didn't
> take into account that a userpsace stack could be running. Fix this by only
> doing the check if o2cb is in use. This patch allows userspace stacks to
> mount the fs again.
> 
> Cc: stable at kernel.org
> Signed-off-by: Mark Fasheh <mfasheh@suse.com>

	This patch is now in the fixes branch of ocfs2.git.

Joel

-- 

"Where are my angels?
 Where's my golden one?
 And where is my hope
 Now that my heroes are gone?"

			http://www.jlbec.org/
			jlbec at evilplan.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-02-20 10:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-31 19:31 [Ocfs2-devel] ocfs2: Check heartbeat mode for kernel stacks only Mark Fasheh
2011-01-31 19:51 ` Sunil Mushran
2011-02-20 10:41 ` Joel Becker

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.