From: Milan Broz <mbroz@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH] Always return error when locking of VG fail.
Date: Wed, 08 Apr 2009 17:02:24 +0200 [thread overview]
Message-ID: <49DCBC80.2060209@redhat.com> (raw)
Always return error when locking of VG fail.
Currently code allows quietly skip vg if locking failed
when processing PVs/LVs on cmdline.
Unfortunately there are situation when this can cause
problems - several tools uses LCK_NONBLOCK flags
(and flock can return EWOULDBLOCK) also locking can fail
for example because system is out of memory.
For example, some lvm command hold lock for vg,
another tries to remove this vg:
# vgremove vg ; echo $?
/var/lock/lvm/V_vg: flock failed: Resource temporarily unavailable
Can't lock volume group vg: skipping
0
This should return an error code instead.
Patch fixes it by using ECMD_FAIL if locking of VG fails.
Side effect is that some commands now return error code
when some VG is skipped. (IMHO it is correct.)
For example, installation depends on return code of these calls,
see also https://bugzilla.redhat.com/show_bug.cgi?id=492642
Signed-off-by: Milan Broz <mbroz@redhat.com>
---
tools/toollib.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/tools/toollib.c b/tools/toollib.c
index 0bc3e40..8a3065b 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -285,6 +285,7 @@ int process_each_lv(struct cmd_context *cmd, int argc, char **argv,
continue; /* FIXME Unnecessary? */
if (!lock_vol(cmd, vgname, lock_type)) {
log_error("Can't lock %s: skipping", vgname);
+ ret_max = ECMD_FAILED;
continue;
}
if (lock_type & LCK_WRITE)
@@ -442,7 +443,7 @@ static int _process_one_vg(struct cmd_context *cmd, const char *vg_name,
if (!lock_vol(cmd, vg_name, lock_type)) {
log_error("Can't lock volume group %s: skipping", vg_name);
- return ret_max;
+ return ECMD_FAILED;
}
log_verbose("Finding volume group \"%s\"", vg_name);
@@ -745,6 +746,7 @@ int process_each_pv(struct cmd_context *cmd, int argc, char **argv,
dm_list_iterate_items(sll, vgnames) {
if (!lock_vol(cmd, sll->str, lock_type)) {
log_error("Can't lock %s: skipping", sll->str);
+ ret_max = ECMD_FAILED;
continue;
}
if (!(vg = vg_read_internal(cmd, sll->str, NULL, &consistent))) {
reply other threads:[~2009-04-08 15:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49DCBC80.2060209@redhat.com \
--to=mbroz@redhat.com \
--cc=lvm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.