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

2972 Commits

Author SHA1 Message Date
Zdenek Kabelac
639983b6b7 clvmd: skip adding reply when finished
Prior adding new reply to the list, check
if the reply thread is not already finished.
In that case discard adding message
(which would otherwise be leaked).
2014-04-14 13:01:42 +02:00
Zdenek Kabelac
7236b92857 clvmd: improve mutex usage in request_timed_out
Use mutex to access localsock values, so check
num_replies when the thread is not yet finished.

Check for threadid prior the mutex taking
(though this check is probably not really needed)
2014-04-14 13:00:51 +02:00
Zdenek Kabelac
7075656034 clvmd: drop reply_mutex
Added complexity with extra reply mutex is not worth the troubles.
The only place which may slightly benefit from this mutex is timeout
and since this is rather error case - let's convert it to
localsock.mutex and keep it simple.
2014-04-14 12:59:07 +02:00
Zdenek Kabelac
6115c0d112 clvmd: set finished flag with mutex
Setting this variable needs to be protected with mutex.
2014-04-14 12:58:28 +02:00
Zdenek Kabelac
cc0096ebdd clvmd: move mutex init and detroy
Move the pthread mutex and condition creation and destroy
to correct place right after client memory is allocatedd
or is going to be released.

In the original place it's been in race with lvm thread
which could have still unlock mutex while it's been already
destroyed.
2014-04-14 12:57:39 +02:00
Zdenek Kabelac
91f4e09b48 clvmd: fix test mode race
When TEST_MODE flag is passed around the cluster,
it's been use in thread unprotected way, so it may have
influenced behaviour of other running parallel lvm commands
(activation/deactivation/suspend/resume).

Fix it by set/query function only under lvm mutex.
For hold_un/lock function calls check lock_flags bits directly.
2014-04-14 12:55:46 +02:00
Zdenek Kabelac
bd3e44643d memlock: ignore more libraries
Extend the list of ignored libraries. Since we do not
use those libraries during suspend, skip their locking.
2014-04-14 12:53:07 +02:00
Zdenek Kabelac
84ff3ae703 pvmove: remove locked flag from error pvmove0
When pvmove0 is finished, it replaces temporarily pvmove0
with error segment, however in this case, pvmove0 remains
unremovable in case pvmove --abort is interrupted in this
moment - since it's not a pvmove anymore and normal
lvremove can't be used to remove LOCKED lv.
2014-04-14 12:52:32 +02:00
Zdenek Kabelac
45f45c9932 polldaemon: ret invalid cmd for negative interval
Negative intervals are not supported.
2014-04-14 12:47:14 +02:00
Alasdair G Kergon
6320c3b905 post-release 2014-04-10 17:13:27 +01:00
Alasdair G Kergon
2043f8c729 pre-release 2014-04-10 16:28:28 +01:00
Peter Rajnoha
6c79556f4f pvcreate: fix ignored --dataalignment/dataalignment offset for pvcreate --restorefile
There were two bugs before when using pvcreate --restorefile together
with data alignment and its offset specified:

  - the --dataalignment was always ignored due to missing braces in the
    code when validating the divisibility of supplied --dataalignment
    argument with pe_start which we're just restoring:

	if (pp->rp.pe_start % pp->data_alignment)
		log_warn("WARNING: Ignoring data alignment %" PRIu64
			 " incompatible with --restorefile value (%"
			 PRIu64").", pp->data_alignment, pp->rp.pe_start);
        pp->data_alignment = 0

    The pp->data_alignment should be zeroed only if the pe_start is not
    divisible with data_alignment.

  - the check for compatibility of restored pe_start was incorrect too
    since it did not properly count with the dataalignmentoffset that
    could be supplied together with dataalignment

The proper formula is:

  X * dataalignment + dataalignmentoffset == pe_start

So it should be:

  if ((pp->rp.pe_start % pp->data_alignment) != pp->data_alignment_offset) {
	...ignore supplied dataalignment and dataalignment offset...
  }
2014-04-10 13:43:46 +02:00
Peter Rajnoha
10e10cfa4f lvmetad: fix lost bootloader area information
The refactoring made by 732859d21f
caused this. The former "ea" was not renamed to "ba" and we used
incorrect tree node name to search for the value.
2014-04-09 14:53:45 +02:00
Peter Rajnoha
a7c930b18d tools: don't require --major to be specified when using -My option on kernels > 2.4
Since kernel > 2.4 have dynamically assigned major numbers.

[0] raw/~ $ lvcreate -l1 -My --minor 10 vg
  Logical volume "lvol0" created

[0] raw/~ $ lvcreate -l1 -My --major 254 --minor 11 vg
  Ignoring supplied major number - kernel assigns major numbers dynamically. Using major number 253 instead.
  Logical volume "lvol1" created

[0] raw/~ $ lvs --profile out -o+major,minor
  lvol0 vg     -wima-----    4.00 253  10
  lvol1 vg     -wima-----    4.00 253  11
