From patchwork Wed Feb 3 13:22:22 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 76703 Received: from mx01.util.phx2.redhat.com (mx1-phx2.redhat.com [209.132.183.26]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o13DQ4jU025291 for ; Wed, 3 Feb 2010 13:26:40 GMT Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx01.util.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o13DMkIU027098; Wed, 3 Feb 2010 08:22:48 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o13DMjTC022443 for ; Wed, 3 Feb 2010 08:22:45 -0500 Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.12]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o13DMdh3026888 for ; Wed, 3 Feb 2010 08:22:39 -0500 Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o13DMN8G009653 for ; Wed, 3 Feb 2010 08:22:24 -0500 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) by mx2.suse.de (Postfix) with ESMTP id 5291089783; Wed, 3 Feb 2010 14:22:23 +0100 (CET) Date: Wed, 03 Feb 2010 14:22:22 +0100 To: Christophe Varoqui User-Agent: Heirloom mailx 12.2 01/07/07 MIME-Version: 1.0 Message-Id: <20100203132222.4BF1329CC3@ochil.suse.de> From: hare@suse.de (Hannes Reinecke) X-RedHat-Spam-Score: -3.849 (AWL,RCVD_IN_DNSWL_MED) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Scanned-By: MIMEDefang 2.67 on 10.5.110.12 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com Subject: [dm-devel] [PATCH] Update path_offline() to return device status 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: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 03 Feb 2010 13:26:40 +0000 (UTC) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 98d1618..6b99d07 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -587,7 +587,7 @@ path_offline (struct path * pp) pp->sysdev = sysfs_device_from_path(pp); if (!pp->sysdev) { condlog(1, "%s: failed to get sysfs information", pp->dev); - return 1; + return PATH_WILD; } parent = sysfs_device_get_parent(pp->sysdev); @@ -597,20 +597,25 @@ path_offline (struct path * pp) parent = sysfs_device_get_parent(parent); if (!parent) { condlog(1, "%s: failed to get parent", pp->dev); - return 1; + return PATH_WILD; } if (sysfs_get_state(parent, buff, SCSI_STATE_SIZE)) - return 1; + return PATH_WILD; condlog(3, "%s: state = %s", pp->dev, buff); if (!strncmp(buff, "offline", 7)) { pp->offline = 1; - return 1; + return PATH_DOWN; } pp->offline = 0; - return 0; + if (!strncmp(buff, "blocked", 7)) + return PATH_PENDING; + else if (!strncmp(buff, "running", 7)) + return PATH_UP; + + return PATH_DOWN; } extern int @@ -703,6 +708,7 @@ static int get_state (struct path * pp) { struct checker * c = &pp->checker; + int sysfs_state; condlog(3, "%s: get_state", pp->dev); @@ -718,9 +724,10 @@ get_state (struct path * pp) return 1; } } - if (path_offline(pp)) { - condlog(3, "%s: path offline", pp->dev); - pp->state = PATH_DOWN; + sysfs_state = path_offline(pp); + if (sysfs_state != PATH_UP) { + condlog(3, "%s: path inaccessible", pp->dev); + pp->state = sysfs_state; return 0; } pp->state = checker_check(c); diff --git a/multipathd/main.c b/multipathd/main.c index 73b06cb..0d244ad 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -948,9 +948,8 @@ check_path (struct vectors * vecs, struct path * pp) */ checker_set_async(&pp->checker); - if (path_offline(pp)) - newstate = PATH_DOWN; - else + newstate = path_offline(pp); + if (newstate == PATH_UP) newstate = checker_check(&pp->checker); if (newstate < 0) {