FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 04-15-2008, 08:02 PM
 
Default Cluster Project branch, master, updated. gfs-kernel_0_1_22-171-gebda3b1

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Cluster Project".

http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=ebda3b163c abd4e0f04127637ed73caf9caf2704

The branch, master has been updated
via ebda3b163cabd4e0f04127637ed73caf9caf2704 (commit)
via 5256ae5d59dd44bfb4b551a2ce1cb9eac71be845 (commit)
from f5a705d3ed1843f403f0d03aeae447f0b6ca10a9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ebda3b163cabd4e0f04127637ed73caf9caf2704
Author: David Teigland <teigland@redhat.com>
Date: Mon Apr 14 15:44:01 2008 -0500

dlm_controld: max name length sanity

Define MAX_LS_NAME 64, and note that it should match MAX_LOCKSPACE_LEN in
dlmconstants.h. Including linux/dlm.h directly is difficult because some files
need to include libdlm.h which doesn't combine nicely with linux/dlm.h.

Signed-off-by: David Teigland <teigland@redhat.com>

commit 5256ae5d59dd44bfb4b551a2ce1cb9eac71be845
Author: David Teigland <teigland@redhat.com>
Date: Mon Apr 14 15:24:34 2008 -0500

libdlm: max name length sanity

Attempting to bring some sanity to handling of max lockspace name length
and max resource name length. A new kernel patch creates single authoritative
definitions in linux/dlmconstants.h:

define DLM_LOCKSPACE_LEN 64
define DLM_RESNAME_MAXLEN 64

These definitions are copied in libdlm.h so that user apps don't need to
include the kernel header. libdlm itself uses the dlmconstants.h
definitions, and now checks both resource and lockspace name params against
these definitions before calling into dlm-kernel. dlm-kernel checks each
of the input names against these definitions when creating a new rsb or ls.

Signed-off-by: David Teigland <teigland@redhat.com>

-----------------------------------------------------------------------

Summary of changes:
dlm/lib/libdlm.c | 36 ++++++++++++++++++++++++++++--------
dlm/lib/libdlm.h | 7 +++++++
group/dlm_controld/action.c | 4 ++--
group/dlm_controld/dlm_daemon.h | 29 +++++++++++++++++++++++------
group/dlm_controld/group.c | 4 ++--
group/dlm_controld/main.c | 4 +++-
6 files changed, 65 insertions(+), 19 deletions(-)

diff --git a/dlm/lib/libdlm.c b/dlm/lib/libdlm.c
index 4bafbbc..fe01af2 100644
--- a/dlm/lib/libdlm.c
+++ b/dlm/lib/libdlm.c
@@ -47,6 +47,10 @@
#include "libdlm.h"
#include <linux/dlm_device.h>

+/* this define will come through linux/dlm.h in 2.6.25-rc */
+#ifndef EXPERIMENTAL_BUILD
+#define DLM_LOCKSPACE_LEN 64
+#endif

#define PROC_MISC "/proc/misc"
#define MISC_PREFIX "/dev/misc/"
@@ -1262,32 +1266,48 @@ int dlm_ls_pthread_init(dlm_lshandle_t ls)

static int create_lockspace_v5(const char *name, uint32_t flags)
{
- char reqbuf[sizeof(struct dlm_write_request_v5) + strlen(name)];
+ char reqbuf[sizeof(struct dlm_write_request_v5) + DLM_LOCKSPACE_LEN];
struct dlm_write_request_v5 *req = (struct dlm_write_request_v5 *)reqbuf;
+ int namelen = strlen(name);
int minor;

- req->cmd = DLM_USER_CREATE_LOCKSPACE;
+ memset(reqbuf, 0, sizeof(reqbuf));
set_version_v5(req);
- strcpy(req->i.lspace.name, name);
+
+ req->cmd = DLM_USER_CREATE_LOCKSPACE;
req->i.lspace.flags = flags;

- minor = write(control_fd, req, sizeof(*req) + strlen(name));
+ if (namelen > DLM_LOCKSPACE_LEN) {
+ errno = EINVAL;
+ return -1;
+ }
+ memcpy(req->i.lspace.name, name, namelen);
+
+ minor = write(control_fd, req, sizeof(*req) + namelen);

return minor;
}

static int create_lockspace_v6(const char *name, uint32_t flags)
{
- char reqbuf[sizeof(struct dlm_write_request) + strlen(name)];
+ char reqbuf[sizeof(struct dlm_write_request) + DLM_LOCKSPACE_LEN];
struct dlm_write_request *req = (struct dlm_write_request *)reqbuf;
+ int namelen = strlen(name);
int minor;

- req->cmd = DLM_USER_CREATE_LOCKSPACE;
+ memset(reqbuf, 0, sizeof(reqbuf));
set_version_v6(req);
- strcpy(req->i.lspace.name, name);
+
+ req->cmd = DLM_USER_CREATE_LOCKSPACE;
req->i.lspace.flags = flags;

- minor = write(control_fd, req, sizeof(*req) + strlen(name));
+ if (namelen > DLM_LOCKSPACE_LEN) {
+ errno = EINVAL;
+ return -1;
+ }
+ memcpy(req->i.lspace.name, name, namelen);
+
+ minor = write(control_fd, req, sizeof(*req) + namelen);

return minor;
}
diff --git a/dlm/lib/libdlm.h b/dlm/lib/libdlm.h
index 2882c30..f7e64dd 100644
--- a/dlm/lib/libdlm.h
+++ b/dlm/lib/libdlm.h
@@ -34,6 +34,13 @@

