dlm: master - dlm_controld: remove /dev/misc/lock_dlm_plock

David Teigland teigland at fedoraproject.org
Thu Oct 6 17:20:54 UTC 2011


Gitweb:        http://git.fedorahosted.org/git/dlm.git?p=dlm.git;a=commitdiff;h=079325c492e5a5a8c43111fe30f0c09fc6f1019f
Commit:        079325c492e5a5a8c43111fe30f0c09fc6f1019f
Parent:        91ba7d83c9468ca3d9c1ca5e65e45347c1d9160b
Author:        David Teigland <teigland at redhat.com>
AuthorDate:    Thu Oct 6 12:19:34 2011 -0500
Committer:     David Teigland <teigland at redhat.com>
CommitterDate: Thu Oct 6 12:19:34 2011 -0500

dlm_controld: remove /dev/misc/lock_dlm_plock

compat code which was replaced by dlm_plock

Signed-off-by: David Teigland <teigland at redhat.com>
---
 dlm_controld/action.c     |  125 ---------------------------------------------
 dlm_controld/dlm_daemon.h |    3 -
 dlm_controld/plock.c      |   41 ---------------
 3 files changed, 0 insertions(+), 169 deletions(-)

diff --git a/dlm_controld/action.c b/dlm_controld/action.c
index 237221a..78500dd 100644
--- a/dlm_controld/action.c
+++ b/dlm_controld/action.c
@@ -15,7 +15,6 @@ 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[DLM_LOCKSPACE_LEN+1];
 
 #define DLM_SYSFS_DIR "/sys/kernel/dlm"
 #define CLUSTER_DIR   "/sys/kernel/config/dlm/cluster"
@@ -74,87 +73,6 @@ static int detect_protocol(void)
 	return proto;
 }
 
-/* look for an id that matches in e.g. /sys/fs/gfs/bull\:x/lock_module/id
-   and then extract the "x" as the name */
-
-static int get_mountgroup_name(uint32_t mg_id)
-{
-	char path[PATH_MAX];
-	char *fsname;
-	const char *fsdir;
-	DIR *d;
-	FILE *file;
-	struct dirent *de;
-	uint32_t id;
-	int retry_gfs2 = 1;
-	int rv, error;
-
-	fsdir = "/sys/fs/gfs";
- retry:
-	rv = -1;
-
-	d = opendir(fsdir);
-	if (!d) {
-		log_debug("%s: opendir failed: %d", path, errno);
-		goto out;
-	}
-
-	while ((de = readdir(d))) {
-		if (de->d_name[0] == '.')
-			continue;
-
-		id = 0;
-		memset(path, 0, PATH_MAX);
-		snprintf(path, PATH_MAX, "%s/%s/lock_module/id",
-			 fsdir, de->d_name);
-
-		file = fopen(path, "r");
-		if (!file) {
-			log_error("can't open %s %d", path, errno);
-			continue;
-		}
-
-		error = fscanf(file, "%u", &id);
-		fclose(file);
-
-		if (error != 1) {
-			log_error("bad read %s %d", path, errno);
-			continue;
-		}
-		if (id != mg_id) {
-			log_debug("get_mountgroup_name skip %x %s",
-				  id, de->d_name);
-			continue;
-		}
-
-		/* take the fsname out of clustername:fsname */
-		fsname = strstr(de->d_name, ":");
-		if (!fsname) {
-			log_debug("get_mountgroup_name skip2 %x %s",
-				  id, de->d_name);
-			continue;
-		}
-		fsname++;
-
-		log_debug("get_mountgroup_name found %x %s %s",
-			  id, de->d_name, fsname);
-		strncpy(mg_name, fsname, sizeof(mg_name));
-		rv = 0;
-		break;
-	}
-
-	closedir(d);
-
- out:
-	if (rv && retry_gfs2) {
-		retry_gfs2 = 0;
-		fsdir = "/sys/fs/gfs2";
-		goto retry;
-	}
-
-	return rv;
-}
-
 /* This is for the case where dlm_controld exits/fails, abandoning dlm
    lockspaces in the kernel, and then dlm_controld is restarted.  When
    dlm_controld exits and abandons lockspaces, that node needs to be
@@ -186,36 +104,6 @@ int check_uncontrolled_lockspaces(void)
 	return 0;
 }
 
-/* find the mountgroup with "mg_id" in sysfs, get it's name, then look for
-   the ls with with the same name in lockspaces list, return its id */
-
-void set_associated_id(uint32_t mg_id)
-{
-	struct lockspace *ls;
-	int rv;
-
-	log_debug("set_associated_id mg_id %x %d", mg_id, mg_id);
-
-	memset(&mg_name, 0, sizeof(mg_name));
-
-	rv = get_mountgroup_name(mg_id);
-	if (rv) {
-		log_error("no mountgroup found with id %x", mg_id);
-		return;
-	}
-
-	ls = find_ls(mg_name);
-	if (!ls) {
-		log_error("no lockspace found with name %s for mg_id %x",
-			   mg_name, mg_id);
-		return;
-	}
-
-	log_debug("set_associated_id mg %x is ls %x", mg_id, ls->global_id);
-
-	ls->associated_mg_id = mg_id;
-}
-
 static int do_sysfs(const char *name, const char *file, char *val)
 {
 	char fname[512];
@@ -996,7 +884,6 @@ static void find_minors(void)
 	control_minor = 0;
 	monitor_minor = 0;
 	plock_minor = 0;
-	old_plock_minor = 0;
 
 	if (!(fl = fopen("/proc/misc", "r"))) {
 		log_error("/proc/misc fopen failed: %s", strerror(errno));
@@ -1015,9 +902,6 @@ static void find_minors(void)
 			} else if (!strcmp(name, "dlm_plock")) {
 				plock_minor = number;
 				found++;
-			} else if (!strcmp(name, "lock_dlm_plock")) {
-				old_plock_minor = number;
-				found++;
 			}
 
 		} else do {
@@ -1078,15 +962,6 @@ int setup_misc_devices(void)
 			  plock_minor);
 	}
 
