Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 89552
b: refs/heads/master
c: 6953b4c
h: refs/heads/master
v: v3
  • Loading branch information
Joel Becker authored and Mark Fasheh committed Apr 18, 2008
1 parent 0306ec2 commit 6b8a1df
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 56 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 19fdb624dc8ccb663f6e48b3a3a3fa4e4e567fc1
refs/heads/master: 6953b4c008628b945bfe0cee97f6e78a98773859
4 changes: 0 additions & 4 deletions trunk/fs/ocfs2/dlmglue.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@
#include <linux/debugfs.h>
#include <linux/seq_file.h>

#include <cluster/heartbeat.h>
#include <cluster/nodemanager.h>
#include <cluster/tcp.h>

#define MLOG_MASK_PREFIX ML_DLM_GLUE
#include <cluster/masklog.h>

Expand Down
33 changes: 0 additions & 33 deletions trunk/fs/ocfs2/heartbeat.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/highmem.h>
#include <linux/kmod.h>

#define MLOG_MASK_PREFIX ML_SUPER
#include <cluster/masklog.h>
Expand Down Expand Up @@ -83,38 +82,6 @@ void ocfs2_do_node_down(int node_num, void *data)
ocfs2_recovery_thread(osb, node_num);
}

void ocfs2_stop_heartbeat(struct ocfs2_super *osb)
{
int ret;
char *argv[5], *envp[3];

if (ocfs2_mount_local(osb))
return;

if (!osb->uuid_str) {
/* This can happen if we don't get far enough in mount... */
mlog(0, "No UUID with which to stop heartbeat!\n\n");
return;
}

argv[0] = (char *)o2nm_get_hb_ctl_path();
argv[1] = "-K";
argv[2] = "-u";
argv[3] = osb->uuid_str;
argv[4] = NULL;

mlog(0, "Run: %s %s %s %s\n", argv[0], argv[1], argv[2], argv[3]);

/* minimal command environment taken from cpu_run_sbin_hotplug */
envp[0] = "HOME=/";
envp[1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
envp[2] = NULL;

ret = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC);
if (ret < 0)
mlog_errno(ret);
}

