diff options
author | Alasdair Kergon <agk@redhat.com> | 2010-05-19 00:52:55 +0000 |
---|---|---|
committer | Alasdair Kergon <agk@redhat.com> | 2010-05-19 00:52:55 +0000 |
commit | 24d21cfceeac1ad37676521da985d5958e05e143 (patch) | |
tree | 4d2334aa9d579dcdae038eb8c202609c001f45be /lib/locking | |
parent | 350232370f57296cea1f38f70ef10336f292d039 (diff) | |
download | lvm2-24d21cfceeac1ad37676521da985d5958e05e143.tar.gz lvm2-24d21cfceeac1ad37676521da985d5958e05e143.tar.xz lvm2-24d21cfceeac1ad37676521da985d5958e05e143.zip |
Use is_orphan_vg in place of hard-coded prefix tests.
Diffstat (limited to 'lib/locking')
-rw-r--r-- | lib/locking/cluster_locking.c | 2 | ||||
-rw-r--r-- | lib/locking/file_locking.c | 2 | ||||
-rw-r--r-- | lib/locking/locking.c | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/lib/locking/cluster_locking.c b/lib/locking/cluster_locking.c index aff213a9..58f59fc7 100644 --- a/lib/locking/cluster_locking.c +++ b/lib/locking/cluster_locking.c @@ -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 (*resource == '#' || (flags & LCK_CACHE)) + if (is_orphan_vg(resource) || (flags & LCK_CACHE)) dm_snprintf(lockname, sizeof(lockname), "P_%s", resource); else diff --git a/lib/locking/file_locking.c b/lib/locking/file_locking.c index f47961df..a6ef086a 100644 --- a/lib/locking/file_locking.c +++ b/lib/locking/file_locking.c @@ -265,7 +265,7 @@ static int _file_lock_resource(struct cmd_context *cmd, const char *resource, if (flags & LCK_CACHE) break; - if (*resource == '#') + if (is_orphan_vg(resource)) dm_snprintf(lockfile, sizeof(lockfile), "%s/P_%s", _lock_dir, resource + 1); else diff --git a/lib/locking/locking.c b/lib/locking/locking.c index c663c285..3abf8f28 100644 --- a/lib/locking/locking.c +++ b/lib/locking/locking.c @@ -369,7 +369,7 @@ static int _lock_vol(struct cmd_context *cmd, const char *resource, return 0; } - if (*resource == '#' && (flags & LCK_CACHE)) { + if (is_orphan_vg(resource) && (flags & LCK_CACHE)) { log_error(INTERNAL_ERROR "P_%s referenced", resource); return 0; } @@ -423,7 +423,7 @@ int lock_vol(struct cmd_context *cmd, const char *vol, uint32_t flags) if (!_blocking_supported) flags |= LCK_NONBLOCK; - if (vol[0] != '#' && + if (!is_orphan_vg(vol) && ((flags & LCK_TYPE_MASK) != LCK_UNLOCK) && (!(flags & LCK_CACHE)) && !lvmcache_verify_lock_order(vol)) |