aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-10-15 18:21:20 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-10-15 18:21:20 -0400
commit8e7768d3f40d4ab79e6af58462e173cdbfad9cc6 (patch)
tree5f47b220e4232d6483fff490290f6491d34a2a74 /fs
parent36d6f3ecbd0bedfbda8b9f7c5fc36edb62a417ad (diff)
parent6861f350785bf476c2d4e3b9cb69ee36b78df2fc (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: fix socket fd translation dlm: fix lowcomms_connect_node for sctp
Diffstat (limited to 'fs')
-rw-r--r--fs/dlm/lowcomms.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 240cef14fe58..70736eb4b516 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -316,6 +316,10 @@ int dlm_lowcomms_connect_node(int nodeid)
316{ 316{
317 struct connection *con; 317 struct connection *con;
318 318
319 /* with sctp there's no connecting without sending */
320 if (dlm_config.ci_protocol != 0)
321 return 0;
322
319 if (nodeid == dlm_our_nodeid()) 323 if (nodeid == dlm_our_nodeid())
320 return 0; 324 return 0;
321 325
@@ -455,9 +459,9 @@ static void process_sctp_notification(struct connection *con,
455 int prim_len, ret; 459 int prim_len, ret;
456 int addr_len; 460 int addr_len;
457 struct connection *new_con; 461 struct connection *new_con;
458 struct file *file;
459 sctp_peeloff_arg_t parg; 462 sctp_peeloff_arg_t parg;
460 int parglen = sizeof(parg); 463 int parglen = sizeof(parg);
464 int err;
461 465
462 /* 466 /*
463 * We get this before any data for an association. 467 * We get this before any data for an association.
@@ -512,19 +516,22 @@ static void process_sctp_notification(struct connection *con,
512 ret = kernel_getsockopt(con->sock, IPPROTO_SCTP, 516 ret = kernel_getsockopt(con->sock, IPPROTO_SCTP,
513 SCTP_SOCKOPT_PEELOFF, 517 SCTP_SOCKOPT_PEELOFF,
514 (void *)&parg, &parglen); 518 (void *)&parg, &parglen);
515 if (ret) { 519 if (ret < 0) {
516 log_print("Can't peel off a socket for " 520 log_print("Can't peel off a socket for "
517 "connection %d to node %d: err=%d\n", 521 "connection %d to node %d: err=%d",
518 parg.associd, nodeid, ret); 522 parg.associd, nodeid, ret);
523 return;
524 }
525 new_con->sock = sockfd_lookup(parg.sd, &err);
526 if (!new_con->sock) {
527 log_print("sockfd_lookup error %d", err);
528 return;
519 } 529 }
520 file = fget(parg.sd);
521 new_con->sock = SOCKET_I(file->f_dentry->d_inode);
522 add_sock(new_con->sock, new_con); 530 add_sock(new_con->sock, new_con);
523 fput(file); 531 sockfd_put(new_con->sock);
524 put_unused_fd(parg.sd);
525 532
526 log_print("got new/restarted association %d nodeid %d", 533 log_print("connecting to %d sctp association %d",
527 (int)sn->sn_assoc_change.sac_assoc_id, nodeid); 534 nodeid, (int)sn->sn_assoc_change.sac_assoc_id);
528 535
529 /* Send any pending writes */ 536 /* Send any pending writes */
530 clear_bit(CF_CONNECT_PENDING, &new_con->flags); 537 clear_bit(CF_CONNECT_PENDING, &new_con->flags);
@@ -837,8 +844,6 @@ static void sctp_init_assoc(struct connection *con)
837 if (con->retries++ > MAX_CONNECT_RETRIES) 844 if (con->retries++ > MAX_CONNECT_RETRIES)
838 return; 845 return;
839 846
840 log_print("Initiating association with node %d", con->nodeid);
841
842 if (nodeid_to_addr(con->nodeid, (struct sockaddr *)&rem_addr)) { 847 if (nodeid_to_addr(con->nodeid, (struct sockaddr *)&rem_addr)) {
843 log_print("no address for nodeid %d", con->nodeid); 848 log_print("no address for nodeid %d", con->nodeid);
844 return; 849 return;
@@ -855,11 +860,14 @@ static void sctp_init_assoc(struct connection *con)
855 outmessage.msg_flags = MSG_EOR; 860 outmessage.msg_flags = MSG_EOR;
856 861
857 spin_lock(&con->writequeue_lock); 862 spin_lock(&con->writequeue_lock);
858 e = list_entry(con->writequeue.next, struct writequeue_entry,
859 list);
860 863
861 BUG_ON((struct list_head *) e == &con->writequeue); 864 if (list_empty(&con->writequeue)) {
865 spin_unlock(&con->writequeue_lock);
866 log_print("writequeue empty for nodeid %d", con->nodeid);
867 return;
868 }
862 869
870 e = list_first_entry(&con->writequeue, struct writequeue_entry, list);
863 len = e->len; 871 len = e->len;
864 offset = e->offset; 872 offset = e->offset;
865 spin_unlock(&con->writequeue_lock); 873 spin_unlock(&con->writequeue_lock);