Re: [PATCH 14/14] target: remove target_submit_cmd_map_sgls

Mike Christie
2021-02-11T18:27:22Z

On 2/11/21 9:17 AM, Christoph Hellwig wrote:
>> + * This function must only be used by drivers that do their own
>> + * sync during shutdown and does not use target_stop_session. If there
>> + * is a failure this function will call into the fabric driver's
>> + * queue_status with a CHECK_CONDITION.
>> */
>> -int target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess,
>> +void target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess,
>> unsigned char *cdb, unsigned char *sense, u64 unpacked_lun,
>> u32 data_length, int task_attr, int data_dir, int flags)
>> {
>> + target_init_cmd(se_cmd, se_sess, sense, unpacked_lun, data_length,
>> + task_attr, data_dir, flags);
>> + target_submit_prep(se_cmd, cdb, NULL, 0, NULL, 0, NULL, 0);
>
> Do we want a WARN_ON_ONCE here to catch the case where the API is
> misued?

It would be nice, but I couldn't figure out how to detect it here.

For example if the driver calls scsi_remove_device to prevent incoming
IO and flush running IO and so they don't need target_stop_session,
then I have no way to detect that above. The driver writer had to know.