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

809 Commits

Author SHA1 Message Date
Zdenek Kabelac
d3b8f270ea headers: add headers for musl libc
On glibc, those are erroneously (namespace pollution) pulled in via
other headers. this doesn't work with conformant libcs (musl libc in
this case), we simply need to include all needed headers.

Signed-Off-By: John Spencer <maillist-lvm@barfooze.de>
2013-02-05 14:27:25 +01:00
Zdenek Kabelac
8bcc1da2f3 locales: use higher prio LC_ALL variable
For reseting locale environment into significantly less memory
consuming version 'C' - use LC_ALL instead of LANG since it has
higher priority in locale settings.

Otherwise we may observe whole locale-archive which might be
over 100MB on i.e. Fedora systems locked in memory with
some daemons.
2013-01-22 11:25:02 +01:00
Petr Rockai
15fdd5c90d lvmetad: Fix a race in metadata update.
The idea is to avoid a period when an existing VG is not mapped to either the
old or the new name. (Note that the brief "blackout" was present even if the
name did not actually change.) We instead allow a brief overlap of a VG existing
under both names, i.e. a query for a VG might succeed but before a lock is
acquired the VG disappears.
2013-01-16 11:19:33 +01:00
Peter Rajnoha
6fc596ca90 dmeventd: close dmeventd FIFO FDs on exec (add FD_CLOEXEC). 2013-01-15 14:59:54 +01:00
Zdenek Kabelac
69099e7ef5 Revert "lvmetad: simplify pvid memory allocation."
This reverts commit ed23da95b6.

Hash table device_to_pvid  seems to contain references to
already deleted pvids and so revert to the older
behaviour using allocated memory.
2012-12-17 13:49:19 +01:00
Petr Rockai
5294a6f77a lvmetad: Fix a possible race in remove_metadata.
All operations on shared hash tables need to be protected by mutexes. Moreover,
lookup and subsequent key removal need to happen atomically, to avoid races (and
possible double free-ing) between multiple threads trying to manipulate the same
VG.
2012-12-17 00:47:55 +01:00
Petr Rockai
fae1a611d2 lvmetad: Fix a possible deadlock.
If an update and a query were running in parallel, there was a slim but non-zero
chance of a deadlock due to (unnecessary) mutex nesting.
2012-12-17 00:47:55 +01:00
Zdenek Kabelac
ed23da95b6 lvmetad: simplify pvid memory allocation.
Since pvid_dup and cft config appears to be tightly
binded together - reuse it's memory pool for string.
Simplifies release of hashes.
2012-12-15 17:23:28 +01:00
Zdenek Kabelac
6f9e26f5c0 thin: dmeventd fix memleak on error path
Some error paths on _umount have leaked bitset.
2012-12-15 17:23:27 +01:00
Zdenek Kabelac
ba3f37c9e4 lvmetad: fix memleak on pv_found error path
Free resources allocated in pv_found when going out
through error path.
2012-12-15 17:23:27 +01:00
Zdenek Kabelac
399fc1bb33 lvmetad: keep returned struct fully initialized
Always clear the response structure.
Simplify daemon_reply initialization.
2012-12-15 17:23:27 +01:00
Zdenek Kabelac
a4269aadf3 lvmetad: unlock vg on out-of-memory path
If we fail to get memory for mutex, hash the mutex
or fail somewhere along pthread function calls
return allocated resources back and unlock vg_lock_map mutex.
2012-12-15 17:23:26 +01:00
Zdenek Kabelac
a266154e1f cleanup: singlenode minor change
Use strcpy instead of sprintf for plain string.
And use dm_strncpy for safer strncpy.

TODO: Fix API return values for cluster functions.
2012-12-15 14:57:40 +01:00
Zdenek Kabelac
1b05438fcb cleanup: ignore errors
Since we are doing just dump and function doesn't report
any error, explicitely ignore return values from
dm_config_write_node and dm_asprintf.

Same applies for the logging function.
2012-12-15 14:57:40 +01:00
Zdenek Kabelac
1d774e5667 cleanup: drop test for optarg NULL
Since -d takes an argument, we do not need to check for
optarg being NULL here.
2012-12-15 14:57:40 +01:00
Zdenek Kabelac
13fe333b54 clvmd: fix parsing of -d argument
clvmd -d option parsing was not working properly.

clvmd -d 2   (with space) has been ignored because of
'::' used in getopt string, and as failsafe it's been used '1'.

