summaryrefslogtreecommitdiff
path: root/lib/activate/fs.c
Commit message (Collapse)AuthorAgeFilesLines
* gcc: use more zero length arraysZdenek Kabelac2021-09-221-1/+1
| | | | Define last array struct member with zero size.
* debug: change sys_error to sys_debugZdenek Kabelac2021-03-101-5/+5
| | | | | These messages do not cause command error - so changing logging level to just 'sys_debug' (so visible only with -vvvv)
* lvm-file: remove duplication of dm_is_empty_dirZdenek Kabelac2021-03-101-1/+1
|
* gcc: change zero-sized array to fexlible arrayZhao Heming2020-09-011-1/+1
| | | | | | this patch makes gcc happy with compiling option: [-Wstringop-overflow=] Signed-off-by: Zhao Heming <heming.zhao@suse.com>
* activation: synchronize before removing devicesZdenek Kabelac2019-03-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | Udev is running udev-rule action upon 'resume'. However lvm2 in special case is doing replacement of 'soon-to-be-removed' device with 'error' target for resuming and then follows actual removal - the sequence is usually quick, so when udev start action - it can result in 'strange' error message in kernel log like: Process '/usr/sbin/dmsetup info -j 253 -m 17 -c --nameprefixes --noheadings --rows -o name,uuid,suspended' failed with exit code 1. To avoid this - we need to ensure there is synchronization wait for udev between 'resume' and 'remove' part of this process. However existing code put strict requirement to avoid synchronizing with udev inside critical section - but this originally came from requirement to not do anything special while there could be devices in suspend-state. Now we are able to see differnce between critical section with or without suspended devices. For udev synchronization only suspended devices are prohibited to be there - so slightly relax condition and allow calling and using 'fs_sync()' even inside critical section - but there must not be any suspended device.
* device_mapper: remove dbg_malloc.Joe Thornber2018-06-081-2/+2
| | | | | I wrote dbg_malloc before we had valgrind. These days there's just no need.
* build: Don't generate symlinks in include/ dirJoe Thornber2018-05-141-6/+6
| | | | | | | As we start refactoring the code to break dependencies (see doc/refactoring.txt), I want us to use full paths in the includes (eg, #include "base/data-struct/list.h"). This makes it more obvious when we're breaking abstraction boundaries, eg, including a file in metadata/ from base/
* activation: check for prioritized_sectionZdenek Kabelac2018-03-151-2/+2
| | | | | | | | Detect we are in prioritezed section instead of critical one, since these operation were supposed to NOT be happining during whole set of operation. This patch fixes verification of udev operations.
* tidy: prefer not using else after returnZdenek Kabelac2017-07-201-9/+11
| | | | | clang-tidy: avoid using 'else' after return - give more readable code, and also saves indention level.
* doc: change fsf addressZdenek Kabelac2016-01-211-1/+1
| | | | | Hmm rpmlint suggest fsf is using a different address these days, so lets keep it up-to-date
* cleanup: constify activation usage of lv pointerZdenek Kabelac2014-09-241-2/+2
| | | | | | Let's enforce cheking of write access to LV by compiler. Activation part does never need to write anything to LV so keep LV pointer const.
* clean-up: Typo 's/should had/should have/'Jonathan Brassow2013-03-061-1/+1
|
* logging: classify log_debug messagesAlasdair G Kergon2013-01-071-1/+1
| | | | Place most log_debug() messages into a class.
* give standard error message if lstat fails unexpectedlyAlasdair Kergon2012-02-121-5/+7
|
* Check result of lstatZdenek Kabelac2012-02-081-3/+4
| | | | | If lstat returns errno different from ENOENT, do not use the content of struct stat 'buf'.
* Replace dynamic buffer allocations for PATH_MAXZdenek Kabelac2011-11-181-6/+6
| | | | | | | | | | Use static buffer instead of stack allocated buffer. This reduces stack size usage of lvm tool and the change is very simple. Since the whole library is not thread safe - it should not add any new problems - and if there will be some conversion it's easy to convert this to use some preallocated buffer.
* Fix lv_info open_count testZdenek Kabelac2011-10-141-1/+9
| | | | | | | | | | When verify_udev_operations was disable, code for stacking fs operation for lvm links was completely disable - but this code was also used for collecting information, that a new node is being created. Add a new flag which is set when a creation of lv symlinks is requested which should restore old behaviour of lv_info function, that has called fs_sync() before quere for open count on device.
* Fix some unmatching sign comparation gcc warningsZdenek Kabelac2011-04-081-1/+1
| | | | Simple replacement for unsigned type - usually in for() loops.
* Critical sectionZdenek Kabelac2011-02-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* pre-releaseAlasdair Kergon2011-02-041-2/+3
|
* Fix operation node stacking for consecutive dm opsZdenek Kabelac2011-02-041-5/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the ability to stack many operations in one udev transaction - in same cases we are adding and removing same device at the same time (i.e. deactivate followed by activate). This leads to a problem of checking stacked operations: i.e. remove /dev/node1 followed by create /dev/node1 If the node creation is handled with udev - there is a problem as stacked operation gives warning about existing node1 and will try to remove it - while next operation needs to recreate it. Current code removes all previous stacked operation if the fs op is FS_DEL - patch adds similar behavior for FS_ADD - it will try to remove any 'delete' operation if udev is in use. For FS_RENAME operation it seems to be more complex. But as we are always stacking FS_READ_AHEAD after FS_ADD operation - should be safe to remove all previous operation on the node when udev is running. Code does same checking for stacking libdm and liblvm operations. As a very simple optimization counters were added for each stacked ops type to avoid unneeded list scans if some operation does not exists in the list. Enable skipping of fs_unlock() (udev sync) if only DEL operations are staked. as we do not use lv_info for already deleted nodes.
* Do not check for open_count when not needed.Zdenek Kabelac2011-02-031-0/+2
| | | | | | Disable open_count checking in lv_info it it's not used. Fix previous commit (comment out unsable code for now).
* Synchronize with udev for lv_infoZdenek Kabelac2011-02-031-0/+5
| | | | | | In case the open_count is requested via lv_info - check if there are any udev operations in-progress - and wait for them before checking for lv_info
* 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/+1
| | | | | | | | | | | | | | | | | | | | | 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.
* Add internal fs cookieZdenek Kabelac2011-01-101-1/+21
| | | | | Add functions for handling internal lvm cookie used for all dm_tree operations until fs_unlock is called.
* Add new dm_prepare_selinux_context fn to libdevmapper and use it throughout.Peter Rajnoha2010-12-131-3/+7
| | | | | | | | | | | Detect existence of new SELinux selabel interface during configure. Use new dm_prepare_selinux_context instead of dm_set_selinux_context. We should set the SELinux context before the actual file system object creation. The new dm_prepare_selinux_context function sets this using the selabel_lookup fn in conjuction with the setfscreatecon fn. If selinux/label.h interface (that should be a part of the selinux library) is not found during configure, we fallback to the original matchpathcon function instead.
* Add missing closedir() - fixes resource leakZdenek Kabelac2010-11-231-0/+3
|
* Add support to disable udev checking: LVM_UDEV_DISABLE_CHECKING=1 env. var.Peter Rajnoha2010-01-111-3/+3
| | | | | LVM_UDEV_DISABLE_CHECKING=1 applies for /dev/<vgname> content only. We still need to define DM_UDEV_DISABLE_CHECKING=1 for /dev/mapper content.
* Add activation/udev_rules config option in lvm.conf.Peter Rajnoha2010-01-071-22/+30
| | | | Add dm_tree_add_dev_with_udev_flags to provide wider support for udev flags.
* Merge Debian patch 05 debian: keep libdm-abi consistent.Fabio M. Di Nitto2009-10-121-2/+0
| | | | | | | This appears to be the only user visible feature that can change libdm ABI at build time. Thanks to Bastian Blank for the patch.
* Use the same default umask for /dev dirs (DM_DEV_DIR_UMASK).Peter Rajnoha2009-09-251-0/+5
|
* Forgotten '%s' in one of _mk_link warning messages.Peter Rajnoha2009-08-051-1/+1
|
* detect udev mk_link problemsAlasdair Kergon2009-08-041-2/+24
|
* Add warnings to check udev did what it was meant to.Alasdair Kergon2009-08-031-3/+8
|
* Fix vgrename using UUID in case there are VGs with the same name.Peter Rajnoha2008-12-191-4/+10
|
* Right, a simple build (without options) is working again.Alasdair Kergon2008-11-031-7/+7
|
* Some whitespace tidy-ups.Alasdair Kergon2008-01-301-4/+4
|
* Use stack return macros throughout.Alasdair Kergon2008-01-301-16/+8
|
* Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1.Alasdair Kergon2007-08-201-3/+3
|
* Remove symlinks if parent volume is deactivated.Milan Broz2007-05-151-0/+5
|
* Move lvm_snprintf into libdevmapper.Alasdair Kergon2006-08-211-8/+8
|
* Move set_selinux_context into libdevmapperAlasdair Kergon2005-10-251-5/+1
|
* Use hash, bitset, malloc, pool from libdevmapper.Alasdair Kergon2005-10-161-3/+2
|
* Use matchpathcon mode parameter.Alasdair Kergon2005-06-131-1/+1
|
* Avoid rmdir opendir error messsages when dir was already removed.Alasdair Kergon2005-03-211-1/+1
|
* Fix return code from rm_link for vgmknodes.Alasdair Kergon2004-09-221-6/+6
|
* Fix /dev/vgname mkdir perms.Alasdair Kergon2004-09-021-1/+1
|
* Don't abort operations if selinux is present but disabled.Alasdair Kergon2004-05-041-1/+1
|
* fix selinux error mesgAlasdair Kergon2004-04-141-1/+1
|