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

205 Commits

Author SHA1 Message Date
Alasdair Kergon
dbd60cf576 Pass exclusive LV locks to all nodes in the cluster.
This was the intended behaviour, as described in the lvchange man page, so you
have complete control through volume_list in lvm.conf, but the code seems to
have been treating -ae as local-only for a very long time.
2011-10-21 15:49:45 +00:00
Alasdair Kergon
10d0d9c7c4 Introduce revert_lv for better pvmove cleanup.
(One further fix needed to remove the stray pvmove LVs left behind.)
2011-09-27 22:43:40 +00:00
Alasdair Kergon
1c26860d82 Abort if _finish_pvmove suspend_lvs fails instead of cleaning up incompletely.
Change suspend_lvs to call vg_revert internally.
Change vg_revert to void and remove superfluous calls after failed vg_commit.
2011-09-27 17:09:42 +00:00
Petr Rockai
e59e2f7c3c Move the core of the lib/config/config.c functionality into libdevmapper,
leaving behind the LVM-specific parts of the code (convenience wrappers that
handle `struct device` and `struct cmd_context`, basically). A number of
functions have been renamed (in addition to getting a dm_ prefix) -- namely,
all of the config interface now has a dm_config_ prefix.
2011-08-30 14:55:15 +00:00
Peter Rajnoha
d183554c72 Suppress locking error messages in monitoring init scripts. 2011-08-11 15:27:46 +00:00
Zdenek Kabelac
077a6755ff Replace free_vg with release_vg
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.
2011-08-10 20:25:29 +00:00
Milan Broz
05960a0c55 If anything bad happens and unlocking fails
(here clvmd crashed in the middle of operation),
lock is not removed from cache - here is one example:

locking/cluster_locking.c:497       Locking VG V_vg_test UN (VG) (0x6)
locking/cluster_locking.c:113   Error writing data to clvmd: Broken pipe
locking/locking.c:399         <backtrace>
locking/locking.c:461         <backtrace>
  Internal error: Volume Group vg_test was not unlocked

