Skip to contentSkip to conversation

GFS2 Filesystem [14/16]

PATCH Steven Whitehouse 2 participants 2 messages Feb 24, 2006 – Feb 25, 2006 GFS2 file system

lore
Share & tools
lore
#0 lore raw

[PATCH 14/16] GFS2:

The interface between GFS2 and the DLM. This is the bit which is actually part of GFS2.

 fs/gfs2/locking/dlm/Makefile   |    3 
 fs/gfs2/locking/dlm/lock.c     |  537 +++++++++++++++++++++++++++++++++++++++++
 fs/gfs2/locking/dlm/lock_dlm.h |  191 ++++++++++++++
 fs/gfs2/locking/dlm/main.c     |   62 ++++
 fs/gfs2/locking/dlm/mount.c    |  247 ++++++++++++++++++
 fs/gfs2/locking/dlm/plock.c    |  297 ++++++++++++++++++++++
 fs/gfs2/locking/dlm/sysfs.c    |  218 ++++++++++++++++
 fs/gfs2/locking/dlm/thread.c   |  352 ++++++++++++++++++++++++++
 include/linux/lock_dlm_plock.h |   40 +++
 9 files changed, 1947 insertions(+)
fs/gfs2/locking/dlm/main.c new file +62 -0
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) Sistina Software, Inc.  1997-2003 All rights reserved.
+ * Copyright (C) 2004-2005 Red Hat, Inc.  All rights reserved.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License v.2.
+ */
+
+#include <linux/init.h>
+
+#include "lock_dlm.h"
+
+extern int gdlm_drop_count;
+extern int gdlm_drop_period;
+
+extern struct lm_lockops gdlm_ops;
+
+int __init init_lock_dlm(void)
+{
+	int error;
+
+	error = gfs_register_lockproto(&gdlm_ops);
+	if (error) {
+		printk("lock_dlm:  can't register protocol: %d\n", error);
+		return error;
+	}
+
+	error = gdlm_sysfs_init();
+	if (error) {
+		gfs_unregister_lockproto(&gdlm_ops);
+		return error;
+	}
+
+	error = gdlm_plock_init();
+	if (error) {
+		gdlm_sysfs_exit();
+		gfs_unregister_lockproto(&gdlm_ops);
+		return error;
+	}
+
+	gdlm_drop_count = GDLM_DROP_COUNT;
+	gdlm_drop_period = GDLM_DROP_PERIOD;
+
+	printk("Lock_DLM (built %s %s) installed\n", __DATE__, __TIME__);
+	return 0;
+}
+
+void __exit exit_lock_dlm(void)
+{
+	gdlm_plock_exit();
+	gdlm_sysfs_exit();
+	gfs_unregister_lockproto(&gdlm_ops);
+}
+
+module_init(init_lock_dlm);
+module_exit(exit_lock_dlm);
+
+MODULE_DESCRIPTION("GFS DLM Locking Module");
+MODULE_AUTHOR("Red Hat, Inc.");
+MODULE_LICENSE("GPL");
+
fs/gfs2/locking/dlm/lock.c new file +537 -0

537 lines not on this page · raw message

fs/gfs2/locking/dlm/mount.c new file +247 -0

247 lines not on this page · raw message

fs/gfs2/locking/dlm/plock.c new file +297 -0

297 lines not on this page · raw message

fs/gfs2/locking/dlm/sysfs.c new file +218 -0

218 lines not on this page · raw message

fs/gfs2/locking/dlm/thread.c new file +352 -0

352 lines not on this page · raw message

fs/gfs2/locking/dlm/lock_dlm.h new file +191 -0

191 lines not on this page · raw message

fs/gfs2/locking/dlm/Makefile new file +3 -0
@@ -0,0 +1,3 @@
+obj-$(CONFIG_GFS2_FS) += lock_dlm.o
+lock_dlm-y := lock.o main.o mount.o sysfs.o thread.o plock.o
+
include/linux/lock_dlm_plock.h new file +40 -0
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2005 Red Hat, Inc.  All rights reserved.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License v.2.
+ */
+
+#ifndef __LOCK_DLM_PLOCK_DOT_H__
+#define __LOCK_DLM_PLOCK_DOT_H__
+
+#define GDLM_PLOCK_MISC_NAME		"lock_dlm_plock"
+
+#define GDLM_PLOCK_VERSION_MAJOR	1
+#define GDLM_PLOCK_VERSION_MINOR	0
+#define GDLM_PLOCK_VERSION_PATCH	0
+
+enum {
+	GDLM_PLOCK_OP_LOCK = 1,
+	GDLM_PLOCK_OP_UNLOCK,
+	GDLM_PLOCK_OP_GET,
+};
+
+struct gdlm_plock_info {
+	__u32 version[3];
+	__u8 optype;
+	__u8 ex;
+	__u8 wait;
+	__u8 pad;
+	__u32 pid;
+	__s32 nodeid;
+	__s32 rv;
+	__u32 fsid;
+	__u64 number;
+	__u64 start;
+	__u64 end;
+};
+
+#endif
+
#1 lore raw
Quoted 2 lines · Steven Whitehouse

[PATCH 14/16] GFS2:

[...]

Quoted 6 lines
fs/gfs2/locking/dlm/sysfs.c new file +6 -0
+
+int gdlm_kobject_setup(struct gdlm_ls *ls, struct kobject *fskobj)
+{
+	int error;
+
+	error = kobject_set_name(&ls->kobj, "%s", "lock_module");

fs/gfs2/locking/dlm/sysfs.c line 191

Quoted 10 lines
fs/gfs2/locking/dlm/sysfs.c new file +10 -0
+	if (error) {
+		log_error("can't set kobj name %d", error);
+		return error;
+	}
+
+	ls->kobj.kset = &gdlm_kset;
+	ls->kobj.ktype = &gdlm_ktype;
+	ls->kobj.parent = fskobj;
+
+	error = kobject_register(&ls->kobj);

What prevents races between file system umount (and file system module unloading) and invocations of ->show/->store? This used to be a show-stopper for exporting file system attributes in sysfs.

Nikita.