aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-08-13 18:16:10 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-08-13 18:16:10 -0400
commit3e11acd4306d558249c31cf6cac09f218f2de52e (patch)
tree71f558c033b74960a97360d0b981161ef92a9331 /fs
parent758db3f2118703a1e36374dae5d58bed963e7e0d (diff)
parent51409340d240dabe66adb49f645588c3a802d055 (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: rename structs dlm: add missing kfrees
Diffstat (limited to 'fs')
-rw-r--r--fs/dlm/config.c203
-rw-r--r--fs/dlm/user.c10
2 files changed, 114 insertions, 99 deletions
diff --git a/fs/dlm/config.c b/fs/dlm/config.c
index c4e7d721bd8d..89d2fb7b991a 100644
--- a/fs/dlm/config.c
+++ b/fs/dlm/config.c
@@ -2,7 +2,7 @@
2******************************************************************************* 2*******************************************************************************
3** 3**
4** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. 4** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
5** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. 5** Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
6** 6**
7** This copyrighted material is made available to anyone wishing to use, 7** This copyrighted material is made available to anyone wishing to use,
8** modify, copy, or redistribute it subject to the terms and conditions 8** modify, copy, or redistribute it subject to the terms and conditions
@@ -30,16 +30,16 @@
30 30
31static struct config_group *space_list; 31static struct config_group *space_list;
32static struct config_group *comm_list; 32static struct config_group *comm_list;
33static struct comm *local_comm; 33static struct dlm_comm *local_comm;
34 34
35struct clusters; 35struct dlm_clusters;
36struct cluster; 36struct dlm_cluster;
37struct spaces; 37struct dlm_spaces;
38struct space; 38struct dlm_space;
39struct comms; 39struct dlm_comms;
40struct comm; 40struct dlm_comm;
41struct nodes; 41struct dlm_nodes;
42struct node; 42struct dlm_node;
43 43
44static struct config_group *make_cluster(struct config_group *, const char *); 44static struct config_group *make_cluster(struct config_group *, const char *);
45static void drop_cluster(struct config_group *, struct config_item *); 45static void drop_cluster(struct config_group *, struct config_item *);
@@ -68,17 +68,22 @@ static ssize_t show_node(struct config_item *i, struct configfs_attribute *a,
68static ssize_t store_node(struct config_item *i, struct configfs_attribute *a, 68static ssize_t store_node(struct config_item *i, struct configfs_attribute *a,
69 const char *buf, size_t len); 69 const char *buf, size_t len);
70 70
71static ssize_t comm_nodeid_read(struct comm *cm, char *buf); 71static ssize_t comm_nodeid_read(struct dlm_comm *cm, char *buf);
72static ssize_t comm_nodeid_write(struct comm *cm, const char *buf, size_t len); 72static ssize_t comm_nodeid_write(struct dlm_comm *cm, const char *buf,
73static ssize_t comm_local_read(struct comm *cm, char *buf); 73 size_t len);
74static ssize_t comm_local_write(struct comm *cm, const char *buf, size_t len); 74static ssize_t comm_local_read(struct dlm_comm *cm, char *buf);
75static ssize_t comm_addr_write(struct comm *cm, const char *buf, size_t len); 75static ssize_t comm_local_write(struct dlm_comm *cm, const char *buf,
76static ssize_t node_nodeid_read(struct node *nd, char *buf); 76 size_t len);
77static ssize_t node_nodeid_write(struct node *nd, const char *buf, size_t len); 77static ssize_t comm_addr_write(struct dlm_comm *cm, const char *buf,
78static ssize_t node_weight_read(struct node *nd, char *buf); 78 size_t len);
79static ssize_t node_weight_write(struct node *nd, const char *buf, size_t len); 79static ssize_t node_nodeid_read(struct dlm_node *nd, char *buf);
80 80static ssize_t node_nodeid_write(struct dlm_node *nd, const char *buf,
81struct cluster { 81 size_t len);
82static ssize_t node_weight_read(struct dlm_node *nd, char *buf);
83static ssize_t node_weight_write(struct dlm_node *nd, const char *buf,
84 size_t len);
85
86struct dlm_cluster {
82 struct config_group group; 87 struct config_group group;
83 unsigned int cl_tcp_port; 88 unsigned int cl_tcp_port;
84 unsigned int cl_buffer_size; 89 unsigned int cl_buffer_size;
@@ -109,11 +114,11 @@ enum {
109 114
110struct cluster_attribute { 115struct cluster_attribute {
111 struct configfs_attribute attr; 116 struct configfs_attribute attr;
112 ssize_t (*show)(struct cluster *, char *); 117 ssize_t (*show)(struct dlm_cluster *, char *);
113 ssize_t (*store)(struct cluster *, const char *, size_t); 118 ssize_t (*store)(struct dlm_cluster *, const char *, size_t);
114}; 119};
115 120
116static ssize_t cluster_set(struct cluster *cl, unsigned int *cl_field, 121static ssize_t cluster_set(struct dlm_cluster *cl, unsigned int *cl_field,
117 int *info_field, int check_zero, 122 int *info_field, int check_zero,
118 const char *buf, size_t len) 123 const char *buf, size_t len)
119{ 124{
@@ -134,12 +139,12 @@ static ssize_t cluster_set(struct cluster *cl, unsigned int *cl_field,
134} 139}
135 140
136#define CLUSTER_ATTR(name, check_zero) \ 141#define CLUSTER_ATTR(name, check_zero) \
137static ssize_t name##_write(struct cluster *cl, const char *buf, size_t len) \ 142static ssize_t name##_write(struct dlm_cluster *cl, const char *buf, size_t len) \
138{ \ 143{ \
139 return cluster_set(cl, &cl->cl_##name, &dlm_config.ci_##name, \ 144 return cluster_set(cl, &cl->cl_##name, &dlm_config.ci_##name, \
140 check_zero, buf, len); \ 145 check_zero, buf, len); \
141} \ 146} \
142static ssize_t name##_read(struct cluster *cl, char *buf) \ 147static ssize_t name##_read(struct dlm_cluster *cl, char *buf) \
143{ \ 148{ \
144 return snprintf(buf, PAGE_SIZE, "%u\n", cl->cl_##name); \ 149 return snprintf(buf, PAGE_SIZE, "%u\n", cl->cl_##name); \
145} \ 150} \
@@ -181,8 +186,8 @@ enum {
181 186
182struct comm_attribute { 187struct comm_attribute {
183 struct configfs_attribute attr; 188 struct configfs_attribute attr;
184 ssize_t (*show)(struct comm *, char *); 189 ssize_t (*show)(struct dlm_comm *, char *);
185 ssize_t (*store)(struct comm *, const char *, size_t); 190 ssize_t (*store)(struct dlm_comm *, const char *, size_t);
186}; 191};
187 192
188static struct comm_attribute comm_attr_nodeid = { 193static struct comm_attribute comm_attr_nodeid = {
@@ -222,8 +227,8 @@ enum {
222 227
223struct node_attribute { 228struct node_attribute {
224 struct configfs_attribute attr; 229 struct configfs_attribute attr;
225 ssize_t (*show)(struct node *, char *); 230 ssize_t (*show)(struct dlm_node *, char *);
226 ssize_t (*store)(struct node *, const char *, size_t); 231 ssize_t (*store)(struct dlm_node *, const char *, size_t);
227}; 232};
228 233
229static struct node_attribute node_attr_nodeid = { 234static struct node_attribute node_attr_nodeid = {
@@ -248,26 +253,26 @@ static struct configfs_attribute *node_attrs[] = {
248 NULL, 253 NULL,
249}; 254};
250 255
251struct clusters { 256struct dlm_clusters {
252 struct configfs_subsystem subsys; 257 struct configfs_subsystem subsys;
253}; 258};
254 259
255struct spaces { 260struct dlm_spaces {
256 struct config_group ss_group; 261 struct config_group ss_group;
257}; 262};
258 263
259struct space { 264struct dlm_space {
260 struct config_group group; 265 struct config_group group;
261 struct list_head members; 266 struct list_head members;
262 struct mutex members_lock; 267 struct mutex members_lock;
263 int members_count; 268 int members_count;
264}; 269};
265 270
266struct comms { 271struct dlm_comms {
267 struct config_group cs_group; 272 struct config_group cs_group;
268}; 273};
269 274
270struct comm { 275struct dlm_comm {
271 struct config_item item; 276 struct config_item item;
272 int nodeid; 277 int nodeid;
273 int local; 278 int local;
@@ -275,11 +280,11 @@ struct comm {
275 struct sockaddr_storage *addr[DLM_MAX_ADDR_COUNT]; 280 struct sockaddr_storage *addr[DLM_MAX_ADDR_COUNT];
276}; 281};
277 282
278struct nodes { 283struct dlm_nodes {
279 struct config_group ns_group; 284 struct config_group ns_group;
280}; 285};
281 286
282struct node { 287struct dlm_node {
283 struct config_item item; 288 struct config_item item;
284 struct list_head list; /* space->members */ 289 struct list_head list; /* space->members */
285 int nodeid; 290 int nodeid;
@@ -372,38 +377,40 @@ static struct config_item_type node_type = {
372 .ct_owner = THIS_MODULE, 377 .ct_owner = THIS_MODULE,
373}; 378};
374 379
375static struct cluster *to_cluster(struct config_item *i) 380static struct dlm_cluster *to_cluster(struct config_item *i)
376{ 381{
377 return i ? container_of(to_config_group(i), struct cluster, group):NULL; 382 return i ? container_of(to_config_group(i), struct dlm_cluster, group) :
383 NULL;
378} 384}
379 385
380static struct space *to_space(struct config_item *i) 386static struct dlm_space *to_space(struct config_item *i)
381{ 387{
382 return i ? container_of(to_config_group(i), struct space, group) : NULL; 388 return i ? container_of(to_config_group(i), struct dlm_space, group) :
389 NULL;
383} 390}
384 391
385static struct comm *to_comm(struct config_item *i) 392static struct dlm_comm *to_comm(struct config_item *i)
386{ 393{
387 return i ? container_of(i, struct comm, item) : NULL; 394 return i ? container_of(i, struct dlm_comm, item) : NULL;
388} 395}
389 396
390static struct node *to_node(struct config_item *i) 397static struct dlm_node *to_node(struct config_item *i)
391{ 398{
392 return i ? container_of(i, struct node, item) : NULL; 399 return i ? container_of(i, struct dlm_node, item) : NULL;
393} 400}
394 401
395static struct config_group *make_cluster(struct config_group *g, 402static struct config_group *make_cluster(struct config_group *g,
396 const char *name) 403 const char *name)
397{ 404{
398 struct cluster *cl = NULL; 405 struct dlm_cluster *cl = NULL;
399 struct spaces *sps = NULL; 406 struct dlm_spaces *sps = NULL;
400 struct comms *cms = NULL; 407 struct dlm_comms *cms = NULL;
401 void *gps = NULL; 408 void *gps = NULL;
402 409
403 cl = kzalloc(sizeof(struct cluster), GFP_KERNEL); 410 cl = kzalloc(sizeof(struct dlm_cluster), GFP_KERNEL);
404 gps = kcalloc(3, sizeof(struct config_group *), GFP_KERNEL); 411 gps = kcalloc(3, sizeof(struct config_group *), GFP_KERNEL);
405 sps = kzalloc(sizeof(struct spaces), GFP_KERNEL); 412 sps = kzalloc(sizeof(struct dlm_spaces), GFP_KERNEL);
406 cms = kzalloc(sizeof(struct comms), GFP_KERNEL); 413 cms = kzalloc(sizeof(struct dlm_comms), GFP_KERNEL);
407 414
408 if (!cl || !gps || !sps || !cms) 415 if (!cl || !gps || !sps || !cms)
409 goto fail; 416 goto fail;
@@ -443,7 +450,7 @@ static struct config_group *make_cluster(struct config_group *g,
443 450
444static void drop_cluster(struct config_group *g, struct config_item *i) 451static void drop_cluster(struct config_group *g, struct config_item *i)
445{ 452{
446 struct cluster *cl = to_cluster(i); 453 struct dlm_cluster *cl = to_cluster(i);
447 struct config_item *tmp; 454 struct config_item *tmp;
448 int j; 455 int j;
449 456
@@ -461,20 +468,20 @@ static void drop_cluster(struct config_group *g, struct config_item *i)
461 468
462static void release_cluster(struct config_item *i) 469static void release_cluster(struct config_item *i)
463{ 470{
464 struct cluster *cl = to_cluster(i); 471 struct dlm_cluster *cl = to_cluster(i);
465 kfree(cl->group.default_groups); 472 kfree(cl->group.default_groups);
466 kfree(cl); 473 kfree(cl);
467} 474}
468 475
469static struct config_group *make_space(struct config_group *g, const char *name) 476static struct config_group *make_space(struct config_group *g, const char *name)
470{ 477{
471 struct space *sp = NULL; 478 struct dlm_space *sp = NULL;
472 struct nodes *nds = NULL; 479 struct dlm_nodes *nds = NULL;
473 void *gps = NULL; 480 void *gps = NULL;
474 481
475 sp = kzalloc(sizeof(struct space), GFP_KERNEL); 482 sp = kzalloc(sizeof(struct dlm_space), GFP_KERNEL);
476 gps = kcalloc(2, sizeof(struct config_group *), GFP_KERNEL); 483 gps = kcalloc(2, sizeof(struct config_group *), GFP_KERNEL);
477 nds = kzalloc(sizeof(struct nodes), GFP_KERNEL); 484 nds = kzalloc(sizeof(struct dlm_nodes), GFP_KERNEL);
478 485
479 if (!sp || !gps || !nds) 486 if (!sp || !gps || !nds)
480 goto fail; 487 goto fail;
@@ -500,7 +507,7 @@ static struct config_group *make_space(struct config_group *g, const char *name)
500 507
501static void drop_space(struct config_group *g, struct config_item *i) 508static void drop_space(struct config_group *g, struct config_item *i)
502{ 509{
503 struct space *sp = to_space(i); 510 struct dlm_space *sp = to_space(i);
504 struct config_item *tmp; 511 struct config_item *tmp;
505 int j; 512 int j;
506 513
@@ -517,16 +524,16 @@ static void drop_space(struct config_group *g, struct config_item *i)
517 524
518static void release_space(struct config_item *i) 525static void release_space(struct config_item *i)
519{ 526{
520 struct space *sp = to_space(i); 527 struct dlm_space *sp = to_space(i);
521 kfree(sp->group.default_groups); 528 kfree(sp->group.default_groups);
522 kfree(sp); 529 kfree(sp);
523} 530}
524 531
525static struct config_item *make_comm(struct config_group *g, const char *name) 532static struct config_item *make_comm(struct config_group *g, const char *name)
526{ 533{
527 struct comm *cm; 534 struct dlm_comm *cm;
528 535
529 cm = kzalloc(sizeof(struct comm), GFP_KERNEL); 536 cm = kzalloc(sizeof(struct dlm_comm), GFP_KERNEL);
530 if (!cm) 537 if (!cm)
531 return ERR_PTR(-ENOMEM); 538 return ERR_PTR(-ENOMEM);
532 539
@@ -539,7 +546,7 @@ static struct config_item *make_comm(struct config_group *g, const char *name)
539 546
540static void drop_comm(struct config_group *g, struct config_item *i) 547static void drop_comm(struct config_group *g, struct config_item *i)
541{ 548{
542 struct comm *cm = to_comm(i); 549 struct dlm_comm *cm = to_comm(i);
543 if (local_comm == cm) 550 if (local_comm == cm)
544 local_comm = NULL; 551 local_comm = NULL;
545 dlm_lowcomms_close(cm->nodeid); 552 dlm_lowcomms_close(cm->nodeid);
@@ -550,16 +557,16 @@ static void drop_comm(struct config_group *g, struct config_item *i)
550 557
551static void release_comm(struct config_item *i) 558static void release_comm(struct config_item *i)
552{ 559{
553 struct comm *cm = to_comm(i); 560 struct dlm_comm *cm = to_comm(i);
554 kfree(cm); 561 kfree(cm);
555} 562}
556 563
557static struct config_item *make_node(struct config_group *g, const char *name) 564static struct config_item *make_node(struct config_group *g, const char *name)
558{ 565{
559 struct space *sp = to_space(g->cg_item.ci_parent); 566 struct dlm_space *sp = to_space(g->cg_item.ci_parent);
560 struct node *nd; 567 struct dlm_node *nd;
561 568
562 nd = kzalloc(sizeof(struct node), GFP_KERNEL); 569 nd = kzalloc(sizeof(struct dlm_node), GFP_KERNEL);
563 if (!nd) 570 if (!nd)
564 return ERR_PTR(-ENOMEM); 571 return ERR_PTR(-ENOMEM);
565 572
@@ -578,8 +585,8 @@ static struct config_item *make_node(struct config_group *g, const char *name)
578 585
579static void drop_node(struct config_group *g, struct config_item *i) 586static void drop_node(struct config_group *g, struct config_item *i)
580{ 587{
581 struct space *sp = to_space(g->cg_item.ci_parent); 588 struct dlm_space *sp = to_space(g->cg_item.ci_parent);
582 struct node *nd = to_node(i); 589 struct dlm_node *nd = to_node(i);
583 590
584 mutex_lock(&sp->members_lock); 591 mutex_lock(&sp->members_lock);
585 list_del(&nd->list); 592 list_del(&nd->list);
@@ -591,11 +598,11 @@ static void drop_node(struct config_group *g, struct config_item *i)
591 598
592static void release_node(struct config_item *i) 599static void release_node(struct config_item *i)
593{ 600{
594 struct node *nd = to_node(i); 601 struct dlm_node *nd = to_node(i);
595 kfree(nd); 602 kfree(nd);
596} 603}
597 604
598static struct clusters clusters_root = { 605static struct dlm_clusters clusters_root = {
599 .subsys = { 606 .subsys = {
600 .su_group = { 607 .su_group = {
601 .cg_item = { 608 .cg_item = {
@@ -625,7 +632,7 @@ void dlm_config_exit(void)
625static ssize_t show_cluster(struct config_item *i, struct configfs_attribute *a, 632static ssize_t show_cluster(struct config_item *i, struct configfs_attribute *a,
626 char *buf) 633 char *buf)
627{ 634{
628 struct cluster *cl = to_cluster(i); 635 struct dlm_cluster *cl = to_cluster(i);
629 struct cluster_attribute *cla = 636 struct cluster_attribute *cla =
630 container_of(a, struct cluster_attribute, attr); 637 container_of(a, struct cluster_attribute, attr);
631 return cla->show ? cla->show(cl, buf) : 0; 638 return cla->show ? cla->show(cl, buf) : 0;
@@ -635,7 +642,7 @@ static ssize_t store_cluster(struct config_item *i,
635 struct configfs_attribute *a, 642 struct configfs_attribute *a,
636 const char *buf, size_t len) 643 const char *buf, size_t len)
637{ 644{
638 struct cluster *cl = to_cluster(i); 645 struct dlm_cluster *cl = to_cluster(i);
639 struct cluster_attribute *cla = 646 struct cluster_attribute *cla =
640 container_of(a, struct cluster_attribute, attr); 647 container_of(a, struct cluster_attribute, attr);
641 return cla->store ? cla->store(cl, buf, len) : -EINVAL; 648 return cla->store ? cla->store(cl, buf, len) : -EINVAL;
@@ -644,7 +651,7 @@ static ssize_t store_cluster(struct config_item *i,
644static ssize_t show_comm(struct config_item *i, struct configfs_attribute *a, 651static ssize_t show_comm(struct config_item *i, struct configfs_attribute *a,
645 char *buf) 652 char *buf)
646{ 653{
647 struct comm *cm = to_comm(i); 654 struct dlm_comm *cm = to_comm(i);
648 struct comm_attribute *cma = 655 struct comm_attribute *cma =
649 container_of(a, struct comm_attribute, attr); 656 container_of(a, struct comm_attribute, attr);
650 return cma->show ? cma->show(cm, buf) : 0; 657 return cma->show ? cma->show(cm, buf) : 0;
@@ -653,29 +660,31 @@ static ssize_t show_comm(struct config_item *i, struct configfs_attribute *a,
653static ssize_t store_comm(struct config_item *i, struct configfs_attribute *a, 660static ssize_t store_comm(struct config_item *i, struct configfs_attribute *a,
654 const char *buf, size_t len) 661 const char *buf, size_t len)
655{ 662{
656 struct comm *cm = to_comm(i); 663 struct dlm_comm *cm = to_comm(i);
657 struct comm_attribute *cma = 664 struct comm_attribute *cma =
658 container_of(a, struct comm_attribute, attr); 665 container_of(a, struct comm_attribute, attr);
659 return cma->store ? cma->store(cm, buf, len) : -EINVAL; 666 return cma->store ? cma->store(cm, buf, len) : -EINVAL;
660} 667}
661 668
662static ssize_t comm_nodeid_read(struct comm *cm, char *buf) 669static ssize_t comm_nodeid_read(struct dlm_comm *cm, char *buf)
663{ 670{
664 return sprintf(buf, "%d\n", cm->nodeid); 671 return sprintf(buf, "%d\n", cm->nodeid);
665} 672}
666 673
667static ssize_t comm_nodeid_write(struct comm *cm, const char *buf, size_t len) 674static ssize_t comm_nodeid_write(struct dlm_comm *cm, const char *buf,
675 size_t len)
668{ 676{
669 cm->nodeid = simple_strtol(buf, NULL, 0); 677 cm->nodeid = simple_strtol(buf, NULL, 0);
670 return len; 678 return len;
671} 679}
672 680
673static ssize_t comm_local_read(struct comm *cm, char *buf) 681static ssize_t comm_local_read(struct dlm_comm *cm, char *buf)
674{ 682{
675 return sprintf(buf, "%d\n", cm->local); 683 return sprintf(buf, "%d\n", cm->local);
676} 684}
677 685
678static ssize_t comm_local_write(struct comm *cm, const char *buf, size_t len) 686static ssize_t comm_local_write(struct dlm_comm *cm, const char *buf,
687 size_t len)
679{ 688{
680 cm->local= simple_strtol(buf, NULL, 0); 689 cm->local= simple_strtol(buf, NULL, 0);
681 if (cm->local && !local_comm) 690 if (cm->local && !local_comm)
@@ -683,7 +692,7 @@ static ssize_t comm_local_write(struct comm *cm, const char *buf, size_t len)
683 return len; 692 return len;
684} 693}
685 694
686static ssize_t comm_addr_write(struct comm *cm, const char *buf, size_t len) 695static ssize_t comm_addr_write(struct dlm_comm *cm, const char *buf, size_t len)
687{ 696{
688 struct sockaddr_storage *addr; 697 struct sockaddr_storage *addr;
689 698
@@ -705,7 +714,7 @@ static ssize_t comm_addr_write(struct comm *cm, const char *buf, size_t len)
705static ssize_t show_node(struct config_item *i, struct configfs_attribute *a, 714static ssize_t show_node(struct config_item *i, struct configfs_attribute *a,
706 char *buf) 715 char *buf)
707{ 716{
708 struct node *nd = to_node(i); 717 struct dlm_node *nd = to_node(i);
709 struct node_attribute *nda = 718 struct node_attribute *nda =
710 container_of(a, struct node_attribute, attr); 719 container_of(a, struct node_attribute, attr);
711 return nda->show ? nda->show(nd, buf) : 0; 720 return nda->show ? nda->show(nd, buf) : 0;
@@ -714,29 +723,31 @@ static ssize_t show_node(struct config_item *i, struct configfs_attribute *a,
714static ssize_t store_node(struct config_item *i, struct configfs_attribute *a, 723static ssize_t store_node(struct config_item *i, struct configfs_attribute *a,
715 const char *buf, size_t len) 724 const char *buf, size_t len)
716{ 725{
717 struct node *nd = to_node(i); 726 struct dlm_node *nd = to_node(i);
718 struct node_attribute *nda = 727 struct node_attribute *nda =
719 container_of(a, struct node_attribute, attr); 728 container_of(a, struct node_attribute, attr);
720 return nda->store ? nda->store(nd, buf, len) : -EINVAL; 729 return nda->store ? nda->store(nd, buf, len) : -EINVAL;
721} 730}
722 731
723static ssize_t node_nodeid_read(struct node *nd, char *buf) 732static ssize_t node_nodeid_read(struct dlm_node *nd, char *buf)
724{ 733{
725 return sprintf(buf, "%d\n", nd->nodeid); 734 return sprintf(buf, "%d\n", nd->nodeid);
726} 735}
727 736
728static ssize_t node_nodeid_write(struct node *nd, const char *buf, size_t len) 737static ssize_t node_nodeid_write(struct dlm_node *nd, const char *buf,
738 size_t len)
729{ 739{
730 nd->nodeid = simple_strtol(buf, NULL, 0); 740 nd->nodeid = simple_strtol(buf, NULL, 0);
731 return len; 741 return len;
732} 742}
733 743
734static ssize_t node_weight_read(struct node *nd, char *buf) 744static ssize_t node_weight_read(struct dlm_node *nd, char *buf)
735{ 745{
736 return sprintf(buf, "%d\n", nd->weight); 746 return sprintf(buf, "%d\n", nd->weight);
737} 747}
738 748
739static ssize_t node_weight_write(struct node *nd, const char *buf, size_t len) 749static ssize_t node_weight_write(struct dlm_node *nd, const char *buf,
750 size_t len)
740{ 751{
741 nd->weight = simple_strtol(buf, NULL, 0); 752 nd->weight = simple_strtol(buf, NULL, 0);
742 return len; 753 return len;
@@ -746,7 +757,7 @@ static ssize_t node_weight_write(struct node *nd, const char *buf, size_t len)
746 * Functions for the dlm to get the info that's been configured 757 * Functions for the dlm to get the info that's been configured
747 */ 758 */
748 759
749static struct space *get_space(char *name) 760static struct dlm_space *get_space(char *name)
750{ 761{
751 struct config_item *i; 762 struct config_item *i;
752 763
@@ -760,15 +771,15 @@ static struct space *get_space(char *name)
760 return to_space(i); 771 return to_space(i);
761} 772}
762 773
763static void put_space(struct space *sp) 774static void put_space(struct dlm_space *sp)
764{ 775{
765 config_item_put(&sp->group.cg_item); 776 config_item_put(&sp->group.cg_item);
766} 777}
767 778
768static struct comm *get_comm(int nodeid, struct sockaddr_storage *addr) 779static struct dlm_comm *get_comm(int nodeid, struct sockaddr_storage *addr)
769{ 780{
770 struct config_item *i; 781 struct config_item *i;
771 struct comm *cm = NULL; 782 struct dlm_comm *cm = NULL;
772 int found = 0; 783 int found = 0;
773 784
774 if (!comm_list) 785 if (!comm_list)
@@ -801,7 +812,7 @@ static struct comm *get_comm(int nodeid, struct sockaddr_storage *addr)
801 return cm; 812 return cm;
802} 813}
803 814
804static void put_comm(struct comm *cm) 815static void put_comm(struct dlm_comm *cm)
805{ 816{
806 config_item_put(&cm->item); 817 config_item_put(&cm->item);
807} 818}
@@ -810,8 +821,8 @@ static void put_comm(struct comm *cm)
810int dlm_nodeid_list(char *lsname, int **ids_out, int *ids_count_out, 821int dlm_nodeid_list(char *lsname, int **ids_out, int *ids_count_out,
811 int **new_out, int *new_count_out) 822 int **new_out, int *new_count_out)
812{ 823{
813 struct space *sp; 824 struct dlm_space *sp;
814 struct node *nd; 825 struct dlm_node *nd;
815 int i = 0, rv = 0, ids_count = 0, new_count = 0; 826 int i = 0, rv = 0, ids_count = 0, new_count = 0;
816 int *ids, *new; 827 int *ids, *new;
817 828
@@ -874,8 +885,8 @@ int dlm_nodeid_list(char *lsname, int **ids_out, int *ids_count_out,
874 885
875int dlm_node_weight(char *lsname, int nodeid) 886int dlm_node_weight(char *lsname, int nodeid)
876{ 887{
877 struct space *sp; 888 struct dlm_space *sp;
878 struct node *nd; 889 struct dlm_node *nd;
879 int w = -EEXIST; 890 int w = -EEXIST;
880 891
881 sp = get_space(lsname); 892 sp = get_space(lsname);
@@ -897,7 +908,7 @@ int dlm_node_weight(char *lsname, int nodeid)
897 908
898int dlm_nodeid_to_addr(int nodeid, struct sockaddr_storage *addr) 909int dlm_nodeid_to_addr(int nodeid, struct sockaddr_storage *addr)
899{ 910{
900 struct comm *cm = get_comm(nodeid, NULL); 911 struct dlm_comm *cm = get_comm(nodeid, NULL);
901 if (!cm) 912 if (!cm)
902 return -EEXIST; 913 return -EEXIST;
903 if (!cm->addr_count) 914 if (!cm->addr_count)
@@ -909,7 +920,7 @@ int dlm_nodeid_to_addr(int nodeid, struct sockaddr_storage *addr)
909 920
910int dlm_addr_to_nodeid(struct sockaddr_storage *addr, int *nodeid) 921int dlm_addr_to_nodeid(struct sockaddr_storage *addr, int *nodeid)
911{ 922{
912 struct comm *cm = get_comm(0, addr); 923 struct dlm_comm *cm = get_comm(0, addr);
913 if (!cm) 924 if (!cm)
914 return -EEXIST; 925 return -EEXIST;
915 *nodeid = cm->nodeid; 926 *nodeid = cm->nodeid;
diff --git a/fs/dlm/user.c b/fs/dlm/user.c
index 929e48ae7591..34f14a14fb4e 100644
--- a/fs/dlm/user.c
+++ b/fs/dlm/user.c
@@ -527,8 +527,10 @@ static ssize_t device_write(struct file *file, const char __user *buf,
527 k32buf = (struct dlm_write_request32 *)kbuf; 527 k32buf = (struct dlm_write_request32 *)kbuf;
528 kbuf = kmalloc(count + 1 + (sizeof(struct dlm_write_request) - 528 kbuf = kmalloc(count + 1 + (sizeof(struct dlm_write_request) -
529 sizeof(struct dlm_write_request32)), GFP_KERNEL); 529 sizeof(struct dlm_write_request32)), GFP_KERNEL);
530 if (!kbuf) 530 if (!kbuf) {
531 kfree(k32buf);
531 return -ENOMEM; 532 return -ENOMEM;
533 }
532 534
533 if (proc) 535 if (proc)
534 set_bit(DLM_PROC_FLAGS_COMPAT, &proc->flags); 536 set_bit(DLM_PROC_FLAGS_COMPAT, &proc->flags);
@@ -539,8 +541,10 @@ static ssize_t device_write(struct file *file, const char __user *buf,
539 541
540 /* do we really need this? can a write happen after a close? */ 542 /* do we really need this? can a write happen after a close? */
541 if ((kbuf->cmd == DLM_USER_LOCK || kbuf->cmd == DLM_USER_UNLOCK) && 543 if ((kbuf->cmd == DLM_USER_LOCK || kbuf->cmd == DLM_USER_UNLOCK) &&
542 (proc && test_bit(DLM_PROC_FLAGS_CLOSING, &proc->flags))) 544 (proc && test_bit(DLM_PROC_FLAGS_CLOSING, &proc->flags))) {
543 return -EINVAL; 545 error = -EINVAL;
546 goto out_free;
547 }
544 548
545 sigfillset(&allsigs); 549 sigfillset(&allsigs);
546 sigprocmask(SIG_BLOCK, &allsigs, &tmpsig); 550 sigprocmask(SIG_BLOCK, &allsigs, &tmpsig);