1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
lvm2/lib
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
..
activate cleanup: use just 2 decimal digits 2015-09-03 23:34:37 +02:00
cache lockd: fix rescanning VG metadata 2015-09-11 13:10:48 -05:00
cache_segtype cleanup: indent 2015-08-12 14:33:16 +02:00
commands filters: make sure regex filter is evaluated before any filter that needs disk access 2015-09-08 15:28:10 +02:00
config config: improve description text layout 2015-08-18 14:02:32 -05:00
datastruct datastruct: Add str_list_add_list. 2015-03-26 18:30:37 +00:00
device dev-cache: fix use of uninitialized device status if reading outdated .cache record 2015-09-04 18:00:29 +02:00
display libdm: Add dm_size_to_string to libdevmapper. 2015-07-27 21:30:20 +01:00
error segtype: drop cmdcontex pointer 2014-10-30 23:58:49 +01:00
filters filters: swap device_is_usable test 2015-09-03 23:34:36 +02:00
format1 coverity: check vg->lvm1_system_id is not NULL before calling strncmp with that 2015-08-04 10:35:31 +02:00
format_pool cache: Store metadata size and checksum. 2015-03-18 23:43:02 +00:00
format_text format-text: label: fix missing dev assignment for struct label in _text_pv_write 2015-09-15 18:07:32 +02:00
freeseg segtype: drop cmdcontex pointer 2014-10-30 23:58:49 +01:00
label cleanup: trace error from lvmcache_update_vgname_and_id 2015-08-18 15:00:08 +02:00
locking lvmlockd: prevent vgremove of dlm VG while lockspace is used 2015-09-11 14:12:13 -05:00
log coverity: fix cppcheck warnings 2015-08-04 09:33:55 +02:00
lvmpolld lvmpolld: Fix segfault on 32 bit architectures 2015-07-10 16:16:57 +02:00
metadata vgcreate: initialize new PVs only in first vg_write 2015-09-14 13:22:22 -05:00
mirror macros: Wrap PRI with FMT. 2015-07-06 15:09:17 +01:00
misc configure: relocate generated headers 2015-09-07 17:40:58 +02:00
mm config: use find_config_tree_array for all arrays 2015-07-15 10:52:23 +02:00
properties report: add support for time (basic) 2015-06-30 15:15:10 +02:00
raid cleanup: drop unused header file 2015-07-15 13:10:22 +02:00
replicator macros: Wrap PRI with FMT. 2015-07-06 15:09:17 +01:00
report cache: report cache pool attrs also for pools 2015-08-26 11:24:41 +02:00
snapshot segtype: add SEG_ONLY_EXCLUSIVE flag 2014-11-10 22:05:48 +01:00
striped segtype: drop cmdcontex pointer 2014-10-30 23:58:49 +01:00
thin thin: validate mapped size of thin volume 2015-09-03 23:34:36 +02:00
unknown segtype: drop cmdcontex pointer 2014-10-30 23:58:49 +01:00
uuid macros: Wrap PRI with FMT. 2015-07-06 15:09:17 +01:00
zero cleanup: remove unused headers 2014-11-13 17:49:42 +01:00
Makefile.in makefiles: ensure no old .h are left 2015-09-08 15:41:33 +02:00