From: Joel Becker <Joel.Becker@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 1/1] ocfs2/cluster: Make fence method configurable
Date: Tue, 17 Nov 2009 13:43:28 -0800 [thread overview]
Message-ID: <20091117214328.GC18683@mail.oracle.com> (raw)
In-Reply-To: <1258492078-32200-1-git-send-email-sunil.mushran@oracle.com>
On Tue, Nov 17, 2009 at 01:07:58PM -0800, Sunil Mushran wrote:
> By default, o2cb fences the box by calling emergency_restart(). While this
> scheme works well in production, it comes in the way during testing as it
> does not let the tester take stack/core dumps for analysis.
>
> This patch allows user to dynamically change the fence method to panic() by:
> # echo "panic" > /sys/kernel/config/cluster/<clustername>/fence_method
>
> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
> ---
> fs/ocfs2/cluster/nodemanager.c | 50 ++++++++++++++++++++++++++++++++++++++++
> fs/ocfs2/cluster/nodemanager.h | 7 +++++
> fs/ocfs2/cluster/quorum.c | 14 +++++++++-
> 3 files changed, 69 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c
> index 7ee6188..77cdc09 100644
> --- a/fs/ocfs2/cluster/nodemanager.c
> +++ b/fs/ocfs2/cluster/nodemanager.c
> @@ -35,6 +35,11 @@
> * cluster references throughout where nodes are looked up */
> struct o2nm_cluster *o2nm_single_cluster = NULL;
>
> +char *o2nm_fence_method_desc[O2NM_FENCE_METHODS + 1] = {
> + "reset", /* O2NM_FENCE_RESET */
> + "panic", /* O2NM_FENCE_PANIC */
> + "unknown",
> +};
Why do you have "unknown"? There's no point to it; we
default to "reset" and you never allow anything about O2NM_FENCE_METHODS
to be set.
> +static ssize_t o2nm_cluster_attr_fence_method_read(
> + struct o2nm_cluster *cluster, char *page)
> +{
> + unsigned int i = O2NM_FENCE_METHODS;
> +
> + if (cluster && cluster->cl_fence_method < O2NM_FENCE_METHODS)
> + i = cluster->cl_fence_method;
cl_fence_method should always be below O2NM_FENCE_METHODS. You
only need to check if(cluster). If cl_fence_method is off, we'll crash,
which is fine.
> + switch (o2nm_single_cluster->cl_fence_method) {
> + case O2NM_FENCE_PANIC:
> + panic("*** ocfs2 is very sorry to be fencing this system by "
> + "panicing ***\n");
> + break;
> + case O2NM_FENCE_RESET:
> + default:
Why not:
+ default:
+ WARN_ON(o2nm_single_cluster->cl_fence_method >=
+ O2NM_FENCE_METHODS);
+ case O2NM_FENCE_RESET:
so that netconsole will catch a wacky cl_fence_method.
> + printk("*** ocfs2 is very sorry to be fencing this system by "
> + "restarting ***\n");
And here, print KERN_ERR so noone filters it out with low klogd
levels.
Joel
--
"For every complex problem there exists a solution that is brief,
concise, and totally wrong."
-Unknown
Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127
prev parent reply other threads:[~2009-11-17 21:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-17 21:07 [Ocfs2-devel] [PATCH 1/1] ocfs2/cluster: Make fence method configurable Sunil Mushran
2009-11-17 21:43 ` Joel Becker [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091117214328.GC18683@mail.oracle.com \
--to=joel.becker@oracle.com \
--cc=ocfs2-devel@oss.oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.