Skip to content

Commit 94ebb47

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: target/core: Add target_send_busy()
Introduce a function that sends the SCSI status "BUSY" back to the initiator. The next patch will add a call to this function in the srpt target driver. Reviewed-by: Hannes Reinecke <hare@suse.com> Cc: Nicholas Bellinger <nab@linux-iscsi.org> Cc: Mike Christie <mchristi@redhat.com> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 83f85b8 commit 94ebb47

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

‎drivers/target/target_core_transport.c‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3246,6 +3246,22 @@ transport_send_check_condition_and_sense(struct se_cmd *cmd,
32463246
}
32473247
EXPORT_SYMBOL(transport_send_check_condition_and_sense);
32483248

3249+
/**
3250+
* target_send_busy - Send SCSI BUSY status back to the initiator
3251+
* @cmd: SCSI command for which to send a BUSY reply.
3252+
*
3253+
* Note: Only call this function if target_submit_cmd*() failed.
3254+
*/
3255+
int target_send_busy(struct se_cmd *cmd)
3256+
{
3257+
WARN_ON_ONCE(cmd->se_cmd_flags & SCF_SCSI_TMR_CDB);
3258+
3259+
cmd->scsi_status = SAM_STAT_BUSY;
3260+
trace_target_cmd_complete(cmd);
3261+
return cmd->se_tfo->queue_status(cmd);
3262+
}
3263+
EXPORT_SYMBOL(target_send_busy);
3264+
32493265
static void target_tmr_work(struct work_struct *work)
32503266
{
32513267
struct se_cmd *cmd = container_of(work, struct se_cmd, work);

‎include/target/target_core_fabric.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ int transport_generic_free_cmd(struct se_cmd *, int);
173173
bool transport_wait_for_tasks(struct se_cmd *);
174174
int transport_send_check_condition_and_sense(struct se_cmd *,
175175
sense_reason_t, int);
176+
int target_send_busy(struct se_cmd *cmd);
176177
int target_get_sess_cmd(struct se_cmd *, bool);
177178
int target_put_sess_cmd(struct se_cmd *);
178179
void target_sess_cmd_list_set_waiting(struct se_session *);

0 commit comments

Comments
 (0)