From mboxrd@z Thu Jan 1 00:00:00 1970 From: Martin Wilck Subject: Re: [PATCH 01/14] multipathd: return if dm_get_major_minor failed in, cli_add_map Date: Thu, 03 Sep 2020 19:26:25 +0200 Message-ID: References: <37544d4c-950f-4281-3b66-e4d1884c5167@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com To: lixiaokeng , Benjamin Marzinski , Christophe Varoqui , dm-devel mailing list Cc: linfeilong , "liuzhiqiang (I)" List-Id: dm-devel.ids On Wed, 2020-09-02 at 15:15 +0800, lixiaokeng wrote: > If dm_get_major_minor failed, log with major and minor should not > be printed to avoid major and minor used before initialization. > > Signed-off-by: Lixiaokeng > Signed-off-by: Zhiqiang Liu > Signed-off-by: Linfeilong > --- > multipathd/cli_handlers.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c > index 8db37961..2d297fd0 100644 > --- a/multipathd/cli_handlers.c > +++ b/multipathd/cli_handlers.c > @@ -847,11 +847,12 @@ cli_add_map (void * v, char ** reply, int * > len, void * data) Why not just quit the "do" loop in the error case for dm_get_major_minor()? Martin > else { > sprintf(dev_path, "dm-%d", minor); > alias = dm_mapname(major, minor); > + if (!alias) > + condlog(2, "%s: mapname not found for > %d:%d", > + param, major, minor); > } > /*if there is no mapname found, we first create the > device*/ > if (!alias && !count) { > - condlog(2, "%s: mapname not found for %d:%d", > - param, major, minor); > get_refwwid(CMD_NONE, param, DEV_DEVMAP, > vecs->pathvec, &refwwid); > if (refwwid) {