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

771 Commits

Author SHA1 Message Date
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
Zdenek Kabelac
fb4584b83d cmirrord: add test for closedir() and close() 2012-06-20 14:40:39 +02:00
Alasdair G Kergon
9f01f1453c dmeventd: Improve comment about repeated DIE msgs 2012-06-08 21:52:02 +01:00
Jonathan Earl Brassow
e5b9338ada Fix bug in cmirror that caused incorrect status info to print on some nodes.
Looking at the code in cmirrord/local.c, we can see the various different
request types handled in different ways.  Some information that is non-changing
does not need to go around the cluster and can be short-circuited.  For
example, once the cluster mirror is in-sync, it is pointless to continue
sending that query around the cluster.  We can save network bandwidth and reply
directly back to the kernel.  When it comes to status information, there are
two types 'TABLE' and 'INFO'.  The 'TABLE' information never changes and
belongs to the group of requests that can be safely short-circuited.  The
'STATUS' information can change - and will change if a device fails.  Thus it
cannot be short-circuited, but this is exactly what was found.  The 'STATUS'
information request was being short-circuited and therefore never reporting the
failure condition to anyone other than the "server" that experienced it
directly.
2012-04-26 17:30:49 +00:00
Zdenek Kabelac
d6f894edf8 Synchronize with self-destruction of dmeventd
In some occasional case dmevent restart was experiencing problems
with obtaining pid lockfile. So this patch tries to send several more kill
message until daemon kills itself so there is would reponse.
With this small loop the restart seems to work reliable,
although the loopsize and usleep are just randomly picked for now.
2012-04-24 12:25:12 +00:00
Zdenek Kabelac
8262a3f6ca Update singlenode locking
Support lock conversion
Work also with LCK_READ
TODO: do more validation.
2012-04-24 12:16:40 +00:00
Jonathan Earl Brassow
bad8b5848f Commit ID 46a75dedb4 consolidated code from the
various dmeventd plug-ins into a new function called 'dmeventd_lvm2_command',
but the new function did not strip off the "_mlog" extentions that the
mirror plug-in had been doing.  This created bug 794904 - failure to replace
devices in a redundant log.

