svn commit: r246431 - in stable/9/sys/cam: . scsi
Alexander Motin
mav at FreeBSD.org
Wed Feb 6 18:40:08 UTC 2013
Author: mav
Date: Wed Feb 6 18:40:07 2013
New Revision: 246431
URL: http://svnweb.freebsd.org/changeset/base/246431
Log:
MFC r242175:
Remove priority enforcement from xpt_ation(). It is not good and even not
safe in some cases to reduce CCB priority after it was scheduled with high
priority. This fixes reproducible deadlock when command sent through the
pass interface while ATA XPT recovers from command timeout.
Instead of that enforce priority at passioctl(). libcam provides no obvious
interface to specify CCB priority and so much (all?) code specifies zero
(highest) priority. This change limits pass CCBs priority to NORMAL run
level, allowing XPT to complete bus and device recovery after reset before
running any payload.
Modified:
stable/9/sys/cam/cam.h
stable/9/sys/cam/cam_xpt.c
stable/9/sys/cam/scsi/scsi_pass.c
Directory Properties:
stable/9/sys/ (props changed)
Modified: stable/9/sys/cam/cam.h
==============================================================================
--- stable/9/sys/cam/cam.h Wed Feb 6 18:37:46 2013 (r246430)
+++ stable/9/sys/cam/cam.h Wed Feb 6 18:40:07 2013 (r246431)
@@ -83,6 +83,7 @@ typedef struct {
#define CAM_PRIORITY_NORMAL ((CAM_RL_NORMAL << 8) + 0x80)
#define CAM_PRIORITY_NONE (u_int32_t)-1
#define CAM_PRIORITY_TO_RL(x) ((x) >> 8)
+#define CAM_RL_TO_PRIORITY(x) ((x) << 8)
u_int32_t generation;
int index;
#define CAM_UNQUEUED_INDEX -1
Modified: stable/9/sys/cam/cam_xpt.c
==============================================================================
--- stable/9/sys/cam/cam_xpt.c Wed Feb 6 18:37:46 2013 (r246430)
+++ stable/9/sys/cam/cam_xpt.c Wed Feb 6 18:40:07 2013 (r246431)
@@ -2466,9 +2466,6 @@ xpt_action(union ccb *start_ccb)
CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("xpt_action\n"));
start_ccb->ccb_h.status = CAM_REQ_INPROG;
- /* Compatibility for RL-unaware code. */
- if (CAM_PRIORITY_TO_RL(start_ccb->ccb_h.pinfo.priority) == 0)
- start_ccb->ccb_h.pinfo.priority += CAM_PRIORITY_NORMAL - 1;
(*(start_ccb->ccb_h.path->bus->xport->action))(start_ccb);
}
Modified: stable/9/sys/cam/scsi/scsi_pass.c
==============================================================================
--- stable/9/sys/cam/scsi/scsi_pass.c Wed Feb 6 18:37:46 2013 (r246430)
+++ stable/9/sys/cam/scsi/scsi_pass.c Wed Feb 6 18:40:07 2013 (r246431)
@@ -521,6 +521,7 @@ passioctl(struct cdev *dev, u_long cmd,
struct cam_periph *periph;
struct pass_softc *softc;
int error;
+ uint32_t priority;
periph = (struct cam_periph *)dev->si_drv1;
if (periph == NULL)
@@ -553,6 +554,11 @@ passioctl(struct cdev *dev, u_long cmd,
break;
}
+ /* Compatibility for RL/priority-unaware code. */
+ priority = inccb->ccb_h.pinfo.priority;
+ if (priority < CAM_RL_TO_PRIORITY(CAM_RL_NORMAL))
+ priority += CAM_RL_TO_PRIORITY(CAM_RL_NORMAL);
+
/*
* Non-immediate CCBs need a CCB from the per-device pool
* of CCBs, which is scheduled by the transport layer.
@@ -561,15 +567,14 @@ passioctl(struct cdev *dev, u_long cmd,
*/
if ((inccb->ccb_h.func_code & XPT_FC_QUEUED)
&& ((inccb->ccb_h.func_code & XPT_FC_USER_CCB) == 0)) {
- ccb = cam_periph_getccb(periph,
- inccb->ccb_h.pinfo.priority);
+ ccb = cam_periph_getccb(periph, priority);
ccb_malloced = 0;
} else {
ccb = xpt_alloc_ccb_nowait();
if (ccb != NULL)
xpt_setup_ccb(&ccb->ccb_h, periph->path,
- inccb->ccb_h.pinfo.priority);
+ priority);
ccb_malloced = 1;
}
More information about the svn-src-stable-9
mailing list