1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-06 10:00:40 +03:00

Track recursive filter iteration to avoid refreshing while in use. (2.02.56)

This commit is contained in:
Alasdair Kergon 2010-09-22 01:36:13 +00:00
parent 064ed484b4
commit a171bb6e85
13 changed files with 43 additions and 12 deletions

View File

@ -1 +1 @@
2.02.74(2)-cvs (2010-08-19)
2.02.74(2)-cvs (2010-09-22)

View File

@ -1 +1 @@
1.02.55-cvs (2010-08-19)
1.02.55-cvs (2010-09-22)

View File

@ -1,7 +1,8 @@
Version 2.02.74 -
==================================
Revert to old glibc behaviour for vsnprintf used in emit_to_buffer function.
Use dynamic allocation for metadata's tag buffer (removes 4096 char. limit).
=====================================
Track recursive filter iteration to avoid refreshing while in use. (2.02.56)
Revert to old glibc vsnprintf behaviour in emit_to_buffer() to catch overflow.
Allocate buffer for metadata tags dynamically to remove 4k limit.
Add random suffix to archive file names to prevent races when being created.
Reinitialize archive and backup handling on toolcontext refresh.
Fix opprobriously slow I/O to cluster mirrors created with --nosync.
@ -16,16 +17,16 @@ Version 2.02.74 -
Add "devices/default_data_alignment" to lvm.conf.
Add implmentation for simple numeric 'get' property functions.
Define GET_NUM_PROPERTY_FN macro to simplify numeric property 'get' function
Add properties.[ch] to lib/report, defined based on columns.h.
Add properties.[ch] to lib/report using columns.h.
Add macro definitions to report infrastructure for character array length.
Remove explicit double quotes from columns.h 'id' entries.
Add 'flags' field to columns.h and define FIELD_MODIFIABLE.
Add vg_mda_size and vg_mda_free functions.
Simplify MD/swap signature detection in pvcreate and allow aborting.
Remove assumption that --yes must be used only in --force mode.
Allow --yes to be used without --force mode.
Fix file descriptor leak in swap signature detection error path.
Detect and allow abort in pvcreate if LUKS signature is detected.
Use proper locks mask when checking for LCK_WRITE.
Always mask lock flags correctly when checking for LCK_WRITE.
Version 2.02.73 - 18th August 2010
==================================

View File

@ -1,5 +1,6 @@
Version 1.02.55 -
==================================
=====================================
Add DM_REPORT_FIELD_TYPE_ID_LEN to libdevmapper.h.
Version 1.02.54 - 18th August 2010
==================================

View File

@ -570,7 +570,7 @@ int lvmcache_label_scan(struct cmd_context *cmd, int full_scan)
goto out;
}
if (full_scan == 2 && !refresh_filters(cmd)) {
if (full_scan == 2 && !cmd->filter->use_count && !refresh_filters(cmd)) {
log_error("refresh filters failed");
goto out;
}

View File

@ -815,12 +815,14 @@ struct dev_iter *dev_iter_create(struct dev_filter *f, int dev_scan)
di->current = btree_first(_cache.devices);
di->filter = f;
di->filter->use_count++;
return di;
}
void dev_iter_destroy(struct dev_iter *iter)
{
iter->filter->use_count--;
dm_free(iter);
}

View File

@ -24,6 +24,7 @@
struct dev_filter {
int (*passes_filter) (struct dev_filter * f, struct device * dev);
void (*destroy) (struct dev_filter * f);
unsigned use_count;
void *private;
};

View File

