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

975 Commits

Author SHA1 Message Date
Zdenek Kabelac
20179523e2 cleanup: set _REENTRANT in header
Use same way of setting _REENTRANT as in other
files - set it in the first included header file
(clvmd-common.h)
2014-04-18 16:38:50 +02:00
Zdenek Kabelac
451a168bf8 cleanup: drop inclusion of devmap - merge 2014-04-18 16:38:50 +02:00
Zdenek Kabelac
589983a257 cleanup: include stdarg.h where needed.
Avoid dependency on implicit inclusion of stdarg.h with
libdevmapper.h.
2014-04-18 16:38:50 +02:00
Zdenek Kabelac
e552824dc0 makefiles: move subdir into same section
Just shift few lines
2014-04-18 16:38:49 +02:00
Zdenek Kabelac
07274f3dd4 makefiles: drop linking of deamon libs to plugins
Daemon lib is linked into lvm2cmd library.
2014-04-18 16:38:49 +02:00
Zdenek Kabelac
db0045dfc9 devmapper-event: always initialize timeout
Before calling select, always set all struct members of timeout.
2014-04-18 16:38:48 +02:00
Zdenek Kabelac
08e7de986c dmeventd: check for list size within lock
Move check for _thread_registry list size behind mutex.
Use alloca() instead of buffer[count] (they are the same anyway)
2014-04-18 16:38:48 +02:00
Zdenek Kabelac
0b6d6bfb77 thin: dmeventd plugins support more minors
Kernel supports upto 1M (20bit) minors.
TODO: convert to hash to reduce memory requirements
2014-04-18 16:38:47 +02:00
Zdenek Kabelac
d896abc705 cleanup: clvmd drop unused enum state 2014-04-14 13:02:27 +02:00
Zdenek Kabelac
e2f194952a cleanup: clvmd reindent local_pipe_callback
Move !node_up check in front and reindent
rest of the function to the left.
2014-04-14 13:02:27 +02:00
Zdenek Kabelac
eccc50d861 clvmd: use thread-safe ctime_r when debugging
Use thread friendly version of ctime
TODO:should be probably replaced with strftime()
2014-04-14 13:02:25 +02:00
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
5553a099d1 cleanup: use DM_ARRAY_SIZE
More use of libdevmapper macro
2014-04-08 11:00:15 +02:00
Alasdair G Kergon
c16c1a9f70 clvmd: Update new remove_info INTERNAL_ERRORS. 2014-04-04 01:37:43 +01:00
Zdenek Kabelac
3fda296da6 cleanup: lvmetad use dm_hash_iterator
Simplify code with the use of dm_hash_iterator
2014-03-26 14:11:37 +01:00
Zdenek Kabelac
406ec4162f cleanup: use dm_free without extra test
It's ok to free(NULL).
2014-03-25 11:22:59 +01:00
Zdenek Kabelac
db71739f42 cleanup: initilization of vars 2014-03-25 11:22:58 +01:00
Zdenek Kabelac
5c9165705a cleanup: indent 2014-03-25 11:22:58 +01:00
Zdenek Kabelac
c7b2c08a6b cleanup: use NULL for pointer reset 2014-03-25 11:22:58 +01:00
Zdenek Kabelac
b714c7ebc6 clvmd: validate open device state
If clvmd does not hold any lock, it should also not keep any opened
device.

The reason for this patch is, that refresh_toolcontext calls
dev_cache_exit() which destroys whole device cache (even those with
opened file) - previous patch added recovery path to avoid memory
corruption, but opened files are still bugs that need to be fixed.

So this patch certainly kills many internal mirror & raid tests,
since they leak opened file descriptors (when tests are executed
with 'abort_on_error').
2014-03-25 11:22:57 +01:00
Zdenek Kabelac
b522312678 clvmd: hardening leak on exit
Operate with lvm_thread_exit while holding lvm_thread_mutex.
Don't leave unfinished work in the lvm thread queue
and always finish all queued tasks before exit,
so no cmd struct is left in the list.