Later this debug_arg has been ignored and debug_opt was used
instead which happend to have value '1'.

Submitted-by: Robert Milasan <rmilasan at suse.com>
Reported-by: Robert Milasan  <rmilasan at suse.com>
2012-10-19 15:35:56 +02:00
Alasdair G Kergon
8290de964f lvmetad: rename DEBUG() to DEBUGLOG()
DEBUG is already defined by -DDEBUG
2012-10-15 14:20:11 +01:00
Alasdair G Kergon
78dafcba99 lvmetad: use -l for logging level not -d 2012-10-15 10:44:43 +01:00
Alasdair G Kergon
a0e60d27ff lvmetad: document and tidy cmdline args
Try to bring the lvmetad usage text and man page closer to the code.
There seem to be 3 useful ways to use -d with lvmetad at the moment:
  -d all
  -d wire
  -d debug
(They can also be comma-separated like -d wire,debug.)
Prior to the last release, -d, -dd and -ddd were supported.
Fail if an unrecognised debug arg is supplied on the command line.
Change -V to report the same version as the lvm binary: previously it
just reported version 0.
2012-10-15 02:06:27 +01:00
Zdenek Kabelac
3972bd98fb thin: add support to unmount volumes
Reset counter after thin pool resize failure.

If the pool goes above threshold, support unmounting
of all thin volumes if the lvextend fails to avoid
overfilling of the pool.
2012-10-14 23:19:20 +02:00
Zdenek Kabelac
9effc6ab31 cleanup: drop unused assignment
Since 'n' is later reassigned and unused between, drop it's first
assign.
2012-10-13 19:17:10 +02:00
Zdenek Kabelac
c4dcbf67a3 lvmetad: initialize cft value
the error should not test garbage value.
2012-10-12 10:59:10 +02:00
Zdenek Kabelac
9ee071705b cleanup: fix compiler warnings
remove unused vars
move var declarations into the front of functions.
fix some sign warnings
2012-10-12 10:25:07 +02:00
Petr Rockai
a63b46bf36 lvmetad: Implement a "dump" request to capture lvmetad state. 2012-10-11 20:31:29 +02:00
Petr Rockai
b07df8850a libdaemon: Make buffer handling asymptotically more efficient. 2012-10-11 18:09:41 +02:00
Petr Rockai
2ba9fb4019 lvmetad: Fix help output (flags and their meaning). 2012-10-10 21:55:24 +02:00
Petr Rockai
622fb968a2 lvmetad: Fix the -f pidfile (non-)creation logic. 2012-10-10 13:53:21 +02:00
Petr Rockai
1997149263 lvmetad: Only create pidfile when running as a daemon (no -f).
Additionally, -f now makes -s mandatory, so the foreground (debugging) lvmetad
does not steal the system-wide socket accidentally.
2012-10-09 20:37:34 +02:00
Petr Rockai
06243be91b lvmetad: Fix a leak on duplicated PVs (same PVID, different device). 2012-10-09 01:38:58 +02:00
Petr Rockai
665b6b308e lvmetad: Fix a leak in an error path in update_metadata. 2012-10-08 23:52:44 +02:00
Petr Rockai
138b4e1719 lvmetad: Fix a typo-induced leak in destroy_metadata_hashes. 2012-10-08 20:35:29 +02:00
Petr Rockai
6e312c56ad lvmetad: Avoid overlapping locks that could cause a deadlock (BZ 862253). 2012-10-08 09:12:51 +02:00
Petr Rockai
662a2122f6 libdaemon: Split daemon-shared.[hc] into daemon-io.[hc] and config-util.[hc]. 2012-09-26 17:26:23 +02:00
Petr Rockai
9f96286c29 lvmetad: Initialise debug_config also if no -d is given. 2012-09-26 17:26:23 +02:00
Petr Rockai
1ff2245c23 lvmetad: Give inconsistent metadata warnings in pvscan --cache. 2012-09-26 17:26:23 +02:00
Petr Rockai
d2d6663428 lvmetad: Clear metadata/PV cache before a token-triggered rescan. 2012-09-26 17:26:23 +02:00
Petr Rockai
c7b17836ea Implement devices/global_filter.
The global filter is applied first, and is also applied in pvscan --cache (which
is called from udev rules to keep lvmetad updated). Cf. example.conf.
2012-09-26 14:49:15 +02:00
Petr Rockai
ea14d5159c libdaemon: Extend and refactor APIs.
- move common dm_config_tree manipulation functions from lvmetad-core to
  daemon-shared
