1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-28 11:55:55 +03:00
Commit Graph

5582 Commits

Author SHA1 Message Date
Zdenek Kabelac
3c9ff9e142 Use lv_activate_opts struct instead of ACTIVATE_EXCL status flag. 2011-06-17 14:17:16 +00:00
Zdenek Kabelac
81beded3af Add lv_activate_opts structure
To avoid modification of 'read-only' volume group structure
add a new structure to pass local data around the code for LV
activation.

As origin_only is one such flag - replace this parameter with new
struct lv_activate_opts.

More parameters might eventually become part of lv_activate_opts.
2011-06-17 14:14:19 +00:00
Petr Rockai
2b6ccfa30b What's new. 2011-06-15 17:48:35 +00:00
Petr Rockai
6d25c0d26f Fix RHBZ 651590 (failure to lock LV results in failure to repair mirror after
transient error), stemming from the following sequence of events:

1) devices fail IO, triggering repair
2) dmeventd starts fixing up the mirror
3) during the downconversion, a new metadata version is written

--> the devices come back online here

4) the mirror device suspend/resume is called to update DM tables
5) during the suspend/resume cycle, *pre*-commit metadata is read;
   however, since the failed devices are now back online, we get back
   inconsistent set of precommit metadata and the whole operation fails

The patch relaxes the check that fails in step 5 above, namely by ignoring
inconsistencies coming from PVs that are marked MISSING.
2011-06-15 17:45:02 +00:00
Peter Rajnoha
53dd32f41d Add proper udev library context initialization and finalization to liblvm.
This was missing in liblvm and it caused all udev-related operations to
not take effect when using liblvm, e.g. obtaining the list of devices from udev
db instead of scanning the whole /dev which also recreated the .cache as a side
effect. This was also the case with udisks-lvm-pv-export prober which is run
from within udev rules whenever the CHANGE event is fired.
2011-06-15 13:29:48 +00:00
Milan Broz
6f14cd22fd Fix lvreduce stripe rounding up from previous commit. 2011-06-15 10:56:52 +00:00
Petr Rockai
acf3616b3a Add a skeleton for lvmetad, a test client, and a temporary Makefile to build
them. These are currently mostly for testing the daemon-common code. LVMetaD
functionality is expected to trickle in soon though.
2011-06-14 02:36:38 +00:00
Petr Rockai
92658f5661 Common daemon code: Implement basic socket-based communication infrastructure
(both client and server side). The server handles each connection in a separate
thread.
2011-06-14 02:34:18 +00:00
Alasdair Kergon
7df72b3c88 Fix last snapshot removal to avoid table reload while a device is suspended. 2011-06-13 22:28:04 +00:00
Alasdair Kergon
98a0fa72be Fix fields in warning message. 2011-06-13 03:53:02 +00:00
Alasdair Kergon
1840aa0974 Maintain a count of the number of suspended devices in libdevmapper
and use this for the LVM critical section logic.  Also report an error if
code tries to load a table while any device is known to be in the
suspended state.
(If the variety of problems these changes are showing up can't be fixed
before the next release, the error messages can be reduced to debug
level.)
2011-06-13 03:32:45 +00:00
Alasdair Kergon
83e797bc52 Fix 'pvs -o pv_all' to include label fields. (Also removed recursion.) 2011-06-12 19:49:40 +00:00
Alasdair Kergon
29f2c5ada6 Disable critical section internal errors until this can be fixed properly
in libdevmapper.
2011-06-12 00:23:50 +00:00
Alasdair Kergon
0a99713ea4 Fix --mirrorlog mirrored. 2011-06-11 12:55:31 +00:00
Alasdair Kergon
df390f1799 Major pvmove fix to issue ioctls in the correct order when multiple LVs
are affected by the move.  (Currently it's possible for I/O to become
trapped between suspended devices amongst other problems.

The current fix was selected so as to minimise the testing surface.  I
hope eventually to replace it with a cleaner one that extends the
deptree code.

Some lvconvert scenarios still suffer from related problems.
2011-06-11 00:03:06 +00:00
Milan Broz
cd72be458c Fix kernel version test (RHEL: 2.6.32-123). 2011-06-09 19:48:26 +00:00
Milan Broz
f4ba9c5d1e Fix mirrored stripe reduction.
Patch adds check for stripe not only in direct
LV segment but also in mirror image segment.

This prevents bugs like:

# lvcreate -i2 -l10 -n lv vg_test
# lvconvert -m1 -i1 vg_test/lv

# lvreduce -f -l1 vg_test/lv
  WARNING: Reducing active logical volume to 4.00 MiB
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
  Reducing logical volume lv to 4.00 MiB
  Segment extent reduction 9 not divisible by #stripes 2
  Logical volume lv successfully resized

# lvremove -f vg_test
  Segment extent reduction 1 not divisible by #stripes 2
  LV segment lv:0-4294967295 is incorrectly listed as being used by LV lv_mimage_0
  Internal error: LV segments corrupted in lv_mimage_0.
2011-06-09 19:38:56 +00:00
Milan Broz
4fb39ae074 Validate mirror segments size
Currently some operation with striped mirrors lead
to corrupted metadata, this patch just add detection of such
situation.

Example:
# lvcreate -i2 -l10 -n lvs vg_test
# lvconvert -m1 vg_test/lvs

# lvreduce -f -l1 vg_test/lvs
  Reducing logical volume lvs to 4.00 MiB
  Segment extent reduction 9not divisible by #stripes 2
  Logical volume lvs successfully resized

# lvremove vg_test/lvs
  Segment extent reduction 1not divisible by #stripes 2
  LV segment lvs:0-4294967295 is incorrectly listed as being used by LV lvs_mimage_0
  Internal error: LV segments corrupted in lvs_mimage_0.
2011-06-09 19:36:16 +00:00
Milan Broz
851b1a9606 Fix extent rounding for striped segments.
We should never remove more extents than requested by user,
so round up to next stripe boundary during lvreduce.

Also this fixes round to zero sized LV bug:

# lvcreate -i2 -I 64k -l10 -n lvs vg_test
# lvreduce -f -l1 vg_test/lvs
  Rounding size (1 extents) down to stripe boundary size for segment (0 extents)
  WARNING: Reducing active logical volume to 0
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
  Reducing logical volume lvs to 0
  Failed to suspend lvs
2011-06-09 19:34:49 +00:00
Milan Broz
96e7ca3c78 Fix kernel version parsing in tests, use common function. 2011-06-09 18:58:00 +00:00
Milan Broz
b39fdcf45b Fix another occurrence of linux kernel version check. 2011-06-09 15:52:59 +00:00
Milan Broz
fa380602cf Accept kernel version 3 (3.0-rc and similar). 2011-06-09 15:07:40 +00:00
Milan Broz
aa809cb877 Fix topology test.
Kernel version is misparsed in Fedora rawhide, just test sysfs file.

SCSI_DEBUG_DEV is no longer exported, use provided file instead.
2011-06-09 14:26:47 +00:00
Peter Rajnoha
afc8a3b104 Fix create_temp_name to replace any '/' found in the hostname with '?'.
There's a possibility someone will use the '/' in the hostname. Since we
generate a temporary file name (path) including the hostname, any '/' would
be ambiguous.

We can always set such hostname using 'sethostname' from unistd.h. But the
'hostname' command already includes the check and removes the '/' char.
However, some old versions still allow that.
See: https://bugzilla.redhat.com/show_bug.cgi?id=711445.

Since this is only a temporary name and the possibility of this error is
quite negligible, we don't need any complex escape sequence here, just a
simple char replace.
2011-06-08 08:49:53 +00:00
Alasdair Kergon
bb056af3c9 missing space in mesg 2011-06-06 12:08:42 +00:00
Petr Rockai
f221800b25 Also check in the pe_start API test that the disks have not been touched. 2011-06-04 21:55:25 +00:00
Petr Rockai
f7a80fd8e3 Add an API test that shows how to find a value of pe_start for a VG without
actually creating the VG on-disk.
2011-06-04 21:46:34 +00:00
Peter Rajnoha
554923e0ae Fix a few compile warnings.
clvmd-command.c:84:2: warning: implicit declaration of function ‘init_test’
lvm-functions.c:141:3: warning: too many arguments for format
2011-06-03 09:05:30 +00:00
Milan Broz
fc7ff7647f Use append but except query for dlm locks:-) 2011-06-02 09:08:16 +00:00
Milan Broz
69ff428151 Always use append to file in lvmdump (selinux policy - no file truncation).
Workaround dmsetup ls --tree (terminal ioctl for width).
(Until isatty() will be allowed by selinux policy.)
2011-06-02 09:02:03 +00:00
Milan Broz
7c1a2417f5 Use /var/run/lvm for lvmetad socket. 2011-06-02 08:58:05 +00:00
Alasdair Kergon
0ebd0960b4 Propagate test mode to clvmd to skip activation and changes to held locks. 2011-06-01 21:16:55 +00:00
Alasdair Kergon
3cac20f850 Defer writing PV labels to vg_write.
Store label_sector only in struct physical_volume.
2011-06-01 19:29:31 +00:00
Alasdair Kergon
2aa785c85f Report sector containing label in verbose message. 2011-06-01 19:26:38 +00:00
Alasdair Kergon
453cdee51c Permit --available with lvcreate so non-snapshot LVs need not be activated. 2011-06-01 19:21:03 +00:00
Alasdair Kergon
677ec408bf Report sector containing label in verbose message. 2011-06-01 15:30:36 +00:00
Peter Rajnoha
1fd2dac60b Clarify error message when unable to convert an LV into a snapshot of an LV. 2011-06-01 12:24:15 +00:00
Peter Rajnoha
c08c564e21 Use new dev_open_readonly fn to prevent opening devices for read-write when not necessary.
Before, we used vg_write_lock_held call to determnine the way a device is
opened. Unfortunately, this opened many devices in RW mode when it was not
really necessary. With the OPTIONS+="watch" rule used in the udev rules,
this could fire numerous events while closing such devices (and it caused
useless scans from within udev rules in return).

