mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Add is_global_vg and split out from is_orphan_vg.
This commit is contained in:
parent
34220fe292
commit
1d837442bf
@ -2,7 +2,7 @@ Version 2.02.66 -
|
||||
===============================
|
||||
Validate orphan and VG_GLOBAL lock order too.
|
||||
Accept orphan VG names as parameters to lock_vol() and related functions.
|
||||
Use is_orphan_vg in place of hard-coded prefix tests.
|
||||
Use is_orphan_vg in place of hard-coded prefix tests and add is_global_vg.
|
||||
|
||||
Version 2.02.65 - 17th May 2010
|
||||
===============================
|
||||
|
5
lib/cache/lvmcache.h
vendored
5
lib/cache/lvmcache.h
vendored
@ -19,9 +19,10 @@
|
||||
#include "dev-cache.h"
|
||||
#include "uuid.h"
|
||||
#include "label.h"
|
||||
#include "locking.h"
|
||||
|
||||
#define ORPHAN_PREFIX "#"
|
||||
#define ORPHAN_VG_NAME(fmt) ORPHAN_PREFIX "orphans_" fmt
|
||||
#define ORPHAN_PREFIX VG_ORPHANS
|
||||
#define ORPHAN_VG_NAME(fmt) ORPHAN_PREFIX "_" fmt
|
||||
|
||||
#define CACHE_INVALID 0x00000001
|
||||
#define CACHE_LOCKED 0x00000002
|
||||
|
@ -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 (is_orphan_vg(resource) || (flags & LCK_CACHE))
|
||||
if (is_orphan_vg(resource) || is_global_vg(resource) || (flags & LCK_CACHE))
|
||||
dm_snprintf(lockname, sizeof(lockname), "P_%s",
|
||||
resource);
|
||||
else
|
||||
|
@ -265,7 +265,7 @@ static int _file_lock_resource(struct cmd_context *cmd, const char *resource,
|
||||
if (flags & LCK_CACHE)
|
||||
break;
|
||||
|
||||
if (is_orphan_vg(resource))
|
||||
if (is_orphan_vg(resource) || is_global_vg(resource))
|
||||
dm_snprintf(lockfile, sizeof(lockfile),
|
||||
"%s/P_%s", _lock_dir, resource + 1);
|
||||
else
|
||||
|
@ -325,7 +325,7 @@ int check_lvm1_vg_inactive(struct cmd_context *cmd, const char *vgname)
|
||||
char path[PATH_MAX];
|
||||
|
||||
/* We'll allow operations on orphans */
|
||||
if (is_orphan_vg(vgname))
|
||||
if (is_orphan_vg(vgname) || is_global_vg(vgname))
|
||||
return 1;
|
||||
|
||||
/* LVM1 is only present in 2.4 kernels. */
|
||||
@ -369,7 +369,7 @@ static int _lock_vol(struct cmd_context *cmd, const char *resource,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (is_orphan_vg(resource) && (flags & LCK_CACHE)) {
|
||||
if ((is_orphan_vg(resource) || is_global_vg(resource)) && (flags & LCK_CACHE)) {
|
||||
log_error(INTERNAL_ERROR "P_%s referenced", resource);
|
||||
return 0;
|
||||
}
|
||||
|
@ -3337,7 +3337,7 @@ int is_global_vg(const char *vg_name)
|
||||
*/
|
||||
int is_orphan_vg(const char *vg_name)
|
||||
{
|
||||
return (vg_name && vg_name[0] == ORPHAN_PREFIX[0]) ? 1 : 0;
|
||||
return (vg_name && !strncmp(vg_name, ORPHAN_PREFIX, sizeof(ORPHAN_PREFIX) - 1)) ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user