- add config-tree-based request manipulation APIs to daemon-client
- factor out _v (va_list) variants of most variadic functions in libdaemon
2012-09-26 14:49:09 +02:00
Peter Rajnoha
847e2856a2 config: require dm_config_create_value for dm_config_node's value
If we were defining a section (which is a node without a value) and
the value was created automatically on dm_config_create_node call,
we were wasting resources as the next step after creating the config
node itself was assigning NULL for the node's value.

The dm_config_node_create + dm_config_create_value sequence should be
used instead for settings and dm_config_node_create alone for sections.

The majority of the code already used the correct sequence. Though
with dm_config_node_create fn creating the value as well, the pool
memory was being trashed this way.

This patch removes the node value initialization on dm_config_create_node
fn call and keeps it for the direct dm_config_create_value fn call.
2012-08-27 14:33:54 +02:00
Zdenek Kabelac
c6f680ee49 clvmd,lvmetad: check for fcntl result
Report any problem of fcntl.
2012-08-23 14:38:48 +02:00
Zdenek Kabelac
15891d366d cleanup: add error message and simplify creation
Report error for malloc failure, and use zeroed allocation
to initialize handler structure.
2012-08-23 14:37:38 +02:00
Zdenek Kabelac
286cd2006b cleanup: drop unneeded included header files
This headers were not resolving anything used for compiled .c files.
Remove unused util.c file.
2012-08-23 14:37:20 +02:00
Zdenek Kabelac
6d0abc6b48 cmirrord: check for result of chdir
Error exit if chdir fails.
2012-08-23 14:37:20 +02:00
Zdenek Kabelac
59ca324c35 clvmd: release excl_uuid hash
Release allocated hash before exit.
2012-08-23 14:34:56 +02:00
Petr Rockai
b61be64370 libdaemon: Draft logging infrastructure.
- logging is not controlled by "levels" but by "types"; types are
  independent of each other... implementation of the usual "log level"
  user-level semantics can be simply done on top; the immediate
  application is enabling/disabling wire traffic logging independently
  of other debug data, since the former is rather bulky and can easily
  obscure almost everything else
- all logs go to "outlets", of which we currently have 2: syslog and
  stderr; which "types" go to which "outlets" is entirely configurable
2012-08-08 09:44:19 +02:00
Petr Rockai
8791d01fee lvmetad: Fix an obscure error message. 2012-07-31 11:43:35 +02:00
Peter Rajnoha
9a96f930a7 configure: run directory configuration cleanup
There were several hard-coded values for run directory around the code.
Also, some tools are DM specific only, others are LVM specific and there
was no distinction made here before. With this patch applied, we have
this cleaned up a bit (subsystem in brackets, defaults in parentheses):

          [common] configurable PID_DIR     (/var/run)

 lvm      [lvm]    configurable RUN_DIR     (/var/run/lvm)
                   configurable locking dir (/var/lock/lvm)

 clvmd    [lvm]    configurable pid file    (PID_DIR/clvmd.pid)
                   socket                   (RUN_DIR/clvmd.sock)

 lvmetad  [lvm]    configurable pid file    (PID_DIR/lvmetad.pid)
                   socket                   (RUN_DIR/lvmetad.socket)

 dm       [dm]     configurable DM_RUN_DIR  (/var/run)

 cmirrord [dm]     configurable pid file    (PID_DIR/cmirrord.pid)

 dmeventd [dm]     configurable pid file    (PID_DIR/dmeventd.pid)
                   server fifo              (DM_RUN_DIR/dmeventd-server)
                   client fifo              (DM_RUN_DIR/dmeventd-client)

The changes briefly:
  - added configure --with-default-pid-dir
  - added configure --with-default-dm-run-dir
  - added configure --with-lvmetad-pidfile
  - by default, using one common pid directory for everything
    (only lvmetad was not following this before)
2012-06-27 12:11:47 +02:00
Zdenek Kabelac
6f3cd63551 cleanup: replace memset with struct initilization
Simplifies the code, properly detects too long socket paths,
drops unused parameter.
2012-06-22 13:23:03 +02:00
Zdenek Kabelac
461eb1ac6a cmirrord: add missing checks for kernel_send
Log errors if kernel_send fails.
2012-06-20 14:48:26 +02:00
Zdenek Kabelac
865b9d3701 cmirrord: fix cut&paste 2012-06-20 14:41:57 +02:00