From patchwork Tue Jan 8 13:53:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 1946031 Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by patchwork2.kernel.org (Postfix) with ESMTP id 86A4FDF23A for ; Tue, 8 Jan 2013 13:58:03 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r08DtlJb019797; Tue, 8 Jan 2013 08:55:47 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r08DsWDn004625 for ; Tue, 8 Jan 2013 08:54:32 -0500 Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.19]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r08DsWMC005081 for ; Tue, 8 Jan 2013 08:54:32 -0500 Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r08DsVYF003160 for ; Tue, 8 Jan 2013 08:54:32 -0500 Received: from relay1.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 977F2A50DE; Tue, 8 Jan 2013 14:54:28 +0100 (CET) From: Hannes Reinecke To: Christophe Varoqui Date: Tue, 8 Jan 2013 14:53:56 +0100 Message-Id: <1357653259-62650-19-git-send-email-hare@suse.de> In-Reply-To: <1357653259-62650-1-git-send-email-hare@suse.de> References: <1357653259-62650-1-git-send-email-hare@suse.de> X-RedHat-Spam-Score: -7.299 (BAYES_00, DCC_REPUT_00_12, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.19 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com Subject: [dm-devel] [PATCH 18/42] Check return code from pathinfo() X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com Pathinfo might fail, which indicates that the path is not available anymore. So check the return value and take appropriate action. Signed-off-by: Hannes Reinecke --- libmultipath/discovery.c | 2 +- libmultipath/structs_vec.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index e328332..b5df8e3 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -680,7 +680,7 @@ path_offline (struct path * pp) return PATH_DOWN; } -extern int +int sysfs_pathinfo(struct path * pp) { if (common_sysfs_pathinfo(pp)) diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index d914435..6d36d58 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -68,9 +68,9 @@ adopt_paths (vector pathvec, struct multipath * mpp, int get_info) if (!find_path_by_dev(mpp->paths, pp->dev) && store_path(mpp->paths, pp)) return 1; - if (get_info) - pathinfo(pp, conf->hwtable, - DI_PRIO | DI_CHECKER); + if (get_info && pathinfo(pp, conf->hwtable, + DI_PRIO | DI_CHECKER)) + return 1; } } return 0;