1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-28 20:25:52 +03:00
lvm2/lib/format_text
Peter Rajnoha fcfca57e2e format-text: label: fix missing dev assignment for struct label in _text_pv_write
When using lvm shell, some structures which are cached in memory may be
reused. This happens for the struct label (a part of lvmcache_info
structure) when lvmetad is used in which case the PV scan is not
done that would normally overwrite these label structures in memory
and making them up-to-date.

This is all consequence of the fact that struct lvmcache_info and
struct label are not always assigned in the same part of the code.
For example, if lvmetad *is not* used, parts of the struct label are
reassigned in label_read fn while struct lvmcache_info is created
elsewhere. No part of the code reused struct label (and its "dev"
field) before calling label_read fn. That's why the real bug is
hidden when using lvm shell without lvmetad.

However, with lvmetad and lvm shell, the situation is a bit different.
The label_read fn is not called if lvmetad *is* used, hence the
struct label may have ended up not initialized properly.

There was missing assignment for the dev field in struct label
in _text_pv_write fn which caused this problem to appear in
lvm shell with lvmetad, for example:

Before this patch:

lvm> pvcreate /dev/sda
  Physical volume "/dev/sda" successfully created
lvm> pvs /dev/sda
  PV             VG     Fmt  Attr PSize   PFree
  unknown device        lvm2 ---  128.00m 128.00m

With this patch applied:

lvm> pvcreate /dev/sda
  Physical volume "/dev/sda" successfully created
lvm> pvs /dev/sda
  PV         VG   Fmt  Attr PSize   PFree
  /dev/sda        lvm2 ---  128.00m 128.00m

Also, this problem had not appeared before changes introduced
by commits e1a63905d1 through
3a6f91d713 which, among other
things, added proper label field type reporting. Before, label
reporting was the same as using struct physical_volume which
has its own dev field assigned and so this problem was not exposed.
2015-09-15 18:07:32 +02:00
..
archive.c cleanup: drop unneeded included header files 2012-08-23 14:37:20 +02:00
archiver.c cache: Store metadata size and checksum. 2015-03-18 23:43:02 +00:00
archiver.h vgconvert: Do not call lvmetad_vg_remove (path shared with vgcfgbackup). 2013-09-18 12:53:11 +02:00
export.c Add lvmlockd 2015-07-02 15:42:26 -05:00
flags.c Add lvmlockd 2015-07-02 15:42:26 -05:00
format-text.c format-text: label: fix missing dev assignment for struct label in _text_pv_write 2015-09-15 18:07:32 +02:00
format-text.h report: select: refactor: move str_list to libdm 2014-06-17 16:27:20 +02:00
import_vsn1.c lvmcache: add lock_type to VG summary and info structs 2015-07-29 14:27:32 -05:00
import-export.h refactor: rename alloc_printed_tags fn to _alloc_printed_str_list and use it for string lists in general 2015-06-29 09:43:41 +02:00
import.c metadata: Reject lvmetad metadata extensions when reading from disk. 2015-06-10 16:25:57 +02:00
layout.h cache: Store metadata size and checksum. 2015-03-18 23:43:02 +00:00
text_export.h Move the core of the lib/config/config.c functionality into libdevmapper, 2011-08-30 14:55:15 +00:00
text_import.h cleanup: self compilable headers 2013-12-12 13:28:19 +01:00
text_label.c Revert "lvmcache: check for too long pvid" 2015-08-18 15:22:13 +02:00