Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Oct 1998 15:16:57 -0700 (PDT)
From:      Kenneth Merry <ken@FreeBSD.ORG>
To:        cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG
Subject:   cvs commit: src/sys/cam cam_periph.c cam_periph.h cam_xpt.c src/sys/cam/scsi scsi_cd.c scsi_ch.c scsi_da.c scsi_pass.c scsi_pt.c scsi_sa.c scsi_target.c
Message-ID:  <199810222216.PAA06253@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
ken         1998/10/22 15:16:56 PDT

  Modified files:
    sys/cam              cam_periph.c cam_periph.h cam_xpt.c 
    sys/cam/scsi         scsi_cd.c scsi_ch.c scsi_da.c scsi_pass.c 
                         scsi_pt.c scsi_sa.c scsi_target.c 
  Log:
  Fix a problem with the way we handled device invalidation when attaching
  to a device failed.
  
  In theory, the same steps that happen when we get an AC_LOST_DEVICE async
  notification should have been taken when a driver fails to attach.  In
  practice, that wasn't the case.
  
  This only affected the da, cd and ch drivers, but the fix affects all
  peripheral drivers.
  
  There were several possible problems:
   - In the da driver, we didn't remove the peripheral's softc from the da
     driver's linked list of softcs.  Once the peripheral and softc got
     removed, we'd get a kernel panic the next time the timeout routine
     called dasendorderedtag().
   - In the da, cd and possibly ch drivers, we didn't remove the
     peripheral's devstat structure from the devstat queue.  Once the
     peripheral and softc were removed, this could cause a panic if anyone
     tried to access device statistics.  (one component of the linked list
     wouldn't exist anymore)
   - In the cd driver, we didn't take the peripheral off the changer run
     queue if it was scheduled to run.  In practice, it's highly unlikely,
     and maybe impossible that the peripheral would have been on the
     changer run queue at that stage of the probe process.
  
  The fix is:
   - Add a new peripheral callback function (the "oninvalidate" function)
     that is called the first time cam_periph_invalidate() is called for a
     peripheral.
  
   - Create new foooninvalidate() routines for each peripheral driver.  This
     routine is always called at splsoftcam(), and contains all the stuff
     that used to be in the AC_LOST_DEVICE case of the async callback
     handler.
  
   - Move the devstat cleanup call to the destructor/cleanup routines, since
     some of the drivers do I/O in their close routines.
  
   - Make sure that when we're flushing the buffer queue, we traverse it at
     splbio().
  
   - Add a check for the invalid flag in the pt driver's open routine.
  
  Reviewed by:	gibbs
  
  Revision  Changes    Path
  1.6       +17 -6     src/sys/cam/cam_periph.c
  1.3       +7 -3      src/sys/cam/cam_periph.h
  1.25      +3 -3      src/sys/cam/cam_xpt.c
  1.8       +80 -66    src/sys/cam/scsi/scsi_cd.c
  1.5       +45 -42    src/sys/cam/scsi/scsi_ch.c
  1.12      +68 -55    src/sys/cam/scsi/scsi_da.c
  1.4       +70 -57    src/sys/cam/scsi/scsi_pass.c
  1.3       +70 -50    src/sys/cam/scsi/scsi_pt.c
  1.4       +76 -51    src/sys/cam/scsi/scsi_sa.c
  1.3       +2 -2      src/sys/cam/scsi/scsi_target.c

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message



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