1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-28 11:55:55 +03:00
Commit Graph

549 Commits

Author SHA1 Message Date
Peter Rajnoha
554923e0ae Fix a few compile warnings.
clvmd-command.c:84:2: warning: implicit declaration of function ‘init_test’
lvm-functions.c:141:3: warning: too many arguments for format
2011-06-03 09:05:30 +00:00
Milan Broz
7c1a2417f5 Use /var/run/lvm for lvmetad socket. 2011-06-02 08:58:05 +00:00
Alasdair Kergon
0ebd0960b4 Propagate test mode to clvmd to skip activation and changes to held locks. 2011-06-01 21:16:55 +00:00
Petr Rockai
ba7d33be9c Mention code layout in lvmetad DESIGN. 2011-05-23 14:46:48 +00:00
Petr Rockai
dc85d3fb57 More work on the common daemon framework. Make things compile, too. 2011-05-15 11:02:29 +00:00
Petr Rockai
73ffd6e748 More scavenging of common daemon code, this time the clvmd local socket setup
sequence.
2011-05-13 09:34:12 +00:00
Petr Rockai
d7448a721b Start filling in some of the common daemon (server-side) functionality, taking
dmeventd code as a starting point.
2011-05-13 08:45:46 +00:00
Petr Rockai
04507b0ace First go at the lvmetad client-side interface. 2011-05-13 08:17:26 +00:00
Petr Rockai
56517bad21 First stab at the prototypes of the daemon-common functionality (to be
eventually shared by dmeventd, lvmetad and clvmd).
2011-05-13 08:07:28 +00:00
Petr Rockai
f03e3ac15b Initial design document for LVMetaD, building on the draft from June of last
year, incorporating the outcomes of today's and yesterday's discussions.
2011-05-12 17:49:46 +00:00
Petr Rockai
eee66d2a80 When glibc needs buffers for line buffering of input and output buffers, it
allocates these buffers in such way it adds memory page for each such buffer
and size of unlock memory check will mismatch by 1 or 2 pages.

This happens when we print or read lines without '\n' so these buffers are
used. To avoid this extra allocation, use setvbuf to set these bufffers ahead.

Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
Reviewed-by: Milan Broz <mbroz@redhat.com>
Reviewed-by: Petr Rockai <prockai@redhat.com>
2011-05-07 13:50:11 +00:00
Zdenek Kabelac
a1eba521e3 Fix some unmatching sign comparation gcc warnings
Simple replacement for unsigned type - usually in for() loops.
2011-04-08 14:40:18 +00:00
Zdenek Kabelac
6b7fe2852a Use dm_snprintf
and fix differently signed comparation.
2011-04-08 14:18:40 +00:00
Petr Rockai
968cdc0066 Add rudimentary versioning to the dmevend protocol, allowing us to detect the
(protocol) version of the running dmeventd on the client side.

Right now this is only used in dmeventd -R.
2011-04-04 16:11:09 +00:00
Zdenek Kabelac
81e269fe15 Keep noreturn attribute for lvm_thread_fn
Even thought my gcc seems to not need it, as it's deduced from pthread_exit(),
keep it here for older compiler to avoid getting warnings.
2011-03-30 12:48:16 +00:00
Zdenek Kabelac
e3cce4b66a Better shutdown for clvmd
'a small step' towards cleaner shutdown sequence.
Normally clvmd doens't care about unreleased memory on exit -
but for valgrind testing it's better to have them cleaned all.

So - few things are left on exit path - this patch starts to remove
just some of them.

