Skip to contentSkip to conversation

dlm: move plock code from gfs2

PATCH New David Teigland 2 participants 7 messages Apr 15, 2008 – Apr 16, 2008

Subsystems (2)
lore
Share & tools
lore

David Teigland

author maintainer
#0 lore raw

PATCH 5/6 dlm: move plock code from gfs2

Move the code that handles cluster posix locks from gfs2 into the dlm so that it can be used by both gfs2 and ocfs2.

---
 fs/dlm/Makefile                |    1 +
 fs/dlm/dlm_internal.h          |    2 +
 fs/dlm/main.c                  |    7 +
 fs/dlm/plock.c                 |  439 ++++++++++++++++++++++++++++++++++++++++
 fs/gfs2/locking/dlm/Makefile   |    2 +-
 fs/gfs2/locking/dlm/lock_dlm.h |   11 +-
 fs/gfs2/locking/dlm/main.c     |    8 -
 fs/gfs2/locking/dlm/mount.c    |   21 ++
 fs/gfs2/locking/dlm/plock.c    |  406 -------------------------------------
 include/linux/Kbuild           |    2 +-
 include/linux/dlm_plock.h      |   50 +++++
 include/linux/lock_dlm_plock.h |   41 ----
 12 files changed, 523 insertions(+), 467 deletions(-)
 create mode 100644 fs/dlm/plock.c
 delete mode 100644 fs/gfs2/locking/dlm/plock.c
 create mode 100644 include/linux/dlm_plock.h
 delete mode 100644 include/linux/lock_dlm_plock.h
fs/dlm/Makefile +1 -0
index d248e60..ca1c912 100644
@@ -10,6 +10,7 @@ dlm-y :=			ast.o \
 				midcomms.o \
 				netlink.o \
 				lowcomms.o \
+				plock.o \
 				rcom.o \
 				recover.o \
 				recoverd.o \
fs/dlm/dlm_internal.h +2 -0
index c70c8e5..caa1581 100644
@@ -582,6 +582,8 @@ static inline int dlm_no_directory(struct dlm_ls *ls)
 int dlm_netlink_init(void);
 void dlm_netlink_exit(void);
 void dlm_timeout_warn(struct dlm_lkb *lkb);
+int dlm_plock_init(void);
+void dlm_plock_exit(void);
 
 #ifdef CONFIG_DLM_DEBUG
 int dlm_register_debugfs(void);
fs/dlm/main.c +7 -0
index 58487fb..b80e0aa 100644
@@ -46,10 +46,16 @@ static int __init init_dlm(void)
 	if (error)
 		goto out_user;
 
+	error = dlm_plock_init();
+	if (error)
+		goto out_netlink;
+
 	printk("DLM (built %s %s) installed\n", __DATE__, __TIME__);
 
 	return 0;
 
+ out_netlink:
+	dlm_netlink_exit();
  out_user:
 	dlm_user_exit();
  out_debug:
@@ -66,6 +72,7 @@ static int __init init_dlm(void)
 
 static void __exit exit_dlm(void)
 {
+	dlm_plock_exit();
 	dlm_netlink_exit();
 	dlm_user_exit();
 	dlm_config_exit();
fs/dlm/plock.c new file +439 -0

439 lines not on this page · raw message

fs/gfs2/locking/dlm/Makefile +1 -1
index 89b93b6..2609bb6 100644
@@ -1,3 +1,3 @@
 obj-$(CONFIG_GFS2_FS_LOCKING_DLM) += lock_dlm.o
-lock_dlm-y := lock.o main.o mount.o sysfs.o thread.o plock.o
+lock_dlm-y := lock.o main.o mount.o sysfs.o thread.o
 
fs/gfs2/locking/dlm/lock_dlm.h +1 -10
index 9e8265d..55e92af 100644
@@ -25,6 +25,7 @@
 #include <net/sock.h>
 
 #include <linux/dlm.h>
+#include <linux/dlm_plock.h>
 #include <linux/lm_interface.h>
 
 /*
@@ -173,15 +174,5 @@ void gdlm_cancel(void *);
 int gdlm_hold_lvb(void *, char **);
 void gdlm_unhold_lvb(void *, char *);
 
-/* plock.c */
-
-int gdlm_plock_init(void);
-void gdlm_plock_exit(void);
-int gdlm_plock(void *, struct lm_lockname *, struct file *, int,
-		struct file_lock *);
-int gdlm_plock_get(void *, struct lm_lockname *, struct file *,
-		struct file_lock *);
-int gdlm_punlock(void *, struct lm_lockname *, struct file *,
-		struct file_lock *);
 #endif
 
fs/gfs2/locking/dlm/main.c +0 -8
index a0e7eda..867763c 100644
@@ -30,13 +30,6 @@ static int __init init_lock_dlm(void)
 		return error;
 	}
 
