1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
Commit Graph

3598 Commits

Author SHA1 Message Date
Zdenek Kabelac
e2cd882f2e thin: check runtime table line for merging
To recognize in runtime if we are merging or not
to make consistent decision between suspend and resume
add function to parse thin table line when add
merging thin device to the table.
2016-04-18 11:18:35 +02:00
Alasdair G Kergon
6954de22e2 activate: Improve snapshot merge initiation
A snapshot merge into its origin cannot be initiated while the devices
are in use.  If there is outside interference (such as from udev),
the suspend (preload) and resume stages can reach conflicting decisions
about whether or not to proceed.

Try to make the logic more robust by checking the inactive or live
table during resume.  (This is still not perfect.)
2016-04-15 02:33:38 +01:00
David Teigland
7ae5f6fc5c WHATS_NEW for lvmetad scanning changes 2016-04-14 16:55:34 -05:00
Alasdair G Kergon
f0179fac31 snapshot: Don't deactivate fictional snapshot LV.
Commit 971ab733b7 ("thin: activation of
merging thin snapshot") also added an incorrect deactivation attempt
for non-thin LVs: find_snapshot(lv)->lv is not designed to be
activated and any attempt to deactivate it is incorrect.
2016-04-14 22:32:26 +01:00
Zdenek Kabelac
fe65a86cbc devcache: do not insert devices without device node
When not obtaining device from udev, we are doing deep devdir scan,
and at the same time we try to insert everything what /sys/dev/block
knows about. However in case  lvm2 is configured to use nonstardard
devdir this way it will see (and scan) devices from a real system.

lvm2 test suite is using its own test devdir with its
own device nodes. To avoid touching real /dev  devices, validate
the device node exist in give dir and do not insert such device
into a cache.

With obtain list from udev this patch has no effect
(the normal user path).
2016-04-11 10:33:14 +02:00
Zdenek Kabelac
07a60b59f7 devcache: index devices also without udev
We have _insert_dirs() for  udev and non-udev compilation.
Compiling without udev missed to call dev_cache_index_devs().
Move the call after _insert_dirs() call so both compilation
gets it.
2016-04-11 10:32:19 +02:00
Alasdair G Kergon
3aab784aa5 pre-release 2016-04-09 02:08:44 +01:00
Zdenek Kabelac
a09d65891f dev_manager: device_is_usable does not flush
When scanning if device is being usable as PV,
we call STATUS - but this status should not cause
any flushing.
Skip also open_count information as it's not needed.
2016-04-08 20:20:04 +02:00
Zdenek Kabelac
8b2108e6b1 activation: do not check for devs without LVM-
Devices without "LVM-" uuid prefix have been generated by very old
version of lvm2 2.00 and 2.01.
Since version 2.02 all lvm2 devices are using prefix "LVM-".

However checking for present of ancient non prefixed devices does
take extra IOCTL per every call and for majority of todays user
it will not find anything new.

So use the assumption that users with kernel 3.X and newer are not
really using such old versions of lvm2 (year <2005) and with their
new kernel they are also using new version of lvm2 and skip
checking for them.

This change also makes trace logs more readable.
2016-04-07 22:32:08 +02:00
Zdenek Kabelac
097a724bda lvcreate: %FREE -> %PVS
This is hotfix for RHBZ: https://bugzilla.redhat.com/1324537
However already the %FREE is not a good fit and we need something
better. Meanwhile make  -l%PVS work at least as good as %FREE
for thin-pool.

TODO: this needs rework - it should be allocator to do all the size
decisions at one place.
2016-04-07 22:32:08 +02:00
Zdenek Kabelac
e2d4f53c82 WHATS_NEW: update
doc for previous commits.
2016-04-07 22:31:40 +02:00
Alasdair G Kergon
55001ae9ec lvmdump: Allow dir to exist already if it is empty 2016-04-06 22:36:42 +01:00
Alasdair G Kergon
76fc41fb9d post-release 2016-04-01 20:36:40 +01:00
Alasdair G Kergon
2d0d58b867 pre-release 2016-04-01 20:29:52 +01:00
Alasdair G Kergon
60befab773 Revert "thin: display highest mapped sector"
This reverts commit fc7dacaa4c.

Let's put this information into a separate field.  It doesn't meet the
definition of the existing field.
2016-04-01 20:09:38 +01:00
Zdenek Kabelac
fc7dacaa4c thin: display highest mapped sector
Use  meta%  to expose highest mapped sector in thinLV.
so showing there 100.00% means thinLV maps latest sector.

Currently using a 'trick' with total_numerator to pass-in
device size when  'seg==NULL'

TODO: Improve device status API per target - current 'percentage'
is not really extensible.
2016-03-31 12:20:43 +02:00
Zdenek Kabelac
8bbec41bd4 thin: no thin-pool flush when reading metadata status
Previous fix missed the fact the we do query for 'percent' with
seg value either set or unset (API overload...)
When 'seg' was unset, we still issue flush with status.
Fix it by cheking segtype by target_type.

As we check for segtype - we could also skip whole percentage
if the 'segtype' is unknown by code directly.

Reported-by: Ming-Hung Tsai <mingnus gmail com
2016-03-31 12:15:47 +02:00
Peter Rajnoha
52e0d0db44 dev-cache: remove spurious error msg if no value found in /sys/dev/block/<major>:<minor>/dm/uuid during dev scan
It's correct to have a DM device that has no DM UUID assigned
so no need to issue error message in this case. Also, if the
device doesn't have DM UUID, it's also clear it's not an LVM LV
(...when looking for VGID/LVID while creating VGID/LVID indices
in dev cache).

For example:

$ dmsetup create test --table "0 1 linear /dev/sda 0"
And there's no PV in the system.

Before this patch (spurious error message issued):
$ pvs
  _get_sysfs_value: /sys/dev/block/253:2/dm/uuid: no value

With this patch applied (no spurious error message):
$ pvs
2016-03-30 11:30:09 +02:00
Peter Rajnoha
8c27c52749 dev-cache: also index VGIDs and LVIDs if using persistent .cache file
If we're using persistent .cache file, we're reading this file instead
of traversing the /dev content. Fix missing indexing by VGID and LVID
here - hook this into persistent_filter_load where we populate device
cache from persistent .cache file instead of scanning /dev.

For example, inducing situation in which we warn about different device
actually used than what LVM thinks should be used based on metadata:

$ lsblk -s /dev/vg/lvol0
NAME     MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
vg-lvol0 253:4    0  124M  0 lvm
`-loop1    7:1    0  128M  0 loop

$ lvmconfig --type diff

global {
	use_lvmetad=0
}
devices {
	obtain_device_list_from_udev=0
}

(obtain_device_list_from_udev=0 also means the persistent .cache file is used)

Before this patch - pvs is fine as it does the dev scan, but lvs relies
on persistent .cache file and it misses the VGID/LVID indices to check
and warn about incorrect devices used:

$ pvs
  Found duplicate PV B9gXTHkIdEIiMVwcOoT2LX3Ywh4YIHgR: using /dev/loop0 not /dev/loop1
  Using duplicate PV /dev/loop0 without holders, ignoring /dev/loop1
  WARNING: Device mismatch detected for vg/lvol0 which is accessing /dev/loop1 instead of /dev/loop0.
  PV          VG Fmt  Attr PSize   PFree
  /dev/loop0 vg lvm2 a--  124.00m    0

$ lvs
  Found duplicate PV B9gXTHkIdEIiMVwcOoT2LX3Ywh4YIHgR: using /dev/loop0 not /dev/loop1
  Using duplicate PV /dev/loop0 without holders, ignoring /dev/loop1
  LV    VG Attr       LSize
  lvol0 vg -wi-a----- 124.00m

With this patch applied - both pvs and lvs is fine - the indices are
always created correctly (lvs just an example here, other LVM commands
that rely on persistent .cache file are fixed with this patch too):

$ pvs
  Found duplicate PV B9gXTHkIdEIiMVwcOoT2LX3Ywh4YIHgR: using /dev/loop0 not /dev/loop1
  Using duplicate PV /dev/loop0 without holders, ignoring /dev/loop1
  WARNING: Device mismatch detected for vg/lvol0 which is accessing /dev/loop1 instead of /dev/loop0.
  PV          VG Fmt  Attr PSize   PFree
  /dev/loop0 vg lvm2 a--  124.00m    0

$ lvs
  Found duplicate PV B9gXTHkIdEIiMVwcOoT2LX3Ywh4YIHgR: using /dev/loop0 not /dev/loop1
  Using duplicate PV /dev/loop0 without holders, ignoring /dev/loop1
  WARNING: Device mismatch detected for vg/lvol0 which is accessing /dev/loop1 instead of /dev/loop0.
  LV    VG Attr       LSize
  lvol0 vg -wi-a----- 124.00m
2016-03-30 11:00:01 +02:00
Peter Rajnoha
91bb202ded dev-cache: handle situation where device is referenced in sysfs, but the node is not yet in dev dir
It's possible that while a device is already referenced in sysfs, the node
is not yet in /dev directory.

This may happen in some rare cases right after LVs get created - we sync
with udev (or alternatively we create /dev content ourselves) while VG
lock is held. However, dev scan is done without VG lock so devices may
already be in sysfs, but /dev may not be updated yet if we call LVM command
right after LV creation (so the fact that fs_unlock is done within VG
lock is not usable here much). This is not a problem with devtmpfs as
there's at least kernel name for device in /dev as soon as the sysfs
item exists, but we still support environments without devtmpfs or
where different directory for dev nodes is used (e.g. our test suite).

This patch covers these situations by tracking such devices in
_cache.sysfs_only_names helper hash for the vgid/lvid check to work still.

This also resolves commit 6129d2e64d
which was then reverted by commit 109b7e2095
due to performance issues it may have brought (...and it didn't resolve
the problem fully anyway).
2016-03-30 10:56:46 +02:00
Alasdair G Kergon
d6e8f18e4d post-commit 2016-03-26 09:07:21 +00:00
Alasdair G Kergon
b9d07f7a12 pre-release 2016-03-26 09:04:50 +00:00
Peter Rajnoha
109b7e2095 revert: 6129d2e64d
Unfortunately, commit 6129d2e64d may
cause performance issue. There's going to be a better fix...
2016-03-24 14:06:12 +01:00
Peter Rajnoha
37b548c6b5 WHATS_NEW: commit 6129d2e64d 2016-03-24 12:47:35 +01:00
Alasdair G Kergon
1216efdf15 activate: Use macros for target and module names. 2016-03-22 17:46:15 +00:00
Alasdair G Kergon
e69e81388d report: Add pv_major, pv_minor to reports. 2016-03-22 00:12:08 +00:00
Peter Rajnoha
03b0a78640 dev: detect mismatch between devices used and devices assumed for an LV
It's possible for an LVM LV to use a device during activation which
then differs from device which LVM assumes based on metadata later on.

For example, such device mismatch can occur if LVM doesn't have
complete view of devices during activation or if filters are
misbehaving or they're incorrectly set during activation.

This patch adds code that can detect this mismatch by creating
VG UUID and LV UUID index while scanning devices for device cache.

The VG UUID index maps VG UUID to a device list. Each device in the
list has a device layered above as a holder which is an LVM LV device
and for which we know the VG UUID (and similarly for LV UUID index).

We can acquire VG and LV UUID by reading /sys/block/<dm_dev_name>/dm/uuid.
So these indices represent the actual state of PV device use in
the system by LVs and then we compare that to what LVM assumes
based on metadata.

For example:

[0] fedora/~ # lsblk /dev/sdq /dev/sdr /dev/sds /dev/sdt
NAME         MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT
sdq           65:0    0  104M  0 disk
|-vg-lvol0   253:2    0  200M  0 lvm
`-mpath_dev1 253:3    0  104M  0 mpath
sdr           65:16   0  104M  0 disk
`-mpath_dev1 253:3    0  104M  0 mpath
sds           65:32   0  104M  0 disk
|-vg-lvol0   253:2    0  200M  0 lvm
`-mpath_dev2 253:4    0  104M  0 mpath
sdt           65:48   0  104M  0 disk
`-mpath_dev2 253:4    0  104M  0 mpath

In this case the vg-lvol0 is mapped onto sdq and sds becauset this is
what was available and seen during activation. Then later on, sdr and
sdt appeared and mpath devices were created out of sdq+sdr (mpath_dev1)
and sds+sdt (mpath_dev2). Now, LVM assumes (correctly) that mpath_dev1
and mpath_dev2 are the PVs that should be used, not the mpath
components (sdq/sdr, sds/sdt).

[0] fedora/~ # pvs
  Found duplicate PV xSUix1GJ2SK82ACFuKzFLAQi8xMfFxnO: using /dev/mapper/mpath_dev1 not /dev/sdq
  Using duplicate PV /dev/mapper/mpath_dev1 from subsystem DM, replacing /dev/sdq
  Found duplicate PV MvHyMVabtSqr33AbkUrobq1LjP8oiTRm: using /dev/mapper/mpath_dev2 not /dev/sds
  Using duplicate PV /dev/mapper/mpath_dev2 from subsystem DM, ignoring /dev/sds
  WARNING: Device mismatch detected for vg/lvol0 which is accessing /dev/sdq, /dev/sds instead of /dev/mapper/mpath_dev1, /dev/mapper/mpath_dev2.
  PV                     VG     Fmt  Attr PSize   PFree
  /dev/mapper/mpath_dev1 vg     lvm2 a--  100.00m      0
  /dev/mapper/mpath_dev2 vg     lvm2 a--  100.00m      0
2016-03-21 11:40:40 +01:00
Alasdair G Kergon
e58d24293f post-release 2016-03-19 01:18:28 +00:00
Alasdair G Kergon
0d4b6bdfc0 pre-release 2016-03-19 01:14:29 +00:00
Peter Rajnoha
2879eff86e fsadm: if available, use /proc/self/mountinfo to detect mounted volume
The /proc/self/mountinfo is not bound to device names like /proc/mounts
and it uses major:minor pairs instead.

This fixes a situation in which a volume is mounted and then renamed
later on - that makes /proc/mounts unreliable when detecting mounted
volumes.

See also https://bugzilla.redhat.com/show_bug.cgi?id=1196910.
2016-03-18 13:42:06 +01:00
Zdenek Kabelac
51ed48f855 lvresize: fix stacked resize
Commit b64703401d cause regression
when handling stacked resize of pool metadata volume that would
be a raid LV.

Fix it by properly setting up size also for layer extension.
2016-03-15 23:21:16 +01:00
Zdenek Kabelac
7daba90fa3 lvconvert: fix error path test
lvremove_single toollib function returns
ECMD_FAILED or ECMD_PROCESSED.
2016-03-14 23:37:42 +01:00
Alasdair G Kergon
a78e696070 post-release 2016-03-11 00:21:53 +00:00
Alasdair G Kergon
2159a1429d pre-release 2016-03-11 00:19:16 +00:00
Zdenek Kabelac
386208e593 man: updates
Continuing with lvconvert style updates.

Minimize usage of '\:' as zero-width break space, since html renderers
do not handle this groff sign well (some of them seems to even render
':' there).
But since we do not want see badly rendered man pages itself, prefer
the 'man visual' appearence over html page generation (man2html should
be actually fixed).

Start to use 'user input option' with Capitals more consistently.
2016-03-10 18:38:54 +01:00
Zdenek Kabelac
86a23b2145 makefiles: avoid using vpath for rules files
Fixing vpath usage as it has been checking for existance of
generated file also in the $(scrdir) e.g.:

No need to remake target '10-dm.rules.in'; using VPATH name '...'

If the $(srcdir) had been also $(builddir) and contained already
generated rules file, it's been used instead generating new
one.

(See: http://make.mad-scientist.net/papers/how-not-to-use-vpath/)
2016-03-10 18:38:53 +01:00
Zdenek Kabelac
70cbd8f1a5 lvconvert: improve vg parameter parsing
Commit abd9618dd8 tried to improve
parsing of vg name from logical path - but still missed couple
corner cases.

This patch further improves the logic and reuses
validate_lvname_param() for parsing of lv_name.

Also explicitly checks for LVM_VG_NAME in the right case.

So now also properly parses cases like:
  'lvconvert --repairt vg/'
and will provide correct error message.
2016-03-10 18:38:53 +01:00
Zdenek Kabelac
5c415afd85 cache: check for cache fail during flush
Just WARN if the cache can't be flushed because it's failed.
2016-03-10 18:38:53 +01:00
Zdenek Kabelac
569ba79abf lvconvert: uncache handles missing PV
Allow to process with --uncache when some PVs are missing in VG.

So it's now possible to --uncache cached LV if the cache-pool
has missing PV.
2016-03-10 18:38:53 +01:00
Alasdair G Kergon
90c5d470c2 report: Tidy some field names, widths and headings.
Specifying an output width of 0 now leads to a default minimum width
taken from the width of the column heading.  (Most fields should use
this.)

Components of field names are generally separated by underscores (which
are optional at run-time).  (Dropped 3 duplicate fields now covered by
this rule.)

Each field heading must be unique and generally doesn't have spaces
between words (which get capitalised) unless they are already short and
the fields are normally longer or clarity demands it.
2016-03-08 19:50:22 +00:00
David Teigland
a8319e62c0 vgscan: add --notifydbus to send a notification
This command option can be used to trigger a D-Bus
notification independent of the usual notifications
that are sent from other commands as an effect of
changes to PV/VG/LV state.  If lvm is not built with
dbus notification support or if notify_dbus is disabled
in the config, this command will exit with an error.
2016-03-07 10:50:45 -06:00
David Teigland
2d5dc6512e dbus: add notification from commands
When a command modifies a PV or VG, or changes the
activation state of an LV, it will send a dbus
notification when the command is finished.  This
can be enabled/disabled with a config setting.
2016-03-07 10:06:09 -06:00
Alasdair G Kergon
7b15ca5c9a post-release 2016-03-04 18:06:24 +00:00
Alasdair G Kergon
68ec240b99 pre-release 2016-03-04 17:59:21 +00:00
Peter Rajnoha
418b7c6be8 WHATS_NEW: historical LVs 2016-03-04 12:08:02 +01:00
Zdenek Kabelac
fd349cb2e5 man: lvconvert updates
Improving style (following lvcreate way).
Sorting options alphabetically.
2016-03-03 10:17:03 +01:00
Zdenek Kabelac
88ce15004e cache: add kernel_cache_policy option
Pair kernel_cache_settings with kernel_cache_policy.
There is very small chance in error case that the value in table
might be differnet from the value stored in metadata
so make it 'checkable'.
2016-03-03 10:14:23 +01:00
David Teigland
3d610fabbd WHATS_NEW: [unknown] replaces 'unknown device' 2016-03-01 11:16:35 -06:00
Zdenek Kabelac
8173c2ff9a coverity: missing error path 2016-03-01 14:02:43 +01:00
David Teigland
b2d819eafa update WHATS_NEW
including changes not recorded for the previous release.
2016-02-29 13:50:02 -06:00