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

208 Commits

Author SHA1 Message Date
Alasdair Kergon
2b82bd79f5 Rename vg_release to free_vg. 2010-12-08 20:50:48 +00:00
Zdenek Kabelac
e3552d738c Check result of vginfo_from_vgname
Check for some potential internal error.
2010-12-01 10:39:28 +00:00
Zdenek Kabelac
faa1268182 Fix constness warnings
After update of device_from_pvid() API fix constness warnings
Also fix info_from_pvid() constness warning for char* usage.
2010-10-25 13:33:42 +00:00
Zdenek Kabelac
710784945c Use 'const' struct id *pvid for device_from_pvid()
Update interface for device_from_pvid and use const pointer.
2010-10-25 13:02:26 +00:00
Alasdair Kergon
ac0252ca07 Add dm_zalloc and use it and dm_pool_zalloc throughout. 2010-09-30 21:06:50 +00:00
Alasdair Kergon
a171bb6e85 Track recursive filter iteration to avoid refreshing while in use. (2.02.56) 2010-09-22 01:36:13 +00:00
Alasdair Kergon
08f1ddea6c Use __attribute__ consistently throughout. 2010-07-09 15:34:40 +00:00
Dave Wysochanski
bb723d7897 Use mdas_empty_or_ignored() in place of checks for empty mda list.
With the addition of ignored mdas, we replace all checks for an empty
mda list with a new function to look for either an empty mda list or
ignored mdas.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2010-06-28 20:34:58 +00:00
Dave Wysochanski
cfb203e14d Add lvmcache_vgname_from_pvid().
Add lvmcache function to lookup a vgname from a pvid.
2010-05-19 11:52:21 +00:00
Dave Wysochanski
dd4097a6a4 Add pvid_from_devname() lvmcache function.
Add supporting function for mappings from devname -> pvid -> vgname.
2010-05-19 11:52:07 +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
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
Milan Broz
9ad39e546b Currently if clvmd is running and user issues vgscan,
the device cache file is dumped both in vgscan and clvmd process.

Unfortunately, clvmd calls lvmcache_label_scan,
it properly destroys persistent filter, but during
persistent_filter_dump it merges old cache content back!

This causes that change in filters is not properly propagated
into device cache after vgscan on cluster.
(Only new devices are added.)

https://bugzilla.redhat.com/show_bug.cgi?id=591861
2010-05-13 13:04:03 +00:00
Zdenek Kabelac
244646902c Initialise _vginfos list staticaly so there is no problem with using uninitialised
variables in case, lvmcache_destory() is called without lvmcache_init().
2010-04-30 12:54:31 +00:00
Alasdair Kergon
258db3ad8e Change most remaining log_error WARNING messages to log_warn. 2010-04-01 10:34:09 +00:00
Milan Broz
c8b0988586 Remove vg_validate call when parsing cached metadata.
vg_validate call is an adept to optimisation, it is very
ineeficient and slow.

Anyway, we should call it only before writing data to disk.

The call in lvmcache was just temporary validation,
we realy do not need to revalidate cached metadata
every time.
(Actually, I added that there just to prove that cache works
properly and forgot to remove it.)

Patch removes it from lvmcache completely, this can hit only
internal bug in export function (and this bug must
be detected in any vg_write call anyway before).
2010-03-31 17:20:44 +00:00
Alasdair Kergon
0a5182fc97 Suppress repeated errors about the same missing PV uuids.
Bypass full device scans when using internally-cached VG metadata.
2010-03-17 02:11:18 +00:00
Alasdair Kergon
f168869702 fix last checkin 2010-03-16 19:06:57 +00:00
Alasdair Kergon
b1f9a2f5d1 Only do one full device scan during each read of text format metadata. 2010-03-16 17:30:00 +00:00
Alasdair Kergon
38220f9fe9 Remove unnecessary full_scan parameter from get_vgids and get_vgnames calls. 2010-03-16 16:57:03 +00:00
Peter Rajnoha
04fa77c3be This is related to liblvm and its lvm_list_vg_names() and lvm_list_vg_uuids() functions
where we should not expose internal VG names/uuids (the ones with "#" prefix )through the
interface. Otherwise, we could end up with library users opening internal VGs which will
initiate locking mechanism that won't be cleaned up properly.