A common bug we hit with this was with the lvremove command which was unable
to remove the LV since it was being opened from within the udev rules. This
patch should minimize such situations (at least with respect to LVM handling
of devices).

Though there's still a possibility someone will open a device 'outside' in
parallel and fire the event based on the watch rule when closing a device
once opened for RW.
2011-05-28 09:48:14 +00:00
Petr Rockai
10c7d802a0 First draft of a document describing how we will automatically and
incrementally assemble (possibly multi-component, like LVM) storage devices.
2011-05-25 21:43:12 +00:00
Alasdair Kergon
1623abd61b test 2011-05-24 14:12:36 +00:00
Alasdair Kergon
035eb2f078 test 2011-05-24 14:10:55 +00:00
Alasdair Kergon
564360c195 test 2011-05-24 14:10:55 +00:00
Alasdair Kergon
2576974c21 test 2011-05-24 14:09:41 +00:00
Alasdair Kergon
2d56f030f0 test 2011-05-24 14:09:41 +00:00
Alasdair Kergon
953c6d9643 test 2011-05-24 14:01:32 +00:00
Alasdair Kergon
972d37f570 test 2011-05-24 14:00:57 +00:00
Alasdair Kergon
e692de88b8 test 2011-05-24 13:59:16 +00:00
Alasdair Kergon
f631b2edb9 test 2011-05-24 13:54:37 +00:00
Alasdair Kergon
33bd9138fa test 2011-05-24 13:53:26 +00:00
Alasdair Kergon
abb30dbf2d test 2011-05-24 13:53:26 +00:00