1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-17 06:04:23 +03:00

device: add DEV_OPEN_FAILURE flag

DEV_OPEN_FAILURE flag is set if the most recent "open" for a device
failed and it's unset if any subsequent "open" succeeds.
This commit is contained in:
Peter Rajnoha 2016-03-17 13:45:14 +01:00
parent e58d24293f
commit 65d9f742f8
2 changed files with 4 additions and 0 deletions

View File

@ -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;
}

View File

@ -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.