From bcfe4993e577167440be511da4ec879fac19afdb Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Thu, 30 Jan 2020 12:52:19 +0100 Subject: [PATCH] lvmlockd: move eval of ENOENT To avoid logging 'errors' for no real error state (ENOENT), move this evaluation upward in the code. --- lib/locking/lvmlockd.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c index cbe212161..416121011 100644 --- a/lib/locking/lvmlockd.c +++ b/lib/locking/lvmlockd.c @@ -2092,7 +2092,8 @@ static int _query_lock_lv(struct cmd_context *cmd, struct volume_group *vg, log_error("Lock query failed for LV %s/%s", vg->name, lv_name); return 0; } else { - ret = (result < 0) ? 0 : 1; + /* ENOENT => The lv was not active/locked. */ + ret = (result < 0 && (result != -ENOENT)) ? 0 : 1; } if (!ret) @@ -2110,10 +2111,6 @@ static int _query_lock_lv(struct cmd_context *cmd, struct volume_group *vg, daemon_reply_destroy(reply); - /* The lv was not active/locked. */ - if (result == -ENOENT) - return 1; - return ret; }