The test suite did catch this scenario because it performs repair tests (mainly)
through the CLI and not dmeventd.  It's also not easy to test because the test
itself will hang if the bug is encountered.
2012-04-10 23:34:41 +00:00
Milan Broz
61a1effcf1 Avoid closing clvmd socket twice. 2012-03-27 16:59:28 +00:00
Zdenek Kabelac
2dba563206 Add fixmes
There is missing some proper reaction when update fails ?
2012-03-23 10:34:51 +00:00
Zdenek Kabelac
0fc9a3dce3 Always free hash table
also in error path
2012-03-23 10:33:26 +00:00
Zdenek Kabelac
5da4d94adc Return mem fail if hash insert fails 2012-03-23 09:48:17 +00:00
Zdenek Kabelac
4ea8533f30 Make sure namelen fits into buffer allocated on stack 2012-03-23 09:43:44 +00:00
Zdenek Kabelac
467f454c09 Update debug message
(compiled only with special debug define)
2012-03-23 09:39:59 +00:00
Zdenek Kabelac
516b79299a Fix check for passed in path for dmeventd startup
Check passed in executable path for dmeventd instead of predefined
compiled in path which is not the thing to be executed.
2012-03-20 17:38:47 +00:00
Peter Rajnoha
08e846e3d9 Remove dmeventd fifos on exit if they are not managed by systemd. 2012-03-15 08:45:55 +00:00
Peter Rajnoha
93945bb616 Use SD_ACTIVATION env. var. in systemd units to better detect systemd in use.
LISTEN_PID and LISTEN_FDS environment variables are defined only during systemd
"start" action. But we still need to know whether we're activated during
"reload" action as well - we use the reload action to call "dmeventd -R"/"lvmetad -R"
for statefull daemon restart. We can't use normal "restart" as that is simply
composed of "stop" and "start" and we would lose any state the daemon has.
2012-03-14 15:51:51 +00:00
Peter Rajnoha
c02af0773f Do not run a new dmeventd instance on restart if there's no existing one. 2012-03-14 11:16:00 +00:00
Zdenek Kabelac
65cfc5d16d We need longer window for checking read from fifo.
Seems like some dmeventd startups are taking more time then expected,
so make the time window longer here.
2012-03-12 14:46:53 +00:00
Milan Broz
ff58a4b099 Remove some whitespaces.
(Test commit.)
2012-03-10 10:39:28 +00:00
Milan Broz
7991a9636e Remove some whitespaces.
(test commit)
2012-03-10 09:32:46 +00:00
Zdenek Kabelac
edb42ac367 Code refactoring
Properly test for dm_asprintf result.
Keep unlocking of mutex in the same function and do not spread lock and
unlock over functions.
2012-03-02 23:01:10 +00:00
Zdenek Kabelac
0438b15353 List _thread_registry missed mutex
Operation on _thread_registry needs to be covered by mutex.
Cosmetic move a die code after free for valgind short leak list.
2012-03-02 22:57:25 +00:00
Alasdair Kergon
9c159ea320 Pass struct device around internally rather than dev_t.
Add 3rd daemon return state "unknown" for lookups that are carried out
successfully but don't find the item requested.
Avoid issuing error messages when it's expected that a device that's
being looked up in lvmetad might not be there.
2012-03-02 20:46:36 +00:00
Zdenek Kabelac
79e4194e59 Add traceback for failpath 2012-03-01 22:55:21 +00:00
Zdenek Kabelac
475c751076 Skip zero length messages
In case of zero length message, there would be a memory leak on
return path from _do_process_request.
2012-03-01 22:54:17 +00:00
Zdenek Kabelac
099aca0311 Check allocated pointers
Test pointers from allocation against NULL.
Error paths should be checked, some of them probably need
some extesions.
2012-03-01 22:52:59 +00:00
Zdenek Kabelac
96b93199a0 Improve logging
Use %m for strerror.
Switch to use 0 for fail return code.
2012-03-01 22:06:18 +00:00
Zdenek Kabelac
dc1be80b26 Debug log for hold_lock failure 2012-03-01 21:18:38 +00:00
Zdenek Kabelac
f3c177312f Correct enum type
Using debug_t and some forgetten alloc_policy_t, force_t from past commit.
2012-03-01 21:14:43 +00:00
Zdenek Kabelac
c452307543 Few more close and dev_close trace
Adding (void) where we cannot really report an error.
2012-03-01 21:12:37 +00:00
Jonathan Earl Brassow
2ce9693341 s/CPG_/CS_: Various CPG constants are going away, even though CPG itself stays
F17 is getting rid of OpenAIS libraries (and checkpointing).  While the
CPG stuff is staying, some if its constants are being removed.  So, we
must adjust and use the remaining constants which the CPG constants were based on.

[~]# egrep 'CPG_DISPATCH_ALL|CPG_OK' /usr/include/*/*
corosync/corotypes.h:#define CPG_DISPATCH_ALL     CS_DISPATCH_ALL
corosync/corotypes.h:#define CPG_OK               CS_OK
2012-03-01 17:41:39 +00:00
Zdenek Kabelac
310f54439c More useful debug message 2012-03-01 10:41:48 +00:00
Zdenek Kabelac
f9467799c1 Check for allocation error
return ENOMEM when malloc fails.
2012-03-01 09:54:23 +00:00
Zdenek Kabelac
ce1c28af19 Log fail of pthread_join
Syslog error outside of mutex section.
2012-03-01 09:50:04 +00:00
Jonathan Earl Brassow
62e38da133 Allow cluster mirrors to handle the absence of the checkpoint lib (libSaCkpt).
The OpenAIS checkpoint library is going away; therefore, cmirrord must
operate without it.  The algorithms the handle the timing of when to send
a checkpoint, the determination of what to send, and which ongoing cluster
requests are relevent with respect to the checkpoints are unaffected.  We
need only replace the functions that actually perform the storing/transmitting
and retrieving/receiving of the checkpoint data.  Rather than store the
checkpoint data in an OpenAIS checkpoint file, we simply transmit it along
with the message that notifies the incoming node that the checkpoint is
ready.
2012-02-29 21:15:34 +00:00
Alasdair Kergon
7126d8c21b Reflect new file locations, include file updates etc. 2012-02-28 18:35:04 +00:00
Alasdair Kergon
e980d54371 remove old makefile 2012-02-28 18:31:28 +00:00
Alasdair Kergon
ec6559c93e move daemon files 2012-02-28 18:30:39 +00:00
Zdenek Kabelac
c682e83760 Check for failing dm_asprintf 2012-02-28 14:25:37 +00:00