(in-release fix)
2014-03-25 11:22:57 +01:00
Zdenek Kabelac
01efb20bdb cleanup: clvmd add more info debug message 2014-03-21 22:29:27 +01:00
Zdenek Kabelac
0d449fe183 cleanup: clvmd uses struct initializers
Code easier to read
2014-03-21 22:29:27 +01:00
Zdenek Kabelac
9196274c1e cleanup: clvmd zombie removal loop
Simplier code to start scan from the next node,
and remove matching pipe client.
2014-03-21 22:29:27 +01:00
Zdenek Kabelac
5740c00f3b cleanup: clvmd reindent read_from_local_sock
Shift indent of else branch to right since
error path returns in the front.
(Simplier to read)
2014-03-21 22:29:26 +01:00
Zdenek Kabelac
dd17286c90 cleanup: clvmd indent change
Plain indent changes.
2014-03-21 22:29:26 +01:00
Zdenek Kabelac
0b79979bb9 cleanup: clvmd dump_messages 2014-03-21 22:29:26 +01:00
Zdenek Kabelac
f8cd435cd8 cleanup: clvmd update log_error
Drop \n from log_error() and add '.'
2014-03-21 22:29:26 +01:00
Zdenek Kabelac
4c97ea2ce5 cleanup: clvmd drop goto 2014-03-21 22:29:25 +01:00
Zdenek Kabelac
7d49c33ffc cleanup: clvmd skip reset of null pointer 2014-03-21 22:29:25 +01:00
Zdenek Kabelac
bf19c6be2c cleanup: clvmd move destroy_lvhash into main
Keep destruction code path consistent and simple and
destroy lvhash in the place it's been created.
Also issue debug message from a single place.
2014-03-21 22:29:25 +01:00
Zdenek Kabelac
46ae028cd3 singlenode: reset pointer when hash is destroyed
Just keep pointer consistent.
2014-03-21 22:29:25 +01:00
Zdenek Kabelac
7041c8bf51 clvmd: drop dead code
Since pipe_client has been already reset to NULL,
remove this dead code.
2014-03-21 22:29:24 +01:00
Zdenek Kabelac
73978f8d7d clvmd: drop unused local_sock parameter 2014-03-21 22:29:24 +01:00
Zdenek Kabelac
37396e2fe5 clvmd: update add_reply_to_list
Take mutex lock after the allocation just before
the structure is merged into reply list.
2014-03-21 22:29:24 +01:00
Zdenek Kabelac
2847994624 clvmd: use dm_malloc
Use libdm malloc wrapper functions.
2014-03-21 22:29:24 +01:00
Zdenek Kabelac
c45cd6eb8d clvmd: move call of cluster_closedown
We have to close cluster in some predicatable way,
otherwise we may access released memory from different
threads.

So move closedown till the point we know all thread
are closed. New messages from cluster are discarded.
2014-03-21 22:29:23 +01:00
Zdenek Kabelac
fc39ad677b clvmd: move destroy_lvm into lvm thread
Since lvm was initialized in lvm thread call destroy there as well.
2014-03-21 22:29:23 +01:00
Zdenek Kabelac
8431d47b3b clvmd: add special lvm thread exit
When multiple threads act on the same 'quit' variable
the order of exit becomes unpredictable.

So let the main_loop() finish first and then clean up
all queued lvm jobs.

Do not add any new work, when lvm_thread_exit is set.
2014-03-21 22:29:23 +01:00
Zdenek Kabelac
05a532e171 clvmd: always set cleanup_needed
When thread is created, set the cleanup_needed flag
immediately so it could be used properly any time later
when cleanup_zombie() is needed.
2014-03-21 22:29:23 +01:00
Zdenek Kabelac
5bea2b5c82 clvmd: fix clean memory on exit
Properly clean 'client' structure only for LOCAL_SOCK type.
(Fixes bug from commit 460c19df62)
(in release fix)

Also cleanup-up associated pthreads by using cleanup_zombie() function.
Since this function may change the list, restart scanning always from
the list header.

Note: couple following patches are necessary to make this working properly.
2014-03-21 22:29:22 +01:00
Jonathan Brassow
bdd7baeab3 cmirrord: Clean-up stray warning message (attempt #2)
There are two types of CPG communications in a corosync cluster:
messages and state transitions.  Cmirrord processes the state
transitions first.

When a cluster mirror issues a POSTSUSPEND, it signals the end of
cluster communication with the rest of the nodes in the cluster.
The POSTSUSPEND marks the last communication of the 'message'
type that will go around the cluster.  The node then calls
cpg_leave which causes a final 'state transition' communication to
all of the nodes.  Once the out-going node receives its own state
transition notice from the cluster, it finalizes the leave.  At this
point, the state of the log is 'INVALID'; but it is possible that
there remains some cluster trafic that was queued up behind the
state transition that still wants to be processed.  It is harmless
to attempt to dispatch any remaining messages - they won't be
delivered because the node is no longer in the cluster.  However,
there was a warning message that was being printed in this case
that is now removed by this patch.  The failure of the dispatch
created a false positive condition that triggered the message.
2014-03-19 14:43:00 -05:00
Peter Rajnoha
b16235de96 cleanup: use 'define' for systemd runtime unit file directory 2014-03-14 15:57:44 +01:00
Petr Rockai
551b6b7998 lvmetad: Fix pvmeta_old_{pvid,dev} logic when they are the same. 2014-03-14 10:09:16 +01:00
Marian Csontos
67c539f346 lvmetad: Fix previous commit
"%d" in buffer_append_vf is 64 bit wide. Using just `int` for the
variable will fetch more from va_list than intended and shifting
remaining arguments resulting in errors like:

    Internal error: Bad format string at '#orphan'
2014-03-14 08:09:37 +01:00