Date: Sat, 15 Jun 2013 12:46:39 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251792 - in head/sys/cam: ata scsi Message-ID: <201306151246.r5FCkdFb072719@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Sat Jun 15 12:46:38 2013 New Revision: 251792 URL: http://svnweb.freebsd.org/changeset/base/251792 Log: 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: head/sys/cam/ata/ata_da.c head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Sat Jun 15 12:16:27 2013 (r251791) +++ head/sys/cam/ata/ata_da.c Sat Jun 15 12:46:38 2013 (r251792) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include <sys/eventhandler.h> #include <sys/malloc.h> #include <sys/cons.h> +#include <sys/proc.h> #include <sys/reboot.h> #include <geom/geom_disk.h> #endif /* _KERNEL */ @@ -1907,11 +1908,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: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Sat Jun 15 12:16:27 2013 (r251791) +++ head/sys/cam/scsi/scsi_da.c Sat Jun 15 12:46:38 2013 (r251792) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include <sys/malloc.h> #include <sys/cons.h> #include <sys/endian.h> +#include <sys/proc.h> #include <geom/geom.h> #include <geom/geom_disk.h> #endif /* _KERNEL */ @@ -3671,8 +3672,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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201306151246.r5FCkdFb072719>