1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

Refresh device filters before full device rescan in lvmcache.

The sysfs filter initialise hash of available devices using
scan of /sys/block. We need to refresh even this hash
when performing full scan otherwise the newly appeared
device could be rejected, because there is no entry
in sysfs filter.

This easily could happen when attaching new device
to cluster node. (Only force refresh of context
in clvmd -R works here now).

Unfortunately consequences of this are much worse,
missing device part on that node is replaced with missing segment
(even when no partial arg is selected) and this directly
lead to data corruption.

See https://bugzilla.redhat.com/show_bug.cgi?id=538515

Simply fix it by refreshing device filters in lvmcache
before performing the full device scan.
This commit is contained in:
Milan Broz 2009-11-24 16:10:25 +00:00
parent b8526452b5
commit f6cabc78c0
4 changed files with 17 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.56 -
====================================
Refresh device filters before full device rescan in lvmcache.
Return error status if vgchange fails to activate some volume.
Fix memory lock imbalance in locking code.
Revert vg_read_internal change, clvmd cannot use vg_read now. (2.02.55)

View File

@ -510,6 +510,11 @@ int lvmcache_label_scan(struct cmd_context *cmd, int full_scan)
goto out;
}
if (full_scan == 2 && !refresh_filters(cmd)) {
log_error("refresh filters failed");
goto out;
}
if (!(iter = dev_iter_create(cmd->filter, (full_scan == 2) ? 1 : 0))) {
log_error("dev_iter creation failed");
goto out;

View File

@ -1223,6 +1223,16 @@ skip_dlclose:
}
}
int refresh_filters(struct cmd_context *cmd)
{
if (cmd->filter) {
cmd->filter->destroy(cmd->filter);
cmd->filter = NULL;
}
return _init_filters(cmd, 0);
}
int refresh_toolcontext(struct cmd_context *cmd)
{
log_verbose("Reloading config files");

View File

@ -105,6 +105,7 @@ struct cmd_context *create_toolcontext(unsigned is_long_lived,
const char *system_dir);
void destroy_toolcontext(struct cmd_context *cmd);
int refresh_toolcontext(struct cmd_context *cmd);
int refresh_filters(struct cmd_context *cmd);
int config_files_changed(struct cmd_context *cmd);
int init_lvmcache_orphans(struct cmd_context *cmd);