summaryrefslogtreecommitdiffstats
path: root/daemons/clvmd/lvm-functions.c
Commit message (Collapse)AuthorAgeFilesLines
* Add traceback for failpathZdenek Kabelac2012-03-011-1/+1
|
* Debug log for hold_lock failureZdenek Kabelac2012-03-011-1/+2
|
* Check for allocation errorZdenek Kabelac2012-03-011-4/+13
| | | | return ENOMEM when malloc fails.
* Limit sscanf params with sizeZdenek Kabelac2012-02-231-2/+2
| | | | Make sure parsed string fits given char buffer.
* Preserve exclusive activation of cluster mirror when converting.Jonathan Earl Brassow2012-01-201-1/+5
| | | | | | | | | This patch to the suspend code - like the similar change for resume - queries the lock mode of a cluster volume and records whether it is active exclusively. This is necessary for suspend due to the possibility of preloading targets. Failure to check to exclusivity causes the cluster target of an exclusively activated mirror to be used when converting - rather than the single machine target.
* Only use built-in stack size in clvmd - ignore lvm.conf.Alasdair Kergon2011-12-081-1/+1
|
* Test for LCK_CLUSTER_VG directly in args[0].Alasdair Kergon2011-12-081-19/+18
| | | | Drop unused LCK_LOCAL from debug msg.
* Fix clvmd to respect DMEVENTD_MONITOR_IGNORE. Fixes a bug where dmeventdPetr Rockai2011-11-301-6/+11
| | | | actions caused clvmd to turn off monitoring of the volume causing the action.
* Introduce revert_lv for better pvmove cleanup.Alasdair Kergon2011-09-271-2/+3
| | | | (One further fix needed to remove the stray pvmove LVs left behind.)
* CLVMD support for LVM_CLVMD_BINARY and LVM_BINARYZdenek Kabelac2011-09-241-5/+14
| | | | | | | | Read 2 environmental vars to learn about overide position for CLVMD and LVM binaries. We support LVM_BINARY in other script - and this way we could easily test restart in our test-suite.
* CLVMD bugfix support for args -S -EZdenek Kabelac2011-09-241-33/+9
| | | | | | | | | | | | | | | | | | Bugfix: Add (most probably unfinished) support for -E arg with list of exclusive locks. (During clvmd restart all exclusive locks would have been lost and in fact, if there would have been an exclusive lock, usage text would be printed and clvmd exits.) Instead of parsing list options multiple times every time some lock UUID is checked - put them straight into the hash table - make the code easier to understand as well. Remove was_ex_lock() function (replaced with dm_hash_lookup()). Swap return value for get_initial_state() (1 means success). Update man pages and usage info for -E option.
* Replace free_vg with release_vgZdenek Kabelac2011-08-101-1/+1
| | | | | | | | Move the free_vg() to vg.c and replace free_vg with release_vg and make the _free_vg internal. Patch is needed for sharing VG in vginfo cache so the release_vg function name is a better fit here.
* Initialise clvmd locks before lvm context to avoid open descriptor leaks.Milan Broz2011-08-101-5/+7
| | | | (At least /dev/mapper/control is open after lvm context init.)
* Remove obsoleted GULM clvmd cluster locking support.Milan Broz2011-08-091-45/+1
|
* Major pvmove fix to issue ioctls in the correct order when multiple LVsAlasdair Kergon2011-06-111-2/+2
| | | | | | | | | | | are affected by the move. (Currently it's possible for I/O to become trapped between suspended devices amongst other problems. The current fix was selected so as to minimise the testing surface. I hope eventually to replace it with a cleaner one that extends the deptree code. Some lvconvert scenarios still suffer from related problems.
* Fix a few compile warnings.Peter Rajnoha2011-06-031-1/+1
| | | | | clvmd-command.c:84:2: warning: implicit declaration of function ‘init_test’ lvm-functions.c:141:3: warning: too many arguments for format
* Propagate test mode to clvmd to skip activation and changes to held locks.Alasdair Kergon2011-06-011-0/+7
|
* When glibc needs buffers for line buffering of input and output buffers, itPetr Rockai2011-05-071-1/+1
| | | | | | | | | | | | 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>
* Fix -Wold-style-definition gcc warningsZdenek Kabelac2011-03-291-4/+4
|
* Fix syslog initialisation in clvmd to respect lvm.conf setting.Milan Broz2011-03-021-3/+4
|
* Critical sectionZdenek Kabelac2011-02-181-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* Fix for bug 677739: removing final exclusive cmirror snapshot,Jonathan Earl Brassow2011-02-181-2/+4
| | | | | | | | | | | | | 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.
* Allow snapshots in a cluster as long as they are exclusivelyJonathan Earl Brassow2011-02-041-3/+11
| | | | | | | | | | | | | | | 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.
* Remove extra sync calls.Zdenek Kabelac2011-02-041-4/+0
| | | | | | | 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.
* Increase hash table size to 1024 lv names and 64 pv uuidsZdenek Kabelac2011-02-031-1/+1
|
* Remove fs_unlock from lv_resume pathZdenek Kabelac2011-02-031-0/+1
| | | | Keep it within clvmd until message for SYNC starts to work.
* Better fix for no-locking udev sync and clvmdZdenek Kabelac2011-02-021-0/+3
| | | | | | | 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.
* Replace fs_unlock by sync_local_dev_names to notify local clvmd. (2.02.80)Alasdair Kergon2011-01-121-0/+1
| | | | Introduce sync_local_dev_names and CLVMD_CMD_SYNC_NAMES to issue fs_unlock.
* Speedup consequent activation callsZdenek Kabelac2011-01-101-0/+7
| | | | | | | | | | | | | | | | | | | | | Stop calling fs_unlock() from lv_de/activate(). Start using internal lvm fs cookie for dm_tree. Stop directly calling dm_udev_wait() and dm_tree_set/get_cookie() from activate code - it's now called through fs_unlock() function. Add lvm_do_fs_unlock() Call fs_unlock() when unlocking vg where implicit unlock solves the problem also for cluster - thus no extra command for clustering environment is required - only lvm_do_fs_unlock() function is added to call lvm's fs_unlock() while holding lvm_lock mutex in clvmd. Add fs_unlock() also to set_lv() so the command waits until devices are ready for regular open (i.e. wiping its begining). Move fs_unlock() prototype to activation.h to keep fs.h private in lib/activate dir and not expose other functions from this header.
* Rename vg_release to free_vg.Alasdair Kergon2010-12-081-1/+1
|
* pre-releaseAlasdair Kergon2010-12-061-1/+1
|
* Fix debug logging of derived flag LCK_CACHE in clvmd.Alasdair Kergon2010-12-061-15/+20
|
* Remove printing of LCK_CACHEZdenek Kabelac2010-11-291-3/+6
| | | | | | | | LCK_CACHE is defined as 0x100 so it cannot be passed through unsigned char parameter - remove it from the sprintf code. If the LCK_CLUSTER should be printed here - lot of code need to be reworked - so adding FIXME comment.
* Suppress 'No PV label' message when removing several PVs without mdas.Alasdair Kergon2010-11-231-1/+1
|
* Use 'SINGLENODE' instead of 'dead' in clvmd singlenode messages.Alasdair Kergon2010-08-171-15/+18
| | | | | | Ignore snapshots when performing mirror recovery beneath an origin. Pass LCK_ORIGIN_ONLY flag around cluster. Add suspend_lv_origin and resume_lv_origin using LCK_ORIGIN_ONLY.
* Allow internal suspend and resume of origin without its snapshots.Alasdair Kergon2010-08-171-17/+19
|
* Use void parameter for function definition.Zdenek Kabelac2010-08-031-2/+2
|
* Remove superfluous suspended device counter from clvmd.Milan Broz2010-07-011-6/+1
| | | | | | Moreover, in current mirror handling, when it calls activate on removed but suspended detached log this counter drops below zero and confuses debug log.
* Maintain memlock balance in clvmd.Petr Rockai2010-06-301-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | When a mirror is being downconverted in a cluster, a series of suspends and resumes is executed. With the change to using UUIDs in dev_manager instead of names, the behaviour has changed with regards to including an _mlog in the deptree of a logical volume. In the old (pre-UUID-enabled) code, the _mlog would appear in a deptree of any volume purely based on a name match: a linear volume foo would include foo_mlog in its dependencies if that happened to exist. This behaviour was fixed and the mlog is now only included for mirrors. By a coincidence, this mlog bug had been hiding a different bug in clvmd. When a mirror is being dismantled (and converted to a linear volume), it is first suspended as a whole, then later resumed in parts. Nevertheless, the overall memlock balance is maintained in this operation. The problem kicks in, because even though the mirror log was suspended as part of the mirror, when the dismantled mirror is resumed again, it is no longer a mirror and therefore the mirror log stays suspended. This would not be a problem in itself, since _delete_lv (from metadata/mirror.c) is called on it subsequently, which does an activate/deactivate cycle and removes the LV. The activate/deactivate cycle correctly prompts clvmd to resume the device: however, in doing this, it will issue an unpaired resume operation (the suspend that caused the mirror log to be suspended is paired with resuming the dismantled mirror later). We have concluded that the path in clvmd should never affect memlock_count, since there should never be an unmatched explicit suspend preceding this resume.
* Various cleanups following recent commits.Alasdair Kergon2010-06-211-23/+3
|
* Clean up cluster lock mode and flags definition.Milan Broz2010-06-171-22/+20
| | | | | | | | | | | | | | | | | | Code is mixing up internal DLM and LVM definitions of lock modes and flags. OpenAIS and singlenode locking do not depend on DLM but code currently cannot be compiled without libdlm.h! LCK_* flags is LVM abstraction, used through all the code. Only low-level backend (clvmd-cman etc) should use DLM definitions, also this code should do all needed conversions. Because there are two DLM flags used in generic code (NOQUEUE, CONVERT) we define it similar way like lock modes. (So all needed binary-compatible flags are on one place in locking.h) (Further code cleaning still needed, though:-)
* Use "" instead of <> for configure.h and libdevmapper.hZdenek Kabelac2010-06-151-2/+2
| | | | Move configure.h as the first header for clvmd source files.
* Fix restart of clvmd using -S switchMilan Broz2010-06-041-1/+3
| | | | | | | | - allocate environment dynamically (still missing some limit?) - try to recover, if destroy failed (do not destroy lvm here) and free memory - check strdup() return codes - report failure to log - do not print NULL in exclusive lock loop
* Use absolute paths in commandsZdenek Kabelac2010-06-031-2/+2
| | | | | clvmd restart does not work at all if clvmd binary is not in current dir.
* Add -S command to clvmd, so it can restart itself and stillChristine Caulfield2010-04-201-6/+60
| | | | preserve exlusive LV locks.
* Use C locales and use_mlockall for clvmd.Zdenek Kabelac2010-04-131-1/+4
| | | | | Use same steps for clvmd as for dmeventd - using C locales to avoid reading large mmaps and use mlockall() for threaded version.
* Fix clvmd cluster propagation of dmeventd monitoring mode.Mike Snitzer2010-03-261-4/+3
| | | | | | | | | | | | clvmd's do_lock_lv() already properly controls dmeventd monitoring based on LCK_DMEVENTD_MONITOR_MODE in lock_flags -- though one small fix was needed for this to work: _lock_for_cluster() must treat dmeventd_monitor_mode()'s return as a tri-state value. Also cleanup do_lock_lv() to: - explicitly init_dmeventd_monitor() based on LCK_DMEVENTD_MONITOR_MODE - no longer reset init_dmeventd_monitor() to default at the end of do_lock_lv() -- it is unnecessary
* Revert having clvmd consult the lvm.conf "activation/monitoring".Mike Snitzer2010-03-241-6/+2
| | | | | Correctly implementing the intent of this change requires more analysis.
* Improve activation monitoring option processingMike Snitzer2010-03-231-2/+6
| | | | | | | | | | | | | . Add "monitoring" option to "activation" section of lvm.conf . Have clvmd consult the lvm.conf "activation/monitoring" too. . Introduce toollib.c:get_activation_monitoring_mode(). . Error out when both --monitor and --ignoremonitoring are provided. . Add --monitor and --ignoremonitoring support to lvcreate. Update lvcreate man page accordingly. . Clarify that '--monitor' controls the start and stop of monitoring in the {vg,lv}change man pages. Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* Unlock shared lock if activation calls failed.Milan Broz2010-01-261-3/+8
| | | | Clvmd should unlock new lock if activation in device-mapper fails.