Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+22 -14
+22 -14
fs/dlm/lowcomms.c
··· 316 316 { 317 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 323 if (nodeid == dlm_our_nodeid()) 320 324 return 0; 321 325 ··· 459 455 int prim_len, ret; 460 456 int addr_len; 461 457 struct connection *new_con; 462 - struct file *file; 463 458 sctp_peeloff_arg_t parg; 464 459 int parglen = sizeof(parg); 460 + int err; 465 461 466 462 /* 467 463 * We get this before any data for an association. ··· 516 512 ret = kernel_getsockopt(con->sock, IPPROTO_SCTP, 517 513 SCTP_SOCKOPT_PEELOFF, 518 514 (void *)&parg, &parglen); 519 - if (ret) { 515 + if (ret < 0) { 520 516 log_print("Can't peel off a socket for " 521 - "connection %d to node %d: err=%d\n", 517 + "connection %d to node %d: err=%d", 522 518 parg.associd, nodeid, ret); 519 + return; 523 520 } 524 - file = fget(parg.sd); 525 - new_con->sock = SOCKET_I(file->f_dentry->d_inode); 521 + new_con->sock = sockfd_lookup(parg.sd, &err); 522 + if (!new_con->sock) { 523 + log_print("sockfd_lookup error %d", err); 524 + return; 525 + } 526 526 add_sock(new_con->sock, new_con); 527 - fput(file); 528 - put_unused_fd(parg.sd); 527 + sockfd_put(new_con->sock); 529 528 530 - log_print("got new/restarted association %d nodeid %d", 531 - (int)sn->sn_assoc_change.sac_assoc_id, nodeid); 529 + log_print("connecting to %d sctp association %d", 530 + nodeid, (int)sn->sn_assoc_change.sac_assoc_id); 532 531 533 532 /* Send any pending writes */ 534 533 clear_bit(CF_CONNECT_PENDING, &new_con->flags); ··· 844 837 if (con->retries++ > MAX_CONNECT_RETRIES) 845 838 return; 846 839 847 - log_print("Initiating association with node %d", con->nodeid); 848 - 849 840 if (nodeid_to_addr(con->nodeid, (struct sockaddr *)&rem_addr)) { 850 841 log_print("no address for nodeid %d", con->nodeid); 851 842 return; ··· 860 855 outmessage.msg_flags = MSG_EOR; 861 856 862 857 spin_lock(&con->writequeue_lock); 863 - e = list_entry(con->writequeue.next, struct writequeue_entry, 864 - list); 865 858 866 - BUG_ON((struct list_head *) e == &con->writequeue); 859 + if (list_empty(&con->writequeue)) { 860 + spin_unlock(&con->writequeue_lock); 861 + log_print("writequeue empty for nodeid %d", con->nodeid); 862 + return; 863 + } 867 864 865 + e = list_first_entry(&con->writequeue, struct writequeue_entry, list); 868 866 len = e->len; 869 867 offset = e->offset; 870 868 spin_unlock(&con->writequeue_lock);