Cleaned up prin_read_keys since task always passed in
Cleaned up prin_read_keys() to assume task is always passed in, since that is the case.
This commit is contained in:
committed by
Ronnie Sahlberg
parent
4c8770a405
commit
40b0a842d1
@@ -194,47 +194,36 @@ prin_read_keys(struct iscsi_context *iscsi, int lun, struct scsi_task **tp,
|
|||||||
{
|
{
|
||||||
const int buf_sz = 16384;
|
const int buf_sz = 16384;
|
||||||
struct scsi_persistent_reserve_in_read_keys *rk = NULL;
|
struct scsi_persistent_reserve_in_read_keys *rk = NULL;
|
||||||
struct scsi_task *task;
|
|
||||||
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Send PRIN/READ_KEYS");
|
logging(LOG_VERBOSE, "Send PRIN/READ_KEYS");
|
||||||
|
|
||||||
task = iscsi_persistent_reserve_in_sync(iscsi, lun,
|
*tp = iscsi_persistent_reserve_in_sync(iscsi, lun,
|
||||||
SCSI_PERSISTENT_RESERVE_READ_KEYS, buf_sz);
|
SCSI_PERSISTENT_RESERVE_READ_KEYS, buf_sz);
|
||||||
if (task == NULL) {
|
if (*tp == NULL) {
|
||||||
logging(LOG_NORMAL,
|
logging(LOG_NORMAL,
|
||||||
"[FAILED] Failed to send PRIN command: %s",
|
"[FAILED] Failed to send PRIN command: %s",
|
||||||
iscsi_get_error(iscsi));
|
iscsi_get_error(iscsi));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (tp != NULL)
|
|
||||||
*tp = task;
|
|
||||||
|
|
||||||
if (task->status != SCSI_STATUS_GOOD) {
|
if ((*tp)->status != SCSI_STATUS_GOOD) {
|
||||||
logging(LOG_NORMAL,
|
logging(LOG_NORMAL,
|
||||||
"[FAILED] PRIN command: failed with sense. %s",
|
"[FAILED] PRIN command: failed with sense. %s",
|
||||||
iscsi_get_error(iscsi));
|
iscsi_get_error(iscsi));
|
||||||
if (tp == NULL)
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
rk = scsi_datain_unmarshall(task);
|
rk = scsi_datain_unmarshall(*tp);
|
||||||
if (rk == NULL) {
|
if (rk == NULL) {
|
||||||
logging(LOG_NORMAL,
|
logging(LOG_NORMAL,
|
||||||
"[FAIL] failed to unmarshall PRIN/READ_KEYS data. %s",
|
"[FAIL] failed to unmarshall PRIN/READ_KEYS data. %s",
|
||||||
iscsi_get_error(iscsi));
|
iscsi_get_error(iscsi));
|
||||||
if (tp == NULL)
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (rkp != NULL)
|
if (rkp != NULL)
|
||||||
*rkp = rk;
|
*rkp = rk;
|
||||||
|
|
||||||
/* clean up if we are managing our own task */
|
|
||||||
if (tp == NULL)
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user