Additional lvmetad fixes.

This commit is contained in:
Peter Rajnoha 2013-05-14 12:59:57 +02:00
parent 41e4f25c4e
commit ebb8908593
3 changed files with 85 additions and 16 deletions

View File

@ -0,0 +1,64 @@
commit 5bad6200b66259dde0c1cf3bd6295e65a5ade3c9
Author: Peter Rajnoha <prajnoha@redhat.com>
Date: Tue May 14 12:57:54 2013 +0200
lvm2-2_02_99-fix-handling-of-reappeared-and-missing-pvs-in-lvmetad.patch
---
lib/cache/lvmetad.c | 8 +++++++-
lib/metadata/metadata.c | 4 ++--
lib/metadata/metadata.h | 3 +++
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index a636f43..d8ad4dd 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -354,14 +354,20 @@ struct volume_group *lvmetad_vg_lookup(struct cmd_context *cmd, const char *vgna
if ((info = lvmcache_info_from_pvid((const char *)&pvl->pv->id, 0))) {
pvl->pv->label_sector = lvmcache_get_label(info)->sector;
pvl->pv->dev = lvmcache_device(info);
+ if (!pvl->pv->dev)
+ pvl->pv->status |= MISSING_PV;
+ else
+ check_reappeared_pv(vg, pvl->pv);
if (!lvmcache_fid_add_mdas_pv(info, fid)) {
vg = NULL;
goto_out; /* FIXME error path */
}
- } /* else probably missing */
+ } else
+ pvl->pv->status |= MISSING_PV; /* probably missing */
}
lvmcache_update_vg(vg, 0);
+ vg_mark_partial_lvs(vg, 1);
}
out:
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index c210a63..2cca93c 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -2870,8 +2870,8 @@ int vg_missing_pv_count(const struct volume_group *vg)
return ret;
}
-static void check_reappeared_pv(struct volume_group *correct_vg,
- struct physical_volume *pv)
+void check_reappeared_pv(struct volume_group *correct_vg,
+ struct physical_volume *pv)
{
struct pv_list *pvl;
diff --git a/lib/metadata/metadata.h b/lib/metadata/metadata.h
index 19bf742..630c4ca 100644
--- a/lib/metadata/metadata.h
+++ b/lib/metadata/metadata.h
@@ -492,4 +492,7 @@ int is_mirror_image_removable(struct logical_volume *mimage_lv, void *baton);
uint64_t find_min_mda_size(struct dm_list *mdas);
char *tags_format_and_copy(struct dm_pool *mem, const struct dm_list *tags);
+void check_reappeared_pv(struct volume_group *correct_vg,
+ struct physical_volume *pv);
+
#endif

View File

@ -1,12 +1,12 @@
commit 6283dc16f6ad54a08aae5f5d0c43bb4973e0ffc1
commit 98c5eb308690d990b957012db9d48b6722ea93cb
Author: Peter Rajnoha <prajnoha@redhat.com>
Date: Tue May 14 11:05:31 2013 +0200
Date: Tue May 14 12:47:24 2013 +0200
lvm2-2_02_99-lvmetad-fix-a-race-in-metadata-update.patch
---
WHATS_NEW | 1 +
daemons/lvmetad/lvmetad-core.c | 18 ++++++++++--------
2 files changed, 11 insertions(+), 8 deletions(-)
daemons/lvmetad/lvmetad-core.c | 21 +++++++++++++--------
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 20a8125..35c5e43 100644
@ -20,7 +20,7 @@ index 20a8125..35c5e43 100644
Fix possible deadlock when querying and updating lvmetad at the same time.
Avoid a global lock in pvs when lvmetad is in use.
diff --git a/daemons/lvmetad/lvmetad-core.c b/daemons/lvmetad/lvmetad-core.c
index fed9296..1e7470b 100644
index fed9296..1f855a7 100644
--- a/daemons/lvmetad/lvmetad-core.c
+++ b/daemons/lvmetad/lvmetad-core.c
@@ -450,7 +450,8 @@ static response vg_lookup(lvmetad_state *s, request r)
@ -61,13 +61,16 @@ index fed9296..1e7470b 100644
}
lock_vgid_to_metadata(s);
@@ -750,14 +749,17 @@ static int update_metadata(lvmetad_state *s, const char *name, const char *_vgid
@@ -750,14 +749,20 @@ static int update_metadata(lvmetad_state *s, const char *name, const char *_vgid
dm_hash_insert(s->vgid_to_metadata, vgid, cft) &&
dm_hash_insert(s->vgid_to_vgname, vgid, cfgname) &&
dm_hash_insert(s->vgname_to_vgid, name, (void*) vgid)) ? 1 : 0;
+
+ if (retval && oldname && strcmp(name, oldname))
+ dm_hash_remove(s->vgname_to_vgid, oldname);
+
+ if (haveseq >= 0 && haveseq < seq)
+ dm_config_destroy(old);
+
unlock_vgid_to_metadata(s);

View File

@ -65,11 +65,12 @@ Patch19: lvm2-2_02_99-avoid-global-lock-in-pvs-when-lvmetad-is-in-use.patch
Patch20: lvm2-2_02_99-fix-possible-deadlock-in-lvmetad-for-parallel-update-and-query.patch
Patch21: lvm2-2_02_99-fix-possible-race-in-lvmetad-remove_metadata.patch
Patch22: lvm2-2_02_99-lvmetad-fix-a-race-in-metadata-update.patch
Patch23: lvm2-2_02_99-fix-blkdeactivate-handling-of-nested-mountpoints-and-mangled-mount-paths.patch
Patch24: lvm2-2_02_99-add-dm-disable-udev-env-var-and-fix-noudevsync-arg.patch
Patch25: lvm2-2_02_99-fix-premature-dm-version-checking-which-caused-useless-mapper-control-access.patch
Patch26: lvm2-2_02_99-close-dmeventd-fifo-fds-on-exec.patch
Patch27: lvm2-2_02_99-fix-dmsetup-splitname-to-not-fail-if-used-without-c-switch.patch
Patch23: lvm2-2_02_99-fix-handling-of-reappeared-and-missing-pvs-in-lvmetad.patch
Patch24: lvm2-2_02_99-fix-blkdeactivate-handling-of-nested-mountpoints-and-mangled-mount-paths.patch
Patch25: lvm2-2_02_99-add-dm-disable-udev-env-var-and-fix-noudevsync-arg.patch
Patch26: lvm2-2_02_99-fix-premature-dm-version-checking-which-caused-useless-mapper-control-access.patch
Patch27: lvm2-2_02_99-close-dmeventd-fifo-fds-on-exec.patch
Patch28: lvm2-2_02_99-fix-dmsetup-splitname-to-not-fail-if-used-without-c-switch.patch
BuildRequires: libselinux-devel >= %{libselinux_version}, libsepol-devel
BuildRequires: ncurses-devel
@ -127,11 +128,12 @@ or more physical volumes and creating one or more logical volumes
%patch20 -p1 -b .lvmetad_deadlock
%patch21 -p1 -b .lvmetad_race_on_remove
%patch22 -p1 -b .lvmetad_race_on_update
%patch23 -p1 -b .blkdeactivate
%patch24 -p1 -b .dm_disable_udev
%patch25 -p1 -b .premature_dm_version
%patch26 -p1 -b .dmeventd_fd_cloexec
%patch27 -p1 -b .dmsetup_splitname
%patch23 -p1 -b .lvmetad_missing_reappear_pv
%patch24 -p1 -b .blkdeactivate
%patch25 -p1 -b .dm_disable_udev
%patch26 -p1 -b .premature_dm_version
%patch27 -p1 -b .dmeventd_fd_cloexec
%patch28 -p1 -b .dmsetup_splitname
%build
%define _default_pid_dir /run