#ifndef BUILDING_LIBDLM

+/*
+ * These two lengths are copied from linux/dlmconstants.h
+ * They are the max length of a lockspace name and the max length of a
+ * resource name.
+ */
+
+#define DLM_LOCKSPACE_LEN 64
#define DLM_RESNAME_MAXLEN 64

struct dlm_lksb {
diff --git a/group/dlm_controld/action.c b/group/dlm_controld/action.c
index b7c422b..6d2db05 100644
--- a/group/dlm_controld/action.c
+++ b/group/dlm_controld/action.c
@@ -17,7 +17,7 @@ static int dir_members[MAX_NODES];
static int dir_members_count;
static int comms_nodes[MAX_NODES];
static int comms_nodes_count;
-static char mg_name[MAXNAME+1];
+static char mg_name[MAX_LS_NAME+1];

#define DLM_SYSFS_DIR "/sys/kernel/dlm"
#define CLUSTER_DIR "/sys/kernel/config/dlm/cluster"
@@ -87,7 +87,7 @@ static int get_mountgroup_name(uint32_t mg_id)

log_debug("get_mountgroup_name found %x %s %s",
id, de->d_name, fsname);
- strncpy(mg_name, fsname, 256);
+ strncpy(mg_name, fsname, sizeof(mg_name));
rv = 0;
break;
}
diff --git a/group/dlm_controld/dlm_daemon.h b/group/dlm_controld/dlm_daemon.h
index b969bdc..e0bca8a 100644
--- a/group/dlm_controld/dlm_daemon.h
+++ b/group/dlm_controld/dlm_daemon.h
@@ -51,12 +51,29 @@
#include "list.h"
#include "linux_endian.h"

-#define MAXARGS 8
-#define MAXLINE 256
-#define MAXCON 4
-#define MAXNAME 255
-#define MAX_NODES 256 /* should be same as MAX_GROUP_MEMBERS */
+/* Maximum lockspace name length, should match MAX_LOCKSPACE_NAME in
+ linux/dlmconstants.h (copied in libdlm.h). The libcpg limit is
+ larger at CPG_MAX_NAME_LENGTH 128. Our cpg name includes a "dlm:"
+ prefix before the lockspace name. */
+
+#define MAX_LS_NAME 64
+
+/* Maximum members of a lockspace, should match CPG_MEMBERS_MAX in openais/cpg.h.
+ There are no max defines in dlm-kernel for lockspace members. */
+
+#define MAX_NODES 128
+
+/* Maximum number of IP addresses per node, when using SCTP and multi-ring in
+ openais. In dlm-kernel this is DLM_MAX_ADDR_COUNT, currently 3. */
+
#define MAX_NODE_ADDRESSES 4
+
+/* Max string length printed on a line, for debugging/dump output. */
+
+#define MAXLINE 256
+
+/* Size of the circular debug buffer. */
+
#define DUMP_SIZE (1024 * 1024)

extern int daemon_debug_opt;
@@ -139,7 +156,7 @@ struct dlm_header {

struct lockspace {
struct list_head list;
- char name[MAXNAME+1];
+ char name[MAX_LS_NAME+1];
uint32_t global_id;

/* lockspace membership stuff */
diff --git a/group/dlm_controld/group.c b/group/dlm_controld/group.c
index 8dc68a1..f9bfccb 100644
--- a/group/dlm_controld/group.c
+++ b/group/dlm_controld/group.c
@@ -26,12 +26,12 @@

group_handle_t gh;
static int cb_action;
-static char cb_name[MAX_GROUP_NAME_LEN+1];
+static char cb_name[MAX_LS_NAME+1];
static int cb_event_nr;
static unsigned int cb_id;
static int cb_type;
static int cb_member_count;
-static int cb_members[MAX_GROUP_MEMBERS];
+static int cb_members[MAX_NODES];


static void stop_cbfn(group_handle_t h, void *private, char *name)
diff --git a/group/dlm_controld/main.c b/group/dlm_controld/main.c
index a3f3012..251548b 100644
--- a/group/dlm_controld/main.c
+++ b/group/dlm_controld/main.c
@@ -183,7 +183,7 @@ static struct lockspace *create_ls(char *name)
if (!ls)
goto out;
memset(ls, 0, sizeof(*ls));
- strncpy(ls->name, name, MAXNAME);
+ strncpy(ls->name, name, MAX_LS_NAME);

INIT_LIST_HEAD(&ls->changes);
INIT_LIST_HEAD(&ls->node_history);
@@ -219,6 +219,8 @@ struct lockspace *find_ls_id(uint32_t id)
return NULL;
}

+#define MAXARGS 8
+
static char *get_args(char *buf, int *argc, char **argv, char sep, int want)
{
char *p = buf, *rp = NULL;


hooks/post-receive
--
Cluster Project
 

Thread Tools




All times are GMT. The time now is 05:55 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org