]> sourceware.org Git - lvm2.git/log
lvm2.git
12 years agoFix splitmirror in cluster having different DM/LVM views of storage.
Jonathan Earl Brassow [Thu, 6 Oct 2011 14:55:39 +0000 (14:55 +0000)]
Fix splitmirror in cluster having different DM/LVM views of storage.
This patch also does some clean-up of the splitmirrors code.

I've attempted to clean-up the splitmirrors code to make it easier to
understand with fewer operations.  I've tried to reduce the number of
metadata operations without compromising the intermediate stages which
are necessary for easy clean-up in the even of failure.

These changes now correctly handle cluster situations - including exclusive
cluster mirrors.  Whereas before, a splitmirror operation would result in
remote nodes having LVM commands report the newly split LV with a proper
name while DM commands would report the old (pre-split) names of the device.
IOW, there was a kernel/userspace mismatch.

12 years agoRevert initial solution to bug 733114 - I/O error message during splitmirror
Jonathan Earl Brassow [Thu, 6 Oct 2011 14:49:16 +0000 (14:49 +0000)]
Revert initial solution to bug 733114 - I/O error message during splitmirror

The original commit comments can be located via this git commit ID:
7d8e615c0b30fc2ef300c90378a51f01c328128c

There were three possible solutions to the original problem proposed in the
initial check-in.  The one chosen was as follows:
    2) Do like _remove_mirror_images does and suspend the original, then suspend
    the sub-lv (the error target), then resume the sub-lv, and finally resume the
    original LV.  This seems like extra pointless operations to me, but it doesn't
    produce the error message (although, I'm not sure why) and it allows us to
    leave the visible flag in place.
Turns out, the cluster also views the extra suspend/resume operations as
pointless too and ignores them.  So, this solution doesn't work in a cluster.
Further, I've noticed that in addition to the remote cluster nodes still getting
I/O errors from scanning the error target, they also have a different LVM and
DM views of the same LV.  IOW, while the LVM level (gotten from the LVM metadata)
sees the correct name for the newly split LV, device-mapper still maintains the
old names.

Because the original fix failed to completely fix the problem (or work-around it)
and because a better solution must be found to address the additional cluster
issue of device renaming, I am reverting the above mentioned commit.

12 years agoThis patch fixes issues with improper udev flags on sub-LVs.
Jonathan Earl Brassow [Thu, 6 Oct 2011 14:45:40 +0000 (14:45 +0000)]
This patch fixes issues with improper udev flags on sub-LVs.

The current code does not always assign proper udev flags to sub-LVs (e.g.
mirror images and log LVs).  This shows up especially during a splitmirror
operation in which an image is split off from a mirror to form a new LV.

A mirror with a disk log is actually composed of 4 different LVs: the 2
mirror images, the log, and the top-level LV that "glues" them all together.
When a 2-way mirror is split into two linear LVs, two of those LVs must be
removed.  The segments of the image which is not split off to form the new
LV are transferred to the top-level LV.  This is done so that the original
LV can maintain its major/minor, UUID, and name.  The sub-lv from which the
segments were transferred gets an error segment as a transitory process
before it is eventually removed.  (Note that if the error target was not put
in place, a resume_lv would result in two LVs pointing to the same segment!
If the machine crashes before the eventual removal of the sub-LV, the result
would be a residual LV with the same mapping as the original (now linear) LV.)
So, the two LVs that need to be removed are now the log device and the sub-LV
with the error segment.  If udev_flags are not properly set, a resume will
cause the error LV to come up and be scanned by udev.  This causes I/O errors.
Additionally, when udev scans sub-LVs (or former sub-LVs), it can cause races
when we are trying to remove those LVs.  This is especially bad during failure
conditions.

When the mirror is suspended, the top-level along with its sub-LVs are
suspended.  The changes (now 2 linear devices and the yet-to-be-removed log
and error LV) are committed.  When the resume takes place on the original
LV, there are no longer links to the other sub-lvs through the LVM metadata.
The links are implicitly handled by querying the kernel for a list of
dependencies.  This is done in the '_add_dev' function (which is recursively
called for each dependency found) - called through the following chain:
_add_dev
dm_tree_add_dev_with_udev_flags
<*** DM / LVM divide ***>
_add_dev_to_dtree
_add_lv_to_dtree
_create_partial_dtree
_tree_action
dev_manager_activate
_lv_activate_lv
_lv_resume
lv_resume_if_active
When udev flags are calculated by '_get_udev_flags', it is done by referencing
the 'logical_volume' structure.  Those flags are then passed down into
'dm_tree_add_dev_with_udev_flags', which in turn passes them to '_add_dev'.
Unfortunately, when '_add_dev' is finding the dependencies, it has no way to
calculate their proper udev_flags.  This is because it is below the DM/LVM
divide - it doesn't have access to the logical_volume structure.  In fact,
'_add_dev' simply reuses the udev_flags given for the initial device!  This
virtually guarentees the udev_flags are wrong for all the dependencies unless
they are reset by some other mechanism.  The current code provides no such
mechanism.  Even if '_add_new_lv_to_dtree' were called on the sub-devices -
which it isn't - entries already in the tree are simply passed over, failing
to reset any udev_flags.  The solution must retain its implicit nature of
discovering dependencies and be able to go back over the dependencies found
to properly set the udev_flags.

My solution simply calls a new function before leaving '_add_new_lv_to_dtree'
that iterates over the dtree nodes to properly reset the udev_flags of any
children.  It is important that this function occur after the '_add_dev' has
done its job of querying the kernel for a list of dependencies.  It is this
list of children that we use to look up their respective LVs and properly
calculate the udev_flags.

This solution has worked for single machine, cluster, and cluster w/ exclusive
activation.

12 years agoFix vgsplit when there are mirrors that have mirrored logs.
Jonathan Earl Brassow [Thu, 6 Oct 2011 14:17:45 +0000 (14:17 +0000)]
Fix vgsplit when there are mirrors that have mirrored logs.

The problem as reported by "ben <benscott@nwlink.com>" on lvm-devel:

vgsplit fails with mirrored mirror log

#lvs --all -o lv_name,lv_attr,devices
LV                       Attr   Devices
MyMirror                 mwi--
[MyMirror_mimage_0]      Iwi--- /dev/sdq(0)
[MyMirror_mimage_1]      Iwi--- /dev/sdo(0)
[MyMirror_mimage_2]      Iwi--- /dev/sdi(0)
[MyMirror_mlog]          mwi---
[MyMirror_mlog_mimage_0] Iwi--- /dev/sds(0)
[MyMirror_mlog_mimage_1] Iwi--- /dev/sde(0)

#vgsplit -v "TestA" "TestB" "/dev/sdq" "/dev/sdo" "/dev/sdi" "/dev/sds"
"/dev/sde"
  Checking for volume group "TestA"
  Checking for new volume group "TestB"
  Archiving volume group "TestA" metadata (seqno 213).
Can't split mirror MyMirror between two Volume Groups

AFTER FIX:

[root@bp-01 ~]# lvs -a -o name,vg_name,devices vg new
  Volume group "new" not found
  Skipping volume group new
  LV                 VG   Devices
  lv                 vg   lv_mimage_0(0),lv_mimage_1(0)
  [lv_mimage_0]      vg   /dev/sdb1(0)
  [lv_mimage_1]      vg   /dev/sdc1(0)
  [lv_mlog]          vg   lv_mlog_mimage_0(0),lv_mlog_mimage_1(0)
  [lv_mlog_mimage_0] vg   /dev/sdh1(0)
  [lv_mlog_mimage_1] vg   /dev/sdi1(0)
[root@bp-01 ~]# vgsplit vg new /dev/sd[bchi]1
  New volume group "new" successfully split from "vg"
[root@bp-01 ~]# lvs -a -o name,vg_name,devices vg new
  LV                 VG   Devices
  lv                 new  lv_mimage_0(0),lv_mimage_1(0)
  [lv_mimage_0]      new  /dev/sdb1(0)
  [lv_mimage_1]      new  /dev/sdc1(0)
  [lv_mlog]          new  lv_mlog_mimage_0(0),lv_mlog_mimage_1(0)
  [lv_mlog_mimage_0] new  /dev/sdh1(0)
  [lv_mlog_mimage_1] new  /dev/sdi1(0)

12 years agoAdd more validation to config parser
Zdenek Kabelac [Thu, 6 Oct 2011 11:06:36 +0000 (11:06 +0000)]
Add more validation to config parser

Do not leave it for vgvalidate().

12 years agoMove defines to header
Zdenek Kabelac [Thu, 6 Oct 2011 11:05:56 +0000 (11:05 +0000)]
Move defines to header

Make limits for thin data_block_size and device_id part of public API.

FIXME: read them possible from some kernel header file in the future ?
But we may need to support different values for different versions ?

12 years agoClarify multi-name device filter pattern matching explanation in lvm.conf.5.
Alasdair Kergon [Tue, 4 Oct 2011 20:49:24 +0000 (20:49 +0000)]
Clarify multi-name device filter pattern matching explanation in lvm.conf.5.

12 years agoClarify multi-name device filter pattern matching explanation in lvm.conf.5.
Alasdair Kergon [Tue, 4 Oct 2011 20:45:36 +0000 (20:45 +0000)]
Clarify multi-name device filter pattern matching explanation in lvm.conf.5.

12 years agoName changes
Zdenek Kabelac [Tue, 4 Oct 2011 16:22:38 +0000 (16:22 +0000)]
Name changes

typo zeroeing->zeroing
add size low_water_mark->low_water_mark_size so it's more obvious its sector
related variable.

12 years agoUse capital letters
Zdenek Kabelac [Tue, 4 Oct 2011 12:39:59 +0000 (12:39 +0000)]
Use capital letters

12 years agoMissed rename pool->thin_pool
Zdenek Kabelac [Mon, 3 Oct 2011 19:10:52 +0000 (19:10 +0000)]
Missed rename pool->thin_pool

Fix compilation

12 years agoAdd code to activate thin target
Zdenek Kabelac [Mon, 3 Oct 2011 18:43:39 +0000 (18:43 +0000)]
Add code to activate thin target

Code to zero pool metadata lv when pool is created.
Add code to create thin target via message sending.

(Revert is missing)

12 years agoAdd simple function for lookup of some free device_id
Zdenek Kabelac [Mon, 3 Oct 2011 18:39:17 +0000 (18:39 +0000)]
Add simple function for lookup of some free device_id

Initial simple implementation for finding some free device_id.

12 years agoAdd lvm functions for sending messages.
Zdenek Kabelac [Mon, 3 Oct 2011 18:37:47 +0000 (18:37 +0000)]
Add lvm functions for sending messages.

Functions are currently only needed for thin provissioning.

12 years agoAdd intial code to check transaction_id
Zdenek Kabelac [Mon, 3 Oct 2011 18:34:52 +0000 (18:34 +0000)]
Add intial code to check transaction_id

Fix typy in transaction_id.
Add this as node property, so it could be easily checked on resume.

Code is not yet finished.

12 years agoDisplay transaction_id for thin_pool
Zdenek Kabelac [Mon, 3 Oct 2011 18:31:03 +0000 (18:31 +0000)]
Display transaction_id for thin_pool

12 years agoMove priority check in front
Zdenek Kabelac [Mon, 3 Oct 2011 18:29:48 +0000 (18:29 +0000)]
Move priority check in front

Just a minor code mode - make a test for priority before
more complex uuid checks.

12 years agoUpdate error path tracing for _resume_node
Zdenek Kabelac [Mon, 3 Oct 2011 18:28:25 +0000 (18:28 +0000)]
Update error path tracing for _resume_node

dm_task_create & dm_task_set_name produces it's own log_error
Add missing stacks for dm_task_set_cookie, dm_task_run,
dm_task_get_info.

12 years agoTransaction_id is property of thin_pool
Zdenek Kabelac [Mon, 3 Oct 2011 18:26:07 +0000 (18:26 +0000)]
Transaction_id is property of thin_pool

Remove Transaction_id from thin target.
Store device_id for thin target.

12 years agoAdd preload support for thin and thin_pool
Zdenek Kabelac [Mon, 3 Oct 2011 18:24:47 +0000 (18:24 +0000)]
Add preload support for thin and thin_pool

12 years agoFix bad error message for thinp validation
Zdenek Kabelac [Thu, 29 Sep 2011 09:03:36 +0000 (09:03 +0000)]
Fix bad error message for thinp validation

12 years agoLet the utils to prepare PVs
Zdenek Kabelac [Thu, 29 Sep 2011 08:58:27 +0000 (08:58 +0000)]
Let the utils to prepare PVs

12 years agoTypo in debug message
Zdenek Kabelac [Thu, 29 Sep 2011 08:57:21 +0000 (08:57 +0000)]
Typo in debug message

12 years agoAdd experimental code for activation of thinp targets
Zdenek Kabelac [Thu, 29 Sep 2011 08:56:38 +0000 (08:56 +0000)]
Add experimental code for activation of thinp targets

No dm messages yes - just a base functionality in the steps of other targets.
For now usable only for debugging and tracing.

12 years agoAdd supporting function for thinp
Zdenek Kabelac [Thu, 29 Sep 2011 08:53:48 +0000 (08:53 +0000)]
Add supporting function for thinp

New dm_tree_node_add_thin_pool_target() and  dm_tree_node_add_thin_target()
This API is highly experimental and unstable for now.

12 years agoJust add warning about potential problem exteding dm_segtypes
Zdenek Kabelac [Thu, 29 Sep 2011 08:50:54 +0000 (08:50 +0000)]
Just add warning about potential problem exteding dm_segtypes

Since raid target is using now dm_segtypes also for search purpose.

12 years agoNew handy gdb debugging function, "dm_list_size"
Jonathan Earl Brassow [Wed, 28 Sep 2011 16:32:22 +0000 (16:32 +0000)]
New handy gdb debugging function, "dm_list_size"

Example:
(gdb) dm_list_size &split_images
1 list items

12 years agoIntroduce revert_lv for better pvmove cleanup.
Alasdair Kergon [Tue, 27 Sep 2011 22:43:40 +0000 (22:43 +0000)]
Introduce revert_lv for better pvmove cleanup.
(One further fix needed to remove the stray pvmove LVs left behind.)

12 years agoReplace incomplete pvmove activation failure recovery code with a message.
Alasdair Kergon [Tue, 27 Sep 2011 17:29:33 +0000 (17:29 +0000)]
Replace incomplete pvmove activation failure recovery code with a message.

As it stands, the recovery code can make things worse sometimes so it's
better to insist on a proper 'pvmove --abort' cleanup.

12 years agoAbort if _finish_pvmove suspend_lvs fails instead of cleaning up incompletely.
Alasdair Kergon [Tue, 27 Sep 2011 17:09:42 +0000 (17:09 +0000)]
Abort if _finish_pvmove suspend_lvs fails instead of cleaning up incompletely.
Change suspend_lvs to call vg_revert internally.
Change vg_revert to void and remove superfluous calls after failed vg_commit.

12 years agobetter -m0 error message, but there's an internal logic error to fix instead
Alasdair Kergon [Tue, 27 Sep 2011 12:37:07 +0000 (12:37 +0000)]
better -m0 error message, but there's an internal logic error to fix instead

12 years agotypo
Alasdair Kergon [Tue, 27 Sep 2011 12:34:14 +0000 (12:34 +0000)]
typo

12 years agocorrect thin_pool width
Alasdair Kergon [Tue, 27 Sep 2011 12:33:36 +0000 (12:33 +0000)]
correct thin_pool width

12 years agoShow some Thin related info in lvdisplay
Zdenek Kabelac [Mon, 26 Sep 2011 13:11:02 +0000 (13:11 +0000)]
Show some Thin related info in lvdisplay

12 years agoAdd log_error even for general device in use when we can't do the sysfs checks.
Peter Rajnoha [Mon, 26 Sep 2011 10:17:51 +0000 (10:17 +0000)]
Add log_error even for general device in use when we can't do the sysfs checks.

12 years agoUse execvp for clvmd restart
Zdenek Kabelac [Mon, 26 Sep 2011 07:51:23 +0000 (07:51 +0000)]
Use execvp for clvmd restart

Since execve passed only NULL as environ, we had lost all environment vars on
restart - thus actually running  'different' clvmd then the one at start.

Preserving environ allows to restart clvmd with the same settings
(i.e. LD_LIBRARY_PATH)

Add test for second restart.

12 years agoRemove test for NULL
Zdenek Kabelac [Sun, 25 Sep 2011 19:45:40 +0000 (19:45 +0000)]
Remove test for NULL

Since it's internal function and we always check for NULL value
before call - this is safe.

Just for case add nonnull attribute so analyzer might better
catch error.

12 years agoAdd missing log_error messages
Zdenek Kabelac [Sun, 25 Sep 2011 19:43:43 +0000 (19:43 +0000)]
Add missing log_error messages

12 years agoAdd backtrace when allocation fails for _type
Zdenek Kabelac [Sun, 25 Sep 2011 19:42:45 +0000 (19:42 +0000)]
Add backtrace when allocation fails for _type

12 years agoReplace test for NULL of root->child with test for NULL l
Zdenek Kabelac [Sun, 25 Sep 2011 19:41:27 +0000 (19:41 +0000)]
Replace test for NULL of root->child with test for NULL l

It's 100% equivalent test - since it always happen for the first iteration.
But the check for 'l' is understandable with analyzers - since analyzer
is not smart enough to deduce connection between  root->child == NULL.

12 years agoSimplier attribute format
Zdenek Kabelac [Sun, 25 Sep 2011 19:40:29 +0000 (19:40 +0000)]
Simplier attribute format

No need to repeat whole declaration for static function.

12 years agoChheck for failing filename strdup
Zdenek Kabelac [Sun, 25 Sep 2011 19:39:38 +0000 (19:39 +0000)]
Chheck for failing filename strdup

12 years agoUse NULL for pointers
Zdenek Kabelac [Sun, 25 Sep 2011 19:38:59 +0000 (19:38 +0000)]
Use  NULL for pointers

12 years agoRestart CLVMD with same cluster manager
Zdenek Kabelac [Sun, 25 Sep 2011 19:37:00 +0000 (19:37 +0000)]
Restart CLVMD with same cluster manager

Add named cluster_ops to easily learn the name of the active cluster manager,
so we are able to restart singlenode manager in testing.

Add simple test for clvmd -S  (restart) and -R (refresh)
(though it needs some extensions).

12 years agoFix log_error() usage
Zdenek Kabelac [Sat, 24 Sep 2011 21:19:30 +0000 (21:19 +0000)]
Fix log_error() usage

Cosmetic - skip <bactrace> when error has been just printed in raid segtype.
Add missing log_error if allocation would fail for unknown segtype.

12 years agoAllow overwrite for VERIFY_UDEV
Zdenek Kabelac [Sat, 24 Sep 2011 21:15:13 +0000 (21:15 +0000)]
Allow overwrite for VERIFY_UDEV

When running tests it might be useful to have an override option when
testing on real /dev  and some broken system (i.e. Debian and its rules).

So one can use:

LVM_TEST_DEVDIR=/dev LVM_VERIFY_UDEV=1 make check

12 years agoAvoid sending garbage to terminal in verbose mode.
Zdenek Kabelac [Sat, 24 Sep 2011 21:12:35 +0000 (21:12 +0000)]
Avoid sending garbage to terminal in verbose mode.

When read in drain returned <0 value, terminal content has been trashed.
Remove unneeded  memset() and use whole buffer.
Free  readbuf before exit (valgrind).

12 years agoImprovements
Zdenek Kabelac [Sat, 24 Sep 2011 21:10:19 +0000 (21:10 +0000)]
Improvements

Simplify RUN_BASE

Put .tests-stamp deps only for check target and fix its cleanup.
Fix abs_top_srcdir.
vgimportclone needs  srcdir.
Clean  api subdir.

12 years agoFix install_ocf
Zdenek Kabelac [Sat, 24 Sep 2011 21:05:03 +0000 (21:05 +0000)]
Fix install_ocf

When builddir is different from srcdir install_ocf: has not been able to find
files for installation.

12 years agoDrop cleanup of .exported_symbols_generated in DISTCLEAN_TARGETS
Zdenek Kabelac [Sat, 24 Sep 2011 21:00:52 +0000 (21:00 +0000)]
Drop cleanup of .exported_symbols_generated in DISTCLEAN_TARGETS

Makefile cosmetics - since .exported_symbols_generated in cleardir:
target via make.tmpl, there is no need to set them in DISTCLEAN_TARGETS.

12 years agoUse Makefile for daemmons/common library.
Zdenek Kabelac [Sat, 24 Sep 2011 20:57:49 +0000 (20:57 +0000)]
Use Makefile for daemmons/common library.

Next iteration for better fit of lvmetad compilation.

Move build of libdaemon.a into common subdir Makefile.
libdaemon.a is device-mapper target.

Build and install lvmetad as lvm2 target.

12 years agoDetect unusable nodes on fs
Zdenek Kabelac [Sat, 24 Sep 2011 20:54:35 +0000 (20:54 +0000)]
Detect unusable nodes on fs

Test whether nodes could be used on given filesystem where TMP
dir is being used and skip teardown quicker in fail case.
(makes the problem quickly obvious if you try to such fs).

Skip teardown_dev if we have not created any devs yet.

and do not mkdir /dev/mapper dir  when LVM_TEST_DEVDIR is set.

Drop this test from t-000-basic.sh.

12 years agoCLVMD support for LVM_CLVMD_BINARY and LVM_BINARY
Zdenek Kabelac [Sat, 24 Sep 2011 20:50:35 +0000 (20:50 +0000)]
CLVMD support for LVM_CLVMD_BINARY and LVM_BINARY

Read 2 environmental vars to learn about overide position for
CLVMD and LVM binaries.

We support LVM_BINARY in other script - and this way we could easily
test restart in our test-suite.

12 years agoCLVMD bugfix support for args -S -E
Zdenek Kabelac [Sat, 24 Sep 2011 20:48:34 +0000 (20:48 +0000)]
CLVMD bugfix support for args -S -E

Bugfix:
Add (most probably unfinished) support for -E arg with list of exclusive
locks.  (During clvmd restart all exclusive locks would have been lost and
in fact, if there would have been an exclusive lock, usage text would be
printed and clvmd exits.)

Instead of parsing list options multiple times every time some lock UUID is
checked - put them straight into the hash table - make the code easier to
understand as well.

Remove  was_ex_lock() function (replaced with dm_hash_lookup()).

Swap return value for get_initial_state() (1 means success).

Update man pages and usage info for -E option.

12 years agoreadlink does not append a null byte to the output string!
Peter Rajnoha [Sat, 24 Sep 2011 11:47:53 +0000 (11:47 +0000)]
readlink does not append a null byte to the output string!

12 years agoupdate man page for new RAID lv_attr characters.
Jonathan Earl Brassow [Fri, 23 Sep 2011 19:21:53 +0000 (19:21 +0000)]
update man page for new RAID lv_attr characters.

12 years agoexplain why we may now retry
Alasdair Kergon [Fri, 23 Sep 2011 17:16:28 +0000 (17:16 +0000)]
explain why we may now retry

12 years agomissing Makefile dep
Alasdair Kergon [Fri, 23 Sep 2011 17:05:44 +0000 (17:05 +0000)]
missing Makefile dep

12 years agoUpdate the RAID design doc to reflect some of the new options introduce (e.g.
Jonathan Earl Brassow [Fri, 23 Sep 2011 17:04:41 +0000 (17:04 +0000)]
Update the RAID design doc to reflect some of the new options introduce (e.g.
--merge and --trackchanges) and document the coding steps of up/down-conversion,
splitting RAID1 images, and merging RAID1 images.

12 years agoAdd 'Volume Type' lv_attr characters for RAID and RAID_IMAGE.
Jonathan Earl Brassow [Fri, 23 Sep 2011 15:17:54 +0000 (15:17 +0000)]
Add 'Volume Type' lv_attr characters for RAID and RAID_IMAGE.

RAID_META is already handled.

12 years agoUpdate dmsetup man page
Zdenek Kabelac [Fri, 23 Sep 2011 09:51:37 +0000 (09:51 +0000)]
Update dmsetup man page

While dmsetup command properly shows all dmsetup resume supported options,
man page missed to document it.

12 years agoBuild all man pages
Zdenek Kabelac [Fri, 23 Sep 2011 09:48:21 +0000 (09:48 +0000)]
Build all man pages

When running plain 'make' in man dir - do also those for device-mapper target.

12 years agoInitialize 'retryable' variable.
Peter Rajnoha [Thu, 22 Sep 2011 17:59:58 +0000 (17:59 +0000)]
Initialize 'retryable' variable.

12 years agoAdd activation/retry_deactivation to lvm.conf to retry deactivation of an LV.
Peter Rajnoha [Thu, 22 Sep 2011 17:39:56 +0000 (17:39 +0000)]
Add activation/retry_deactivation to lvm.conf to retry deactivation of an LV.

12 years agoAdd dm_tree_retry_remove to use retry logic for device removal in a dm_tree.
Peter Rajnoha [Thu, 22 Sep 2011 17:36:50 +0000 (17:36 +0000)]
Add dm_tree_retry_remove to use retry logic for device removal in a dm_tree.

12 years agoReplace open_count check with holders/mounted_fs check on lvremove path.
Peter Rajnoha [Thu, 22 Sep 2011 17:33:50 +0000 (17:33 +0000)]
Replace open_count check with holders/mounted_fs check on lvremove path.

Before, we used to display "Can't remove open logical volume" which was
generic. There 3 possibilities of how a device could be opened:
  - used by another device
  - having a filesystem on that device which is mounted
  - opened directly by an application

With the help of sysfs info, we can distinguish the first two situations.
The third one will be subject to "remove retry" logic - if it's opened
quickly (e.g. a parallel scan from within a udev rule run), this will
finish quickly and we can remove it once it has finished. If it's a
legitimate application that keeps the device opened, we'll do our best
to remove the device, but we will fail finally after a few retries.

12 years agoAdd dm_device_has_holders fn to to check use of the device by another device.
Peter Rajnoha [Thu, 22 Sep 2011 17:23:35 +0000 (17:23 +0000)]
Add dm_device_has_holders fn to to check use of the device by another device.
Add dm_device_has_mounted_fs fn to check mounted filesystem on a device.

This requires sysfs directory to be correctly set via dm_set_sysfs_dir
(/sys by default). If sysfs dir is not used or it's set incorrectly,
dm_device_has_{holders,mounted_fs} will return 0!

12 years agoAdd dm_set_sysfs_dir to libdevmapper to set sysfs location.
Peter Rajnoha [Thu, 22 Sep 2011 17:17:07 +0000 (17:17 +0000)]
Add dm_set_sysfs_dir to libdevmapper to set sysfs location.
Add dm_sysfs_dir to libdevmapper to retrieve sysfs location thas is set.

12 years agoAdd --retry option for dmsetup remove to retry removal if not successful.
Peter Rajnoha [Thu, 22 Sep 2011 17:12:28 +0000 (17:12 +0000)]
Add --retry option for dmsetup remove to retry removal if not successful.

12 years agoAdd dm_task_retry_remove fn to use retry logic for device removal.
Peter Rajnoha [Thu, 22 Sep 2011 17:09:48 +0000 (17:09 +0000)]
Add dm_task_retry_remove fn to use retry logic for device removal.

This call ensures that the dm device removal is retried several
times before failing.

12 years agoDisallow the creation of mirrors (mirror or raid1 segtype) with only one leg.
Jonathan Earl Brassow [Thu, 22 Sep 2011 15:36:21 +0000 (15:36 +0000)]
Disallow the creation of mirrors (mirror or raid1 segtype) with only one leg.

If you specify the segment type (e.g. --type mirror) and the mirrors argument
as zero, it would result in a mirrored LV with only one image.  While the device
may be valid in theory, it should not be allowed in practice.  It also makes it
difficult on the conversion tools, since they react badly to single-image
mirrors.

12 years agoWhen up-converting a RAID1 array, we need to allocate new larger arrays for
Jonathan Earl Brassow [Thu, 22 Sep 2011 15:33:21 +0000 (15:33 +0000)]
When up-converting a RAID1 array, we need to allocate new larger arrays for
seg->areas and seg->meta_areas.  We also need to copy the memory from the
old arrays to the newly allocated arrays.  The amount of memory to copy was
determined by seg->area_count.  However, seg->area_count was being set to the
higher value after copying the 'seg->areas' information, but before copying
the 'seg->meta_areas' information.  This means we were copying more memory
than necessary for 'seg->meta_areas' - something that could lead to a segfault.

12 years agoClvmd restart cleanup
Zdenek Kabelac [Thu, 22 Sep 2011 09:47:34 +0000 (09:47 +0000)]
Clvmd restart cleanup

Patch fixes Clang warnings about possible access via lv_name NULL pointer.

Replaces allocation of memory (strdup) with just pointer assignment
(since execve is being called anyway).

Checks for  !*lv_name only when lv_name is defined.
(and as I'm not quite sure what state this really is - putting a FIXME
around - as this rather looks suspicios ??).

Add debug print of passed clvmd args.

12 years agoAdd all exclusive locks to clvmd restart option args
Zdenek Kabelac [Thu, 22 Sep 2011 09:45:24 +0000 (09:45 +0000)]
Add all exclusive locks to clvmd restart option args

Fix bug when only every even lock has been passed.

Warning: currently -E causes clvmd to exit with usage text being printed.

12 years agoFIXMEs to note problems with some error paths. (Perhaps safer to disable
Alasdair Kergon [Wed, 21 Sep 2011 16:36:39 +0000 (16:36 +0000)]
FIXMEs to note problems with some error paths.  (Perhaps safer to disable
them until they can be fixed completely?)

12 years agoAlways sent the whole command header in restart/reload clvmd commands.
Milan Broz [Wed, 21 Sep 2011 13:40:46 +0000 (13:40 +0000)]
Always sent the whole command header in restart/reload clvmd commands.
(Newly added check catch this as invalid packet.)

(N.B. that code is so fragile that it need full rewrite soon:-)

12 years agoCheck for failing 'stat' and skip this loop iteration
Zdenek Kabelac [Wed, 21 Sep 2011 10:42:53 +0000 (10:42 +0000)]
Check for failing 'stat' and skip this loop iteration
(since data in statbuf are invalid).

Check whether sysconf managed to find _SC_PAGESIZE.

Report at least debug warning about failing unlink
(logging scheme here seems to be a different then in lvm).

Duplicate terminal FDs and use similar code as is made in clvmd
and cleanup warns about missing open/close tests.
FIXME: Looks like we already have 3 instancies of the same code in lvm repo.

12 years agoAdd missing log_error() to lvresize command when fsadm tool fails
Zdenek Kabelac [Wed, 21 Sep 2011 10:39:47 +0000 (10:39 +0000)]
Add missing log_error() to lvresize command when fsadm tool fails

Also add test case

12 years agoUnmount works with -y
Zdenek Kabelac [Mon, 19 Sep 2011 19:37:26 +0000 (19:37 +0000)]
Unmount works with -y

12 years agoAdd support for DM_DEV_DIR
Zdenek Kabelac [Mon, 19 Sep 2011 19:36:52 +0000 (19:36 +0000)]
Add support for DM_DEV_DIR

Follow other commands support this directory setting.
Useful for test suite.

12 years agoAnother vgremove for speedup
Zdenek Kabelac [Mon, 19 Sep 2011 18:40:51 +0000 (18:40 +0000)]
Another vgremove for speedup

It seems like test-suite is significantly slowed down on removal phase.

Maybe it should be part of generic teardown - though the reason of slowdown
should be also discovered -  probably related to retry loop ?

12 years agoRevert patch
Zdenek Kabelac [Mon, 19 Sep 2011 18:38:43 +0000 (18:38 +0000)]
Revert patch

Caller of exec must report log_error when rstatus is passed.

12 years agoEnsure fsadm.sh is executable
Zdenek Kabelac [Mon, 19 Sep 2011 15:54:15 +0000 (15:54 +0000)]
Ensure  fsadm.sh is executable

When the srcdir == builddir we get the link on non-exectable file.
So make always sure fsadm.sh is executable script file.

Add cleanup target for lib/fsadm.

12 years agoUse log_error instead of log_verbose when executed command fails
Zdenek Kabelac [Mon, 19 Sep 2011 14:54:23 +0000 (14:54 +0000)]
Use log_error instead of log_verbose when executed command fails

12 years agoAdd support for non /dev devices
Zdenek Kabelac [Mon, 19 Sep 2011 14:52:33 +0000 (14:52 +0000)]
Add support for non /dev devices

Since test suite is not using /dev - add support for such dirs into fsadm.

12 years agofix compiler warning.
Jonathan Earl Brassow [Mon, 19 Sep 2011 14:28:23 +0000 (14:28 +0000)]
fix compiler warning.

Compiler says variable may be used uninitialized.  It can't be, but we
initialize the variable to NULL anyway.  Also, remove the double initialization
of another variable.

12 years agoEnable t-fsadm test
Zdenek Kabelac [Mon, 19 Sep 2011 13:52:22 +0000 (13:52 +0000)]
Enable  t-fsadm test

Now all commands are executed from preffered directory.

12 years agoSupport different PATH setting
Zdenek Kabelac [Mon, 19 Sep 2011 13:51:09 +0000 (13:51 +0000)]
Support different PATH setting

When fsadm is test - it needs to execute lvm and fsadm from non-standard path
setting.   So adding a support in fsadm script when user set LVM_BINARY, then
the lvm command invoced from fsadm will have the same PATH setting as before
entering  fsadm command.

Needed for testing.

12 years agoSurround all executed commands with quotes
Zdenek Kabelac [Mon, 19 Sep 2011 13:47:37 +0000 (13:47 +0000)]
Surround all executed commands with quotes

In case someone would use filename paths with spaces when changing
this script surround commands with '"'.

With default settings there is no change in behavior.

12 years agoFix missing '$' in test
Zdenek Kabelac [Mon, 19 Sep 2011 13:43:50 +0000 (13:43 +0000)]
Fix missing '$' in test

12 years agoAdd link for fsadm script
Zdenek Kabelac [Mon, 19 Sep 2011 12:50:17 +0000 (12:50 +0000)]
Add link for fsadm script

Prepare to enabling t-fsadm.sh test

12 years agoTest speed up
Zdenek Kabelac [Mon, 19 Sep 2011 12:49:14 +0000 (12:49 +0000)]
Test speed up

Removing vg  reduces time execution of this test.
Teardown has some wait states here...

12 years agoMove debug message
Zdenek Kabelac [Mon, 19 Sep 2011 12:48:02 +0000 (12:48 +0000)]
Move debug message

so it does not look like we are executing command in the middle of
critical_section in log trace.

12 years agoFew more updates to lvmetad build deps
Zdenek Kabelac [Mon, 19 Sep 2011 00:29:11 +0000 (00:29 +0000)]
Few more updates to lvmetad build deps

It seem lvmetad deps must be expressed after the include.
Also adding lvmetad deps to device-mapper target in daemons dir.

12 years agoBuild fixes for lvmetad
Zdenek Kabelac [Sat, 17 Sep 2011 14:50:22 +0000 (14:50 +0000)]
Build fixes for lvmetad

Should now be giving better build order and install lvmetad.

12 years agoMore gcc warnings removed
Zdenek Kabelac [Sat, 17 Sep 2011 14:49:18 +0000 (14:49 +0000)]
More gcc warnings removed

12 years agoFix for gcc compilation warnings
Zdenek Kabelac [Sat, 17 Sep 2011 13:33:51 +0000 (13:33 +0000)]
Fix for gcc compilation warnings

and put _XOPEN_SOURCE so pthread_mutexattr is properly defined.

12 years agoFix Bug 738832 - core to disk log conversion fails with internal error
Jonathan Earl Brassow [Fri, 16 Sep 2011 18:39:03 +0000 (18:39 +0000)]
Fix Bug 738832 - core to disk log conversion fails with internal error

This bug showed up when trying to add a log to a mirror whose images are on
multiple devices.  This is an intra-release regression and no WHATS_NEW
entry will be added.  The error was introduce in the following commit:
2d8a2f35c77fdeef1dbe0ef791db8530d07826eb

The solution is to recognise in _alloc_init that if there are no mirrors
or stripes specified, then 'new_extents' should be zero.

12 years agoAfter suspend/resume following a splitmirror op, call sync_local_dev_names
Jonathan Earl Brassow [Fri, 16 Sep 2011 16:41:37 +0000 (16:41 +0000)]
After suspend/resume following a splitmirror op, call sync_local_dev_names
to settle udev before calling deactivate_lv.

This is an intra-release regression (no WHATS_NEW entry required).  It is
part of the fix for the current WHATS_NEW entry:
  Work around resume_lv causing error LV scanning during splitmirror operation.

12 years agoFix clvmd processing of invalid request on local socket. (rommer)
Milan Broz [Fri, 16 Sep 2011 14:40:06 +0000 (14:40 +0000)]
Fix clvmd processing of invalid request on local socket. (rommer)

Code now detects small packet and wrong arglen and reply with
error intead of infinite loop.

https://bugzilla.redhat.com/show_bug.cgi?id=738484

This page took 0.073209 seconds and 5 git commands to generate.