From 09177b53dddadf89f976ad72ec293c61d0eee9ba Mon Sep 17 00:00:00 2001 From: David Teigland Date: Fri, 1 Jun 2018 10:12:04 -0500 Subject: [PATCH] lvmlockd: clarify lock_type use for coverity Make it clearer when vg->lock_type will be used so coverity doesn't worry about it. --- lib/metadata/metadata.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index 6525cf98e..1bbea19a7 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -2929,13 +2929,15 @@ int vg_write(struct volume_group *vg) struct lv_list *lvl; int revert = 0, wrote = 0; - dm_list_iterate_items(lvl, &vg->lvs) { - if (lvl->lv->lock_args && !strcmp(lvl->lv->lock_args, "pending")) { - if (!lockd_init_lv_args(vg->cmd, vg, lvl->lv, vg->lock_type, &lvl->lv->lock_args)) { - log_error("Cannot allocate lock for new LV."); - return 0; + if (vg_is_shared(vg)) { + dm_list_iterate_items(lvl, &vg->lvs) { + if (lvl->lv->lock_args && !strcmp(lvl->lv->lock_args, "pending")) { + if (!lockd_init_lv_args(vg->cmd, vg, lvl->lv, vg->lock_type, &lvl->lv->lock_args)) { + log_error("Cannot allocate lock for new LV."); + return 0; + } + lvl->lv->new_lock_args = 1; } - lvl->lv->new_lock_args = 1; } }