From owner-svn-src-all@FreeBSD.ORG Sat Jun 20 03:40:20 2015 Return-Path: Delivered-To: svn-src-all@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D8F422E4; Sat, 20 Jun 2015 03:40:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BA35D304; Sat, 20 Jun 2015 03:40:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5K3eJqv052732; Sat, 20 Jun 2015 03:40:19 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5K3eJB3052731; Sat, 20 Jun 2015 03:40:19 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201506200340.t5K3eJB3052731@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 20 Jun 2015 03:40:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r284622 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Jun 2015 03:40:20 -0000 Author: mav Date: Sat Jun 20 03:40:19 2015 New Revision: 284622 URL: https://svnweb.freebsd.org/changeset/base/284622 Log: Remove device queue freeze handling and replace it with dummy. At this point CTL has no known use case for device queue freezes. Same time existing (considered to be broken) code was found to cause modify-after-free issues. Discussed with: ken MFC after: 1 week Modified: head/sys/cam/ctl/scsi_ctl.c Modified: head/sys/cam/ctl/scsi_ctl.c ============================================================================== --- head/sys/cam/ctl/scsi_ctl.c Sat Jun 20 00:58:46 2015 (r284621) +++ head/sys/cam/ctl/scsi_ctl.c Sat Jun 20 03:40:19 2015 (r284622) @@ -848,15 +848,6 @@ ctlfestart(struct cam_periph *periph, un atio->ccb_h.target_lun = CAM_LUN_WILDCARD; } - if ((atio->ccb_h.status & CAM_DEV_QFRZN) != 0) { - cam_release_devq(periph->path, - /*relsim_flags*/0, - /*reduction*/0, - /*timeout*/0, - /*getcount_only*/0); - atio->ccb_h.status &= ~CAM_DEV_QFRZN; - } - if (atio->ccb_h.func_code != XPT_ACCEPT_TARGET_IO) { xpt_print(periph->path, "%s: func_code " "is %#x\n", __func__, @@ -966,15 +957,6 @@ ctlfestart(struct cam_periph *periph, un xpt_action(start_ccb); cam_periph_lock(periph); - if ((atio->ccb_h.status & CAM_DEV_QFRZN) != 0) { - cam_release_devq(periph->path, - /*relsim_flags*/0, - /*reduction*/0, - /*timeout*/0, - /*getcount_only*/0); - atio->ccb_h.status &= ~CAM_DEV_QFRZN; - } - /* * If we still have work to do, ask for another CCB. */ @@ -1107,6 +1089,19 @@ ctlfedone(struct cam_periph *periph, uni done_ccb->ccb_h.func_code); #endif + /* + * At this point CTL has no known use case for device queue freezes. + * In case some SIM think different -- drop its freeze right here. + */ + if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { + cam_release_devq(periph->path, + /*relsim_flags*/0, + /*reduction*/0, + /*timeout*/0, + /*getcount_only*/0); + done_ccb->ccb_h.status &= ~CAM_DEV_QFRZN; + } + softc = (struct ctlfe_lun_softc *)periph->softc; bus_softc = softc->parent_softc; mtx = cam_periph_mtx(periph); @@ -1417,12 +1412,9 @@ ctlfedone(struct cam_periph *periph, uni union ctl_io *io; struct ccb_immediate_notify *inot; cam_status status; - int frozen, send_ctl_io; + int send_ctl_io; inot = &done_ccb->cin1; - - frozen = (done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0; - printf("%s: got XPT_IMMEDIATE_NOTIFY status %#x tag %#x " "seq %#x\n", __func__, inot->ccb_h.status, inot->tag_id, inot->seq_id); @@ -1524,14 +1516,6 @@ ctlfedone(struct cam_periph *periph, uni done_ccb->ccb_h.func_code = XPT_NOTIFY_ACKNOWLEDGE; xpt_action(done_ccb); } - - if (frozen != 0) { - cam_release_devq(periph->path, - /*relsim_flags*/ 0, - /*opening reduction*/ 0, - /*timeout*/ 0, - /*getcount_only*/ 0); - } break; } case XPT_NOTIFY_ACKNOWLEDGE: