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

15956 Commits

Author SHA1 Message Date
David Teigland
38770db19b man: lvmcache update
for cache changes including writecache
2018-11-08 15:48:36 -06:00
David Teigland
2f02e8d33a tests: specify m1 for raid1 in cache-single-types 2018-11-08 14:12:42 -06:00
Zdenek Kabelac
73132bc254 tests: futher test tunning 2018-11-08 17:19:39 +01:00
David Teigland
025332edc2 tests: add lvchange cachemode passthrough in cache-single-options 2018-11-08 10:08:38 -06:00
David Teigland
8794fb71db tests: enable cachepolicy cleaner in cache-single-options 2018-11-08 09:43:23 -06:00
David Teigland
e1e33e75e7 tests: enable writeback in cache-single-options 2018-11-08 09:40:41 -06:00
David Teigland
8c5fbd5fac tests: fix dd option in cache-single-options 2018-11-08 09:33:09 -06:00
Zdenek Kabelac
d4de3cfa4d tests: updates 2018-11-08 12:22:18 +01:00
Zdenek Kabelac
f86f01a3a1 tests: keep results configurable 2018-11-08 12:22:18 +01:00
Zdenek Kabelac
3a557dcfbf configure: update 2018-11-08 12:22:07 +01:00
Zdenek Kabelac
6cee8f1b06 devicemapper: retry remove even for subLVs
With older systems and udevs we don't have control over scanning of lvm2
internal devices - so far we set retry-removal only for top-level LVs,
but in occasional cases udev can be 'fast enough' to open device for
scanning and prevent removal of such device from DM table.

So to combat this case - try to pass 'retry' flag also for removal of
internal device so see how many races can go away with this simple
patch.

Note: patch is applied only to internal version of libdm so the external
API remains working in the old way for now.
2018-11-08 12:20:57 +01:00
Zdenek Kabelac
c1703845c3 activation: trimming string is expected
Commit 813347cf84 added extra validation,
however in this particular we do want to trim suffix out so rather ignore
resulting error code here intentionaly.
2018-11-08 12:20:57 +01:00
David Teigland
1dc5603f73 devices: reuse bcache fd when getting block size
This avoids an unnecessary open() on the device.
2018-11-06 16:36:18 -06:00
David Teigland
3ae5569570 Add dm-writecache support
dm-writecache is used like dm-cache with a standard LV
as the cache.

$ lvcreate -n main -L 128M -an foo /dev/loop0

$ lvcreate -n fast -L 32M -an foo /dev/pmem0

$ lvconvert --type writecache --cachepool fast foo/main

$ lvs -a foo -o+devices
  LV            VG  Attr       LSize   Origin        Devices
  [fast]        foo -wi-------  32.00m               /dev/pmem0(0)
  main          foo Cwi------- 128.00m [main_wcorig] main_wcorig(0)
  [main_wcorig] foo -wi------- 128.00m               /dev/loop0(0)

$ lvchange -ay foo/main

$ dmsetup table
foo-main_wcorig: 0 262144 linear 7:0 2048
foo-main: 0 262144 writecache p 253:4 253:3 4096 0
foo-fast: 0 65536 linear 259:0 2048

$ lvchange -an foo/main

$ lvconvert --splitcache foo/main

$ lvs -a foo -o+devices
  LV   VG  Attr       LSize   Devices
  fast foo -wi-------  32.00m /dev/pmem0(0)
  main foo -wi------- 128.00m /dev/loop0(0)
2018-11-06 14:18:41 -06:00
David Teigland
cac4a9743a Allow dm-cache cache device to be standard LV
If a single, standard LV is specified as the cache, use
it directly instead of converting it into a cache-pool
object with two separate LVs (for data and metadata).

With a single LV as the cache, lvm will use blocks at the
beginning for metadata, and the rest for data.  Separate
dm linear devices are set up to point at the metadata and
data areas of the LV.  These dm devs are given to the
dm-cache target to use.

The single LV cache cannot be resized without recreating it.

If the --poolmetadata option is used to specify an LV for
metadata, then a cache pool will be created (with separate
LVs for data and metadata.)

Usage:

$ lvcreate -n main -L 128M vg /dev/loop0

$ lvcreate -n fast -L 64M vg /dev/loop1

