From owner-svn-src-stable-9@FreeBSD.ORG Tue Jun 25 07:27:24 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9B0C832E; Tue, 25 Jun 2013 07:27:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 725FC17F6; Tue, 25 Jun 2013 07:27:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5P7ROlr013303; Tue, 25 Jun 2013 07:27:24 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5P7ROJY013301; Tue, 25 Jun 2013 07:27:24 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201306250727.r5P7ROJY013301@svn.freebsd.org> From: Alexander Motin Date: Tue, 25 Jun 2013 07:27:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252201 - in stable/9/sys/cam: ata scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2013 07:27:24 -0000 Author: mav Date: Tue Jun 25 07:27:23 2013 New Revision: 252201 URL: http://svnweb.freebsd.org/changeset/base/252201 Log: MFC r251792: Restore use of polling mode for disk cache flush in case of kernel panic. While I am not sure that any extra hardware access is a good idea after panic, that is an existing behaviour that should better work correctly. Modified: stable/9/sys/cam/ata/ata_da.c stable/9/sys/cam/scsi/scsi_da.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ata/ata_da.c ============================================================================== --- stable/9/sys/cam/ata/ata_da.c Tue Jun 25 07:17:30 2013 (r252200) +++ stable/9/sys/cam/ata/ata_da.c Tue Jun 25 07:27:23 2013 (r252201) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #endif /* _KERNEL */ @@ -1932,11 +1933,16 @@ adaflush(void) int error; CAM_PERIPH_FOREACH(periph, &adadriver) { - /* If we paniced with lock held - not recurse here. */ - if (cam_periph_owned(periph)) + softc = (struct ada_softc *)periph->softc; + if (SCHEDULER_STOPPED()) { + /* If we paniced with the lock held, do not recurse. */ + if (!cam_periph_owned(periph) && + (softc->flags & ADA_FLAG_OPEN)) { + adadump(softc->disk, NULL, 0, 0, 0); + } continue; + } cam_periph_lock(periph); - softc = (struct ada_softc *)periph->softc; /* * We only sync the cache if the drive is still open, and * if the drive is capable of it.. Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Tue Jun 25 07:17:30 2013 (r252200) +++ stable/9/sys/cam/scsi/scsi_da.c Tue Jun 25 07:27:23 2013 (r252201) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #endif /* _KERNEL */ @@ -3617,8 +3618,16 @@ dashutdown(void * arg, int howto) int error; CAM_PERIPH_FOREACH(periph, &dadriver) { - cam_periph_lock(periph); softc = (struct da_softc *)periph->softc; + if (SCHEDULER_STOPPED()) { + /* If we paniced with the lock held, do not recurse. */ + if (!cam_periph_owned(periph) && + (softc->flags & DA_FLAG_OPEN)) { + dadump(softc->disk, NULL, 0, 0, 0); + } + continue; + } + cam_periph_lock(periph); /* * We only sync the cache if the drive is still open, and