"#orphans_{lvm1, lvm2, pool}" names are treated in a special way, they are truncated first
to "orphans" and this is used as a part of the lock name then (e.g. while calling lvm_vg_open()).
When library user calls lvm_vg_close(), the original name "orphans_{lvm1, lvm2, pool}"
is used directly and therefore no unlock occurs.

We should exclude internal VG names and uuids in the lists provided by lvmcache:
lvmcache_get_vgids() and lvmcache_get_vgnames().
2010-02-03 14:08:39 +00:00
Mike Snitzer
ccd6d287eb remove errant comment fragment 2010-01-11 19:12:25 +00:00
Mike Snitzer
beacd0b303 Reset _vgs_locked in lvmcache_init()
Upon successful fork(), _become_daemon() must assert that the locks that
are currently held belong to the parent, not the child.  All of the
child's internal state saying 'this process holds a lock' has to be
reset.

A proper lvmcache_locking_reset() should follow later.
2010-01-11 19:08:18 +00:00
Milan Broz
d37be0b865 Add possibility to handle precommitted metadata in lvmcache.
- Add drop_precommitted flag to force drop precommitted metadata
 - add lvmcache_commit_metadata() which upgrades precommitted metadata in cache

No functional change in this patch - just preparation for following change.
2010-01-05 16:06:42 +00:00
Petr Rockai
550cae2340 #define an INTERNAL_ERROR macro and use it throughout LVM. 2009-12-16 19:22:11 +00:00
Milan Broz
cd501dd440 Move persistent filter dump to more appropriate place.
After context_refresh is cache empty, the cache flush
does nothing.

Call it after lvmcache full rescan if running from
log lived process.
2009-11-24 16:11:37 +00:00
Milan Broz
e1ab01e3ad Refresh device filters before full device rescan in lvmcache.
The sysfs filter initialise hash of available devices using
scan of /sys/block. We need to refresh even this hash
when performing full scan otherwise the newly appeared
device could be rejected, because there is no entry
in sysfs filter.

This easily could happen when attaching new device
to cluster node. (Only force refresh of context
in clvmd -R works here now).

Unfortunately consequences of this are much worse,
missing device part on that node is replaced with missing segment
(even when no partial arg is selected) and this directly
lead to data corruption.

See https://bugzilla.redhat.com/show_bug.cgi?id=538515

Simply fix it by refreshing device filters in lvmcache
before performing the full device scan.
2009-11-24 16:10:25 +00:00
Milan Broz
4059d2219c Recognise DRBD device part and handle it similar to MD devices.
The DRBD uses underlying device so code should prefer top
device if duplicate is found.

Patch also introduce
        dev_subsystem_part_major and dev_subsytem_name
functions to easily handle all these replication susbystems
and not hardcode md_major call.

See https://bugzilla.redhat.com/show_bug.cgi?id=530881
for full problem description.
2009-10-27 17:00:44 +00:00
Alasdair Kergon
06bb53b1e8 Remember to clear 'global lock held during cache refresh' state after use. 2009-10-22 17:33:09 +00:00
Alasdair Kergon
663bf8f7f6 pre-release cleanup 2009-09-15 13:49:10 +00:00
Dave Wysochanski
905240f91d Use vg_is_exported(vg) macro everywhere.
This patch is all just cleanup and no other patch depends on it.
Replace explicit dereference and check with vg_is_exported().
Update a few copyrights and remove unnecessary whitespace.
Should be no functional change.
2009-09-14 19:44:15 +00:00
Dave Wysochanski
3de6df8410 Enforce an alphabetical lock ordering for vgname locks.
Add a new constraint that vgname locks must be obtained in
alphabetical order.  At this point, we have test coverage for
the 3 commands affected - vgsplit, vgmerge, and vgrename.
Tests have been updated to cover these commands.
Going forward any command or library call that must obtain
more than one vgname lock must do so in alphabetical order.
Future patches will update lvm2app to enforce this ordering.