$ lvs -a vg
  LV   VG Attr       LSize   Type   Devices
  main vg -wi-a----- 128.00m linear /dev/loop0(0)
  fast vg -wi-a-----  64.00m linear /dev/loop1(0)

$ lvconvert --type cache --cachepool fast vg/main

$ lvs -a vg
  LV           VG Attr       LSize   Origin       Pool  Type   Devices
  [fast]       vg Cwi---C---  64.00m                     linear /dev/loop1(0)
  main         vg Cwi---C--- 128.00m [main_corig] [fast] cache  main_corig(0)
  [main_corig] vg owi---C--- 128.00m                     linear /dev/loop0(0)

$ lvchange -ay vg/main

$ dmsetup ls
vg-fast_cdata   (253:4)
vg-fast_cmeta   (253:5)
vg-main_corig   (253:6)
vg-main (253:24)
vg-fast (253:3)

$ dmsetup table
vg-fast_cdata: 0 98304 linear 253:3 32768
vg-fast_cmeta: 0 32768 linear 253:3 0
vg-main_corig: 0 262144 linear 7:0 2048
vg-main: 0 262144 cache 253:5 253:4 253:6 128 2 metadata2 writethrough mq 0
vg-fast: 0 131072 linear 7:1 2048

$ lvchange -an vg/min

$ lvconvert --splitcache vg/main

$ lvs -a vg
  LV   VG Attr       LSize   Type   Devices
  fast vg -wi-------  64.00m linear /dev/loop1(0)
  main vg -wi------- 128.00m linear /dev/loop0(0)
2018-11-06 13:44:54 -06:00
David Teigland
8c9d9a7446 cache: factor lvchange_cache
to prepare for future addition
2018-11-06 11:36:34 -06:00
David Teigland
e548e7c29d cache: factor report functions
to prepare for future addition
2018-11-06 11:36:29 -06:00
David Teigland
a686391eca cache: reorganize cache_set_policy
to prepare for future addition
2018-11-06 11:36:29 -06:00
David Teigland
23948e99b3 cache: improve error message about flush 2018-11-06 11:36:29 -06:00
David Teigland
3e547fa952 cache: improve warning message about cached thin data 2018-11-06 11:36:28 -06:00
David Teigland
5ee1727f80 cache: rename variable in _cache_add_target_line
so it is not specific to lv/seg type
2018-11-06 11:36:28 -06:00
David Teigland
7541e002b2 cache: rename variable in _cache_display
so it is not specific to lv/seg type
2018-11-06 11:36:28 -06:00
David Teigland
85b4b2f924 cache: clean up segment line creation 2018-11-06 11:36:28 -06:00
David Teigland
e26dacf30a cache: factor getting cache mode
so part can be called separately
2018-11-06 11:36:28 -06:00
David Teigland
f3f3d6066b cache: factor settings text import export
Pull out the export/import of settings text so
it can be used later from elsewhere.
2018-11-06 11:36:28 -06:00
David Teigland
8d7075528f cache: add cache_mode_num_to_str
Requires only string and number, no specific lv/seg type.
2018-11-06 11:36:28 -06:00
Zdenek Kabelac
a427a93549 tests: fix shell quoting 2018-11-06 17:26:15 +01:00
Zdenek Kabelac
ad0268e239 tests: add wait for udev
Since the test is currently directly working with live directory,
which can be getting updates from system's udev - add wait
for settling so removal of all known PVs happens after that.
But still this has major influce on behavior of running system,
so the test should never be executed on a user used box.
2018-11-06 15:05:44 +01:00
Zdenek Kabelac
a1b1b3dbb6 pvscan: add error checking for write of online files
When there is any write failure during writting file,
report this upward as error and fail command instead
of continuing futher.
2018-11-06 15:05:44 +01:00
Zdenek Kabelac
9a6f0e64f9 debug: missing backtrace 2018-11-05 17:25:11 +01:00
Zdenek Kabelac
9d9979963f debug: tracing fclose failure
Using log_debug (not returning error code) to trace possible
failure of fclose().
2018-11-05 17:25:11 +01:00
Zdenek Kabelac
aa8b2d6a0f cleanup: move cast to det_t into MKDEV macro 2018-11-05 17:25:11 +01:00
Zdenek Kabelac
d3ebb18f40 cov: avoid unsing unchecked label_scan_open
Drop extra call too label_scan_open() without checking return value,
and let code go through next call bellow.
2018-11-05 17:25:11 +01:00
Zdenek Kabelac
70e3d0a613 cov: remove unused assigns 2018-11-05 17:25:11 +01:00
Zdenek Kabelac
a91ac41b93 cov: hide intentionaly ptr arithmetic report
Only single region count is ever replaced with on-stack uint64_t.
2018-11-03 16:10:32 +01:00
Zdenek Kabelac
9238b972c5 cov: mark warning as expected one 2018-11-03 16:10:32 +01:00
Zdenek Kabelac
0d934e730e cov: trace failing pthread_kill 2018-11-03 16:10:32 +01:00
Zdenek Kabelac
813347cf84 cov: add missing check for dm_strncpy 2018-11-03 16:10:32 +01:00
Zdenek Kabelac
c7789daec0 cov: overflow before widen
Evaluate as 64bit arithmetic (instead of doing 32bit mults which can
in this case purely teoretically overflow).
2018-11-03 16:10:31 +01:00
Zdenek Kabelac
bc1976011a cov: explicit ignore if failures
Here we can't do anything better than just ignore syscall failures
(with silence as there is no loging mechanism)
2018-11-03 16:09:36 +01:00
Zdenek Kabelac
79879bd201 cov: split check for type assignment
Check that type is always defined, if not make it explicit internal
error (although logged as debug - so catched only with proper lvm.conf
setting).
This ensures later type being NULL can't be dereferenced with coredump.
2018-11-03 16:09:36 +01:00
Zdenek Kabelac
6235861e64 cov: remove uneeded code
Since clvmd was dropped this code become useless.
2018-11-03 16:09:36 +01:00
Zdenek Kabelac
1951e0db0f label: add stack trace for failing dev_set_last_byte
Temporarily add check for failure, but whole function
needs to be likely traced for error result.

