mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
Reopen RO file descriptor RW if necessary.
This commit is contained in:
parent
6aad654559
commit
5e94864311
@ -294,14 +294,19 @@ int dev_open_flags(struct device *dev, int flags, int direct, int quiet)
|
||||
const char *name;
|
||||
|
||||
if (dev->fd >= 0) {
|
||||
if (!(dev->flags & DEV_OPENED_RW) &&
|
||||
((flags & O_ACCMODE) == O_RDWR))
|
||||
log_debug("WARNING: %s already opened read-only",
|
||||
dev_name(dev));
|
||||
if ((dev->flags & DEV_OPENED_RW) ||
|
||||
((flags & O_ACCMODE) != O_RDWR)) {
|
||||
dev->open_count++;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (dev->open_count)
|
||||
log_debug("WARNING: %s already opened read-only",
|
||||
dev_name(dev));
|
||||
else
|
||||
dev_close_immediate(dev);
|
||||
}
|
||||
|
||||
if (memlock())
|
||||
log_error("WARNING: dev_open(%s) called while suspended",
|
||||
dev_name(dev));
|
||||
|
Loading…
Reference in New Issue
Block a user