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

Test dm_hash_insert() failures mem failures

This commit is contained in:
Zdenek Kabelac 2012-02-28 11:12:58 +00:00
parent 0098904026
commit a22be5e2e9
3 changed files with 14 additions and 4 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.94 -
====================================
Test dm_hash_insert() failures in filter-persistent.c and fid_add_mda().
Ensure clvmd message is always \0 terminated after read.
Better detection of missing dmeventd fifo connection (2.02.93).
Add some close() and dev_close() error path backtraces.

View File

@ -292,7 +292,10 @@ static int _lookup_p(struct dev_filter *f, struct device *dev)
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 (!dm_hash_insert(pf->devices, sl->str, PF_GOOD_DEVICE)) {
log_error("Failed to hash device to filter.");
return 0;
}
if (!device_is_usable(dev)) {
log_debug("%s: Skipping unusable device", dev_name(dev));
return 0;
@ -305,7 +308,10 @@ static int _lookup_p(struct dev_filter *f, struct device *dev)
l = pf->real->passes_filter(pf->real, dev) ? PF_GOOD_DEVICE : PF_BAD_DEVICE;
dm_list_iterate_items(sl, &dev->aliases)
dm_hash_insert(pf->devices, sl->str, l);
if (!dm_hash_insert(pf->devices, sl->str, l)) {
log_error("Failed to hash alias to filter.");
return 0;
}
}
return (l == PF_BAD_DEVICE) ? 0 : 1;

View File

@ -4283,8 +4283,11 @@ int fid_add_mda(struct format_instance *fid, struct metadata_area *mda,
full_key, sizeof(full_key)))
return_0;
dm_hash_insert(fid->metadata_areas_index,
full_key, mda);
if (!dm_hash_insert(fid->metadata_areas_index,
full_key, mda)) {
log_error("Failed to hash mda.");
return 0;
}
return 1;
}