scsi_eh_prep_cmnd(9)
π scsi_eh_prep_cmnd(9) β like, the kernel API manual bestie β¨
okay so real talk, this one's from the Kernel API Manual and it's the save-a-SCSI-command-for-error-recovery girlie. her whole job is snapshotting a command so the SCSI error handler can go feral and then put everything back. π
β¨ NAME β¨
scsi_eh_prep_cmnd β bestie, it saves a scsi command info as part of error recovery π«Ά
πΈ SYNOPSIS πΈ
void scsi_eh_prep_cmnd (struct scsi_cmnd *scmd , struct scsi_eh_save
*ses , unsigned char *cmnd , int cmnd_size , unsigned sense_bytes );
no cap, that's the whole signature. five args. she's not complicated, she's just specific. π
π¦ ARGUMENTS π¦
scmdβ the SCSI command structure you're hijacking π like sorry babe, we're taking the wheel for a sec. this is the struct getting its info saved.sesβ the structure that holds the save/restore information. sticky notes for later energy πcmndβ the CDB to send. it can beNULLif no new cmnd is needed β sometimes the assignment is "do nothing", iconic.cmnd_sizeβ size in bytes ofcmnd. and listen, it must be<= MAX_COMMAND_SIZE. not a vibe suggestion, a hard limit. β οΈsense_bytesβ size of sense data to copy. or0. and here's the tea: if!= 0,cmndis ignored π
π DESCRIPTION π
okay so picture it. this function saves a scsi command's information before re-execution, as part of the error recovery process. the way that error recovery just needs a little backup plan, you know? main character energy honestly.
here's the rule that will lowkey catch you if you're not paying attention:
ifsense_bytesis0, the command you send must be one that does not transfer any data. fr fr, zero data movement, don't even think about it.
and then the flip side β if sense_bytes != 0, then cmnd is ignored, and this function wires up a REQUEST_SENSE command and cmnd buffers to read sense_bytes into scmd->sense_buffer. like she just takes over. slay. π₯
π SEE ALSO π
it's giving repertoire, bestie. here's the whole friend group, plus the kernel file that lives at ./drivers/scsi/scsi_error.c:
scsi_schedule_eh(9)scmd_eh_abort_handler(9)scsi_abort_command(9)scsi_eh_reset(9)scsi_eh_scmd_add(9)scsi_timeout(9)scsi_block_when_processing_errors(9)scsi_eh_prt_fail_stats(9)scsi_report_sense(9)scsi_check_sense(9)scsi_eh_completed_normally(9)scsi_eh_done(9)scsi_try_host_reset(9)scsi_try_bus_reset(9)scsi_try_target_reset(9)scsi_try_bus_device_reset(9)scsi_try_to_abort_cmd(9)scsi_eh_restore_cmnd(9)scsi_send_eh_cmnd(9)scsi_request_sense(9)scsi_eh_finish_cmd(9)scsi_eh_get_sense(9)scsi_eh_tur(9)scsi_eh_test_devices(9)scsi_eh_try_stu(9)scsi_eh_bus_device_reset(9)scsi_eh_target_reset(9)scsi_eh_bus_reset(9)scsi_eh_host_reset(9)scsi_eh_offline_sdevs(9)scsi_noretry_cmd(9)scsi_decide_disposition(9)scsi_eh_lock_door(9)scsi_restart_operations(9)scsi_eh_ready_devs(9)scsi_eh_flush_done_q(9)scsi_unjam_host(9)scsi_error_handler(9)scsi_report_bus_reset(9)scsi_report_device_reset(9)scsi_ioctl_reset(9)scsi_get_sense_info_fld(9)
π one last thing π
this page lives in ./drivers/scsi, and it's dated October 2026 β so yeah, she's from the future, and she's still saving your commands. π
β¨ bye bestie, go read scsi_eh_restore_cmnd(9) next, it's literally the other half of this story π«Άπ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms