From: dlg Date: Sun, 20 Apr 2014 00:50:18 +0000 (+0000) Subject: make the status handler more like rdac and emc. the big functional change X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=2cdf3b65e5969bca7cc288528e9e0ebe86b7906e;p=openbsd make the status handler more like rdac and emc. the big functional change is to check xs->status on completion to make sure it worked. --- diff --git a/sys/scsi/mpath_hds.c b/sys/scsi/mpath_hds.c index b2a593ba409..0a57c37eca7 100644 --- a/sys/scsi/mpath_hds.c +++ b/sys/scsi/mpath_hds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpath_hds.c,v 1.15 2014/04/03 04:02:50 dlg Exp $ */ +/* $OpenBSD: mpath_hds.c,v 1.16 2014/04/20 00:50:18 dlg Exp $ */ /* * Copyright (c) 2011 David Gwynne @@ -245,17 +245,16 @@ hds_status_done(struct scsi_xfer *xs) struct scsi_link *link = xs->sc_link; struct hds_softc *sc = link->device_softc; struct hds_vpd *vpd = sc->sc_vpd; - int status; + int status = MPATH_S_UNKNOWN; - scsi_xs_put(xs); + if (xs->error == XS_NOERROR && + _2btol(vpd->hdr.page_length) >= sizeof(vpd->state) && + ISSET(vpd->state, HDS_VPD_VALID)) { + status = ISSET(vpd->state, HDS_VPD_PREFERRED) ? + MPATH_S_ACTIVE : MPATH_S_PASSIVE; + } - if (_2btol(vpd->hdr.page_length) < sizeof(vpd->state) || - !ISSET(vpd->state, HDS_VPD_VALID)) - status = MPATH_S_UNKNOWN; - else if (ISSET(vpd->state, HDS_VPD_PREFERRED)) - status = MPATH_S_ACTIVE; - else - status = MPATH_S_PASSIVE; + scsi_xs_put(xs); mpath_path_status(&sc->sc_path, status); }