Zdenek Kabelac
c682e83760
Check for failing dm_asprintf
2012-02-28 14:25:37 +00:00
Peter Rajnoha
870353f9d1
Add support for systemd socket handover for common daemon-server code and also add support for new OOM killer adjustment interface.
...
This code is already a part of dmeventd, but it's modified slightly to check
sockets instead of FIFOs.
2012-02-28 13:05:21 +00:00
Zdenek Kabelac
bd046f0201
Ensure clvmd message is always \0 terminated
...
Drop whole buffer clearing (most messages at <100 bytes).
Just make sure we have always \0 terminated string for strlen() operations.
(before for PIPE_BUF sized messages this was not set).
2012-02-28 11:06:56 +00:00
Zdenek Kabelac
c19d86338d
Better detection of missing dmeventd fifo connection
2012-02-28 11:03:24 +00:00
Zdenek Kabelac
e5d399f667
Missed to properly merge patch for definition of MAX_MISSING_LEN
...
(fix previous commit)
2012-02-28 10:42:20 +00:00
Zdenek Kabelac
4d44893d60
Add log_sys_error for close
2012-02-28 10:14:06 +00:00
Zdenek Kabelac
696052b78e
Limit max size of clvmd message
...
This could be seen as some sort of simple validation - it's not easy to
recognize a valid message for now - but we definitely do not want to
allocate a lot of megabytes in clvmd memory locked daemon when broken
message gets in.
Size of 8000 is just selected for now - possibly there could be much
lower value put in.
2012-02-28 09:58:19 +00:00
Zdenek Kabelac
782a37e411
Do not send uninitilised bytes
...
Use struct initalizers to fill struct members and at the same time have
all unspecified members set to 0.
2012-02-28 09:53:55 +00:00
Zdenek Kabelac
5627fc8e7b
Do not hide deallocation of buffer
...
As API is passing structures by value, do not leave
the function which created buffer and keeps valid pointer
look like it would be some memory leak and move
free of buffer from inner function - makes more obvious,
how is the memory management handled.
2012-02-27 11:49:16 +00:00
Zdenek Kabelac
c57a9960b5
Add FIXME for misuse in case of dm_event_mask enum.
...
Using enum for bitmask is not proper solution here.
2012-02-27 11:46:25 +00:00
Zdenek Kabelac
8918bf2430
Add some log_sys_errors to close() call
2012-02-27 11:28:47 +00:00
Zdenek Kabelac
75f8f3ce8b
Nicer cleanup of excl_uuid hash
...
Since it on exit path, it's not a big difference,
but makes less noise in analyzer and valgrind.
2012-02-27 11:26:25 +00:00
Peter Rajnoha
ceec205594
Systemd is linux-specific - move the supporting code under the 'ifdef linux'.
...
Some 'defines' used in this specific code were already under an ifdef so this
patch just completes it.
2012-02-27 11:13:51 +00:00
Zdenek Kabelac
d2e33bed94
Add assert for oldname
...
Code cannot proceed if oldname would be NULL.
Since lvmetad currently doesn't use logging mechanism of lvm to report
internal errors - stay with current code style of lvmetad which uses
plain asserts for cases like this.
2012-02-27 10:19:00 +00:00
Zdenek Kabelac
25555737bd
A bit more safe version of sprintf
...
Use just buffer size limit (it's used for debug only)
2012-02-27 10:17:06 +00:00
Zdenek Kabelac
0c35eb915c
Move allocation after check for vgid
...
so there is no mem leak on this error path.
Also actually check if the hash exists.
2012-02-27 10:10:43 +00:00
Zdenek Kabelac
8df2c89cd4
Explicitely ignore result from sync_unlock()
...
Make it obvious to analyzer - we can't do anything better here anyway.
2012-02-27 10:02:17 +00:00
Zdenek Kabelac
7e25b8f932
Drop uname call, it's not used from gulm era.
2012-02-27 09:58:18 +00:00
Petr Rockai
98b4241b2f
Improve error handling & reporting in common daemon code.
2012-02-26 08:46:28 +00:00
Petr Rockai
dc4a15bb69
Fix server-side leaks in lvmetad.
2012-02-24 00:24:37 +00:00
Petr Rockai
2a11eea2e1
Clean up the lvmetad state more thoroughly upon shutdown.
2012-02-24 00:11:59 +00:00
Petr Rockai
dc5ba5c392
Fix an error path in daemon_open.
2012-02-24 00:02:54 +00:00
Petr Rockai
3f694b1265
Couple of improvements in the daemon (common + lvmetad) code:
...
- some client-side memory leak fixes
- announce and check protocols and protocol versions
2012-02-23 23:52:11 +00:00
Zdenek Kabelac
71f3bbd53f
Limit sscanf params with size
...
Make sure parsed string fits given char buffer.
2012-02-23 22:50:50 +00:00
Zdenek Kabelac
ba337a5f3e
Remaing code suffling
...
Move declaration to the front of function to follow coding rules.
2012-02-23 22:23:12 +00:00
Zdenek Kabelac
b6c5ea358e
Some reformating for lvmetad uddates
...
cleanup gcc warning,
use PRIu64
header cleanups
const pointer fixes.
2012-02-23 17:59:32 +00:00
Petr Rockai
52e8e908d6
Add a missed dependency that is required to pull in dameons/common in an early
...
part of the build.
2012-02-23 13:58:56 +00:00
Petr Rockai
ce700e70d2
We need daemons/common now even if the lvmetad server side is not built.
2012-02-23 13:41:11 +00:00
Petr Rockai
dae0822698
The lvmetad client-side integration. Only active when use_lvmetad = 1 is set in
...
lvm.conf *and* lvmetad is running.
2012-02-23 13:11:07 +00:00
Petr Rockai
182d1f60d2
Also use DEFAULT_RUN_DIR for the lvmetad socket on the client side.
2012-02-23 11:40:24 +00:00
Petr Rockai
daa0000a47
Tweak lvmetad a bit more:
...
- allow at most one PV on any given device
- allow PV lookup by device
- merge the pvmeta info into VG metadata when responding to vg_lookup
2012-02-21 09:19:08 +00:00
Petr Rockai
64a20df41c
Drop the now-redundant pvid_to_status hash.
2012-02-15 17:37:09 +00:00
Petr Rockai
ff455b1806
Update lvmetad: use device major/minor pair to track devices. Keep a pvmeta
...
config tree per PV which is mostly provided by the client, so it can be used to
keep track of things like label_sector, PV format, mda count / offsets and so
on.
2012-02-15 17:30:07 +00:00
Petr Rockai
12dba91d9d
(lvmetad) Remove unused variable.
2012-02-15 14:15:50 +00:00
Petr Rockai
23ce26fe22
In lvmetad, also nuke VGs when all their PVs are stolen by another VG (vgmerge
...
& vgsplit do this).
2012-02-15 14:06:48 +00:00
Zdenek Kabelac
80202ecd98
Detect failing fifo
...
If the fifo died because of dmeventd restart - do not wait for 20s
in select - it will not get better and return error immediately.
2012-02-15 13:56:47 +00:00
Petr Rockai
69a82801ef
lvmetad server-side update:
...
- rename the hashes to be explicit about the mapping
- add VG/PV listing calls to the protocol
- cache slightly more of the per-PV state
- filter cached metadata
- compare the metadata upon metadata_update
2012-02-15 11:43:06 +00:00
Petr Rockai
351aefc8a0
Do not forget to initialise the error value in daemon_reply.
2012-02-15 09:14:54 +00:00
Zdenek Kabelac
99e2a2e156
Add some FIXME around allocation code
...
Remove also unreachable break..
2012-02-13 14:25:14 +00:00
Zdenek Kabelac
5e4f234918
Make sure dereferenced words[0] and words[1] are defined
2012-02-13 14:17:04 +00:00
Zdenek Kabelac
74b5744b4b
Check for missing reply_uuid
2012-02-13 11:24:09 +00:00
Zdenek Kabelac
65d01ed981
Check for allocation failure
2012-02-13 11:18:45 +00:00
Zdenek Kabelac
8380b37529
Fix message check
...
Check pointer from strchr for NULL instead of crash later.
Badly formated message would have crash dmeventd otherwise.
2012-02-10 15:17:52 +00:00
Zdenek Kabelac
5726f4aaac
Remove unreachable code
2012-02-10 13:46:23 +00:00
Zdenek Kabelac
cdcf7aaf07
A bit more readable code
...
Just a minor readability conversion.
2012-02-08 13:03:40 +00:00
Zdenek Kabelac
a6292f2a6d
Remove unneeded assignments
...
Variables have (or will have) those values set.
2012-02-08 11:36:18 +00:00
Zdenek Kabelac
3a8b6a9948
Keep page_size as signed number
...
Since it's return value from sysconf and is checked for <0.
2012-02-08 11:34:46 +00:00
Zdenek Kabelac
b63b775143
Add boundary test for number of mirror devs and logs
...
As atoi may return negative value - test for both limits.
Test log_args for limits before calling alloca().
Code from dmeventd mirror plugin should probably share same code as
we have in mirrored.c.
2012-02-08 11:29:13 +00:00
Petr Rockai
cd466297f4
Remove a dubious log message ("another thread is handling an event") from LVM
...
dmeventd plugins. Fixes RHBZ 771419.
2012-02-01 20:11:58 +00:00
Alasdair Kergon
b6d7a48480
Automatically detect whether corosync clvmd needs to use confdb or cmap. (fabio)
2012-01-31 21:21:53 +00:00