From 82f5ffd25549c8bdbd4d07da16a343f816c6bacd Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Fri, 21 Apr 2017 01:04:16 +0000 Subject: [PATCH] iscsi-scstd: daemon handle EOF (rc == 0) from nl_fd Daemon now handles receipt of EOF (rc == 0) from nl_fd. Probably this never happens in a real kernel build, but it does during shutdown in a usermode build and it seems like it is "generically correct" in either case. Signed-off-by: David Butterfield git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7140 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/usr/event.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/iscsi-scst/usr/event.c b/iscsi-scst/usr/event.c index 8d0734767..1d28ef9e9 100644 --- a/iscsi-scst/usr/event.c +++ b/iscsi-scst/usr/event.c @@ -1066,6 +1066,15 @@ retry: goto retry; log_error("read netlink fd (%d) failed: %s", fd, strerror(errno)); exit(1); + } else if (rc == 0) { + /* + * EOF on nl_fd -- + * We arrive here after the kernel module closes the other end + * of nl_fd during shutdown of the kernel modules. The daemon + * thread is expected to exit when this happens. + */ + log_info("kernel module shutdown -- daemon exits"); + exit(1); } log_debug(1, "target %u, session %#" PRIx64 ", conn %u, code %u, cookie %d",