]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
msg: do not abort when driver->del_event() returns -ENOENT 56034/head
authorKefu Chai <tchaikov@gmail.com>
Thu, 7 Mar 2024 11:48:54 +0000 (19:48 +0800)
committerKefu Chai <tchaikov@gmail.com>
Sun, 10 Mar 2024 11:09:53 +0000 (19:09 +0800)
commit543fe9f1fbb5257693b83b8002f31625cafbce56
tree4d1e3814a66997d9e09473f9e249d1d91690bd25
parentcb2b48d76f56fc07bc6a177ed79951f825d2165e
msg: do not abort when driver->del_event() returns -ENOENT

when shutting down a connection, we call into
`EpollDriver::del_event(..., EVENT_READABLE | EVENT_WRITABLE)`, and
its caller, `EventCenter::delete_file_event()` considers a negative
return value from this function a signal of bug and aborts in that
case. but in linux, if a nic is hot unplugged, all the socket file
descriptors associated with it are closed, and we would have following
chain:

__fput() -> eventpoll_release() -> eventpoll_release_file() -> __ep_remove()

in __ep_remove(), the epitem representing the fd is removed from
the list. so if we perform the cleanup when shutting down the
TCP connection, and try to unregister the fd from the interest list,
-ENOENT is returned.

librbd is using EpollDriver as well, and it sits at the client side.
the machine on which librbd is running could unplug its NIC without
shutting down librbd first. so, if librbd happen to be reading/writing
to the socket associated with the NIC being unplugged, there are
chances that librbd could crash due to the `ceph_abort_msg()` call
in `EventCenter::delete_file_event()`. but this is not a fatal error,
as we are unregistering the fd anyway.

in this change, in order to avoid the crash, we don't consider it a
bug if `driver->del_event()` returns -ENOENT anymore.

Fixes: https://tracker.ceph.com/issues/64788
Co-Authored-by: Zhang Jiao <zhangjiao@cmss.chinamobile.com>
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/msg/async/Event.cc