diff options
Diffstat (limited to 'fs/dlm')
-rw-r--r-- | fs/dlm/dir.c | 17 | ||||
-rw-r--r-- | fs/dlm/lock.c | 8 | ||||
-rw-r--r-- | fs/dlm/lock.h | 3 | ||||
-rw-r--r-- | fs/dlm/lowcomms.c | 24 |
4 files changed, 33 insertions, 19 deletions
diff --git a/fs/dlm/dir.c b/fs/dlm/dir.c index 83641574b016..dc5eb598b81f 100644 --- a/fs/dlm/dir.c +++ b/fs/dlm/dir.c | |||
@@ -351,11 +351,28 @@ int dlm_dir_lookup(struct dlm_ls *ls, int nodeid, char *name, int namelen, | |||
351 | static struct dlm_rsb *find_rsb_root(struct dlm_ls *ls, char *name, int len) | 351 | static struct dlm_rsb *find_rsb_root(struct dlm_ls *ls, char *name, int len) |
352 | { | 352 | { |
353 | struct dlm_rsb *r; | 353 | struct dlm_rsb *r; |
354 | uint32_t hash, bucket; | ||
355 | int rv; | ||
356 | |||
357 | hash = jhash(name, len, 0); | ||
358 | bucket = hash & (ls->ls_rsbtbl_size - 1); | ||
359 | |||
360 | spin_lock(&ls->ls_rsbtbl[bucket].lock); | ||
361 | rv = dlm_search_rsb_tree(&ls->ls_rsbtbl[bucket].keep, name, len, 0, &r); | ||
362 | if (rv) | ||
363 | rv = dlm_search_rsb_tree(&ls->ls_rsbtbl[bucket].toss, | ||
364 | name, len, 0, &r); | ||
365 | spin_unlock(&ls->ls_rsbtbl[bucket].lock); | ||
366 | |||
367 | if (!rv) | ||
368 | return r; | ||
354 | 369 | ||
355 | down_read(&ls->ls_root_sem); | 370 | down_read(&ls->ls_root_sem); |
356 | list_for_each_entry(r, &ls->ls_root_list, res_root_list) { | 371 | list_for_each_entry(r, &ls->ls_root_list, res_root_list) { |
357 | if (len == r->res_length && !memcmp(name, r->res_name, len)) { | 372 | if (len == r->res_length && !memcmp(name, r->res_name, len)) { |
358 | up_read(&ls->ls_root_sem); | 373 | up_read(&ls->ls_root_sem); |
374 | log_error(ls, "find_rsb_root revert to root_list %s", | ||
375 | r->res_name); | ||
359 | return r; | 376 | return r; |
360 | } | 377 | } |
361 | } | 378 | } |
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c index d47183043c59..fa5c07d51dcc 100644 --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c | |||
@@ -411,8 +411,8 @@ static int rsb_cmp(struct dlm_rsb *r, const char *name, int nlen) | |||
411 | return memcmp(r->res_name, maxname, DLM_RESNAME_MAXLEN); | 411 | return memcmp(r->res_name, maxname, DLM_RESNAME_MAXLEN); |
412 | } | 412 | } |
413 | 413 | ||
414 | static int search_rsb_tree(struct rb_root *tree, char *name, int len, | 414 | int dlm_search_rsb_tree(struct rb_root *tree, char *name, int len, |
415 | unsigned int flags, struct dlm_rsb **r_ret) | 415 | unsigned int flags, struct dlm_rsb **r_ret) |
416 | { | 416 | { |
417 | struct rb_node *node = tree->rb_node; | 417 | struct rb_node *node = tree->rb_node; |
418 | struct dlm_rsb *r; | 418 | struct dlm_rsb *r; |
@@ -474,12 +474,12 @@ static int _search_rsb(struct dlm_ls *ls, char *name, int len, int b, | |||
474 | struct dlm_rsb *r; | 474 | struct dlm_rsb *r; |
475 | int error; | 475 | int error; |
476 | 476 | ||
477 | error = search_rsb_tree(&ls->ls_rsbtbl[b].keep, name, len, flags, &r); | 477 | error = dlm_search_rsb_tree(&ls->ls_rsbtbl[b].keep, name, len, flags, &r); |
478 | if (!error) { | 478 | if (!error) { |
479 | kref_get(&r->res_ref); | 479 | kref_get(&r->res_ref); |
480 | goto out; | 480 | goto out; |
481 | } | 481 | } |
482 | error = search_rsb_tree(&ls->ls_rsbtbl[b].toss, name, len, flags, &r); | 482 | error = dlm_search_rsb_tree(&ls->ls_rsbtbl[b].toss, name, len, flags, &r); |
483 | if (error) | 483 | if (error) |
484 | goto out; | 484 | goto out; |
485 | 485 | ||
diff --git a/fs/dlm/lock.h b/fs/dlm/lock.h index 265017a7c3e7..1a255307f6ff 100644 --- a/fs/dlm/lock.h +++ b/fs/dlm/lock.h | |||
@@ -28,6 +28,9 @@ void dlm_scan_waiters(struct dlm_ls *ls); | |||
28 | void dlm_scan_timeout(struct dlm_ls *ls); | 28 | void dlm_scan_timeout(struct dlm_ls *ls); |
29 | void dlm_adjust_timeouts(struct dlm_ls *ls); | 29 | void dlm_adjust_timeouts(struct dlm_ls *ls); |
30 | 30 | ||
31 | int dlm_search_rsb_tree(struct rb_root *tree, char *name, int len, | ||
32 | unsigned int flags, struct dlm_rsb **r_ret); | ||
33 | |||
31 | int dlm_purge_locks(struct dlm_ls *ls); | 34 | int dlm_purge_locks(struct dlm_ls *ls); |
32 | void dlm_purge_mstcpy_locks(struct dlm_rsb *r); | 35 | void dlm_purge_mstcpy_locks(struct dlm_rsb *r); |
33 | void dlm_grant_after_purge(struct dlm_ls *ls); | 36 | void dlm_grant_after_purge(struct dlm_ls *ls); |
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 0b3109ee4257..133ef6dc7cb7 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <linux/mutex.h> | 52 | #include <linux/mutex.h> |
53 | #include <linux/sctp.h> | 53 | #include <linux/sctp.h> |
54 | #include <linux/slab.h> | 54 | #include <linux/slab.h> |
55 | #include <net/sctp/sctp.h> | ||
55 | #include <net/sctp/user.h> | 56 | #include <net/sctp/user.h> |
56 | #include <net/ipv6.h> | 57 | #include <net/ipv6.h> |
57 | 58 | ||
@@ -474,9 +475,6 @@ static void process_sctp_notification(struct connection *con, | |||
474 | int prim_len, ret; | 475 | int prim_len, ret; |
475 | int addr_len; | 476 | int addr_len; |
476 | struct connection *new_con; | 477 | struct connection *new_con; |
477 | sctp_peeloff_arg_t parg; | ||
478 | int parglen = sizeof(parg); | ||
479 | int err; | ||
480 | 478 | ||
481 | /* | 479 | /* |
482 | * We get this before any data for an association. | 480 | * We get this before any data for an association. |
@@ -525,23 +523,19 @@ static void process_sctp_notification(struct connection *con, | |||
525 | return; | 523 | return; |
526 | 524 | ||
527 | /* Peel off a new sock */ | 525 | /* Peel off a new sock */ |
528 | parg.associd = sn->sn_assoc_change.sac_assoc_id; | 526 | sctp_lock_sock(con->sock->sk); |
529 | ret = kernel_getsockopt(con->sock, IPPROTO_SCTP, | 527 | ret = sctp_do_peeloff(con->sock->sk, |
530 | SCTP_SOCKOPT_PEELOFF, | 528 | sn->sn_assoc_change.sac_assoc_id, |
531 | (void *)&parg, &parglen); | 529 | &new_con->sock); |
530 | sctp_release_sock(con->sock->sk); | ||
532 | if (ret < 0) { | 531 | if (ret < 0) { |
533 | log_print("Can't peel off a socket for " | 532 | log_print("Can't peel off a socket for " |
534 | "connection %d to node %d: err=%d", | 533 | "connection %d to node %d: err=%d", |
535 | parg.associd, nodeid, ret); | 534 | (int)sn->sn_assoc_change.sac_assoc_id, |
536 | return; | 535 | nodeid, ret); |
537 | } | ||
538 | new_con->sock = sockfd_lookup(parg.sd, &err); | ||
539 | if (!new_con->sock) { | ||
540 | log_print("sockfd_lookup error %d", err); | ||
541 | return; | 536 | return; |
542 | } | 537 | } |
543 | add_sock(new_con->sock, new_con); | 538 | add_sock(new_con->sock, new_con); |
544 | sockfd_put(new_con->sock); | ||
545 | 539 | ||
546 | log_print("connecting to %d sctp association %d", | 540 | log_print("connecting to %d sctp association %d", |
547 | nodeid, (int)sn->sn_assoc_change.sac_assoc_id); | 541 | nodeid, (int)sn->sn_assoc_change.sac_assoc_id); |
@@ -1082,7 +1076,7 @@ static void init_local(void) | |||
1082 | int i; | 1076 | int i; |
1083 | 1077 | ||
1084 | dlm_local_count = 0; | 1078 | dlm_local_count = 0; |
1085 | for (i = 0; i < DLM_MAX_ADDR_COUNT - 1; i++) { | 1079 | for (i = 0; i < DLM_MAX_ADDR_COUNT; i++) { |
1086 | if (dlm_our_addr(&sas, i)) | 1080 | if (dlm_our_addr(&sas, i)) |
1087 | break; | 1081 | break; |
1088 | 1082 | ||