Code should always remove lock info from lvmcache and update counters
on unlock, even if unlock fails.
2011-08-10 16:07:53 +00:00
Peter Rajnoha
cf9927697b Suppress low-level locking errors and warnings while using --sysinit.
Today, we use "suppress_messages" flag (set internally in init_locking fn based
on 'ignorelockingfailure() && getenv("LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES")'.
This way, we can suppress high level messages like "File-based locking
initialisation failed" or "Internal cluster locking initialisation failed".

However, each locking has its own sequence of initialization steps and these
could log some errors as well. It's quite misleading for the user to see such
errors and warnings if the "--sysinit" is used (and so the ignorelockingfailure
&& LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES environment variable). Errors and
warnings from these intermediary steps should be suppressed as well if requested.

This patch propagates the "suppress_messages" flag deeper into locking init
functions. I've also added these flags for other locking types for consistency,
though it's not actually used for no_locking and readonly_locking.
2011-08-09 11:44:57 +00:00
Alasdair Kergon
df390f1799 Major pvmove fix to issue ioctls in the correct order when multiple LVs
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.
2011-06-11 00:03:06 +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
Alasdair Kergon
919ab56b6d pre-release clean-ups 2011-04-29 00:21:13 +00:00
Alasdair Kergon
9cda028a96 clean up critical section patch 2011-04-28 20:29:59 +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
45109d497c Fix some forgotten -Wold-style-definition gcc warnings 2011-04-08 14:13:08 +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
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
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
Alasdair Kergon
c221ae8cdb a few more comments 2011-02-02 23:57:48 +00:00
Alasdair Kergon
12e36e7ea7 Allow CLVMD_CMD_SYNC_NAMES to be propagated around the cluster if requested. 2011-02-02 23:39:39 +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
Jonathan Earl Brassow
e7cb9788c4 fix bad 'strcmp's in 'decode_lock_type' - missing !'s
There was no effect from having this wrong yet, because the
tree of callers only ever cared about the answer to the first
condition (!response), which determines whether a lock is
held or not.  Correct responses, however, are needed soon.
2011-02-01 17:31:40 +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
Zdenek Kabelac
a5c6acf22a Skip NULL check before dm_free
dm_free checks for NULL itself.
2011-01-28 10:16:04 +00:00
Zdenek Kabelac
96eda8b9b3 Skip unnecessary lock_vol() call after volume deactivation
Improve condition within lock_vol so we are not calling extra unlock
if the volume just has been deactivated.

Patch uses lck_type and replaces negative 'and' condition to more
readable 'or' condition.
Few missing strace traces added.
2011-01-13 14:56:17 +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
Zdenek Kabelac
937a21f0d2 Speedup consequent activation calls
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.
2011-01-10 14:02:30 +00:00
Zdenek Kabelac
2d6e83ea19 Check result of dm_snprintf for error 2011-01-05 15:10:30 +00:00
Peter Rajnoha
7dfce0e467 Add new dm_prepare_selinux_context fn to libdevmapper and use it throughout.
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.
2010-12-13 10:43:56 +00:00
Alasdair Kergon
2b82bd79f5 Rename vg_release to free_vg. 2010-12-08 20:50:48 +00:00
Zdenek Kabelac
73e3226012 Remove dead assignment in _lock_for_cluster
'saved_errno' is not read from this initialization and before its
usage is assigned again before _cluster_free_request() call.
2010-11-29 11:13:12 +00:00
Alasdair Kergon
b83af51668 Add global/metadata_read_only to use unrepaired metadata in read-only cmds. 2010-10-25 11:20:54 +00:00
Petr Rockai
976b95d929 Limit repeated accesses to broken devices.
Signed-off-by: Takahiro Yasui <takahiro.yasui@hds.com>
Reviewed-by: Petr Rockai <prockai@redhat.com>
2010-10-13 15:40:38 +00:00
Alasdair Kergon
22149572e8 Use 'SINGLENODE' instead of 'dead' in clvmd singlenode messages.
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.
2010-08-17 19:25:05 +00:00
Alasdair Kergon
2d6fcbf67d Allow internal suspend and resume of origin without its snapshots. 2010-08-17 16:25:32 +00:00
Zdenek Kabelac
9f926fd060 Use void parameter for function definition. 2010-08-03 13:06:35 +00:00
Alasdair Kergon
08f1ddea6c Use __attribute__ consistently throughout. 2010-07-09 15:34:40 +00:00
Milan Broz
d2031f6a16 Clean up cluster lock mode and flags definition.
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:-)
2010-06-17 12:48:54 +00:00
Zdenek Kabelac
b5f33faf9f Replicator: lock_lv_vol() finds missing VGs
Find and check for all needed VGs before calling lock_vol().
2010-05-21 14:29:49 +00:00
Alasdair Kergon
1d837442bf Add is_global_vg and split out from is_orphan_vg. 2010-05-19 02:36:33 +00:00
Alasdair Kergon
34220fe292 Validate orphan and VG_GLOBAL lock order too. 2010-05-19 02:08:50 +00:00
Alasdair Kergon
8c965cafb7 Note that orphan lock is always obtained last 2010-05-19 01:49:08 +00:00
Alasdair Kergon
fa305e2ec6 Accept orphan VG names as parameters to lock_vol() and related functions. 2010-05-19 01:16:40 +00:00
Alasdair Kergon
24d21cfcee Use is_orphan_vg in place of hard-coded prefix tests. 2010-05-19 00:52:55 +00:00
Peter Rajnoha
d50c6d4bf5 Add new --sysinit option for vgchange and lvchange.
A shortcut for --ignorelockingfailure, --ignoremonitoring, --poll n options
and LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES environment variable used all at
once in initialisation scripts (e.g. rc.sysinit or initrd).
2010-05-06 11:15:55 +00:00
Zdenek Kabelac
180b3dea11 Install plugins to subdirs
Target install_dm_plugin installs files to libdir/device-mapper.
Target install_lvm2_plugin installs files to libdir/lvm2.

Both targets creates relative links to libdir to keep the code
compatible with current dlopen handling.

Once we will be able to read plugins from subdir, links
could be removed.
2010-05-06 10:07:46 +00:00
Milan Broz
e4594d9c23 Mask LCK_HOLD flag in cluster VG locks for compatibility reasons. 2010-04-13 14:36:24 +00:00