-	error = gdlm_plock_init();
-	if (error) {
-		gdlm_sysfs_exit();
-		gfs2_unregister_lockproto(&gdlm_ops);
-		return error;
-	}
-
 	printk(KERN_INFO
 	       "Lock_DLM (built %s %s) installed\n", __DATE__, __TIME__);
 	return 0;
@@ -44,7 +37,6 @@ static int __init init_lock_dlm(void)
 
 static void __exit exit_lock_dlm(void)
 {
-	gdlm_plock_exit();
 	gdlm_sysfs_exit();
 	gfs2_unregister_lockproto(&gdlm_ops);
 }
fs/gfs2/locking/dlm/mount.c +21 -0
index f2efff4..470bdf6 100644
@@ -236,6 +236,27 @@ static void gdlm_withdraw(void *lockspace)
 	gdlm_kobject_release(ls);
 }
 
+static int gdlm_plock(void *lockspace, struct lm_lockname *name,
+	       struct file *file, int cmd, struct file_lock *fl)
+{
+	struct gdlm_ls *ls = lockspace;
+	return dlm_posix_lock(ls->dlm_lockspace, name->ln_number, file, cmd, fl);
+}
+
+static int gdlm_punlock(void *lockspace, struct lm_lockname *name,
+		 struct file *file, struct file_lock *fl)
+{
+	struct gdlm_ls *ls = lockspace;
+	return dlm_posix_unlock(ls->dlm_lockspace, name->ln_number, file, fl);
+}
+
+static int gdlm_plock_get(void *lockspace, struct lm_lockname *name,
+		   struct file *file, struct file_lock *fl)
+{
+	struct gdlm_ls *ls = lockspace;
+	return dlm_posix_get(ls->dlm_lockspace, name->ln_number, file, fl);
+}
+
 const struct lm_lockops gdlm_ops = {
 	.lm_proto_name = "lock_dlm",
 	.lm_mount = gdlm_mount,
fs/gfs2/locking/dlm/plock.c deleted +0 -406

406 lines not on this page · raw message

include/linux/Kbuild +1 -1
index 9cdd12a..7fd04ba 100644
@@ -99,7 +99,7 @@ header-y += ixjuser.h
 header-y += jffs2.h
 header-y += keyctl.h
 header-y += limits.h
-header-y += lock_dlm_plock.h
+header-y += dlm_plock.h
 header-y += magic.h
 header-y += major.h
 header-y += matroxfb.h
include/linux/dlm_plock.h new file +50 -0

50 lines not on this page · raw message

include/linux/lock_dlm_plock.h deleted +0 -41

41 lines not on this page · raw message

Signature · 1 line
1.5.3.3
author maintainer
#1 lore raw

PATCH 5/6 dlm: move plock code from gfs2

Quoted 2 lines · David Teigland

Move the code that handles cluster posix locks from gfs2 into the dlm so that it can be used by both gfs2 and ocfs2.

Attached is a patch to gfs_controld in STABLE2 to adapt to this change. Since the cluster STABLE2 branch is meant to run on the latest released kernel, this won't be commited until 2.6.26 is released.

Dave

#2 lore raw

PATCH 5/6 dlm: move plock code from gfs2

Quoted 7 lines · David Teigland
Quoted 2 lines · David Teigland

Move the code that handles cluster posix locks from gfs2 into the dlm so that it can be used by both gfs2 and ocfs2.

Attached is a patch to gfs_controld in STABLE2 to adapt to this change. Since the cluster STABLE2 branch is meant to run on the latest released kernel, this won't be commited until 2.6.26 is released.

Looks like the patch is empty.

Fabio

--
I'm going to make him an offer he can't refuse.

author maintainer
#3 lore raw

PATCH 5/6 dlm: move plock code from gfs2

Quoted 11 lines · Fabio M. Di Nitto
Quoted 7 lines · David Teigland
Quoted 2 lines · David Teigland

Move the code that handles cluster posix locks from gfs2 into the dlm so that it can be used by both gfs2 and ocfs2.

Attached is a patch to gfs_controld in STABLE2 to adapt to this change. Since the cluster STABLE2 branch is meant to run on the latest released kernel, this won't be commited until 2.6.26 is released.

Looks like the patch is empty.

thanks, second attempt

author maintainer
#4 lore raw

PATCH 5/6 dlm: move plock code from gfs2

Quoted 7 lines · David Teigland
Quoted 6 lines · Fabio M. Di Nitto
Quoted 4 lines · David Teigland
Quoted 2 lines · David Teigland

Move the code that handles cluster posix locks from gfs2 into the dlm so that it can be used by both gfs2 and ocfs2.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Attached is a patch to gfs_controld in STABLE2 to adapt to this change. Since the cluster STABLE2 branch is meant to run on the latest released kernel, this won't be commited until 2.6.26 is released.

Looks like the patch is empty.

thanks, second attempt

That attachment is empty too, baffling, here it is in the body,

author maintainer
#5 lore raw

PATCH 5/6 dlm: move plock code from gfs2

Quoted 12 lines · David Teigland
Quoted 11 lines · David Teigland
Quoted 10 lines · Fabio M. Di Nitto
Quoted 7 lines · David Teigland
Quoted 2 lines · David Teigland

Move the code that handles cluster posix locks from gfs2 into the dlm so that it can be used by both gfs2 and ocfs2.

Attached is a patch to gfs_controld in STABLE2 to adapt to this change. Since the cluster STABLE2 branch is meant to run on the latest released kernel, this won't be commited until 2.6.26 is released.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Looks like the patch is empty.

thanks, second attempt

That attachment is empty too, baffling, here it is in the body,

Looks like the patch headers confused the mailing list. Took them off this time...

-------------- next part --------------
In kernels before 2.6.26, cluster posix lock ops are passed to user space through the gfs-specific lock_dlm module. In 2.6.26, the same ops are passed to user space through the dlm module. Update gfs_controld to read the plock ops from either module, depending on the kernel.

---
 group/gfs_controld/lock_dlm.h |    1 +
 group/gfs_controld/plock.c    |  256 ++++++++++++++++++++++++++++++++---------
 2 files changed, 201 insertions(+), 56 deletions(-)
group/gfs_controld/lock_dlm.h +1 -0
index 7b514df..746d0c7 100644
@@ -121,6 +121,7 @@ struct mountpoint {
 struct mountgroup {
 	struct list_head	list;
 	uint32_t		id;
+	uint32_t		associated_ls_id;
 	struct list_head	members;
 	struct list_head	members_gone;
 	int			memb_count;
group/gfs_controld/plock.c +200 -56

550 lines not on this page · raw message

Signature · 1 line
1.5.3.3
#6 lore raw

PATCH 5/6 dlm: move plock code from gfs2

In reply to David Teigland
Quoted 7 lines · David Teigland
Quoted 6 lines · Fabio M. Di Nitto
Quoted 4 lines · David Teigland
Quoted 2 lines · David Teigland

Move the code that handles cluster posix locks from gfs2 into the dlm so that it can be used by both gfs2 and ocfs2.

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

Attached is a patch to gfs_controld in STABLE2 to adapt to this change. Since the cluster STABLE2 branch is meant to run on the latest released kernel, this won't be commited until 2.6.26 is released.

Looks like the patch is empty.

thanks, second attempt

Looks like a problem with the mailing list. The copy in CC to me had the patch. The one to the mailing list not.

Am I the only one?

Fabio

--
I'm going to make him an offer he can't refuse.