The 'libndctl' test was neglecting to add the health_eventfd to the
select() fdset when testing for notification timeouts. We also need to
clear the signalled status by reading the buffer.

Reported-by: Daniel Osawa <[email protected]>
Signed-off-by: Dan Williams <[email protected]>
---
 test/libndctl.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/test/libndctl.c b/test/libndctl.c
index 50fce70183a8..770171919b6c 100644
--- a/test/libndctl.c
+++ b/test/libndctl.c
@@ -2210,6 +2210,7 @@ static int check_smart_threshold(struct ndctl_bus *bus, 
struct ndctl_dimm *dimm,
        };
        struct ndctl_cmd *cmd = ndctl_dimm_cmd_new_smart_threshold(dimm);
        struct timeval tm;
+       char buf[4096];
        fd_set fds;
        int rc, fd;
 
@@ -2221,6 +2222,8 @@ static int check_smart_threshold(struct ndctl_bus *bus, 
struct ndctl_dimm *dimm,
 
        fd = ndctl_dimm_get_health_eventfd(dimm);
        FD_ZERO(&fds);
+       FD_SET(fd, &fds);
+       rc = pread(fd, buf, sizeof(buf), 0);
        tm.tv_sec = 0;
        tm.tv_usec = 500;
        rc = select(fd + 1, NULL, NULL, &fds, &tm);
@@ -2245,6 +2248,7 @@ static int check_smart_threshold(struct ndctl_bus *bus, 
struct ndctl_dimm *dimm,
                        rc = select(fd + 1, NULL, NULL, &fds, &tm);
                        if (rc != 1 || !FD_ISSET(fd, &fds))
                                exit(EXIT_FAILURE);
+                       rc = pread(fd, buf, sizeof(buf), 0);
                        exit(EXIT_SUCCESS);
                }
        }

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

Reply via email to