mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
Use is_orphan_vg in place of hard-coded prefix tests.
This commit is contained in:
parent
350232370f
commit
24d21cfcee
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.66 -
|
Version 2.02.66 -
|
||||||
===============================
|
===============================
|
||||||
|
Use is_orphan_vg in place of hard-coded prefix tests.
|
||||||
|
|
||||||
Version 2.02.65 - 17th May 2010
|
Version 2.02.65 - 17th May 2010
|
||||||
===============================
|
===============================
|
||||||
|
4
lib/cache/lvmcache.c
vendored
4
lib/cache/lvmcache.c
vendored
@ -224,11 +224,11 @@ void lvmcache_drop_metadata(const char *vgname, int drop_precommitted)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Ensure vgname2 comes after vgname1 alphabetically.
|
* Ensure vgname2 comes after vgname1 alphabetically.
|
||||||
* Special VG names beginning with '#' don't count.
|
* Orphans don't count.
|
||||||
*/
|
*/
|
||||||
static int _vgname_order_correct(const char *vgname1, const char *vgname2)
|
static int _vgname_order_correct(const char *vgname1, const char *vgname2)
|
||||||
{
|
{
|
||||||
if ((*vgname1 == '#') || (*vgname2 == '#'))
|
if (is_orphan_vg(vgname1) || is_orphan_vg(vgname2))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (strcmp(vgname1, vgname2) < 0)
|
if (strcmp(vgname1, vgname2) < 0)
|
||||||
|
@ -406,7 +406,7 @@ int lock_resource(struct cmd_context *cmd, const char *resource, uint32_t flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If the VG name is empty then lock the unused PVs */
|
/* If the VG name is empty then lock the unused PVs */
|
||||||
if (*resource == '#' || (flags & LCK_CACHE))
|
if (is_orphan_vg(resource) || (flags & LCK_CACHE))
|
||||||
dm_snprintf(lockname, sizeof(lockname), "P_%s",
|
dm_snprintf(lockname, sizeof(lockname), "P_%s",
|
||||||
resource);
|
resource);
|
||||||
else
|
else
|
||||||
|
@ -265,7 +265,7 @@ static int _file_lock_resource(struct cmd_context *cmd, const char *resource,
|
|||||||
if (flags & LCK_CACHE)
|
if (flags & LCK_CACHE)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (*resource == '#')
|
if (is_orphan_vg(resource))
|
||||||
dm_snprintf(lockfile, sizeof(lockfile),
|
dm_snprintf(lockfile, sizeof(lockfile),
|
||||||
"%s/P_%s", _lock_dir, resource + 1);
|
"%s/P_%s", _lock_dir, resource + 1);
|
||||||
else
|
else
|
||||||
|
@ -369,7 +369,7 @@ static int _lock_vol(struct cmd_context *cmd, const char *resource,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*resource == '#' && (flags & LCK_CACHE)) {
|
if (is_orphan_vg(resource) && (flags & LCK_CACHE)) {
|
||||||
log_error(INTERNAL_ERROR "P_%s referenced", resource);
|
log_error(INTERNAL_ERROR "P_%s referenced", resource);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -423,7 +423,7 @@ int lock_vol(struct cmd_context *cmd, const char *vol, uint32_t flags)
|
|||||||
if (!_blocking_supported)
|
if (!_blocking_supported)
|
||||||
flags |= LCK_NONBLOCK;
|
flags |= LCK_NONBLOCK;
|
||||||
|
|
||||||
if (vol[0] != '#' &&
|
if (!is_orphan_vg(vol) &&
|
||||||
((flags & LCK_TYPE_MASK) != LCK_UNLOCK) &&
|
((flags & LCK_TYPE_MASK) != LCK_UNLOCK) &&
|
||||||
(!(flags & LCK_CACHE)) &&
|
(!(flags & LCK_CACHE)) &&
|
||||||
!lvmcache_verify_lock_order(vol))
|
!lvmcache_verify_lock_order(vol))
|
||||||
|
Loading…
Reference in New Issue
Block a user