diff --git a/lib/device/dev-io.c b/lib/device/dev-io.c index f8b24bfcd..9bf6d2e14 100644 --- a/lib/device/dev-io.c +++ b/lib/device/dev-io.c @@ -513,6 +513,8 @@ int dev_open_flags(struct device *dev, int flags, int direct, int quiet) log_sys_debug("open", name); else log_sys_error("open", name); + + dev->flags |= DEV_OPEN_FAILURE; return 0; } @@ -556,6 +558,7 @@ int dev_open_flags(struct device *dev, int flags, int direct, int quiet) dev->flags & DEV_OPENED_EXCL ? " O_EXCL" : "", dev->flags & DEV_O_DIRECT ? " O_DIRECT" : ""); + dev->flags &= ~DEV_OPEN_FAILURE; return 1; } diff --git a/lib/device/device.h b/lib/device/device.h index 6b01fb6e7..fc5a5b992 100644 --- a/lib/device/device.h +++ b/lib/device/device.h @@ -27,6 +27,7 @@ #define DEV_OPENED_EXCL 0x00000010 /* Opened EXCL */ #define DEV_O_DIRECT 0x00000020 /* Use O_DIRECT */ #define DEV_O_DIRECT_TESTED 0x00000040 /* DEV_O_DIRECT is reliable */ +#define DEV_OPEN_FAILURE 0x00000080 /* Has last open failed? */ /* * Support for external device info.