1. lvm_thread_fs is made as a thread which could be joined on exit()
2. memory allocated to local_clien_head list is released.
   (this part is somewhat more complex if the proper reaction is
   needed - and as it requires some heavier code moving - it will
   be resolved later.
2011-03-30 12:36:19 +00:00
Zdenek Kabelac
6460d5a405 Add attribute printf
gcc suggested to add these attributes to instrumentat
printf arguments. Adding it for internal functions as well.
2011-03-29 21:53:46 +00:00
Zdenek Kabelac
7f0d89f8b4 Fix sending uninitilised bytes in cluster messages
Fix 2 more functions sending cluster messages to avoid passing uninitilised bytes
and compensate 1 extra byte attached to the message from the clvm_header.args[1]
member variable.
2011-03-29 21:05:39 +00:00
Zdenek Kabelac
aaf92617b0 Fix -Wold-style-definition gcc warnings 2011-03-29 20:30:05 +00:00
Zdenek Kabelac
dc4150e018 Release allocated memory on closedown
Release allocated buffers before exit() in debug singlenode - so it's not
poping out in valgrind as memory leak.
2011-03-24 10:45:00 +00:00
Peter Rajnoha
2011571bf5 Remove compile warning for lock_id.
%llx --> PRIx64
2011-03-13 18:08:26 +00:00
Zdenek Kabelac
ee12300a56 Do not send random bytes in message
Fixing few issues:

struct clvm_header  contains  'char args[1]' - so adding '+ 1' here
for message length calculation is 1 byte off.
Message with last byte uninitialized is then passed to write function.
Update also related arglen.

Initialise xid and clintid to 0.

Memory allocation is checked for NULL
2011-03-08 22:48:50 +00:00
Milan Broz
5a47eb762a Fix clvmd return code for bad options.
We should return exit code 2 for unknown option.

Patch also adds standard --help option instead.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=666991
2011-03-08 13:27:39 +00:00
Peter Rajnoha
eb36643cb7 Lower severity of selabel_lookup and matchpathcon failure to log_debug. 2011-03-03 13:05:40 +00:00
Milan Broz
faa6ac9439 Fix syslog initialisation in clvmd to respect lvm.conf setting. 2011-03-02 23:38:22 +00:00
Petr Rockai
0263cd7bbc Do not run past the end of an array in dmeventd's _handle_request when faced
with an unknown command ID.
2011-03-02 14:20:48 +00:00
Petr Rockai
61394ca4aa As requested in BZ 454618:
- dmeventd -R will continue to start up even if no dmeventd is currently
  running + a test for this behaviour
- add -R to dmeventd manpage
2011-03-02 12:49:13 +00:00
Milan Broz
cbedb99e4c Fix some compile warnings on RHEL5
- returned char not needed to be explicitly const
- warn if pipe() fails in clvmd (more fixes here needed for error paths...)
- assign (and ignore) read() output in drain buffer
2011-03-01 20:17:56 +00:00
Zdenek Kabelac
ebcbe00d17 Remove dead code
Remove code which is no longer used.
Code which has been using msg_malloced was removed in 2007.
2011-02-28 19:50:15 +00:00
Zdenek Kabelac
eba7348340 Test result of dm_task_set_uuid 2011-02-28 19:47:22 +00:00
Peter Rajnoha
93cca5c1c8 Remove a few size_t type warnings. 2011-02-22 10:01:11 +00:00
Zdenek Kabelac
faf2288895 Fix gcc warnings for unused variables
Put dead assigment code into comment.
2011-02-18 16:17:56 +00:00
Zdenek Kabelac
aec2115410 Const fixing
Fixing some const warnings - with API change in:

int vg_extend(struct volume_group *vg, int pv_count, const char *const *pv_names,

Change is needed - as lvm2api expects const behaviour here.
So vg_extend() is doing local strdup for unescaping.

skip_dev_dir return const char* from const char* vg_name.

Rest of the patch is cleanup of related warnings.

Also using dm_report_filed_string() API change to simplify
casting in _string_disp and _lvname_disp.
2011-02-18 14:47:28 +00:00
Zdenek Kabelac
4ebc6404ee Void* arithmetic replaced with char* 2011-02-18 14:34:41 +00:00
Zdenek Kabelac
b1bcff7424 Critical section
New strategy for memory locking to decrease the number of call to
to un/lock memory when processing critical lvm functions.

Introducing functions for critical section.

Inside the critical section - memory is always locked.
When leaving the critical section, the memory stays locked
until memlock_unlock() is called - this happens with
sync_local_dev_names() and sync_dev_names() function call.

memlock_reset() is needed to reset locking numbers after fork
(polldaemon).

The patch itself is mostly rename:

memlock_inc  -> critical_section_inc
memlock_dec  -> critical_section_dec
memlock      -> critical_section

Daemons (clmvd, dmevent) are using memlock_daemon_inc&dec
(mlockall()) thus they will never release or relock memory they've
already locked memory.

Macros sync_local_dev_names() and sync_dev_names() are functions.
It's better for debugging - and also we do not need to add memlock.h
to locking.h header (for memlock_unlock() prototyp).
2011-02-18 14:16:11 +00:00
Jonathan Earl Brassow
c054e7cc56 Fix for bug 677739: removing final exclusive cmirror snapshot,
results in clvmd deadlock

When a logical volume is activated exclusively in a cluster, the
local (non-cluster-aware) target is used.  However, when creating
a snapshot on the exclusive LV, the resulting suspend/resume fails
to load the appropriate device-mapper table - instead loading the
cluster-aware target.

This patch adds an 'exclusive' parameter to the pertinent resume
functions to allow for the right target type to be loaded.
2011-02-18 00:36:04 +00:00
Petr Rockai
228fbb6f84 Avoid flooding syslog with redundant messages when a snapshot is invalidated
(reported by Corey).
2011-02-14 14:26:36 +00:00
Jonathan Earl Brassow
27ff8813da Allow snapshots in a cluster as long as they are exclusively
activated.

In order to achieve this, we need to be able to query whether
the origin is active exclusively (a condition of being able to
add an exclusive snapshot).

Once we are able to query the exclusive activation of an LV, we
can safely create/activate the snapshot.

A change to 'hold_lock' was also made so that a request to aquire
a WRITE lock did not replace an EX lock, which is already a form
of write lock.
2011-02-04 20:30:17 +00:00
Zdenek Kabelac
09d288535b Remove extra sync calls.
Remove temporaly added fs_unlock() calls to fix clmvd usablity.
Now when the message passing is properly working - they are no longer needed.
Simplify no_locking  check for VG unlock - as message is always send
for all targets - clustered & non-clustered.
2011-02-04 19:21:47 +00:00
Zdenek Kabelac
fa6a525c2d Use cluster-wide message to request device name sync
Thanks to CLVMD_CMD_SYNC_NAMES propagation fix the message passing started
to work. So starts to send a message before the VG is unlocked.
Removing also implicit sync in VG unlock from clmvd as now the message
is delievered and processed in do_command().
Also add support for this new message into external locking
and mask this event from further processing.
2011-02-04 19:18:16 +00:00
Zdenek Kabelac
135af49da5 Increase hash table size to 1024 lv names and 64 pv uuids 2011-02-03 16:03:13 +00:00
Zdenek Kabelac
3a00204a23 Remove fs_unlock from lv_resume path
Keep it within clvmd until message for SYNC starts to work.
2011-02-03 01:58:20 +00:00
Zdenek Kabelac
fccfa9e929 Better fix for no-locking udev sync and clvmd
This is better way how to fix clustered synchronization with udev.
As the code for message passing needs fixed - put currently
fs_unlock() after every active/deactive command in clvmd to
ensure nodes are properly created in time.
2011-02-02 20:04:39 +00:00
Zdenek Kabelac
9dc3afb1fa Revert wrong fix for nolock locking missing fs_unlock
Patch was wrond and introduced recursive lock_vol
Reverting it.
2011-02-02 13:34:00 +00:00
Zdenek Kabelac
116cbc267c Fix udev synchronization for no-locking mode
Instead of implicitly syncing udev operation in clustered and
file locking code -  call synchronization directly in lock_vol() when
the operation unlocks VG

The problem is missing implicit fs_unlock() in the no_locking code.
This is used with --sysinit on read-only filesystem locking dir.
In this case vgchange -ay could exit before all udev nodes are properly
synchronised and may cause problems with accessing such node right after
vgchange --sysinint command is finished.

Add test case for vgchange --sysinit.
2011-01-31 19:52:40 +00:00
Milan Broz
679830cf58 In some versions (RHEL6) dlm_create_lockspace() always
return lockspace reference (even if lockspace already exists)
and thus increases DLM lockspace count. It means that after
clvmd restart the lockspace is still in use.

(The only way to clean environment to enable clean cluster
shutdown is call "dlm_tool leave clvmd" several times.)

Because only one clvmd can run in time, we can use simpler logic,
try to open lockspace with dlm_open_lockspace() and only if it fails
try to create new one. This way the lockspace reference doesn not
increase.

Very easily reproducible with  "clvmd -S" command.

Patch also fixes return code when clvmd_restart fails and fixes
double free if debug option was specified during restart.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=612862
2011-01-19 23:09:31 +00:00
Milan Broz
4c29343443 Remove DEBUGLOG from dmeventd. 2011-01-17 23:14:05 +00:00
Milan Broz
92e6277c28 Add -f (don't fork) option to clvmd and fix clvmd -d<num> description. 2011-01-17 23:13:14 +00:00
Alasdair Kergon
4299c31d26 remove unused definitions 2011-01-17 19:02:44 +00:00
Alasdair Kergon
a8de276520 Replace fs_unlock by sync_local_dev_names to notify local clvmd. (2.02.80)
Introduce sync_local_dev_names and CLVMD_CMD_SYNC_NAMES to issue fs_unlock.
2011-01-12 20:42:50 +00:00