Author: Dave Wysochanski <dwysocha@redhat.com>
2009-09-02 21:34:11 +00:00
Dave Wysochanski
0589e19fd7 Update error return and comments for lvm_list_vg_names/uuids.
The two liblvm functions that return a list of vgnames and vguuids use
cmd->mem to allocate the list.  Make it clear to the caller that this
memory will be freed when the LVM handle is freed.

Clean up and clarify the return value of the functions.  In the
case of a memory allocation error, add a couple log_errnos to the internal
code, and make it clear that memory allocation returns a NULL pointer.
If there are no VGs in the system, the list returned is an empty list.

Make a note of the fact that currently we return hidden VG names, how
these can be detected (always start with "#"), and that they should
not be used.


Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-27 11:00:17 +00:00
Milan Broz
bf3423d355 Fix pool leak in lvmcache_read_vg error path.
(Introduced in previous patches.)
2009-04-24 12:03:55 +00:00
Alasdair Kergon
9b99f3337b Index cached vgmetadata by vgid not vgname to cope with duplicate vgnames. (dwyso) 2009-02-17 18:56:41 +00:00
Alasdair Kergon
615de1b59b Suppress 'duplicate PV' message when it's only a cache update not a real
duplicate.
2008-11-28 15:51:40 +00:00
Alasdair Kergon
e2675481f0 Don't skip updating pvid hash when lvmcache_info struct got swapped. 2008-11-27 18:13:50 +00:00
Alasdair Kergon
2c44337bd5 Right, a simple build (without options) is working again. 2008-11-03 22:14:30 +00:00
Alasdair Kergon
a0e00ccf3f Avoid repeatedly wiping cache while VG_GLOBAL is held in vgscan & pvscan. 2008-09-16 18:05:11 +00:00
Alasdair Kergon
59743245b4 Fix up cache for PVs without mdas after consistent VG metadata is processed. 2008-06-27 15:18:31 +00:00
Alasdair Kergon
56637f2a85 Fix tracking of validity of PVs with no mdas in lvmcache. 2008-06-11 11:02:05 +00:00
Alasdair Kergon
80b7fe0e88 Fix segfault after _free_vginfo by remembering to remove vginfo from list. 2008-06-09 16:22:33 +00:00
Alasdair Kergon
f0dfe9dcda fix _free_vginfo not to remove a ref to a *different* vginfo from the vgid cache 2008-06-06 12:43:40 +00:00
Alasdair Kergon
d0de492ff3 cope with volatile vginfo in vg_read 2008-06-06 11:12:50 +00:00
Alasdair Kergon
e350c2f648 Decode numbers in clvmd debugging output. 2008-06-05 14:24:28 +00:00
Alasdair Kergon
e4b34bfad0 When activating, if precommitted metadata is still cached, assume it's live. 2008-06-05 13:06:39 +00:00
Alasdair Kergon
bdce11cb30 Avoid spurious duplicate VG messages referring to VGs that are gone.
(untested)
2008-05-28 22:27:47 +00:00
Alasdair Kergon
fc54be1062 Refactor some vginfo manipulation code. 2008-05-19 19:49:56 +00:00
Alasdair Kergon
98fd1ce332 More P_ and V_ lock cleanup. 2008-05-09 18:45:15 +00:00
Alasdair Kergon
3d6af3e35e Add missing mutex around clvmd lvmcache_drop_metadata library call. 2008-05-09 15:13:20 +00:00
Alasdair Kergon
3835ad6b1c When asked to drop cached committed VG metadata, invalidate cached PV labels. 2008-05-08 18:28:27 +00:00
Alasdair Kergon
d3ccaf8ae5 remove unused lvmcache_drop_vg prototype 2008-05-08 18:00:47 +00:00
Alasdair Kergon
b5618c07d8 Exclude VG_GLOBAL from internal concurrent VG lock counter.
(Avoids 'device left open' warning messages from vgscan etc.)
2008-04-24 02:22:07 +00:00
Alasdair Kergon
082628eb2c missing stack 2008-04-15 14:57:12 +00:00
Milan Broz
581b17def2 Drop cached VG metadata before and after committing changes to it. 2008-04-15 14:46:19 +00:00
Alasdair Kergon
8b1ae3c140 Don't store fid in VG metadata cache to avoid clvmd segfault. (2.02.34) 2008-04-14 19:24:16 +00:00
Alasdair Kergon
6eb44b5091 Fix vgreduce to use vg_split_mdas to check sufficient mdas remain.
Add (empty) orphan VGs to lvmcache during initialisation.
Fix orphan VG name used for format_pool.
2008-04-08 12:49:21 +00:00
Alasdair Kergon
906935e580 Add some basic internal VG lock validation. 2008-04-03 18:56:40 +00:00
Alasdair Kergon
bf7dea978e Add per-command flags to control which commands use the VG metadata cache. 2008-04-02 21:23:39 +00:00
Alasdair Kergon
6e210a6c54 Cache VG metadata internally while VG lock is held. 2008-04-01 22:40:13 +00:00
Alasdair Kergon
7284f3f966 preparation for vg cache 2008-03-17 16:51:31 +00:00
Alasdair Kergon
bb097a97ea split orphan VG by format type 2008-02-06 15:47:28 +00:00
Alasdair Kergon
16e2a5aa3b only read labels once between each lock event 2008-01-30 16:18:37 +00:00
Alasdair Kergon
67cdbd7e4d Some whitespace tidy-ups. 2008-01-30 14:00:02 +00:00
Alasdair Kergon
c51b9fff19 Use stack return macros throughout. 2008-01-30 13:19:47 +00:00
Alasdair Kergon
962b2a559d Rely upon internally-cached PV labels while corresponding VG lock is held. 2008-01-29 23:45:48 +00:00
Alasdair Kergon
180b4569e2 fix inverted orphan test 2007-11-05 17:12:50 +00:00
Bryn M. Reeves
8b98c12815 Add is_orphan_vg() and change all hardcoded checks to use it. 2007-11-02 13:06:42 +00:00
Alasdair Kergon
be6845999b Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1. 2007-08-20 20:55:30 +00:00
Dave Wysochanski
17a6fc0b45 Add 'scan_sector' parameter to label_read and _find_labeller to add
flexibility in searching for disk labels.
2007-04-23 18:21:01 +00:00
Alasdair Kergon
4dc0ec2253 Adjust some alignments for ia64 and sparc.
(Some of the changes are probably unnecessary.)
2006-11-30 23:11:42 +00:00
Alasdair Kergon
e3ad1d19d5 Add --trustcache option to reporting commands in preparation for supporting
event-driven model.  Without changes to the way the cache gets updated, the
option is currently unreliable without a global lock to prevent any lvm2
commands from running concurrently.
2006-08-01 14:56:33 +00:00
Alasdair Kergon
2415c1ef87 Fix PV tools to include orphaned PVs in default output again. 2006-06-14 20:11:22 +00:00
Alasdair Kergon
898e6f8e41 Add mirror_library description to example.conf.
More compile-time cleanup.
2006-05-11 17:58:58 +00:00
Alasdair Kergon
2c7fbadeef more coverity fixes 2006-05-10 17:49:25 +00:00
Alasdair Kergon
72b2cb613a Make SIZE_SHORT the default for display_size().
Fix some memory leaks in error paths found by coverity.
Use C99 struct initialisers.
Move DEFS into configure.h.
Clean-ups to remove miscellaneous compiler warnings.
2006-05-09 21:23:51 +00:00
Alasdair Kergon
26b2524996 Invalidate cache if composition of VG changed externally. 2006-04-21 19:12:41 +00:00
Alasdair Kergon
05ffaffe0c Fix vgid string termination in recent cache code. 2006-04-21 14:44:33 +00:00
Alasdair Kergon
dbd3026f8a vgrename accepts vgid and exported VG. 2006-04-13 21:08:29 +00:00
Alasdair Kergon
2ab16287e6 When choosing between identically-named VGs, also consider creation_host. 2006-04-13 17:32:24 +00:00
Alasdair Kergon
a5fe5a7cdd Fix vgexport/vgimport to set/reset PV exported flag so pv_attr is correct.
Add vgid to struct physical_volume and pass with vg_name to some functions.
2006-04-12 21:23:04 +00:00
Alasdair Kergon
e8db70239e If two or more VGs are found with the same name, use one that is not exported. 2006-04-12 17:54:11 +00:00
Alasdair Kergon
5dbc1f263a tidy 2006-04-11 19:09:55 +00:00
Alasdair Kergon
f084e627cc When scanning, also record whether or not VG is exported. 2006-04-11 17:42:15 +00:00
Alasdair Kergon
f9c232c2ee Use lvmcache_update_vgname_and_id throughout. 2006-04-11 16:00:26 +00:00
Alasdair Kergon
cced28dac3 Whenever vgname is captured, also capture vgid. 2006-04-11 13:55:59 +00:00
Alasdair Kergon
a14aa9d8c3 Capture vgid in more places. 2006-04-10 22:09:00 +00:00
Alasdair Kergon
e6c20c6100 Fix new mirror_seg pointer. 2005-10-27 21:51:28 +00:00
Alasdair Kergon
22c0314758 Export vgname_is_locked 2005-10-27 17:41:41 +00:00
Alasdair Kergon
352a99b95a Use dm_is_dm_major instead of local copy.
Allow mapped devices to be used as PVs safely.
2005-10-25 19:08:21 +00:00
Alasdair Kergon
2262b32057 Use hash, bitset, malloc, pool from libdevmapper. 2005-10-16 23:03:59 +00:00
Alasdair Kergon
68366c99b2 Add is_dm_major() for use in duplicate device detection in lvmcache_add(). 2005-09-16 18:53:01 +00:00
Alasdair Kergon
72a16423d2 Really switch device number in lvmcache when it says it is doing so. 2005-09-16 18:44:52 +00:00
Alasdair Kergon
60f13f01d2 Basic support for mirrors. 2005-06-01 16:51:55 +00:00
Alasdair Kergon
1165258cda Alignment tidying. 2005-04-06 13:47:41 +00:00
Alasdair Kergon
e5b836d2d6 Improve detection of external changes affecting internal cache. 2005-03-21 22:40:35 +00:00
Alasdair Kergon
b9565b406a Cope with new devices appearing by rescanning /dev if a uuid can't be found. 2005-03-08 13:46:17 +00:00
Alasdair Kergon
4922197a33 Begin to separate out segment types. 2004-05-04 21:25:57 +00:00
Alasdair Kergon
6606c3ae81 Update copyright notices. 2004-03-30 19:35:44 +00:00
Alasdair Kergon
ac21f47034 more str_list fns 2003-10-15 20:04:29 +00:00
Alasdair Kergon
914c97239f Another sync point - numerous fixes & clean ups. 2003-07-04 22:34:56 +00:00
Alasdair Kergon
26e7f2e0c4 Tidy various pre-processing incl. making libdl optional. 2003-03-24 18:08:53 +00:00
Alasdair Kergon
e9ea1fb3bf Fix (rare) cache bug on machines with large /dev directories. 2003-01-10 19:14:01 +00:00
Alasdair Kergon
f3f3424f9a Detect duplicate PV uuids - select the one on an md device if appropriate. 2003-01-06 21:10:43 +00:00
Alasdair Kergon
8ef2b021ed Default stripesize 64k & config file setting for it;
Clear many compiler warnings (i386) & associated bugs - hopefully without
introducing too many new bugs:-)  (Same exercise required for other archs.)
Default compilation has optimisation - or else use ./configure --enable-debug
2002-12-19 23:25:55 +00:00
Alasdair Kergon
74b27447c1 A new cache. 2002-11-18 13:53:58 +00:00