FIXME
2018-11-03 16:09:36 +01:00
David Teigland
5d747f724e lvmlockd: use standard major minor functions 2018-11-02 15:58:47 -05:00
David Teigland
e7a56d5cd3 lvmlockd: fix handling of sanlock release error
When sanlock_release returns an error because of an i/o
timeout releasing the lease on disk, lvmlockd should just
consider the lock released.  sanlock will continue trying
to release the lease on disk after the original request
times out.
2018-11-02 12:11:09 -05:00
David Teigland
f6a54a50a0 lvmlockd: deactivate lvmlock LV in vgchange
When changing a VG to lock_type sanlock, the internal
lvmlock LV was left active at the end of vgchange.
It shouldn't be active until lockstart.
2018-11-01 13:25:21 -05:00
David Teigland
7a170873aa lvmlockd: fix size/resizing of internal lvmlock LV for sanlock
The lvmlock LV size was not adjusted correctly for 512 vs 4K
sector sizes which influence the lease size used by sanlock.

When lvmlock was automatically extended, the zeroing through
bcache wasn't working.
2018-11-01 13:25:21 -05:00
David Teigland
0b01e3f5d7 lvmlockd: use new sanlock sector/align interface
The choice about sector size and lease align size is
now made by the sanlock user, in this case lvmlockd.
This will allow lvmlockd to use other lease sizes in
the future.  This also prevents breakage if hosts
report different sector sizes, or the sector size
reported by a device changes.
2018-11-01 13:25:21 -05:00
Bryn M. Reeves
925aaf0b87 dmsetup: fix stats report command output
Since the stats handle is neither bound nor listed before the
attempt to call dm_stats_get_nr_regions(), it will always return
zero: this prevents reporting of any dmstats regions on any
device.

Remove the dm_stats_get_nr_regions() check and instead rely on
the correct return status from dm_stats_populate() which only
returns 0 in the case that there are regions to inspect (and
which logs a specific error for all other cases).

Reported-by: Bryan Gurney <bgurney@redhat.com>
2018-11-01 17:00:06 +00:00
Bryn M. Reeves
19f2105b87 libdm-stats: move no regions warning after dm_stats_list()
It doesn't make sense to test or warn about the region count until
the stats handle has been listed: at this point it may or may not
contain valid information (but is guaranteed to be correct after
the list).
2018-11-01 16:59:56 +00:00