-	if (!plock_minor && old_plock_minor) {
-		rv = find_udev_device("/dev/misc/lock_dlm_plock",
-				      old_plock_minor);
-		if (rv < 0)
-			return rv;
-		log_debug("found /dev/misc/lock_dlm_plock minor %u",
-			  old_plock_minor);
-	}
-
 	return 0;
 }
 
diff --git a/dlm_controld/dlm_daemon.h b/dlm_controld/dlm_daemon.h
index 27c9d7a..6f70a17 100644
--- a/dlm_controld/dlm_daemon.h
+++ b/dlm_controld/dlm_daemon.h
@@ -132,7 +132,6 @@ EXTERN int our_nodeid;
 EXTERN uint32_t control_minor;
 EXTERN uint32_t monitor_minor;
 EXTERN uint32_t plock_minor;
-EXTERN uint32_t old_plock_minor;
 
 EXTERN int optk_debug;
 EXTERN int optk_timewarn;
@@ -240,7 +239,6 @@ struct lockspace {
 	int			save_plocks;
 	int			disable_plock;
 	uint32_t		recv_plocks_data_count;
-	uint32_t		associated_mg_id;
 	struct list_head	saved_messages;
 	struct list_head	plock_resources;
 	struct rb_root		plock_resources_root;
@@ -266,7 +264,6 @@ struct lockspace {
 };
 
 /* action.c */
-void set_associated_id(uint32_t mg_id);
 int set_sysfs_control(char *name, int val);
 int set_sysfs_event_done(char *name, int val);
 int set_sysfs_id(char *name, uint32_t id);
diff --git a/dlm_controld/plock.c b/dlm_controld/plock.c
index 4b66904..d475cf4 100644
--- a/dlm_controld/plock.c
+++ b/dlm_controld/plock.c
@@ -26,7 +26,6 @@ static struct timeval plock_recv_time;
 static struct timeval plock_rate_last;
 
 static int plock_device_fd = -1;
-static int need_fsid_translation = 0;
 
 extern int message_flow_control_on;
 
@@ -163,13 +162,6 @@ static const char *ex_str(int optype, int ex)
 		return "RD";
 }
 
-/*
- * In kernels before 2.6.26, plocks came from gfs2's lock_dlm module.
- * Reading plocks from there as well should allow us to use cluster3
- * on old (RHEL5) kernels.  In this case, the fsid we read in plock_info
- * structs is the mountgroup id, which we need to translate to the ls id.
- */
-
 int setup_plocks(void)
 {
 	plock_read_count = 0;
@@ -181,10 +173,6 @@ int setup_plocks(void)
 
 	if (plock_minor) {
 		plock_device_fd = open("/dev/misc/dlm_plock", O_RDWR);
-	} else if (old_plock_minor) {
-		log_debug("setup_plocks using old lock_dlm interface");
-		need_fsid_translation = 1;
-		plock_device_fd = open("/dev/misc/lock_dlm_plock", O_RDWR);
 	}
 
 	if (plock_device_fd < 0) {
@@ -193,9 +181,6 @@ int setup_plocks(void)
 	}
 
 	log_debug("plocks %d", plock_device_fd);
-	log_debug("plock cpg message size: %u bytes",
-		  (unsigned int) (sizeof(struct dlm_header) +
-		                  sizeof(struct dlm_plock_info)));
 
 	return plock_device_fd;
 }
@@ -206,26 +191,6 @@ void close_plocks(void)
 		close(plock_device_fd);
 }
 
-static uint32_t mg_to_ls_id(uint32_t fsid)
-{
-	struct lockspace *ls;
-	int do_set = 1;
-
- retry:
-	list_for_each_entry(ls, &lockspaces, list) {
-		if (ls->associated_mg_id == fsid)
-			return ls->global_id;
-	}
-
-	if (do_set) {
-		do_set = 0;
-		set_associated_id(fsid);
-		goto retry;
-	}
-
-	return fsid;
-}
-
 /* FIXME: unify these two */
 
 static unsigned long time_diff_ms(struct timeval *begin, struct timeval *end)
@@ -724,9 +689,6 @@ static int add_waiter(struct lockspace *ls, struct resource *r,
 static void write_result(struct lockspace *ls, struct dlm_plock_info *in,
 			 int rv)
 {
-	if (need_fsid_translation)
-		in->fsid = ls->associated_mg_id;
-
 	in->rv = rv;
 	write(plock_device_fd, in, sizeof(struct dlm_plock_info));
 }
@@ -1582,9 +1544,6 @@ void process_plocks(int ci)
 		goto fail;
 	}
 
-	if (need_fsid_translation)
-		info.fsid = mg_to_ls_id(info.fsid);
-
 	ls = find_ls_id(info.fsid);
 	if (!ls) {
 		log_plock(ls, "process_plocks: no ls id %x", info.fsid);


More information about the cluster-commits mailing list