1
0
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:
Alasdair Kergon 2004-12-12 21:47:14 +00:00
parent 6aad654559
commit 5e94864311

View File

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