2014-04-04 13:29:39 +02:00
Alasdair G Kergon
cc72f340d7 thin: Support thin_check --clear-needs-check-flag.
Update thin provisioning tools to version 0.3.2 or later!
2014-04-04 02:22:40 +01:00
Alasdair G Kergon
12ddaa5f10 lib: Share lvm_even_rand for random numbers. 2014-04-04 01:26:19 +01:00
Alasdair G Kergon
6d2a26f6b6 man: Add lvmthin(7). 2014-04-04 01:14:25 +01:00
Zdenek Kabelac
84beba5d7f vg_validate: check size of lv_name + vg_name
Since the whole dm device name may not exceed 127 characters,
validate no LV names is bigger then this limit.
2014-03-31 12:05:32 +02:00
Zdenek Kabelac
6570d36ad5 lv_rename: resume fail is certainly error
Failing resume path means command has failed,
even when commit was ok.
2014-03-31 12:03:25 +02:00
Zdenek Kabelac
d3e4934a15 lvrename: fix name length validation
This test for LV name restriction check name of device is below 128
chars (which is enforced by dm target).
Thus it should not count with device name.
(Though the test for PATH_MAX size should be probably also added,
but this is runtime test, since theoretically devpath might differ in cluster)
2014-03-31 12:02:18 +02:00
Zdenek Kabelac
caa429da2e lvdiplay: prohibit use of -c and -m
It's unclear why we should prohibit use of -v output.
So reenable (like with other 'display' tools)
But -c -m is really unsupported - return invalid cmd.
2014-03-31 12:00:45 +02:00
Zdenek Kabelac
31d68b7124 man: sort options
Sort order for -C|--columns as with other options,
and use short capital name as the first (as with other options).
Also drop multiple reference for pvs/lvs/vgs, since now
the text for -C is really close to referrence of lvm anyway.
2014-03-30 23:43:31 +02:00
Zdenek Kabelac
7a9c569eb4 pvscan: return error when free parameter is given
Just like vgscan, pvscan (without --cache option) is not
accepting and 'free' args  (i.e.  pvscan /dev/sdx)
2014-03-30 23:42:57 +02:00
Zdenek Kabelac
844afa32a0 pvdisplay: fix option error
Properly show error for '-m'.
Also report unsupported  '-c & -s' (just like with vg/lvdisplay)
2014-03-30 23:41:52 +02:00
Zdenek Kabelac
cf29de5de0 vgimport/vgexport: return invalid cmd
When option parsing fails, return invalid cmd instead of fail.
2014-03-30 23:40:27 +02:00
Zdenek Kabelac
88a9705222 pvchange: populate lvmcache for --all
When running pvchange --all  learn about available VGs from lvmetad.
2014-03-28 10:41:58 +01:00
Peter Rajnoha
801d43445d man: add man page for lvm dumpconfig 2014-03-27 14:03:28 +01:00
Zdenek Kabelac
356fdda46d lv_manip: drop cmd pointer from for_each_sub_lv
Drop unused passed cmd pointer from function.

TODO:

We have two similar functions (though not identical)

lv_manip.c: for_each_sub_lv()
metadata.c: _lv_each_dependency()

They seem to not always match - we should probably convert
to use only a single function.
2014-03-27 13:10:13 +01:00
Zdenek Kabelac
22579b4451 lv_rename: validate renamed sublv
Use proper vgmem memory pool for allocation of LV name in the vg
and check if new renamed LV is a valid name.

TODO: validation should really use also VG name, othewise we are not
able to tell "vgname-lvname" will be valid.
2014-03-27 13:06:23 +01:00
Zdenek Kabelac
28e4bf0b6d lvrename: fix exit code
Return invalid cmd line (3) when error is detect on cmd line input.
Cmd failed (5) is used when command processing fails.
2014-03-27 13:04:55 +01:00
Zdenek Kabelac
80fe100afa pvchange: fix exit code regression
Commit 1a832398a7 moved
some code from _pvchange_single() to main pvchange() and
introduced exit code regression as return codes have not
been properly changed, thus pvchange command exited
with '0' exit code, even though it has reported error.
Also there is a missing vg unlock in error path.

Fix it by counting the total number of expected calls before
checking for pvname and also unlock and relase vg when
pv is not found.
2014-03-27 13:01:51 +01:00
Peter Rajnoha
ce78cb58eb lvmdump: add lvm dumpconfig --type diff/missing
For a quick overview of config when debugging and to quickly check
which values are different from defaults and which are not defined
in the config and for which defaults are used.
2014-03-25 13:06:59 +01:00
Zdenek Kabelac
0738f0ad72 pvresize: fail exit code for negative size
Pvresize with negative value retuns invalid cmd line exit code.
2014-03-25 11:52:03 +01:00
Zdenek Kabelac
68d13b2517 dev-cache: fix mem corruption on refresh context
When lvm2 command works with clvmd and uses locking in wrong way,
it may 'leak' certain file descriptors in opened (incorrect) state.

