Silently exit on ENODEV
ENODEV should be included in the check for "disappeared" device or
directory when hwmon driver is being unloaded. There is a race
condition between unloading drivers and stopping hwmon polling, even
up to several seconds, which exceeds the previous retry period for
ENODEV.
Change-Id: I39c8ae9ea79aa41028f5529c7ea9816d4736fc65
Signed-off-by: Edward A. James <eajames@us.ibm.com>
diff --git a/sysfs.cpp b/sysfs.cpp
index aeee859..b0c5a6d 100644
--- a/sysfs.cpp
+++ b/sysfs.cpp
@@ -56,14 +56,6 @@
ENXIO,
/*
- * We can see this from some drivers when we try to do
- * a read in the middle of them being unbound. The
- * unbinding should complete before the retries are up
- * and kill this process.
- */
- ENODEV,
-
- /*
* Some devices return this when they are busy doing
* something else. Even if being busy isn't the cause,
* a retry still gives this app a shot at getting data
@@ -290,10 +282,10 @@
throw;
}
- if (rc == ENOENT)
+ if (rc == ENOENT || rc == ENODEV)
{
- // If the directory disappeared then this application should
- // gracefully exit. There are race conditions between the
+ // If the directory or device disappeared then this application
+ // should gracefully exit. There are race conditions between the
// unloading of a hwmon driver and the stopping of this service
// by systemd. To prevent this application from falsely failing
// in these scenarios, it will simply exit if the directory or