diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-22 16:44:23 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-22 16:44:23 -0400 |
| commit | 03b883840c630c7b571690577809754739ac773f (patch) | |
| tree | aeec0581accf5e19360205e21dd25a220b4a0e54 | |
| parent | 0d07a15bdb5a4ea6271b6e874d307c48151ef546 (diff) | |
| parent | c1c76743e98346eb052b707f0e054377a09441d1 (diff) | |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/dlm
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/dlm:
dlm: linux/{dlm,dlm_device}.h: cleanup for userspace
dlm: common max length definitions
dlm: move plock code from gfs2
dlm: recover nodes that are removed and re-added
dlm: save master info after failed no-queue request
dlm: make dlm_print_rsb() static
dlm: match signedness between dlm_config_info and cluster_set
| -rw-r--r-- | fs/dlm/Makefile | 1 | ||||
| -rw-r--r-- | fs/dlm/config.c | 50 | ||||
| -rw-r--r-- | fs/dlm/config.h | 3 | ||||
| -rw-r--r-- | fs/dlm/dlm_internal.h | 8 | ||||
| -rw-r--r-- | fs/dlm/lock.c | 5 | ||||
| -rw-r--r-- | fs/dlm/lock.h | 1 | ||||
| -rw-r--r-- | fs/dlm/main.c | 7 | ||||
| -rw-r--r-- | fs/dlm/member.c | 34 | ||||
| -rw-r--r-- | fs/dlm/plock.c (renamed from fs/gfs2/locking/dlm/plock.c) | 169 | ||||
| -rw-r--r-- | fs/dlm/recoverd.c | 1 | ||||
| -rw-r--r-- | fs/gfs2/locking/dlm/Makefile | 2 | ||||
| -rw-r--r-- | fs/gfs2/locking/dlm/lock_dlm.h | 12 | ||||
| -rw-r--r-- | fs/gfs2/locking/dlm/main.c | 8 | ||||
| -rw-r--r-- | fs/gfs2/locking/dlm/mount.c | 21 | ||||
| -rw-r--r-- | include/linux/Kbuild | 2 | ||||
| -rw-r--r-- | include/linux/dlm.h | 7 | ||||
| -rw-r--r-- | include/linux/dlm_device.h | 11 | ||||
| -rw-r--r-- | include/linux/dlm_plock.h | 50 | ||||
| -rw-r--r-- | include/linux/dlmconstants.h | 4 | ||||
| -rw-r--r-- | include/linux/lock_dlm_plock.h | 41 |
20 files changed, 276 insertions, 161 deletions
diff --git a/fs/dlm/Makefile b/fs/dlm/Makefile index d248e60951ba..ca1c9124c8ce 100644 --- a/fs/dlm/Makefile +++ b/fs/dlm/Makefile | |||
| @@ -10,6 +10,7 @@ dlm-y := ast.o \ | |||
| 10 | midcomms.o \ | 10 | midcomms.o \ |
| 11 | netlink.o \ | 11 | netlink.o \ |
| 12 | lowcomms.o \ | 12 | lowcomms.o \ |
| 13 | plock.o \ | ||
| 13 | rcom.o \ | 14 | rcom.o \ |
| 14 | recover.o \ | 15 | recover.o \ |
| 15 | recoverd.o \ | 16 | recoverd.o \ |
diff --git a/fs/dlm/config.c b/fs/dlm/config.c index c3ad1dff3b25..eac23bd288b2 100644 --- a/fs/dlm/config.c +++ b/fs/dlm/config.c | |||
| @@ -114,7 +114,7 @@ struct cluster_attribute { | |||
| 114 | }; | 114 | }; |
| 115 | 115 | ||
| 116 | static ssize_t cluster_set(struct cluster *cl, unsigned int *cl_field, | 116 | static ssize_t cluster_set(struct cluster *cl, unsigned int *cl_field, |
| 117 | unsigned int *info_field, int check_zero, | 117 | int *info_field, int check_zero, |
| 118 | const char *buf, size_t len) | 118 | const char *buf, size_t len) |
| 119 | { | 119 | { |
| 120 | unsigned int x; | 120 | unsigned int x; |
| @@ -284,6 +284,7 @@ struct node { | |||
| 284 | struct list_head list; /* space->members */ | 284 | struct list_head list; /* space->members */ |
| 285 | int nodeid; | 285 | int nodeid; |
| 286 | int weight; | 286 | int weight; |
| 287 | int new; | ||
| 287 | }; | 288 | }; |
| 288 | 289 | ||
| 289 | static struct configfs_group_operations clusters_ops = { | 290 | static struct configfs_group_operations clusters_ops = { |
| @@ -565,6 +566,7 @@ static struct config_item *make_node(struct config_group *g, const char *name) | |||
| 565 | config_item_init_type_name(&nd->item, name, &node_type); | 566 | config_item_init_type_name(&nd->item, name, &node_type); |
| 566 | nd->nodeid = -1; | 567 | nd->nodeid = -1; |
| 567 | nd->weight = 1; /* default weight of 1 if none is set */ | 568 | nd->weight = 1; /* default weight of 1 if none is set */ |
| 569 | nd->new = 1; /* set to 0 once it's been read by dlm_nodeid_list() */ | ||
| 568 | 570 | ||
| 569 | mutex_lock(&sp->members_lock); | 571 | mutex_lock(&sp->members_lock); |
| 570 | list_add(&nd->list, &sp->members); | 572 | list_add(&nd->list, &sp->members); |
| @@ -805,12 +807,13 @@ static void put_comm(struct comm *cm) | |||
| 805 | } | 807 | } |
| 806 | 808 | ||
| 807 | /* caller must free mem */ | 809 | /* caller must free mem */ |
| 808 | int dlm_nodeid_list(char *lsname, int **ids_out) | 810 | int dlm_nodeid_list(char *lsname, int **ids_out, int *ids_count_out, |
| 811 | int **new_out, int *new_count_out) | ||
| 809 | { | 812 | { |
| 810 | struct space *sp; | 813 | struct space *sp; |
| 811 | struct node *nd; | 814 | struct node *nd; |
| 812 | int i = 0, rv = 0; | 815 | int i = 0, rv = 0, ids_count = 0, new_count = 0; |
| 813 | int *ids; | 816 | int *ids, *new; |
| 814 | 817 | ||
| 815 | sp = get_space(lsname); | 818 | sp = get_space(lsname); |
| 816 | if (!sp) | 819 | if (!sp) |
| @@ -818,23 +821,50 @@ int dlm_nodeid_list(char *lsname, int **ids_out) | |||
| 818 | 821 | ||
| 819 | mutex_lock(&sp->members_lock); | 822 | mutex_lock(&sp->members_lock); |
| 820 | if (!sp->members_count) { | 823 | if (!sp->members_count) { |
| 821 | rv = 0; | 824 | rv = -EINVAL; |
| 825 | printk(KERN_ERR "dlm: zero members_count\n"); | ||
| 822 | goto out; | 826 | goto out; |
| 823 | } | 827 | } |
| 824 | 828 | ||
| 825 | ids = kcalloc(sp->members_count, sizeof(int), GFP_KERNEL); | 829 | ids_count = sp->members_count; |
| 830 | |||
| 831 | ids = kcalloc(ids_count, sizeof(int), GFP_KERNEL); | ||
| 826 | if (!ids) { | 832 | if (!ids) { |
| 827 | rv = -ENOMEM; | 833 | rv = -ENOMEM; |
| 828 | goto out; | 834 | goto out; |
| 829 | } | 835 | } |
| 830 | 836 | ||
| 831 | rv = sp->members_count; | 837 | list_for_each_entry(nd, &sp->members, list) { |
| 832 | list_for_each_entry(nd, &sp->members, list) | ||
| 833 | ids[i++] = nd->nodeid; | 838 | ids[i++] = nd->nodeid; |
| 839 | if (nd->new) | ||
| 840 | new_count++; | ||
| 841 | } | ||
| 842 | |||
| 843 | if (ids_count != i) | ||
| 844 | printk(KERN_ERR "dlm: bad nodeid count %d %d\n", ids_count, i); | ||
| 845 | |||
| 846 | if (!new_count) | ||
| 847 | goto out_ids; | ||
| 848 | |||
| 849 | new = kcalloc(new_count, sizeof(int), GFP_KERNEL); | ||
| 850 | if (!new) { | ||
| 851 | kfree(ids); | ||
| 852 | rv = -ENOMEM; | ||
| 853 | goto out; | ||
| 854 | } | ||
| 834 | 855 | ||
| 835 | if (rv != i) | 856 | i = 0; |
| 836 | printk("bad nodeid count %d %d\n", rv, i); | 857 | list_for_each_entry(nd, &sp->members, list) { |
| 858 | if (nd->new) { | ||
| 859 | new[i++] = nd->nodeid; | ||
| 860 | nd->new = 0; | ||
| 861 | } | ||
| 862 | } | ||
| 863 | *new_count_out = new_count; | ||
| 864 | *new_out = new; | ||
| 837 | 865 | ||
| 866 | out_ids: | ||
| 867 | *ids_count_out = ids_count; | ||
| 838 | *ids_out = ids; | 868 | *ids_out = ids; |
| 839 | out: | 869 | out: |
| 840 | mutex_unlock(&sp->members_lock); | 870 | mutex_unlock(&sp->members_lock); |
diff --git a/fs/dlm/config.h b/fs/dlm/config.h index a3170fe22090..4f1d6fce58c5 100644 --- a/fs/dlm/config.h +++ b/fs/dlm/config.h | |||
| @@ -35,7 +35,8 @@ extern struct dlm_config_info dlm_config; | |||
| 35 | int dlm_config_init(void); | 35 | int dlm_config_init(void); |
| 36 | void dlm_config_exit(void); | 36 | void dlm_config_exit(void); |
| 37 | int dlm_node_weight(char *lsname, int nodeid); | 37 | int dlm_node_weight(char *lsname, int nodeid); |
| 38 | int dlm_nodeid_list(char *lsname, int **ids_out); | 38 | int dlm_nodeid_list(char *lsname, int **ids_out, int *ids_count_out, |
| 39 | int **new_out, int *new_count_out); | ||
| 39 | int dlm_nodeid_to_addr(int nodeid, struct sockaddr_storage *addr); | 40 | int dlm_nodeid_to_addr(int nodeid, struct sockaddr_storage *addr); |
| 40 | int dlm_addr_to_nodeid(struct sockaddr_storage *addr, int *nodeid); | 41 | int dlm_addr_to_nodeid(struct sockaddr_storage *addr, int *nodeid); |
| 41 | int dlm_our_nodeid(void); | 42 | int dlm_our_nodeid(void); |
diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h index 7a8824f475f2..5a7ac33b629c 100644 --- a/fs/dlm/dlm_internal.h +++ b/fs/dlm/dlm_internal.h | |||
| @@ -42,8 +42,6 @@ | |||
| 42 | #include <linux/dlm.h> | 42 | #include <linux/dlm.h> |
| 43 | #include "config.h" | 43 | #include "config.h" |
| 44 | 44 | ||
| 45 | #define DLM_LOCKSPACE_LEN 64 | ||
| 46 | |||
| 47 | /* Size of the temp buffer midcomms allocates on the stack. | 45 | /* Size of the temp buffer midcomms allocates on the stack. |
| 48 | We try to make this large enough so most messages fit. | 46 | We try to make this large enough so most messages fit. |
| 49 | FIXME: should sctp make this unnecessary? */ | 47 | FIXME: should sctp make this unnecessary? */ |
| @@ -132,8 +130,10 @@ struct dlm_member { | |||
| 132 | 130 | ||
| 133 | struct dlm_recover { | 131 | struct dlm_recover { |
| 134 | struct list_head list; | 132 | struct list_head list; |
| 135 | int *nodeids; | 133 | int *nodeids; /* nodeids of all members */ |
| 136 | int node_count; | 134 | int node_count; |
| 135 | int *new; /* nodeids of new members */ | ||
| 136 | int new_count; | ||
| 137 | uint64_t seq; | 137 | uint64_t seq; |
| 138 | }; | 138 | }; |
| 139 | 139 | ||
| @@ -579,6 +579,8 @@ static inline int dlm_no_directory(struct dlm_ls *ls) | |||
| 579 | int dlm_netlink_init(void); | 579 | int dlm_netlink_init(void); |
| 580 | void dlm_netlink_exit(void); | 580 | void dlm_netlink_exit(void); |
| 581 | void dlm_timeout_warn(struct dlm_lkb *lkb); | 581 | void dlm_timeout_warn(struct dlm_lkb *lkb); |
| 582 | int dlm_plock_init(void); | ||
| 583 | void dlm_plock_exit(void); | ||
| 582 | 584 | ||
| 583 | #ifdef CONFIG_DLM_DEBUG | 585 | #ifdef CONFIG_DLM_DEBUG |
| 584 | int dlm_register_debugfs(void); | 586 | int dlm_register_debugfs(void); |
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c index 8f250ac8b928..2d3d1027ce2b 100644 --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c | |||
| @@ -165,7 +165,7 @@ void dlm_print_lkb(struct dlm_lkb *lkb) | |||
| 165 | lkb->lkb_grmode, lkb->lkb_wait_type, lkb->lkb_ast_type); | 165 | lkb->lkb_grmode, lkb->lkb_wait_type, lkb->lkb_ast_type); |
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | void dlm_print_rsb(struct dlm_rsb *r) | 168 | static void dlm_print_rsb(struct dlm_rsb *r) |
| 169 | { | 169 | { |
| 170 | printk(KERN_ERR "rsb: nodeid %d flags %lx first %x rlc %d name %s\n", | 170 | printk(KERN_ERR "rsb: nodeid %d flags %lx first %x rlc %d name %s\n", |
| 171 | r->res_nodeid, r->res_flags, r->res_first_lkid, | 171 | r->res_nodeid, r->res_flags, r->res_first_lkid, |
| @@ -1956,8 +1956,7 @@ static void confirm_master(struct dlm_rsb *r, int error) | |||
| 1956 | list_del_init(&lkb->lkb_rsb_lookup); | 1956 | list_del_init(&lkb->lkb_rsb_lookup); |
| 1957 | r->res_first_lkid = lkb->lkb_id; | 1957 | r->res_first_lkid = lkb->lkb_id; |
| 1958 | _request_lock(r, lkb); | 1958 | _request_lock(r, lkb); |
| 1959 | } else | 1959 | } |
| 1960 | r->res_nodeid = -1; | ||
| 1961 | break; | 1960 | break; |
| 1962 | 1961 | ||
| 1963 | default: | 1962 | default: |
diff --git a/fs/dlm/lock.h b/fs/dlm/lock.h index 05d9c82e646b..88e93c80cc22 100644 --- a/fs/dlm/lock.h +++ b/fs/dlm/lock.h | |||
| @@ -13,7 +13,6 @@ | |||
| 13 | #ifndef __LOCK_DOT_H__ | 13 | #ifndef __LOCK_DOT_H__ |
| 14 | #define __LOCK_DOT_H__ | 14 | #define __LOCK_DOT_H__ |
| 15 | 15 | ||
| 16 | void dlm_print_rsb(struct dlm_rsb *r); | ||
| 17 | void dlm_dump_rsb(struct dlm_rsb *r); | 16 | void dlm_dump_rsb(struct dlm_rsb *r); |
| 18 | void dlm_print_lkb(struct dlm_lkb *lkb); | 17 | void dlm_print_lkb(struct dlm_lkb *lkb); |
| 19 | void dlm_receive_message_saved(struct dlm_ls *ls, struct dlm_message *ms); | 18 | void dlm_receive_message_saved(struct dlm_ls *ls, struct dlm_message *ms); |
diff --git a/fs/dlm/main.c b/fs/dlm/main.c index 58487fb95a4c..b80e0aa3cfa5 100644 --- a/fs/dlm/main.c +++ b/fs/dlm/main.c | |||
| @@ -46,10 +46,16 @@ static int __init init_dlm(void) | |||
| 46 | if (error) | 46 | if (error) |
| 47 | goto out_user; | 47 | goto out_user; |
| 48 | 48 | ||
| 49 | error = dlm_plock_init(); | ||
| 50 | if (error) | ||
| 51 | goto out_netlink; | ||
| 52 | |||
| 49 | printk("DLM (built %s %s) installed\n", __DATE__, __TIME__); | 53 | printk("DLM (built %s %s) installed\n", __DATE__, __TIME__); |
| 50 | 54 | ||
| 51 | return 0; | 55 | return 0; |
| 52 | 56 | ||
| 57 | out_netlink: | ||
| 58 | dlm_netlink_exit(); | ||
| 53 | out_user: | 59 | out_user: |
| 54 | dlm_user_exit(); | 60 | dlm_user_exit(); |
| 55 | out_debug: | 61 | out_debug: |
| @@ -66,6 +72,7 @@ static int __init init_dlm(void) | |||
| 66 | 72 | ||
| 67 | static void __exit exit_dlm(void) | 73 | static void __exit exit_dlm(void) |
| 68 | { | 74 | { |
| 75 | dlm_plock_exit(); | ||
| 69 | dlm_netlink_exit(); | 76 | dlm_netlink_exit(); |
| 70 | dlm_user_exit(); | 77 | dlm_user_exit(); |
| 71 | dlm_config_exit(); | 78 | dlm_config_exit(); |
diff --git a/fs/dlm/member.c b/fs/dlm/member.c index fa17f5a27883..26133f05ae3a 100644 --- a/fs/dlm/member.c +++ b/fs/dlm/member.c | |||
| @@ -210,6 +210,23 @@ int dlm_recover_members(struct dlm_ls *ls, struct dlm_recover *rv, int *neg_out) | |||
| 210 | } | 210 | } |
| 211 | } | 211 | } |
| 212 | 212 | ||
| 213 | /* Add an entry to ls_nodes_gone for members that were removed and | ||
| 214 | then added again, so that previous state for these nodes will be | ||
| 215 | cleared during recovery. */ | ||
| 216 | |||
| 217 | for (i = 0; i < rv->new_count; i++) { | ||
| 218 | if (!dlm_is_member(ls, rv->new[i])) | ||
| 219 | continue; | ||
| 220 | log_debug(ls, "new nodeid %d is a re-added member", rv->new[i]); | ||
| 221 | |||
| 222 | memb = kzalloc(sizeof(struct dlm_member), GFP_KERNEL); | ||
| 223 | if (!memb) | ||
| 224 | return -ENOMEM; | ||
| 225 | memb->nodeid = rv->new[i]; | ||
| 226 | list_add_tail(&memb->list, &ls->ls_nodes_gone); | ||
| 227 | neg++; | ||
| 228 | } | ||
| 229 | |||
| 213 | /* add new members to ls_nodes */ | 230 | /* add new members to ls_nodes */ |
| 214 | 231 | ||
| 215 | for (i = 0; i < rv->node_count; i++) { | 232 | for (i = 0; i < rv->node_count; i++) { |
| @@ -314,15 +331,16 @@ int dlm_ls_stop(struct dlm_ls *ls) | |||
| 314 | int dlm_ls_start(struct dlm_ls *ls) | 331 | int dlm_ls_start(struct dlm_ls *ls) |
| 315 | { | 332 | { |
| 316 | struct dlm_recover *rv = NULL, *rv_old; | 333 | struct dlm_recover *rv = NULL, *rv_old; |
| 317 | int *ids = NULL; | 334 | int *ids = NULL, *new = NULL; |
| 318 | int error, count; | 335 | int error, ids_count = 0, new_count = 0; |
| 319 | 336 | ||
| 320 | rv = kzalloc(sizeof(struct dlm_recover), GFP_KERNEL); | 337 | rv = kzalloc(sizeof(struct dlm_recover), GFP_KERNEL); |
| 321 | if (!rv) | 338 | if (!rv) |
| 322 | return -ENOMEM; | 339 | return -ENOMEM; |
| 323 | 340 | ||
| 324 | error = count = dlm_nodeid_list(ls->ls_name, &ids); | 341 | error = dlm_nodeid_list(ls->ls_name, &ids, &ids_count, |
| 325 | if (error <= 0) | 342 | &new, &new_count); |
| 343 | if (error < 0) | ||
| 326 | goto fail; | 344 | goto fail; |
| 327 | 345 | ||
| 328 | spin_lock(&ls->ls_recover_lock); | 346 | spin_lock(&ls->ls_recover_lock); |
| @@ -337,14 +355,19 @@ int dlm_ls_start(struct dlm_ls *ls) | |||
| 337 | } | 355 | } |
| 338 | 356 | ||
| 339 | rv->nodeids = ids; | 357 | rv->nodeids = ids; |
| 340 | rv->node_count = count; | 358 | rv->node_count = ids_count; |
| 359 | rv->new = new; | ||
| 360 | rv->new_count = new_count; | ||
| 341 | rv->seq = ++ls->ls_recover_seq; | 361 | rv->seq = ++ls->ls_recover_seq; |
| 342 | rv_old = ls->ls_recover_args; | 362 | rv_old = ls->ls_recover_args; |
| 343 | ls->ls_recover_args = rv; | 363 | ls->ls_recover_args = rv; |
| 344 | spin_unlock(&ls->ls_recover_lock); | 364 | spin_unlock(&ls->ls_recover_lock); |
| 345 | 365 | ||
| 346 | if (rv_old) { | 366 | if (rv_old) { |
| 367 | log_error(ls, "unused recovery %llx %d", | ||
| 368 | (unsigned long long)rv_old->seq, rv_old->node_count); | ||
| 347 | kfree(rv_old->nodeids); | 369 | kfree(rv_old->nodeids); |
| 370 | kfree(rv_old->new); | ||
| 348 | kfree(rv_old); | 371 | kfree(rv_old); |
| 349 | } | 372 | } |
| 350 | 373 | ||
| @@ -354,6 +377,7 @@ int dlm_ls_start(struct dlm_ls *ls) | |||
| 354 | fail: | 377 | fail: |
| 355 | kfree(rv); | 378 | kfree(rv); |
| 356 | kfree(ids); | 379 | kfree(ids); |
| 380 | kfree(new); | ||
| 357 | return error; | 381 | return error; |
| 358 | } | 382 | } |
| 359 | 383 | ||
diff --git a/fs/gfs2/locking/dlm/plock.c b/fs/dlm/plock.c index 2ebd374b3143..d6d6e370f89c 100644 --- a/fs/gfs2/locking/dlm/plock.c +++ b/fs/dlm/plock.c | |||
| @@ -1,17 +1,19 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) 2005 Red Hat, Inc. All rights reserved. | 2 | * Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved. |
| 3 | * | 3 | * |
| 4 | * This copyrighted material is made available to anyone wishing to use, | 4 | * This copyrighted material is made available to anyone wishing to use, |
| 5 | * modify, copy, or redistribute it subject to the terms and conditions | 5 | * modify, copy, or redistribute it subject to the terms and conditions |
| 6 | * of the GNU General Public License version 2. | 6 | * of the GNU General Public License version 2. |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #include <linux/fs.h> | ||
| 9 | #include <linux/miscdevice.h> | 10 | #include <linux/miscdevice.h> |
| 10 | #include <linux/lock_dlm_plock.h> | ||
| 11 | #include <linux/poll.h> | 11 | #include <linux/poll.h> |
| 12 | #include <linux/dlm.h> | ||
| 13 | #include <linux/dlm_plock.h> | ||
| 12 | 14 | ||
| 13 | #include "lock_dlm.h" | 15 | #include "dlm_internal.h" |
| 14 | 16 | #include "lockspace.h" | |
| 15 | 17 | ||
| 16 | static spinlock_t ops_lock; | 18 | static spinlock_t ops_lock; |
| 17 | static struct list_head send_list; | 19 | static struct list_head send_list; |
| @@ -22,7 +24,7 @@ static wait_queue_head_t recv_wq; | |||
| 22 | struct plock_op { | 24 | struct plock_op { |
| 23 | struct list_head list; | 25 | struct list_head list; |
| 24 | int done; | 26 | int done; |
| 25 | struct gdlm_plock_info info; | 27 | struct dlm_plock_info info; |
| 26 | }; | 28 | }; |
| 27 | 29 | ||
| 28 | struct plock_xop { | 30 | struct plock_xop { |
| @@ -34,22 +36,22 @@ struct plock_xop { | |||
| 34 | }; | 36 | }; |
| 35 | 37 | ||
| 36 | 38 | ||
| 37 | static inline void set_version(struct gdlm_plock_info *info) | 39 | static inline void set_version(struct dlm_plock_info *info) |
| 38 | { | 40 | { |
| 39 | info->version[0] = GDLM_PLOCK_VERSION_MAJOR; | 41 | info->version[0] = DLM_PLOCK_VERSION_MAJOR; |
| 40 | info->version[1] = GDLM_PLOCK_VERSION_MINOR; | 42 | info->version[1] = DLM_PLOCK_VERSION_MINOR; |
| 41 | info->version[2] = GDLM_PLOCK_VERSION_PATCH; | 43 | info->version[2] = DLM_PLOCK_VERSION_PATCH; |
| 42 | } | 44 | } |
| 43 | 45 | ||
| 44 | static int check_version(struct gdlm_plock_info *info) | 46 | static int check_version(struct dlm_plock_info *info) |
| 45 | { | 47 | { |
| 46 | if ((GDLM_PLOCK_VERSION_MAJOR != info->version[0]) || | 48 | if ((DLM_PLOCK_VERSION_MAJOR != info->version[0]) || |
| 47 | (GDLM_PLOCK_VERSION_MINOR < info->version[1])) { | 49 | (DLM_PLOCK_VERSION_MINOR < info->version[1])) { |
| 48 | log_error("plock device version mismatch: " | 50 | log_print("plock device version mismatch: " |
| 49 | "kernel (%u.%u.%u), user (%u.%u.%u)", | 51 | "kernel (%u.%u.%u), user (%u.%u.%u)", |
| 50 | GDLM_PLOCK_VERSION_MAJOR, | 52 | DLM_PLOCK_VERSION_MAJOR, |
| 51 | GDLM_PLOCK_VERSION_MINOR, | 53 | DLM_PLOCK_VERSION_MINOR, |
| 52 | GDLM_PLOCK_VERSION_PATCH, | 54 | DLM_PLOCK_VERSION_PATCH, |
| 53 | info->version[0], | 55 | info->version[0], |
| 54 | info->version[1], | 56 | info->version[1], |
| 55 | info->version[2]); | 57 | info->version[2]); |
| @@ -68,25 +70,31 @@ static void send_op(struct plock_op *op) | |||
| 68 | wake_up(&send_wq); | 70 | wake_up(&send_wq); |
| 69 | } | 71 | } |
| 70 | 72 | ||
| 71 | int gdlm_plock(void *lockspace, struct lm_lockname *name, | 73 | int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file, |
| 72 | struct file *file, int cmd, struct file_lock *fl) | 74 | int cmd, struct file_lock *fl) |
| 73 | { | 75 | { |
| 74 | struct gdlm_ls *ls = lockspace; | 76 | struct dlm_ls *ls; |
| 75 | struct plock_op *op; | 77 | struct plock_op *op; |
| 76 | struct plock_xop *xop; | 78 | struct plock_xop *xop; |
| 77 | int rv; | 79 | int rv; |
| 78 | 80 | ||
| 81 | ls = dlm_find_lockspace_local(lockspace); | ||
| 82 | if (!ls) | ||
| 83 | return -EINVAL; | ||
| 84 | |||
| 79 | xop = kzalloc(sizeof(*xop), GFP_KERNEL); | 85 | xop = kzalloc(sizeof(*xop), GFP_KERNEL); |
| 80 | if (!xop) | 86 | if (!xop) { |
| 81 | return -ENOMEM; | 87 | rv = -ENOMEM; |
| 88 | goto out; | ||
| 89 | } | ||
| 82 | 90 | ||
| 83 | op = &xop->xop; | 91 | op = &xop->xop; |
| 84 | op->info.optype = GDLM_PLOCK_OP_LOCK; | 92 | op->info.optype = DLM_PLOCK_OP_LOCK; |
| 85 | op->info.pid = fl->fl_pid; | 93 | op->info.pid = fl->fl_pid; |
| 86 | op->info.ex = (fl->fl_type == F_WRLCK); | 94 | op->info.ex = (fl->fl_type == F_WRLCK); |
| 87 | op->info.wait = IS_SETLKW(cmd); | 95 | op->info.wait = IS_SETLKW(cmd); |
| 88 | op->info.fsid = ls->id; | 96 | op->info.fsid = ls->ls_global_id; |
| 89 | op->info.number = name->ln_number; | 97 | op->info.number = number; |
| 90 | op->info.start = fl->fl_start; | 98 | op->info.start = fl->fl_start; |
| 91 | op->info.end = fl->fl_end; | 99 | op->info.end = fl->fl_end; |
| 92 | if (fl->fl_lmops && fl->fl_lmops->fl_grant) { | 100 | if (fl->fl_lmops && fl->fl_lmops->fl_grant) { |
| @@ -107,12 +115,15 @@ int gdlm_plock(void *lockspace, struct lm_lockname *name, | |||
| 107 | 115 | ||
| 108 | if (xop->callback == NULL) | 116 | if (xop->callback == NULL) |
| 109 | wait_event(recv_wq, (op->done != 0)); | 117 | wait_event(recv_wq, (op->done != 0)); |
| 110 | else | 118 | else { |
| 111 | return -EINPROGRESS; | 119 | rv = -EINPROGRESS; |
| 120 | goto out; | ||
| 121 | } | ||
| 112 | 122 | ||
| 113 | spin_lock(&ops_lock); | 123 | spin_lock(&ops_lock); |
| 114 | if (!list_empty(&op->list)) { | 124 | if (!list_empty(&op->list)) { |
| 115 | printk(KERN_INFO "plock op on list\n"); | 125 | log_error(ls, "dlm_posix_lock: op on list %llx", |
| 126 | (unsigned long long)number); | ||
| 116 | list_del(&op->list); | 127 | list_del(&op->list); |
| 117 | } | 128 | } |
| 118 | spin_unlock(&ops_lock); | 129 | spin_unlock(&ops_lock); |
| @@ -121,17 +132,19 @@ int gdlm_plock(void *lockspace, struct lm_lockname *name, | |||
| 121 | 132 | ||
| 122 | if (!rv) { | 133 | if (!rv) { |
| 123 | if (posix_lock_file_wait(file, fl) < 0) | 134 | if (posix_lock_file_wait(file, fl) < 0) |
| 124 | log_error("gdlm_plock: vfs lock error %x,%llx", | 135 | log_error(ls, "dlm_posix_lock: vfs lock error %llx", |
| 125 | name->ln_type, | 136 | (unsigned long long)number); |
| 126 | (unsigned long long)name->ln_number); | ||
| 127 | } | 137 | } |
| 128 | 138 | ||
| 129 | kfree(xop); | 139 | kfree(xop); |
| 140 | out: | ||
| 141 | dlm_put_lockspace(ls); | ||
| 130 | return rv; | 142 | return rv; |
| 131 | } | 143 | } |
| 144 | EXPORT_SYMBOL_GPL(dlm_posix_lock); | ||
| 132 | 145 | ||
| 133 | /* Returns failure iff a succesful lock operation should be canceled */ | 146 | /* Returns failure iff a succesful lock operation should be canceled */ |
| 134 | static int gdlm_plock_callback(struct plock_op *op) | 147 | static int dlm_plock_callback(struct plock_op *op) |
| 135 | { | 148 | { |
| 136 | struct file *file; | 149 | struct file *file; |
| 137 | struct file_lock *fl; | 150 | struct file_lock *fl; |
| @@ -142,7 +155,8 @@ static int gdlm_plock_callback(struct plock_op *op) | |||
| 142 | 155 | ||
| 143 | spin_lock(&ops_lock); | 156 | spin_lock(&ops_lock); |
| 144 | if (!list_empty(&op->list)) { | 157 | if (!list_empty(&op->list)) { |
| 145 | printk(KERN_INFO "plock op on list\n"); | 158 | log_print("dlm_plock_callback: op on list %llx", |
| 159 | (unsigned long long)op->info.number); | ||
| 146 | list_del(&op->list); | 160 | list_del(&op->list); |
| 147 | } | 161 | } |
| 148 | spin_unlock(&ops_lock); | 162 | spin_unlock(&ops_lock); |
| @@ -165,19 +179,19 @@ static int gdlm_plock_callback(struct plock_op *op) | |||
| 165 | * This can only happen in the case of kmalloc() failure. | 179 | * This can only happen in the case of kmalloc() failure. |
| 166 | * The filesystem's own lock is the authoritative lock, | 180 | * The filesystem's own lock is the authoritative lock, |
| 167 | * so a failure to get the lock locally is not a disaster. | 181 | * so a failure to get the lock locally is not a disaster. |
| 168 | * As long as GFS cannot reliably cancel locks (especially | 182 | * As long as the fs cannot reliably cancel locks (especially |
| 169 | * in a low-memory situation), we're better off ignoring | 183 | * in a low-memory situation), we're better off ignoring |
| 170 | * this failure than trying to recover. | 184 | * this failure than trying to recover. |
| 171 | */ | 185 | */ |
| 172 | log_error("gdlm_plock: vfs lock error file %p fl %p", | 186 | log_print("dlm_plock_callback: vfs lock error %llx file %p fl %p", |
| 173 | file, fl); | 187 | (unsigned long long)op->info.number, file, fl); |
| 174 | } | 188 | } |
| 175 | 189 | ||
| 176 | rv = notify(flc, NULL, 0); | 190 | rv = notify(flc, NULL, 0); |
| 177 | if (rv) { | 191 | if (rv) { |
| 178 | /* XXX: We need to cancel the fs lock here: */ | 192 | /* XXX: We need to cancel the fs lock here: */ |
| 179 | printk("gfs2 lock granted after lock request failed;" | 193 | log_print("dlm_plock_callback: lock granted after lock request " |
| 180 | " dangling lock!\n"); | 194 | "failed; dangling lock!\n"); |
| 181 | goto out; | 195 | goto out; |
| 182 | } | 196 | } |
| 183 | 197 | ||
| @@ -186,25 +200,31 @@ out: | |||
| 186 | return rv; | 200 | return rv; |
| 187 | } | 201 | } |
| 188 | 202 | ||
| 189 | int gdlm_punlock(void *lockspace, struct lm_lockname *name, | 203 | int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file, |
| 190 | struct file *file, struct file_lock *fl) | 204 | struct file_lock *fl) |
| 191 | { | 205 | { |
| 192 | struct gdlm_ls *ls = lockspace; | 206 | struct dlm_ls *ls; |
| 193 | struct plock_op *op; | 207 | struct plock_op *op; |
| 194 | int rv; | 208 | int rv; |
| 195 | 209 | ||
| 210 | ls = dlm_find_lockspace_local(lockspace); | ||
| 211 | if (!ls) | ||
| 212 | return -EINVAL; | ||
| 213 | |||
| 196 | op = kzalloc(sizeof(*op), GFP_KERNEL); | 214 | op = kzalloc(sizeof(*op), GFP_KERNEL); |
| 197 | if (!op) | 215 | if (!op) { |
| 198 | return -ENOMEM; | 216 | rv = -ENOMEM; |
| 217 | goto out; | ||
| 218 | } | ||
| 199 | 219 | ||
| 200 | if (posix_lock_file_wait(file, fl) < 0) | 220 | if (posix_lock_file_wait(file, fl) < 0) |
| 201 | log_error("gdlm_punlock: vfs unlock error %x,%llx", | 221 | log_error(ls, "dlm_posix_unlock: vfs unlock error %llx", |
| 202 | name->ln_type, (unsigned long long)name->ln_number); | 222 | (unsigned long long)number); |
| 203 | 223 | ||
| 204 | op->info.optype = GDLM_PLOCK_OP_UNLOCK; | 224 | op->info.optype = DLM_PLOCK_OP_UNLOCK; |
| 205 | op->info.pid = fl->fl_pid; | 225 | op->info.pid = fl->fl_pid; |
| 206 | op->info.fsid = ls->id; | 226 | op->info.fsid = ls->ls_global_id; |
| 207 | op->info.number = name->ln_number; | 227 | op->info.number = number; |
| 208 | op->info.start = fl->fl_start; | 228 | op->info.start = fl->fl_start; |
| 209 | op->info.end = fl->fl_end; | 229 | op->info.end = fl->fl_end; |
| 210 | if (fl->fl_lmops && fl->fl_lmops->fl_grant) | 230 | if (fl->fl_lmops && fl->fl_lmops->fl_grant) |
| @@ -217,7 +237,8 @@ int gdlm_punlock(void *lockspace, struct lm_lockname *name, | |||
| 217 | 237 | ||
| 218 | spin_lock(&ops_lock); | 238 | spin_lock(&ops_lock); |
| 219 | if (!list_empty(&op->list)) { | 239 | if (!list_empty(&op->list)) { |
| 220 | printk(KERN_INFO "punlock op on list\n"); | 240 | log_error(ls, "dlm_posix_unlock: op on list %llx", |
| 241 | (unsigned long long)number); | ||
| 221 | list_del(&op->list); | 242 | list_del(&op->list); |
| 222 | } | 243 | } |
| 223 | spin_unlock(&ops_lock); | 244 | spin_unlock(&ops_lock); |
| @@ -228,25 +249,34 @@ int gdlm_punlock(void *lockspace, struct lm_lockname *name, | |||
| 228 | rv = 0; | 249 | rv = 0; |
| 229 | 250 | ||
| 230 | kfree(op); | 251 | kfree(op); |
| 252 | out: | ||
| 253 | dlm_put_lockspace(ls); | ||
| 231 | return rv; | 254 | return rv; |
| 232 | } | 255 | } |
| 256 | EXPORT_SYMBOL_GPL(dlm_posix_unlock); | ||
| 233 | 257 | ||
| 234 | int gdlm_plock_get(void *lockspace, struct lm_lockname *name, | 258 | int dlm_posix_get(dlm_lockspace_t *lockspace, u64 number, struct file *file, |
| 235 | struct file *file, struct file_lock *fl) | 259 | struct file_lock *fl) |
| 236 | { | 260 | { |
| 237 | struct gdlm_ls *ls = lockspace; | 261 | struct dlm_ls *ls; |
| 238 | struct plock_op *op; | 262 | struct plock_op *op; |
| 239 | int rv; | 263 | int rv; |
| 240 | 264 | ||
| 265 | ls = dlm_find_lockspace_local(lockspace); | ||
| 266 | if (!ls) | ||
| 267 | return -EINVAL; | ||
| 268 | |||
| 241 | op = kzalloc(sizeof(*op), GFP_KERNEL); | 269 | op = kzalloc(sizeof(*op), GFP_KERNEL); |
| 242 | if (!op) | 270 | if (!op) { |
| 243 | return -ENOMEM; | 271 | rv = -ENOMEM; |
| 272 | goto out; | ||
| 273 | } | ||
| 244 | 274 | ||
| 245 | op->info.optype = GDLM_PLOCK_OP_GET; | 275 | op->info.optype = DLM_PLOCK_OP_GET; |
| 246 | op->info.pid = fl->fl_pid; | 276 | op->info.pid = fl->fl_pid; |
| 247 | op->info.ex = (fl->fl_type == F_WRLCK); | 277 | op->info.ex = (fl->fl_type == F_WRLCK); |
| 248 | op->info.fsid = ls->id; | 278 | op->info.fsid = ls->ls_global_id; |
| 249 | op->info.number = name->ln_number; | 279 | op->info.number = number; |
| 250 | op->info.start = fl->fl_start; | 280 | op->info.start = fl->fl_start; |
| 251 | op->info.end = fl->fl_end; | 281 | op->info.end = fl->fl_end; |
| 252 | if (fl->fl_lmops && fl->fl_lmops->fl_grant) | 282 | if (fl->fl_lmops && fl->fl_lmops->fl_grant) |
| @@ -259,7 +289,8 @@ int gdlm_plock_get(void *lockspace, struct lm_lockname *name, | |||
| 259 | 289 | ||
| 260 | spin_lock(&ops_lock); | 290 | spin_lock(&ops_lock); |
| 261 | if (!list_empty(&op->list)) { | 291 | if (!list_empty(&op->list)) { |
| 262 | printk(KERN_INFO "plock_get op on list\n"); | 292 | log_error(ls, "dlm_posix_get: op on list %llx", |
| 293 | (unsigned long long)number); | ||
| 263 | list_del(&op->list); | 294 | list_del(&op->list); |
| 264 | } | 295 | } |
| 265 | spin_unlock(&ops_lock); | 296 | spin_unlock(&ops_lock); |
| @@ -281,14 +312,17 @@ int gdlm_plock_get(void *lockspace, struct lm_lockname *name, | |||
| 281 | } | 312 | } |
| 282 | 313 | ||
| 283 | kfree(op); | 314 | kfree(op); |
| 315 | out: | ||
| 316 | dlm_put_lockspace(ls); | ||
| 284 | return rv; | 317 | return rv; |
| 285 | } | 318 | } |
| 319 | EXPORT_SYMBOL_GPL(dlm_posix_get); | ||
| 286 | 320 | ||
| 287 | /* a read copies out one plock request from the send list */ | 321 | /* a read copies out one plock request from the send list */ |
| 288 | static ssize_t dev_read(struct file *file, char __user *u, size_t count, | 322 | static ssize_t dev_read(struct file *file, char __user *u, size_t count, |
| 289 | loff_t *ppos) | 323 | loff_t *ppos) |
| 290 | { | 324 | { |
| 291 | struct gdlm_plock_info info; | 325 | struct dlm_plock_info info; |
| 292 | struct plock_op *op = NULL; | 326 | struct plock_op *op = NULL; |
| 293 | 327 | ||
| 294 | if (count < sizeof(info)) | 328 | if (count < sizeof(info)) |
| @@ -315,7 +349,7 @@ static ssize_t dev_read(struct file *file, char __user *u, size_t count, | |||
| 315 | static ssize_t dev_write(struct file *file, const char __user *u, size_t count, | 349 | static ssize_t dev_write(struct file *file, const char __user *u, size_t count, |
| 316 | loff_t *ppos) | 350 | loff_t *ppos) |
| 317 | { | 351 | { |
| 318 | struct gdlm_plock_info info; | 352 | struct dlm_plock_info info; |
| 319 | struct plock_op *op; | 353 | struct plock_op *op; |
| 320 | int found = 0; | 354 | int found = 0; |
| 321 | 355 | ||
| @@ -345,12 +379,12 @@ static ssize_t dev_write(struct file *file, const char __user *u, size_t count, | |||
| 345 | struct plock_xop *xop; | 379 | struct plock_xop *xop; |
| 346 | xop = (struct plock_xop *)op; | 380 | xop = (struct plock_xop *)op; |
| 347 | if (xop->callback) | 381 | if (xop->callback) |
| 348 | count = gdlm_plock_callback(op); | 382 | count = dlm_plock_callback(op); |
| 349 | else | 383 | else |
| 350 | wake_up(&recv_wq); | 384 | wake_up(&recv_wq); |
| 351 | } else | 385 | } else |
| 352 | printk(KERN_INFO "gdlm dev_write no op %x %llx\n", info.fsid, | 386 | log_print("dev_write no op %x %llx", info.fsid, |
| 353 | (unsigned long long)info.number); | 387 | (unsigned long long)info.number); |
| 354 | return count; | 388 | return count; |
| 355 | } | 389 | } |
| 356 | 390 | ||
| @@ -377,11 +411,11 @@ static const struct file_operations dev_fops = { | |||
| 377 | 411 | ||
| 378 | static struct miscdevice plock_dev_misc = { | 412 | static struct miscdevice plock_dev_misc = { |
| 379 | .minor = MISC_DYNAMIC_MINOR, | 413 | .minor = MISC_DYNAMIC_MINOR, |
| 380 | .name = GDLM_PLOCK_MISC_NAME, | 414 | .name = DLM_PLOCK_MISC_NAME, |
| 381 | .fops = &dev_fops | 415 | .fops = &dev_fops |
| 382 | }; | 416 | }; |
| 383 | 417 | ||
| 384 | int gdlm_plock_init(void) | 418 | int dlm_plock_init(void) |
| 385 | { | 419 | { |
| 386 | int rv; | 420 | int rv; |
| 387 | 421 | ||
| @@ -393,14 +427,13 @@ int gdlm_plock_init(void) | |||
| 393 | 427 | ||
| 394 | rv = misc_register(&plock_dev_misc); | 428 | rv = misc_register(&plock_dev_misc); |
| 395 | if (rv) | 429 | if (rv) |
| 396 | printk(KERN_INFO "gdlm_plock_init: misc_register failed %d", | 430 | log_print("dlm_plock_init: misc_register failed %d", rv); |
| 397 | rv); | ||
| 398 | return rv; | 431 | return rv; |
| 399 | } | 432 | } |
| 400 | 433 | ||
| 401 | void gdlm_plock_exit(void) | 434 | void dlm_plock_exit(void) |
| 402 | { | 435 | { |
| 403 | if (misc_deregister(&plock_dev_misc) < 0) | 436 | if (misc_deregister(&plock_dev_misc) < 0) |
| 404 | printk(KERN_INFO "gdlm_plock_exit: misc_deregister failed"); | 437 | log_print("dlm_plock_exit: misc_deregister failed"); |
| 405 | } | 438 | } |
| 406 | 439 | ||
diff --git a/fs/dlm/recoverd.c b/fs/dlm/recoverd.c index 997f9531d594..fd677c8c3d3b 100644 --- a/fs/dlm/recoverd.c +++ b/fs/dlm/recoverd.c | |||
| @@ -257,6 +257,7 @@ static void do_ls_recovery(struct dlm_ls *ls) | |||
| 257 | if (rv) { | 257 | if (rv) { |
| 258 | ls_recover(ls, rv); | 258 | ls_recover(ls, rv); |
| 259 | kfree(rv->nodeids); | 259 | kfree(rv->nodeids); |
| 260 | kfree(rv->new); | ||
| 260 | kfree(rv); | 261 | kfree(rv); |
| 261 | } | 262 | } |
| 262 | } | 263 | } |
diff --git a/fs/gfs2/locking/dlm/Makefile b/fs/gfs2/locking/dlm/Makefile index 89b93b6b45cf..2609bb6cd013 100644 --- a/fs/gfs2/locking/dlm/Makefile +++ b/fs/gfs2/locking/dlm/Makefile | |||
| @@ -1,3 +1,3 @@ | |||
| 1 | obj-$(CONFIG_GFS2_FS_LOCKING_DLM) += lock_dlm.o | 1 | obj-$(CONFIG_GFS2_FS_LOCKING_DLM) += lock_dlm.o |
| 2 | lock_dlm-y := lock.o main.o mount.o sysfs.o thread.o plock.o | 2 | lock_dlm-y := lock.o main.o mount.o sysfs.o thread.o |
| 3 | 3 | ||
diff --git a/fs/gfs2/locking/dlm/lock_dlm.h b/fs/gfs2/locking/dlm/lock_dlm.h index 58fcf8c5bf39..a243cf69c54e 100644 --- a/fs/gfs2/locking/dlm/lock_dlm.h +++ b/fs/gfs2/locking/dlm/lock_dlm.h | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #include <net/sock.h> | 25 | #include <net/sock.h> |
| 26 | 26 | ||
| 27 | #include <linux/dlm.h> | 27 | #include <linux/dlm.h> |
| 28 | #include <linux/dlm_plock.h> | ||
| 28 | #include <linux/lm_interface.h> | 29 | #include <linux/lm_interface.h> |
| 29 | 30 | ||
| 30 | /* | 31 | /* |
| @@ -173,17 +174,6 @@ void gdlm_cancel(void *); | |||
| 173 | int gdlm_hold_lvb(void *, char **); | 174 | int gdlm_hold_lvb(void *, char **); |
| 174 | void gdlm_unhold_lvb(void *, char *); | 175 | void gdlm_unhold_lvb(void *, char *); |
| 175 | 176 | ||
| 176 | /* plock.c */ | ||
| 177 | |||
| 178 | int gdlm_plock_init(void); | ||
| 179 | void gdlm_plock_exit(void); | ||
| 180 | int gdlm_plock(void *, struct lm_lockname *, struct file *, int, | ||
| 181 | struct file_lock *); | ||
| 182 | int gdlm_plock_get(void *, struct lm_lockname *, struct file *, | ||
| 183 | struct file_lock *); | ||
| 184 | int gdlm_punlock(void *, struct lm_lockname *, struct file *, | ||
| 185 | struct file_lock *); | ||
| 186 | |||
| 187 | /* mount.c */ | 177 | /* mount.c */ |
| 188 | 178 | ||
| 189 | extern const struct lm_lockops gdlm_ops; | 179 | extern const struct lm_lockops gdlm_ops; |
diff --git a/fs/gfs2/locking/dlm/main.c b/fs/gfs2/locking/dlm/main.c index 36a225850bd8..b9a03a7ff801 100644 --- a/fs/gfs2/locking/dlm/main.c +++ b/fs/gfs2/locking/dlm/main.c | |||
| @@ -28,13 +28,6 @@ static int __init init_lock_dlm(void) | |||
| 28 | return error; | 28 | return error; |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | error = gdlm_plock_init(); | ||
| 32 | if (error) { | ||
| 33 | gdlm_sysfs_exit(); | ||
| 34 | gfs2_unregister_lockproto(&gdlm_ops); | ||
| 35 | return error; | ||
| 36 | } | ||
| 37 | |||
| 38 | printk(KERN_INFO | 31 | printk(KERN_INFO |
| 39 | "Lock_DLM (built %s %s) installed\n", __DATE__, __TIME__); | 32 | "Lock_DLM (built %s %s) installed\n", __DATE__, __TIME__); |
| 40 | return 0; | 33 | return 0; |
| @@ -42,7 +35,6 @@ static int __init init_lock_dlm(void) | |||
| 42 | 35 | ||
| 43 | static void __exit exit_lock_dlm(void) | 36 | static void __exit exit_lock_dlm(void) |
| 44 | { | 37 | { |
| 45 | gdlm_plock_exit(); | ||
| 46 | gdlm_sysfs_exit(); | 38 | gdlm_sysfs_exit(); |
| 47 | gfs2_unregister_lockproto(&gdlm_ops); | 39 | gfs2_unregister_lockproto(&gdlm_ops); |
| 48 | } | 40 | } |
diff --git a/fs/gfs2/locking/dlm/mount.c b/fs/gfs2/locking/dlm/mount.c index f2efff424224..470bdf650b50 100644 --- a/fs/gfs2/locking/dlm/mount.c +++ b/fs/gfs2/locking/dlm/mount.c | |||
| @@ -236,6 +236,27 @@ static void gdlm_withdraw(void *lockspace) | |||
| 236 | gdlm_kobject_release(ls); | 236 | gdlm_kobject_release(ls); |
| 237 | } | 237 | } |
| 238 | 238 | ||
| 239 | static int gdlm_plock(void *lockspace, struct lm_lockname *name, | ||
| 240 | struct file *file, int cmd, struct file_lock *fl) | ||
| 241 | { | ||
| 242 | struct gdlm_ls *ls = lockspace; | ||
| 243 | return dlm_posix_lock(ls->dlm_lockspace, name->ln_number, file, cmd, fl); | ||
| 244 | } | ||
| 245 | |||
| 246 | static int gdlm_punlock(void *lockspace, struct lm_lockname *name, | ||
| 247 | struct file *file, struct file_lock *fl) | ||
| 248 | { | ||
| 249 | struct gdlm_ls *ls = lockspace; | ||
| 250 | return dlm_posix_unlock(ls->dlm_lockspace, name->ln_number, file, fl); | ||
| 251 | } | ||
| 252 | |||
| 253 | static int gdlm_plock_get(void *lockspace, struct lm_lockname *name, | ||
| 254 | struct file *file, struct file_lock *fl) | ||
| 255 | { | ||
| 256 | struct gdlm_ls *ls = lockspace; | ||
| 257 | return dlm_posix_get(ls->dlm_lockspace, name->ln_number, file, fl); | ||
| 258 | } | ||
| 259 | |||
| 239 | const struct lm_lockops gdlm_ops = { | 260 | const struct lm_lockops gdlm_ops = { |
| 240 | .lm_proto_name = "lock_dlm", | 261 | .lm_proto_name = "lock_dlm", |
| 241 | .lm_mount = gdlm_mount, | 262 | .lm_mount = gdlm_mount, |
diff --git a/include/linux/Kbuild b/include/linux/Kbuild index 97a88b2b0c8e..cbb5ccb27de3 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild | |||
| @@ -100,7 +100,7 @@ header-y += ixjuser.h | |||
| 100 | header-y += jffs2.h | 100 | header-y += jffs2.h |
| 101 | header-y += keyctl.h | 101 | header-y += keyctl.h |
| 102 | header-y += limits.h | 102 | header-y += limits.h |
| 103 | header-y += lock_dlm_plock.h | 103 | header-y += dlm_plock.h |
| 104 | header-y += magic.h | 104 | header-y += magic.h |
| 105 | header-y += major.h | 105 | header-y += major.h |
| 106 | header-y += matroxfb.h | 106 | header-y += matroxfb.h |
diff --git a/include/linux/dlm.h b/include/linux/dlm.h index c743fbc769db..203a025e30e5 100644 --- a/include/linux/dlm.h +++ b/include/linux/dlm.h | |||
| @@ -21,10 +21,7 @@ | |||
| 21 | 21 | ||
| 22 | /* Lock levels and flags are here */ | 22 | /* Lock levels and flags are here */ |
| 23 | #include <linux/dlmconstants.h> | 23 | #include <linux/dlmconstants.h> |
| 24 | 24 | #include <linux/types.h> | |
| 25 | |||
| 26 | #define DLM_RESNAME_MAXLEN 64 | ||
| 27 | |||
| 28 | 25 | ||
| 29 | typedef void dlm_lockspace_t; | 26 | typedef void dlm_lockspace_t; |
| 30 | 27 | ||
| @@ -63,7 +60,7 @@ typedef void dlm_lockspace_t; | |||
| 63 | 60 | ||
| 64 | struct dlm_lksb { | 61 | struct dlm_lksb { |
| 65 | int sb_status; | 62 | int sb_status; |
| 66 | uint32_t sb_lkid; | 63 | __u32 sb_lkid; |
| 67 | char sb_flags; | 64 | char sb_flags; |
| 68 | char * sb_lvbptr; | 65 | char * sb_lvbptr; |
| 69 | }; | 66 | }; |
diff --git a/include/linux/dlm_device.h b/include/linux/dlm_device.h index 9642277a152a..c6034508fed9 100644 --- a/include/linux/dlm_device.h +++ b/include/linux/dlm_device.h | |||
| @@ -11,10 +11,16 @@ | |||
| 11 | ******************************************************************************* | 11 | ******************************************************************************* |
| 12 | ******************************************************************************/ | 12 | ******************************************************************************/ |
| 13 | 13 | ||
| 14 | #ifndef _LINUX_DLM_DEVICE_H | ||
| 15 | #define _LINUX_DLM_DEVICE_H | ||
| 16 | |||
| 14 | /* This is the device interface for dlm, most users will use a library | 17 | /* This is the device interface for dlm, most users will use a library |
| 15 | * interface. | 18 | * interface. |
| 16 | */ | 19 | */ |
| 17 | 20 | ||
| 21 | #include <linux/dlm.h> | ||
| 22 | #include <linux/types.h> | ||
| 23 | |||
| 18 | #define DLM_USER_LVB_LEN 32 | 24 | #define DLM_USER_LVB_LEN 32 |
| 19 | 25 | ||
| 20 | /* Version of the device interface */ | 26 | /* Version of the device interface */ |
| @@ -94,10 +100,9 @@ struct dlm_lock_result { | |||
| 94 | #define DLM_USER_PURGE 6 | 100 | #define DLM_USER_PURGE 6 |
| 95 | #define DLM_USER_DEADLOCK 7 | 101 | #define DLM_USER_DEADLOCK 7 |
| 96 | 102 | ||
| 97 | /* Arbitrary length restriction */ | ||
| 98 | #define MAX_LS_NAME_LEN 64 | ||
| 99 | |||
| 100 | /* Lockspace flags */ | 103 | /* Lockspace flags */ |
| 101 | #define DLM_USER_LSFLG_AUTOFREE 1 | 104 | #define DLM_USER_LSFLG_AUTOFREE 1 |
| 102 | #define DLM_USER_LSFLG_FORCEFREE 2 | 105 | #define DLM_USER_LSFLG_FORCEFREE 2 |
| 103 | 106 | ||
| 107 | #endif | ||
| 108 | |||
diff --git a/include/linux/dlm_plock.h b/include/linux/dlm_plock.h new file mode 100644 index 000000000000..18d5fdbceb74 --- /dev/null +++ b/include/linux/dlm_plock.h | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved. | ||
| 3 | * | ||
| 4 | * This copyrighted material is made available to anyone wishing to use, | ||
| 5 | * modify, copy, or redistribute it subject to the terms and conditions | ||
| 6 | * of the GNU General Public License v.2. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #ifndef __DLM_PLOCK_DOT_H__ | ||
| 10 | #define __DLM_PLOCK_DOT_H__ | ||
| 11 | |||
| 12 | #define DLM_PLOCK_MISC_NAME "dlm_plock" | ||
| 13 | |||
| 14 | #define DLM_PLOCK_VERSION_MAJOR 1 | ||
| 15 | #define DLM_PLOCK_VERSION_MINOR 1 | ||
| 16 | #define DLM_PLOCK_VERSION_PATCH 0 | ||
| 17 | |||
| 18 | enum { | ||
| 19 | DLM_PLOCK_OP_LOCK = 1, | ||
| 20 | DLM_PLOCK_OP_UNLOCK, | ||
| 21 | DLM_PLOCK_OP_GET, | ||
| 22 | }; | ||
| 23 | |||
| 24 | struct dlm_plock_info { | ||
| 25 | __u32 version[3]; | ||
| 26 | __u8 optype; | ||
| 27 | __u8 ex; | ||
| 28 | __u8 wait; | ||
| 29 | __u8 pad; | ||
| 30 | __u32 pid; | ||
| 31 | __s32 nodeid; | ||
| 32 | __s32 rv; | ||
| 33 | __u32 fsid; | ||
| 34 | __u64 number; | ||
| 35 | __u64 start; | ||
| 36 | __u64 end; | ||
| 37 | __u64 owner; | ||
| 38 | }; | ||
| 39 | |||
| 40 | #ifdef __KERNEL__ | ||
| 41 | int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file, | ||
| 42 | int cmd, struct file_lock *fl); | ||
| 43 | int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file, | ||
| 44 | struct file_lock *fl); | ||
| 45 | int dlm_posix_get(dlm_lockspace_t *lockspace, u64 number, struct file *file, | ||
| 46 | struct file_lock *fl); | ||
| 47 | #endif /* __KERNEL__ */ | ||
| 48 | |||
| 49 | #endif | ||
| 50 | |||
diff --git a/include/linux/dlmconstants.h b/include/linux/dlmconstants.h index fddb3d3ff321..47bf08dc7566 100644 --- a/include/linux/dlmconstants.h +++ b/include/linux/dlmconstants.h | |||
| @@ -18,6 +18,10 @@ | |||
| 18 | * Constants used by DLM interface. | 18 | * Constants used by DLM interface. |
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | #define DLM_LOCKSPACE_LEN 64 | ||
| 22 | #define DLM_RESNAME_MAXLEN 64 | ||
| 23 | |||
| 24 | |||
| 21 | /* | 25 | /* |
| 22 | * Lock Modes | 26 | * Lock Modes |
| 23 | */ | 27 | */ |
diff --git a/include/linux/lock_dlm_plock.h b/include/linux/lock_dlm_plock.h deleted file mode 100644 index fc3415113973..000000000000 --- a/include/linux/lock_dlm_plock.h +++ /dev/null | |||
| @@ -1,41 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2005 Red Hat, Inc. All rights reserved. | ||
| 3 | * | ||
| 4 | * This copyrighted material is made available to anyone wishing to use, | ||
| 5 | * modify, copy, or redistribute it subject to the terms and conditions | ||
| 6 | * of the GNU General Public License v.2. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #ifndef __LOCK_DLM_PLOCK_DOT_H__ | ||
| 10 | #define __LOCK_DLM_PLOCK_DOT_H__ | ||
| 11 | |||
| 12 | #define GDLM_PLOCK_MISC_NAME "lock_dlm_plock" | ||
| 13 | |||
| 14 | #define GDLM_PLOCK_VERSION_MAJOR 1 | ||
| 15 | #define GDLM_PLOCK_VERSION_MINOR 1 | ||
| 16 | #define GDLM_PLOCK_VERSION_PATCH 0 | ||
| 17 | |||
| 18 | enum { | ||
| 19 | GDLM_PLOCK_OP_LOCK = 1, | ||
| 20 | GDLM_PLOCK_OP_UNLOCK, | ||
| 21 | GDLM_PLOCK_OP_GET, | ||
| 22 | }; | ||
| 23 | |||
| 24 | struct gdlm_plock_info { | ||
| 25 | __u32 version[3]; | ||
| 26 | __u8 optype; | ||
| 27 | __u8 ex; | ||
| 28 | __u8 wait; | ||
| 29 | __u8 pad; | ||
| 30 | __u32 pid; | ||
| 31 | __s32 nodeid; | ||
| 32 | __s32 rv; | ||
| 33 | __u32 fsid; | ||
| 34 | __u64 number; | ||
| 35 | __u64 start; | ||
| 36 | __u64 end; | ||
| 37 | __u64 owner; | ||
| 38 | }; | ||
| 39 | |||
| 40 | #endif | ||
| 41 | |||
