Skip to content

Commit

Permalink
Update LUN handling
Browse files Browse the repository at this point in the history
  • Loading branch information
uweseimet committed Jan 23, 2024
1 parent 3dee5dd commit 2ab78f6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cpp/controllers/generic_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,18 +144,19 @@ void GenericController::Execute()
ResetOffset();
SetBlocks(1);

int lun = GetEffectiveLun();

// Discard pending sense data from the previous command if the current command is not REQUEST SENSE
if (GetOpcode() != scsi_command::cmd_request_sense) {
SetStatus(status::good);

int lun = GetEffectiveLun();
if (!HasDeviceForLun(lun)) {
lun = 0;
}
GetDeviceForLun(lun)->SetStatusCode(0);
}

int lun = GetEffectiveLun();
if (!HasDeviceForLun(lun)) {
if (GetOpcode() != scsi_command::cmd_inquiry && GetOpcode() != scsi_command::cmd_request_sense) {
LogTrace(fmt::format("Invalid LUN {}", lun));
Expand Down

0 comments on commit 2ab78f6

Please sign in to comment.