Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Aug 2012 12:03:30 -0700
From:      Matthew Jacob <mjacob@freebsd.org>
To:        scsi@freebsd.org
Subject:   tired of mangled xpt_print output?
Message-ID:  <502AA102.8020109@freebsd.org>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------020909090709090106090301
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

I sure am.

ctlfe_onoffline: SIM isp1 (path id 1) target disable succeeded
(ctl2:isp0:0:0:0): disabling lun 0
(ctl2:isp0:0:0:0): lun now disabled for target mode
(ctl2:isp0:0:0:0): LUN removed, 1024 ATIOs outstanding, 1024 INOTs 
outstanding, 1 refs
(ctl3:isp1:0:0:0): (ctl2:disabling lun 0
isp0:0:0:(ctl3:0): isp1:0:now releasing locked
0:(ctl2:0): isp0:0:lun now disabled for target mode
0:(ctl3:0): isp1:0:ctlfecleanup: Called
0:0): LUN removed, 1024 ATIOs outstanding, 1024 INOTs outstanding, 1 refs
(ctl3:isp1:0:0:0): now releasing locked
(ctl3:isp1:0:0:0): ctlfecleanup: Called

The attached patch mitigates this and produces instead:

ctlfe_onoffline: SIM isp1 (path id 1) target disable succeeded
(ctl2:isp0:0:0:0): disabling lun 0
(ctl2:isp0:0:0:0): lun now disabled for target mode
(ctl2:isp0:0:0:0): LUN being removed, 1024 ATIOs still outstanding, 1024 
INOTs still outstanding, 1 refs
(ctl3:isp1:0:0:0): disabling lun 0
(ctl2:isp0:0:0:0): All ATIOs and INOTs now returned
(ctl3:isp1:0:0:0): lun now disabled for target mode
(ctl2:isp0:0:0:0): ctlfecleanup: Called
(ctl3:isp1:0:0:0): LUN being removed, 1024 ATIOs still outstanding, 1024 
INOTs still outstanding, 1 refs
(ctl3:isp1:0:0:0): All ATIOs and INOTs now returned
(ctl3:isp1:0:0:0): ctlfecleanup: Called

This won't play into PRINTF_BUFR_SIZE stuff, but at least will be more 
readable.
An alternative would be sprintf, but then we'd have to do dork around 
with sbuf stuff or more stack,.....

Comments about putting it in?


--------------020909090709090106090301
Content-Type: text/plain;
 name="cam_xpt.c.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="cam_xpt.c.diff"

Index: cam/cam_xpt.c
===================================================================
--- cam/cam_xpt.c	(revision 239240)
+++ cam/cam_xpt.c	(working copy)
@@ -158,6 +158,8 @@
 static cam_simq_t cam_simq;
 static struct mtx cam_simq_lock;
 
+static struct mtx xpt_print_lock;
+
 /* Pointers to software interrupt handlers */
 static void *cambio_ih;
 
@@ -900,6 +902,7 @@
 	xsoftc.num_highpower = CAM_MAX_HIGHPOWER;
 
 	mtx_init(&cam_simq_lock, "CAM SIMQ lock", NULL, MTX_DEF);
+	mtx_init(&xpt_print_lock, "XPT print lock", NULL, MTX_DEF);
 	mtx_init(&xsoftc.xpt_lock, "XPT lock", NULL, MTX_DEF);
 	mtx_init(&xsoftc.xpt_topo_lock, "XPT topology lock", NULL, MTX_DEF);
 
@@ -3650,10 +3653,12 @@
 xpt_print(struct cam_path *path, const char *fmt, ...)
 {
 	va_list ap;
+	mtx_lock(&xpt_print_lock);
 	xpt_print_path(path);
 	va_start(ap, fmt);
 	vprintf(fmt, ap);
 	va_end(ap);
+	mtx_unlock(&xpt_print_lock);
 }
 
 int

--------------020909090709090106090301--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?502AA102.8020109>