@ -37,6 +37,9 @@ static void _composite_destroy(struct dev_filter *f)
{
struct dev_filter **filters = (struct dev_filter **) f->private;
if (f->use_count)
log_error(INTERNAL_ERROR "Destroying composite filter while in use %u times.", f->use_count);
while (*filters) {
(*filters)->destroy(*filters);
filters++;
@ -69,6 +72,7 @@ struct dev_filter *composite_filter_create(int n, struct dev_filter **filters)
cft->passes_filter = _and_p;
cft->destroy = _composite_destroy;
cft->use_count = 0;
cft->private = filters_copy;
return cft;

View File

@ -45,6 +45,9 @@ static int _ignore_md(struct dev_filter *f __attribute__((unused)),
static void _destroy(struct dev_filter *f)
{
if (f->use_count)
log_error(INTERNAL_ERROR "Destroying sysfs filter while in use %u times.", f->use_count);
dm_free(f);
}
@ -59,6 +62,7 @@ struct dev_filter *md_filter_create(void)
f->passes_filter = _ignore_md;
f->destroy = _destroy;
f->use_count = 0;
f->private = NULL;
return f;

View File

@ -274,13 +274,13 @@ static int _lookup_p(struct dev_filter *f, struct device *dev)
return 0;
}
/* Test dm devices every time, so cache them as GOOD. */
/* Test dm devices every time, so cache them as GOOD. */
if (MAJOR(dev->dev) == dm_major()) {
if (!l)
dm_list_iterate_items(sl, &dev->aliases)
dm_hash_insert(pf->devices, sl->str, PF_GOOD_DEVICE);
if (!device_is_usable(dev)) {
log_debug("%s: Skipping unusable device", dev_name(dev));
log_debug("%s: Skipping unusable device", dev_name(dev));
return 0;
}
return pf->real->passes_filter(pf->real, dev);
@ -301,6 +301,9 @@ static void _persistent_destroy(struct dev_filter *f)
{
struct pfilter *pf = (struct pfilter *) f->private;
if (f->use_count)
log_error(INTERNAL_ERROR "Destroying persistent filter while in use %u times.", f->use_count);
dm_hash_destroy(pf->devices);
dm_free(pf->file);
pf->real->destroy(pf->real);
@ -339,6 +342,7 @@ struct dev_filter *persistent_filter_create(struct dev_filter *real,
f->passes_filter = _lookup_p;
f->destroy = _persistent_destroy;
f->use_count = 0;
f->private = pf;
return f;

View File

@ -181,6 +181,10 @@ static int _accept_p(struct dev_filter *f, struct device *dev)
static void _regex_destroy(struct dev_filter *f)
{
struct rfilter *rf = (struct rfilter *) f->private;
if (f->use_count)
log_error(INTERNAL_ERROR "Destroying regex filter while in use %u times.", f->use_count);
dm_pool_destroy(rf->mem);
}
@ -206,6 +210,7 @@ struct dev_filter *regex_filter_create(struct config_value *patterns)
f->passes_filter = _accept_p;
f->destroy = _regex_destroy;
f->use_count = 0;
f->private = rf;
return f;

View File

@ -282,6 +282,10 @@ static int _accept_p(struct dev_filter *f, struct device *dev)
static void _destroy(struct dev_filter *f)
{
struct dev_set *ds = (struct dev_set *) f->private;
if (f->use_count)
log_error(INTERNAL_ERROR "Destroying sysfs filter while in use %u times.", f->use_count);
dm_pool_destroy(ds->mem);
}
@ -316,6 +320,7 @@ struct dev_filter *sysfs_filter_create(const char *sysfs_dir)
f->passes_filter = _accept_p;
f->destroy = _destroy;
f->use_count = 0;
f->private = ds;
return f;

View File

@ -326,6 +326,7 @@ struct dev_filter *lvm_type_filter_create(const char *proc,
f->passes_filter = _passes_lvm_type_device_filter;
f->destroy = lvm_type_filter_destroy;
f->use_count = 0;
f->private = NULL;
if (!_scan_proc_dev(proc, cn)) {
@ -338,5 +339,8 @@ struct dev_filter *lvm_type_filter_create(const char *proc,
void lvm_type_filter_destroy(struct dev_filter *f)
{
if (f->use_count)
log_error(INTERNAL_ERROR "Destroying lvm_type filter while in use %u times.", f->use_count);
dm_free(f);
}