NOP: copy the LUN from target NOP-In to NOP-Out
Signed-off-by: Peter Lieven <pl@kamp.de>
This commit is contained in:
@@ -316,7 +316,7 @@ int iscsi_process_r2t(struct iscsi_context *iscsi, struct iscsi_pdu *pdu,
|
||||
struct iscsi_in_pdu *in);
|
||||
int iscsi_process_reject(struct iscsi_context *iscsi,
|
||||
struct iscsi_in_pdu *in);
|
||||
int iscsi_send_target_nop_out(struct iscsi_context *iscsi, uint32_t ttt);
|
||||
int iscsi_send_target_nop_out(struct iscsi_context *iscsi, uint32_t ttt, uint32_t lun);
|
||||
|
||||
#if defined(WIN32)
|
||||
void iscsi_set_error(struct iscsi_context *iscsi, const char *error_string,
|
||||
|
||||
@@ -91,7 +91,7 @@ iscsi_nop_out_async(struct iscsi_context *iscsi, iscsi_command_cb cb,
|
||||
}
|
||||
|
||||
int
|
||||
iscsi_send_target_nop_out(struct iscsi_context *iscsi, uint32_t ttt)
|
||||
iscsi_send_target_nop_out(struct iscsi_context *iscsi, uint32_t ttt, uint32_t lun)
|
||||
{
|
||||
struct iscsi_pdu *pdu;
|
||||
|
||||
@@ -115,7 +115,7 @@ iscsi_send_target_nop_out(struct iscsi_context *iscsi, uint32_t ttt)
|
||||
iscsi_pdu_set_ttt(pdu, ttt);
|
||||
|
||||
/* lun */
|
||||
iscsi_pdu_set_lun(pdu, 0);
|
||||
iscsi_pdu_set_lun(pdu, lun);
|
||||
|
||||
/* cmdsn is not increased if Immediate delivery*/
|
||||
iscsi_pdu_set_cmdsn(pdu, iscsi->cmdsn);
|
||||
@@ -127,8 +127,8 @@ iscsi_send_target_nop_out(struct iscsi_context *iscsi, uint32_t ttt)
|
||||
}
|
||||
|
||||
ISCSI_LOG(iscsi, (iscsi->nops_in_flight > 1) ? 1 : 6,
|
||||
"NOP Out Send (nops_in_flight: %d, pdu->cmdsn %08x, pdu->itt %08x, pdu->ttt %08x, iscsi->maxcmdsn %08x, iscsi->expcmdsn %08x)",
|
||||
iscsi->nops_in_flight, pdu->cmdsn, 0xffffffff, ttt, iscsi->maxcmdsn, iscsi->expcmdsn);
|
||||
"NOP Out Send (nops_in_flight: %d, pdu->cmdsn %08x, pdu->itt %08x, pdu->ttt %08x, pdu->lun %8x, iscsi->maxcmdsn %08x, iscsi->expcmdsn %08x)",
|
||||
iscsi->nops_in_flight, pdu->cmdsn, 0xffffffff, ttt, lun, iscsi->maxcmdsn, iscsi->expcmdsn);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -321,12 +321,13 @@ int iscsi_process_target_nop_in(struct iscsi_context *iscsi,
|
||||
{
|
||||
uint32_t ttt = scsi_get_uint32(&in->hdr[20]);
|
||||
uint32_t itt = scsi_get_uint32(&in->hdr[16]);
|
||||
uint32_t lun = scsi_get_uint16(&in->hdr[8]);
|
||||
|
||||
iscsi_adjust_statsn(iscsi, in);
|
||||
iscsi_adjust_maxexpcmdsn(iscsi, in);
|
||||
|
||||
ISCSI_LOG(iscsi, (iscsi->nops_in_flight > 1) ? 1 : 6,
|
||||
"NOP-In received (pdu->itt %08x, pdu->ttt %08x, iscsi->maxcmdsn %08x, iscsi->expcmdsn %08x, iscsi->statsn %08x)",
|
||||
"NOP-In received (pdu->itt %08x, pdu->ttt %08x, pdu->lun %8x, iscsi->maxcmdsn %08x, iscsi->expcmdsn %08x, iscsi->statsn %08x)",
|
||||
itt, ttt, iscsi->maxcmdsn, iscsi->expcmdsn, iscsi->statsn);
|
||||
|
||||
/* if the server does not want a response */
|
||||
@@ -334,7 +335,7 @@ int iscsi_process_target_nop_in(struct iscsi_context *iscsi,
|
||||
return 0;
|
||||
}
|
||||
|
||||
iscsi_send_target_nop_out(iscsi, ttt);
|
||||
iscsi_send_target_nop_out(iscsi, ttt, lun);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -671,8 +672,7 @@ iscsi_pdu_set_cdb(struct iscsi_pdu *pdu, struct scsi_task *task)
|
||||
void
|
||||
iscsi_pdu_set_lun(struct iscsi_pdu *pdu, uint32_t lun)
|
||||
{
|
||||
pdu->outdata.data[8] = lun >> 8;
|
||||
pdu->outdata.data[9] = lun & 0xff;
|
||||
scsi_set_uint16(&pdu->outdata.data[8], lun);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user