static inline void __ocfs2_node_map_set_bit(struct ocfs2_node_map *map,
int bit)
{
Expand Down
1 change: 0 additions & 1 deletion trunk/fs/ocfs2/heartbeat.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
void ocfs2_init_node_maps(struct ocfs2_super *osb);

void ocfs2_do_node_down(int node_num, void *data);
void ocfs2_stop_heartbeat(struct ocfs2_super *osb);

/* node map functions - used to keep track of mounted and in-recovery
* nodes. */
Expand Down
1 change: 1 addition & 0 deletions trunk/fs/ocfs2/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include <linux/fs.h>
#include <linux/mount.h>
#include <linux/smp_lock.h>

#define MLOG_MASK_PREFIX ML_INODE
#include <cluster/masklog.h>
Expand Down
4 changes: 0 additions & 4 deletions trunk/fs/ocfs2/ocfs2.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@
#include <linux/mutex.h>
#include <linux/jbd.h>

#include "cluster/nodemanager.h"
#include "cluster/heartbeat.h"
#include "cluster/tcp.h"

/* For union ocfs2_dlm_lksb */
#include "stackglue.h"

Expand Down
50 changes: 50 additions & 0 deletions trunk/fs/ocfs2/stackglue.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@

#include <linux/slab.h>
#include <linux/crc32.h>
#include <linux/kmod.h>

/* Needed for AOP_TRUNCATED_PAGE in mlog_errno() */
#include <linux/fs.h>

#include "cluster/masklog.h"
#include "cluster/nodemanager.h"
#include "cluster/heartbeat.h"

#include "stackglue.h"

Expand Down Expand Up @@ -301,6 +303,13 @@ int ocfs2_cluster_connect(const char *group,
goto out;
}

/* for now we only have one cluster/node, make sure we see it
* in the heartbeat universe */
if (!o2hb_check_local_node_heartbeating()) {
rc = -EINVAL;
goto out;
}

new_conn = kzalloc(sizeof(struct ocfs2_cluster_connection),
GFP_KERNEL);
if (!new_conn) {
Expand Down Expand Up @@ -359,6 +368,7 @@ int ocfs2_cluster_connect(const char *group,
return rc;
}


int ocfs2_cluster_disconnect(struct ocfs2_cluster_connection *conn)
{
struct dlm_ctxt *dlm = conn->cc_lockspace;
Expand All @@ -373,6 +383,46 @@ int ocfs2_cluster_disconnect(struct ocfs2_cluster_connection *conn)
return 0;
}

static void o2hb_stop(const char *group)
{
int ret;
char *argv[5], *envp[3];

argv[0] = (char *)o2nm_get_hb_ctl_path();
argv[1] = "-K";
argv[2] = "-u";
argv[3] = (char *)group;
argv[4] = NULL;

mlog(0, "Run: %s %s %s %s\n", argv[0], argv[1], argv[2], argv[3]);

/* minimal command environment taken from cpu_run_sbin_hotplug */
envp[0] = "HOME=/";
envp[1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
envp[2] = NULL;

ret = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC);
if (ret < 0)
mlog_errno(ret);
}

/*
* Hangup is a hack for tools compatibility. Older ocfs2-tools software
* expects the filesystem to call "ocfs2_hb_ctl" during unmount. This
* happens regardless of whether the DLM got started, so we can't do it
* in ocfs2_cluster_disconnect(). We bring the o2hb_stop() function into
* the glue and provide a "hangup" API for super.c to call.
*
* Other stacks will eventually provide a NULL ->hangup() pointer.
*/
void ocfs2_cluster_hangup(const char *group, int grouplen)
{
BUG_ON(group == NULL);
BUG_ON(group[grouplen] != '\0');

o2hb_stop(group);
}

int ocfs2_cluster_this_node(unsigned int *node)
{
int node_num;
Expand Down
1 change: 1 addition & 0 deletions trunk/fs/ocfs2/stackglue.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ int ocfs2_cluster_connect(const char *group,
void *recovery_data,
struct ocfs2_cluster_connection **conn);
int ocfs2_cluster_disconnect(struct ocfs2_cluster_connection *conn);
void ocfs2_cluster_hangup(const char *group, int grouplen);
int ocfs2_cluster_this_node(unsigned int *node);

int ocfs2_dlm_lock(struct ocfs2_cluster_connection *conn,
Expand Down
23 changes: 10 additions & 13 deletions trunk/fs/ocfs2/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
#include <linux/crc32.h>
#include <linux/debugfs.h>
#include <linux/mount.h>

#include <cluster/nodemanager.h>
#include <linux/seq_file.h>

#define MLOG_MASK_PREFIX ML_SUPER
#include <cluster/masklog.h>
Expand Down Expand Up @@ -579,15 +578,6 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
goto read_super_error;
}

/* for now we only have one cluster/node, make sure we see it
* in the heartbeat universe */
if (parsed_options.mount_opt & OCFS2_MOUNT_HB_LOCAL) {
if (!o2hb_check_local_node_heartbeating()) {
status = -EINVAL;
goto read_super_error;
}
}

/* probe for superblock */
status = ocfs2_sb_probe(sb, &bh, &sector_size);
if (status < 0) {
Expand Down Expand Up @@ -1275,8 +1265,15 @@ static void ocfs2_dismount_volume(struct super_block *sb, int mnt_err)

debugfs_remove(osb->osb_debug_root);

if (!mnt_err)
ocfs2_stop_heartbeat(osb);
/*
* This is a small hack to move ocfs2_hb_ctl into stackglue.
* If we're dismounting due to mount error, mount.ocfs2 will clean
* up heartbeat. If we're a local mount, there is no heartbeat.
* If we failed before we got a uuid_str yet, we can't stop
* heartbeat. Otherwise, do it.
*/
if (!mnt_err && !ocfs2_mount_local(osb) && osb->uuid_str)
ocfs2_cluster_hangup(osb->uuid_str, strlen(osb->uuid_str));

atomic_set(&osb->vol_state, VOLUME_DISMOUNTED);

Expand Down

0 comments on commit 6b8a1df

Please sign in to comment.