1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

device: Fix an unpaired device close.

dev_open_flags contains an unpaired dev_close_immediate so increment
open_count before calling it.
This commit is contained in:
Alasdair G Kergon 2017-12-12 17:56:58 +00:00
parent b96862ee11
commit e932c5da50

View File

@ -491,11 +491,12 @@ int dev_open_flags(struct device *dev, int flags, int direct, int quiet)
return 1;
}
if (dev->open_count && !need_excl) {
if (dev->open_count && !need_excl)
log_debug_devs("%s: Already opened read-only. Upgrading "
"to read-write.", dev_name(dev));
dev->open_count++;
}
/* dev_close_immediate will decrement this */
dev->open_count++;
dev_close_immediate(dev);
// FIXME: dev with DEV_ALLOCED is released