aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/stackglue.c
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2008-05-30 18:43:58 -0400
committerMark Fasheh <mfasheh@suse.com>2008-06-16 13:46:51 -0400
commit9f9a99f4eccc64650e932090cff0ebd07b81e334 (patch)
tree44315dfb1b5f3d4fc802e4d7cde5d681832b34f0 /fs/ocfs2/stackglue.c
parent3878f110f71a0971ff7acc15dd6db711b6ef37c6 (diff)
ocfs2: Move the call of ocfs2_hb_ctl into the stack glue.
Take o2hb_stop() out of the o2cb code and make it part of the generic stack glue as ocfs2_leave_group(). This also allows us to remove the ocfs2_get_hb_ctl_path() function - everything to do with hb_ctl is now part of stackglue.c. o2cb no longer needs a ->hangup() function. Signed-off-by: Joel Becker <joel.becker@oracle.com> Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2/stackglue.c')
-rw-r--r--fs/ocfs2/stackglue.c49
1 files changed, 40 insertions, 9 deletions
diff --git a/fs/ocfs2/stackglue.c b/fs/ocfs2/stackglue.c
index fb9b8e0db260..5f78ff4c76c7 100644
--- a/fs/ocfs2/stackglue.c
+++ b/fs/ocfs2/stackglue.c
@@ -34,11 +34,13 @@
34 34
35#define OCFS2_STACK_PLUGIN_O2CB "o2cb" 35#define OCFS2_STACK_PLUGIN_O2CB "o2cb"
36#define OCFS2_STACK_PLUGIN_USER "user" 36#define OCFS2_STACK_PLUGIN_USER "user"
37#define OCFS2_MAX_HB_CTL_PATH 256
37 38
38static struct ocfs2_locking_protocol *lproto; 39static struct ocfs2_locking_protocol *lproto;
39static DEFINE_SPINLOCK(ocfs2_stack_lock); 40static DEFINE_SPINLOCK(ocfs2_stack_lock);
40static LIST_HEAD(ocfs2_stack_list); 41static LIST_HEAD(ocfs2_stack_list);
41static char cluster_stack_name[OCFS2_STACK_LABEL_LEN + 1]; 42static char cluster_stack_name[OCFS2_STACK_LABEL_LEN + 1];
43static char ocfs2_hb_ctl_path[OCFS2_MAX_HB_CTL_PATH] = "/sbin/ocfs2_hb_ctl";
42 44
43/* 45/*
44 * The stack currently in use. If not null, active_stack->sp_count > 0, 46 * The stack currently in use. If not null, active_stack->sp_count > 0,
@@ -363,6 +365,42 @@ int ocfs2_cluster_disconnect(struct ocfs2_cluster_connection *conn,
363} 365}
364EXPORT_SYMBOL_GPL(ocfs2_cluster_disconnect); 366EXPORT_SYMBOL_GPL(ocfs2_cluster_disconnect);
365 367
368/*
369 * Leave the group for this filesystem. This is executed by a userspace
370 * program (stored in ocfs2_hb_ctl_path).
371 */
372static void ocfs2_leave_group(const char *group)
373{
374 int ret;
375 char *argv[5], *envp[3];
376
377 argv[0] = ocfs2_hb_ctl_path;
378 argv[1] = "-K";
379 argv[2] = "-u";
380 argv[3] = (char *)group;
381 argv[4] = NULL;
382
383 /* minimal command environment taken from cpu_run_sbin_hotplug */
384 envp[0] = "HOME=/";
385 envp[1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
386 envp[2] = NULL;
387
388 ret = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC);
389 if (ret < 0) {
390 printk(KERN_ERR
391 "ocfs2: Error %d running user helper "
392 "\"%s %s %s %s\"\n",
393 ret, argv[0], argv[1], argv[2], argv[3]);
394 }
395}
396
397/*
398 * Hangup is a required post-umount. ocfs2-tools software expects the
399 * filesystem to call "ocfs2_hb_ctl" during unmount. This happens
400 * regardless of whether the DLM got started, so we can't do it
401 * in ocfs2_cluster_disconnect(). The ocfs2_leave_group() function does
402 * the actual work.
403 */
366void ocfs2_cluster_hangup(const char *group, int grouplen) 404void ocfs2_cluster_hangup(const char *group, int grouplen)
367{ 405{
368 BUG_ON(group == NULL); 406 BUG_ON(group == NULL);
@@ -371,6 +409,8 @@ void ocfs2_cluster_hangup(const char *group, int grouplen)
371 if (active_stack->sp_ops->hangup) 409 if (active_stack->sp_ops->hangup)
372 active_stack->sp_ops->hangup(group, grouplen); 410 active_stack->sp_ops->hangup(group, grouplen);
373 411
412 ocfs2_leave_group(group);
413
374 /* cluster_disconnect() was called with hangup_pending==1 */ 414 /* cluster_disconnect() was called with hangup_pending==1 */
375 ocfs2_stack_driver_put(); 415 ocfs2_stack_driver_put();
376} 416}
@@ -559,9 +599,6 @@ error:
559 599
560#define FS_OCFS2_NM 1 600#define FS_OCFS2_NM 1
561 601
562#define OCFS2_MAX_HB_CTL_PATH 256
563static char ocfs2_hb_ctl_path[OCFS2_MAX_HB_CTL_PATH] = "/sbin/ocfs2_hb_ctl";
564
565static ctl_table ocfs2_nm_table[] = { 602static ctl_table ocfs2_nm_table[] = {
566 { 603 {
567 .ctl_name = 1, 604 .ctl_name = 1,
@@ -613,12 +650,6 @@ static ctl_table ocfs2_root_table[] = {
613 650
614static struct ctl_table_header *ocfs2_table_header = NULL; 651static struct ctl_table_header *ocfs2_table_header = NULL;
615 652
616const char *ocfs2_get_hb_ctl_path(void)
617{
618 return ocfs2_hb_ctl_path;
619}
620EXPORT_SYMBOL_GPL(ocfs2_get_hb_ctl_path);
621
622 653
623/* 654/*
624 * Initialization 655 * Initialization