mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
device: Don't try to close config file on failure.
$file: open failed: Permission denied Failed to load config file $file Attempt to close device '$file' which is not open.
This commit is contained in:
parent
a606966029
commit
623b46a17d
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.128 -
|
Version 2.02.128 -
|
||||||
===================================
|
===================================
|
||||||
|
Don't attempt to close config file that couldn't be opened.
|
||||||
Check for valid cache mode in validation of cache segment.
|
Check for valid cache mode in validation of cache segment.
|
||||||
Change internal interface handling cache mode and policy.
|
Change internal interface handling cache mode and policy.
|
||||||
When no cache policy specified, prefer smq (if available) over mq.
|
When no cache policy specified, prefer smq (if available) over mq.
|
||||||
|
@ -582,8 +582,11 @@ int config_file_read(struct dm_config_tree *cft)
|
|||||||
if (!(cf->dev = dev_create_file(filename, NULL, NULL, 1)))
|
if (!(cf->dev = dev_create_file(filename, NULL, NULL, 1)))
|
||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
if (!dev_open_readonly_buffered(cf->dev))
|
if (!dev_open_readonly_buffered(cf->dev)) {
|
||||||
|
dev_destroy_file(cf->dev);
|
||||||
|
cf->dev = NULL;
|
||||||
return_0;
|
return_0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
r = config_file_read_fd(cft, cf->dev, 0, (size_t) info.st_size, 0, 0,
|
r = config_file_read_fd(cft, cf->dev, 0, (size_t) info.st_size, 0, 0,
|
||||||
|
@ -71,6 +71,16 @@ static void _dev_init(struct device *dev, int max_error_count)
|
|||||||
dm_list_init(&dev->open_list);
|
dm_list_init(&dev->open_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dev_destroy_file(struct device *dev)
|
||||||
|
{
|
||||||
|
if (!(dev->flags & DEV_ALLOCED))
|
||||||
|
return;
|
||||||
|
|
||||||
|
dm_free((void *) dm_list_item(dev->aliases.n, struct dm_str_list)->str);
|
||||||
|
dm_free(dev->aliases.n);
|
||||||
|
dm_free(dev);
|
||||||
|
}
|
||||||
|
|
||||||
struct device *dev_create_file(const char *filename, struct device *dev,
|
struct device *dev_create_file(const char *filename, struct device *dev,
|
||||||
struct dm_str_list *alias, int use_malloc)
|
struct dm_str_list *alias, int use_malloc)
|
||||||
{
|
{
|
||||||
|
@ -586,12 +586,8 @@ static void _close(struct device *dev)
|
|||||||
|
|
||||||
log_debug_devs("Closed %s", dev_name(dev));
|
log_debug_devs("Closed %s", dev_name(dev));
|
||||||
|
|
||||||
if (dev->flags & DEV_ALLOCED) {
|
if (dev->flags & DEV_ALLOCED)
|
||||||
dm_free((void *) dm_list_item(dev->aliases.n, struct dm_str_list)->
|
dev_destroy_file(dev);
|
||||||
str);
|
|
||||||
dm_free(dev->aliases.n);
|
|
||||||
dm_free(dev);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _dev_close(struct device *dev, int immediate)
|
static int _dev_close(struct device *dev, int immediate)
|
||||||
|
@ -123,6 +123,7 @@ void dev_flush(struct device *dev);
|
|||||||
|
|
||||||
struct device *dev_create_file(const char *filename, struct device *dev,
|
struct device *dev_create_file(const char *filename, struct device *dev,
|
||||||
struct dm_str_list *alias, int use_malloc);
|
struct dm_str_list *alias, int use_malloc);
|
||||||
|
void dev_destroy_file(struct device *dev);
|
||||||
|
|
||||||
/* Return a valid device name from the alias list; NULL otherwise */
|
/* Return a valid device name from the alias list; NULL otherwise */
|
||||||
const char *dev_name_confirmed(struct device *dev, int quiet);
|
const char *dev_name_confirmed(struct device *dev, int quiet);
|
||||||
|
Loading…
Reference in New Issue
Block a user