Skip to content

Commit

Permalink
dlm: replace BUG_ON with a less severe handling
Browse files Browse the repository at this point in the history
BUG_ON() is a severe action for this case, specially now that DLM with
SCTP will use 1 socket per association. Instead, we can just close the
socket on this error condition and return from the function.

Also move the check to an earlier stage as it won't change and thus we
can abort as soon as possible.

Although this issue was reported when still using SCTP with 1-to-many
API, this cleanup wouldn't be that simple back then because we couldn't
close the socket and making sure such event would cease would be hard.
And actually, previous code was closing the association, yet SCTP layer
is still raising the new data event. Probably a bug to be fixed in SCTP.

Reported-by: <tan.hu@zte.com.cn>
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David Teigland <teigland@redhat.com>
  • Loading branch information
Marcelo Ricardo Leitner authored and David Teigland committed Aug 17, 2015
1 parent ee44b4b commit acee4e5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fs/dlm/lowcomms.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,10 @@ static int receive_from_sock(struct connection *con)
ret = -EAGAIN;
goto out_close;
}
if (con->nodeid == 0) {
ret = -EINVAL;
goto out_close;
}

if (con->rx_page == NULL) {
/*
Expand Down Expand Up @@ -582,8 +586,6 @@ static int receive_from_sock(struct connection *con)
else if (ret == len)
call_again_soon = 1;

BUG_ON(con->nodeid == 0);

cbuf_add(&con->cb, ret);
ret = dlm_process_incoming_buffer(con->nodeid,
page_address(con->rx_page),
Expand Down

0 comments on commit acee4e5

Please sign in to comment.