dev_cache_exit then destroys memory pool of cached devices, while
_open_devices list in dev-io.c was still referencing them if they
were still opened.

Patch properly calls _close() function to 'self-heal' from this
invalid state, but it will report internal error (so execution
with abort_on_internal_error causes immediate death). On the
normal 'execution', error is only reported, but memory state is
corrected, and linked list is not referencing devices from
released mempool.

For crash see: https://bugzilla.redhat.com/show_bug.cgi?id=1073886
2014-03-25 11:22:57 +01:00
Peter Rajnoha
d29fe919e6 WHATS_NEW: commit f12ee43 2014-03-25 11:00:44 +01:00
Peter Rajnoha
5dcec1734e dumpconfig: add dumpconfig --type diff to show differences from defaults 2014-03-24 15:35:54 +01:00
Zdenek Kabelac
936bfeb8de dev-swap: detect swap signature on devices smaller then 2MB
Smallest supported size for swap device is 40KB, however current
test skipped devices smaller then 4096 sectors (2MB).

Since page is in bytes, convert it to sectors before comparing
with device size (in sectors).
2014-03-22 20:36:14 +01:00
Zdenek Kabelac
93d77455ea WHATS_NEW update 2014-03-21 22:29:28 +01:00
Peter Rajnoha
2f279797f5 WHATS_NEW: commit 5eef269 2014-03-19 09:49:09 +01:00
Zdenek Kabelac
3d7eaf9226 pvscan: fix report of long pv names
pvscan --uuid was broken since it was using only 128 char buffers
without checking any write size, so any longer device path leads to
crash.

Also ansure format is properly aligned into columns with this option.
2014-03-19 00:58:01 +01:00
Zdenek Kabelac
506091be70 pv_vg_name: do not expose internal orphans to lvm2 users
Check for orphan VG name and return just empty string,
Use internally pv->vg_name if the real orphan name is needed.
2014-03-19 00:57:59 +01:00
Thomas Fehr
5b69bfb6f8 pvdisplay: fix man to refer to sectors, not KB
The PV size is displayed in sectors, not kilobytes
for 'pvdisplay -c'

Signed-off-by: Thomas Fehr <fehr@suse.de>
Acked-by: Hannes Reinecke <hare@suse.de>
2014-03-19 00:49:32 +01:00
Zdenek Kabelac
6a8d3d7811 clvmd: avoid resending local sync commands
Instead of sending repeatedly  LOCAL_SYNC commands to clvmds
like 'lvs', rememeber the last sent commmand, and if there was no other
clvmd command, drop this redundant SYNC call message.

The problem has started with commit:
56cab8cc03

This introduced correct synchronisation of name, when user requests to know
open_count (needs to wait for udev), however it is also executed for
read-only cases like 'lvs' command.

For now implement very simple solution, which is only monitoring
outgoing clvmd command, and when sequence of LOCAL sync names are
recognized, they are skipped automatically.

TODO:
Future solution might move this variable info 'cmd_context' and
use  'needs_sync' flag also i.e. in file locking code.
2014-03-19 00:47:58 +01:00
Zdenek Kabelac
a6b159e99c file_locking: use PATH_MAX for dir name
Using just 128 chars for locking dir may wail if longer
dir entry is used, swich to default linux max path.
2014-03-19 00:46:28 +01:00
Zdenek Kabelac
08018a5345 archiver: drop unneeded backup check
When the backup is disabled, avoid testing backup presence.
This only leads to errors being logged in debug trace and the missing
backup can't be fixed, since it's disabled.
2014-03-19 00:45:41 +01:00
Peter Rajnoha
25f5e2da8d dumpconfig: fix memleak when using --mergedconfig
Check whether lvm dumpconfig --mergedconfig is used only
with --type current (where we're merging current config and
the config supplied on command line). With other types
the config was merged, but it was thrown away since we're
generating other type of config anyway. This lead to a memleak.

Error out if --mergedconfig is used with anything else than
--type current (or without specifying --type in which case
the --type current is used by default).
2014-03-18 11:11:31 +01:00
Peter Rajnoha
21b3c983fd config: make global/lvdisplay_shows_full_device_path profilable 2014-03-18 09:49:53 +01:00
Peter Rajnoha
3a6bc7fc65 WHATS_NEW: previous commit 2014-03-18 09:28:52 +01:00
Peter Rajnoha
c1ce2cc86c config: make global/units and global/si_unit_consistency profilable 2014-03-17 16:07:29 +01:00
Zdenek Kabelac
d425e788e9 lvconvert: validate min chunk size for snapshot
Do not allow conversion of too small LV into a COW snapshot device.

Without this patch snapshot target is generating these kernel
messages before creation fails:

attempt to access beyond end of device
dm-9: rw=16, want=8, limit=2
attempt to access beyond end of device
...
device-mapper: table: 253:11: snapshot: Failed to read snapshot metadata
device-mapper: ioctl: error adding target to table
device-mapper: reload ioctl on  failed: Input/output error
2014-03-17 14:31:43 +01:00