diff options
| author | David Teigland <teigland@redhat.com> | 2009-09-24 16:58:23 -0400 |
|---|---|---|
| committer | David Teigland <teigland@redhat.com> | 2009-09-30 13:19:44 -0400 |
| commit | 6861f350785bf476c2d4e3b9cb69ee36b78df2fc (patch) | |
| tree | 99cb1eb3cb5ac2084077fae9eec7e1f3e9d2cdc5 | |
| parent | 04bedd79a7037ee7af816b06c60c738144475c4a (diff) | |
dlm: fix socket fd translation
The code to set up sctp sockets was not using the sockfd_lookup()
and sockfd_put() routines to translate an fd to a socket. The
direct fget and fput calls were resulting in error messages from
alloc_fd().
Also clean up two log messages and remove a third, related to
setting up sctp associations.
Signed-off-by: David Teigland <teigland@redhat.com>
| -rw-r--r-- | fs/dlm/lowcomms.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index a3350e4c8184..70736eb4b516 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c | |||
| @@ -459,9 +459,9 @@ static void process_sctp_notification(struct connection *con, | |||
| 459 | int prim_len, ret; | 459 | int prim_len, ret; |
| 460 | int addr_len; | 460 | int addr_len; |
| 461 | struct connection *new_con; | 461 | struct connection *new_con; |
| 462 | struct file *file; | ||
| 463 | sctp_peeloff_arg_t parg; | 462 | sctp_peeloff_arg_t parg; |
| 464 | int parglen = sizeof(parg); | 463 | int parglen = sizeof(parg); |
| 464 | int err; | ||
| 465 | 465 | ||
| 466 | /* | 466 | /* |
| 467 | * We get this before any data for an association. | 467 | * We get this before any data for an association. |
| @@ -516,19 +516,22 @@ static void process_sctp_notification(struct connection *con, | |||
| 516 | ret = kernel_getsockopt(con->sock, IPPROTO_SCTP, | 516 | ret = kernel_getsockopt(con->sock, IPPROTO_SCTP, |
| 517 | SCTP_SOCKOPT_PEELOFF, | 517 | SCTP_SOCKOPT_PEELOFF, |
| 518 | (void *)&parg, &parglen); | 518 | (void *)&parg, &parglen); |
| 519 | if (ret) { | 519 | if (ret < 0) { |
| 520 | log_print("Can't peel off a socket for " | 520 | log_print("Can't peel off a socket for " |
| 521 | "connection %d to node %d: err=%d\n", | 521 | "connection %d to node %d: err=%d", |
| 522 | 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; | ||
| 523 | } | 529 | } |
| 524 | file = fget(parg.sd); | ||
| 525 | new_con->sock = SOCKET_I(file->f_dentry->d_inode); | ||
| 526 | add_sock(new_con->sock, new_con); | 530 | add_sock(new_con->sock, new_con); |
| 527 | fput(file); | 531 | sockfd_put(new_con->sock); |
| 528 | put_unused_fd(parg.sd); | ||
| 529 | 532 | ||
| 530 | log_print("got new/restarted association %d nodeid %d", | 533 | log_print("connecting to %d sctp association %d", |
| 531 | (int)sn->sn_assoc_change.sac_assoc_id, nodeid); | 534 | nodeid, (int)sn->sn_assoc_change.sac_assoc_id); |
| 532 | 535 | ||
| 533 | /* Send any pending writes */ | 536 | /* Send any pending writes */ |
| 534 | clear_bit(CF_CONNECT_PENDING, &new_con->flags); | 537 | clear_bit(CF_CONNECT_PENDING, &new_con->flags); |
| @@ -841,8 +844,6 @@ static void sctp_init_assoc(struct connection *con) | |||
| 841 | if (con->retries++ > MAX_CONNECT_RETRIES) | 844 | if (con->retries++ > MAX_CONNECT_RETRIES) |
| 842 | return; | 845 | return; |
| 843 | 846 | ||
| 844 | log_print("Initiating association with node %d", con->nodeid); | ||
| 845 | |||
| 846 | if (nodeid_to_addr(con->nodeid, (struct sockaddr *)&rem_addr)) { | 847 | if (nodeid_to_addr(con->nodeid, (struct sockaddr *)&rem_addr)) { |
| 847 | log_print("no address for nodeid %d", con->nodeid); | 848 | log_print("no address for nodeid %d", con->nodeid); |
| 848 | return; | 849 | return; |
