Skip to content

Commit

Permalink
msg/async: bug fix 23600. After listen_socket was closed, it entered …
Browse files Browse the repository at this point in the history
…the start() process magically. so I think we should make '_fd = -1' when listen_socket was closed. And in the start process, determine the value of listen_socket, if it equal to -1, return the process

Fixes: https://tracker.ceph.com/issues/23600

Signed-off-by: shangfufei <shangfufei@inspur.com>
  • Loading branch information
shangfufei committed Apr 11, 2018
1 parent 46df695 commit 609c4cd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/msg/async/AsyncMessenger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ void Processor::start()

// start thread
if (listen_socket) {
if (listen_socket.fd() == -1) {
ldout(msgr->cct, 1) << __func__ << " Erro: processor restart after listen_socket.fd closed. " << this << dendl;
return;
}
worker->center.submit_to(worker->center.get_id(), [this]() {
worker->center.create_file_event(listen_socket.fd(), EVENT_READABLE, listen_handler); }, false);
}
Expand Down
1 change: 1 addition & 0 deletions src/msg/async/PosixStack.cc
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ class PosixServerSocketImpl : public ServerSocketImpl {
int accept(ConnectedSocket *sock, const SocketOptions &opts, entity_addr_t *out, Worker *w) override;
void abort_accept() override {
::close(_fd);
_fd = -1;
}
int fd() const override {
return _fd;
Expand Down

0 comments on commit 609c4cd

Please sign in to comment.