From owner-freebsd-scsi@FreeBSD.ORG Tue Aug 14 19:03:33 2012 Return-Path: Delivered-To: scsi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5FF78106566B for ; Tue, 14 Aug 2012 19:03:33 +0000 (UTC) (envelope-from mjacob@freebsd.org) Received: from ns1.feral.com (ns1.feral.com [192.67.166.1]) by mx1.freebsd.org (Postfix) with ESMTP id 1CBE08FC16 for ; Tue, 14 Aug 2012 19:03:32 +0000 (UTC) Received: from centos62.localhost (bastis [10.3.0.2]) by ns1.feral.com (8.14.4/8.14.4) with ESMTP id q7EJ3Ujf024271 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 14 Aug 2012 12:03:32 -0700 (PDT) (envelope-from mjacob@freebsd.org) Message-ID: <502AA102.8020109@freebsd.org> Date: Tue, 14 Aug 2012 12:03:30 -0700 From: Matthew Jacob Organization: FreeBSD User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.6esrpre) Gecko/20120717 Thunderbird/10.0.6 MIME-Version: 1.0 To: scsi@freebsd.org Content-Type: multipart/mixed; boundary="------------020909090709090106090301" X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.2.7 (ns1.feral.com [172.16.1.79]); Tue, 14 Aug 2012 12:03:32 -0700 (PDT) X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: tired of mangled xpt_print output? X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: mjacob@freebsd.org List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Aug 2012 19:03:33 -0000 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--