svn commit: r255864 - in projects/bhyve_npt_pmap/sys: amd64/amd64 cam/ctl

Neel Natu neel at FreeBSD.org
Tue Sep 24 21:44:24 UTC 2013


Author: neel
Date: Tue Sep 24 21:44:23 2013
New Revision: 255864
URL: http://svnweb.freebsd.org/changeset/base/255864

Log:
  IFC @r255849

Modified:
  projects/bhyve_npt_pmap/sys/amd64/amd64/pmap.c
  projects/bhyve_npt_pmap/sys/cam/ctl/ctl_frontend_iscsi.c
Directory Properties:
  projects/bhyve_npt_pmap/   (props changed)
  projects/bhyve_npt_pmap/sys/   (props changed)

Modified: projects/bhyve_npt_pmap/sys/amd64/amd64/pmap.c
==============================================================================
--- projects/bhyve_npt_pmap/sys/amd64/amd64/pmap.c	Tue Sep 24 21:06:50 2013	(r255863)
+++ projects/bhyve_npt_pmap/sys/amd64/amd64/pmap.c	Tue Sep 24 21:44:23 2013	(r255864)
@@ -5886,13 +5886,13 @@ pmap_clear_modify(vm_page_t m)
 	 */
 	if ((m->aflags & PGA_WRITEABLE) == 0)
 		return;
+	pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
 	rw_rlock(&pvh_global_lock);
 	lock = VM_PAGE_TO_PV_LIST_LOCK(m);
 	rw_wlock(lock);
 restart:
 	if ((m->flags & PG_FICTITIOUS) != 0)
 		goto small_mappings;
-	pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
 	TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_next, next_pv) {
 		pmap = PV_PMAP(pv);
 		if (!PMAP_TRYLOCK(pmap)) {

Modified: projects/bhyve_npt_pmap/sys/cam/ctl/ctl_frontend_iscsi.c
==============================================================================
--- projects/bhyve_npt_pmap/sys/cam/ctl/ctl_frontend_iscsi.c	Tue Sep 24 21:06:50 2013	(r255863)
+++ projects/bhyve_npt_pmap/sys/cam/ctl/ctl_frontend_iscsi.c	Tue Sep 24 21:44:23 2013	(r255864)
@@ -147,7 +147,7 @@ static int	cfiscsi_devid(struct ctl_scsi
 static void	cfiscsi_datamove(union ctl_io *io);
 static void	cfiscsi_done(union ctl_io *io);
 static uint32_t	cfiscsi_map_lun(void *arg, uint32_t lun);
-static void	cfiscsi_pdu_update_cmdsn(const struct icl_pdu *request);
+static bool	cfiscsi_pdu_update_cmdsn(const struct icl_pdu *request);
 static void	cfiscsi_pdu_handle_nop_out(struct icl_pdu *request);
 static void	cfiscsi_pdu_handle_scsi_command(struct icl_pdu *request);
 static void	cfiscsi_pdu_handle_task_request(struct icl_pdu *request);
@@ -182,7 +182,7 @@ cfiscsi_pdu_new_response(struct icl_pdu 
 	return (icl_pdu_new_bhs(request->ip_conn, flags));
 }
 
-static void
+static bool
 cfiscsi_pdu_update_cmdsn(const struct icl_pdu *request)
 {
 	const struct iscsi_bhs_scsi_command *bhssc;
@@ -206,7 +206,7 @@ cfiscsi_pdu_update_cmdsn(const struct ic
 	 */
 	if ((request->ip_bhs->bhs_opcode & ~ISCSI_BHS_OPCODE_IMMEDIATE) ==
 	    ISCSI_BHS_OPCODE_SCSI_DATA_OUT)
-		return;
+		return (false);
 
 	/*
 	 * We're only using fields common for all the request
@@ -226,38 +226,39 @@ cfiscsi_pdu_update_cmdsn(const struct ic
 #endif
 
 	/*
-	 * XXX: The target MUST silently ignore any non-immediate command
-	 *	outside of this range or non-immediate duplicates within
-	 *	the range.
+	 * The target MUST silently ignore any non-immediate command outside
+	 * of this range.
+	 *
+	 * XXX:	... or non-immediate duplicates within the range.
 	 */
-	if (cmdsn != cs->cs_cmdsn) {
+	if (cmdsn < cs->cs_cmdsn || cmdsn > cs->cs_cmdsn + maxcmdsn_delta) {
+		CFISCSI_SESSION_UNLOCK(cs);
 		CFISCSI_SESSION_WARN(cs, "received PDU with CmdSN %d, "
 		    "while expected CmdSN was %d", cmdsn, cs->cs_cmdsn);
-		cs->cs_cmdsn = cmdsn + 1;
-		CFISCSI_SESSION_UNLOCK(cs);
-		return;
+		return (true);
 	}
 
-	/*
-	 * XXX: The CmdSN of the rejected command PDU (if it is a non-immediate
-	 *	command) MUST NOT be considered received by the target
-	 *	(i.e., a command sequence gap must be assumed for the CmdSN)
-	 */
-
 	if ((request->ip_bhs->bhs_opcode & ISCSI_BHS_OPCODE_IMMEDIATE) == 0)
 		cs->cs_cmdsn++;
 
 	CFISCSI_SESSION_UNLOCK(cs);
+
+	return (false);
 }
 
 static void
 cfiscsi_pdu_handle(struct icl_pdu *request)
 {
 	struct cfiscsi_session *cs;
+	bool ignore;
 
 	cs = PDU_SESSION(request);
 
-	cfiscsi_pdu_update_cmdsn(request);
+	ignore = cfiscsi_pdu_update_cmdsn(request);
+	if (ignore) {
+		icl_pdu_free(request);
+		return;
+	}
 
 	/*
 	 * Handle the PDU; this includes e.g. receiving the remaining


More information about the svn-src-projects mailing list