From nobody@FreeBSD.org  Mon Dec  3 04:29:18 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 938FCA13
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  3 Dec 2012 04:29:18 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 7C01F8FC0C
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  3 Dec 2012 04:29:18 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.5/8.14.5) with ESMTP id qB34TIjd060514
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 3 Dec 2012 04:29:18 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.5/8.14.5/Submit) id qB34TIF1060513;
	Mon, 3 Dec 2012 04:29:18 GMT
	(envelope-from nobody)
Message-Id: <201212030429.qB34TIF1060513@red.freebsd.org>
Date: Mon, 3 Dec 2012 04:29:18 GMT
From: Garrett Cooper <yaneurabeya@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] mptutil: capture cam related errors
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         174072
>Category:       bin
>Synopsis:       [patch] mptutil(8): capture cam related errors
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    smh
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 03 04:30:00 UTC 2012
>Closed-Date:    
>Last-Modified:  Sun Feb 03 22:31:46 UTC 2013
>Originator:     Garrett Cooper
>Release:        n/a
>Organization:
EMC Isilon
>Environment:
n/a
>Description:
The attached patch catches cam-related errors when using mptutil.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

Index: usr.sbin/mptutil/mpt_config.c
===================================================================
--- usr.sbin/mptutil/mpt_config.c	(revision 243802)
+++ usr.sbin/mptutil/mpt_config.c	(working copy)
@@ -305,10 +305,10 @@
 	}
 
 	printf("mpt%d: Configuration cleared\n", mpt_unit);
-	mpt_rescan_bus(-1, -1);
+	error = mpt_rescan_bus(-1, -1);
 	close(fd);
 
-	return (0);
+	return (error);
 }
 MPT_COMMAND(top, clear, clear_config);
 
@@ -742,7 +742,7 @@
 #ifdef DEBUG
 skip:
 #endif
-	mpt_rescan_bus(vol->VolumeBus, vol->VolumeID);
+	error = mpt_rescan_bus(vol->VolumeBus, vol->VolumeID);
 
 	/* Clean up. */
 	free(vol);
@@ -752,7 +752,7 @@
 	free(state.ioc2);
 	close(fd);
 
-	return (0);
+	return (error);
 }
 MPT_COMMAND(top, create, create_volume);
 
@@ -792,10 +792,10 @@
 		return (error);
 	}
 
-	mpt_rescan_bus(-1, -1);
+	error = mpt_rescan_bus(-1, -1);
 	close(fd);
 
-	return (0);
+	return (error);
 }
 MPT_COMMAND(top, delete, delete_volume);
 
@@ -1015,7 +1015,9 @@
 		return (error);
 	}
 
-	mpt_rescan_bus(info->PhysDiskBus, info->PhysDiskID);
+	error = mpt_rescan_bus(info->PhysDiskBus, info->PhysDiskID);
+	if (error)
+		return (error);
 	free(info);
 	close(fd);
 
@@ -1119,7 +1121,9 @@
 		return (error);
 	}
 
-	mpt_rescan_bus(info->PhysDiskBus, info->PhysDiskID);
+	error = mpt_rescan_bus(info->PhysDiskBus, info->PhysDiskID);
+	if (error)
+		return (error);
 	free(info);
 	close(fd);
 


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->smh 
Responsible-Changed-By: smh 
Responsible-Changed-When: Thu Dec 13 23:11:16 UTC 2012 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=174072 
>Unformatted:
