Skip to content

Commit

Permalink
Merge branch 'master' of ssh://172.29.0.8/home/folkert/git/iesp
Browse files Browse the repository at this point in the history
  • Loading branch information
folkertvanheusden committed Oct 10, 2024
2 parents af672b3 + 226d29b commit 6a322d4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
17 changes: 13 additions & 4 deletions scsi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -765,11 +765,20 @@ std::optional<scsi_response> scsi::send(const uint64_t lun, const uint8_t *const
if (ok) {
scsi::scsi_rw_result rc = rw_ok;

const uint64_t size_in_blocks = b->get_size_in_blocks();

if (transfer_length == 0) {
for(uint64_t i=lba; i<b->get_size_in_blocks() && rc == rw_ok; i++) {
rc = response.r2t.write_same_is_unmap ?
trim(i, 1) :
write(i, 1, data.first);
if (size_in_blocks - lba > MAX_WS_LEN) {
DOLOG(logging::ll_debug, "scsi::validate_request", "-", "WRITE_SAME maximum number of blocks for TL=0");
response.sense_data = error_invalid_field();
ok = false;
}
else {
for(uint64_t i=lba; i<b->get_size_in_blocks() && rc == rw_ok; i++) {
rc = response.r2t.write_same_is_unmap ?
trim(i, 1) :
write(i, 1, data.first);
}
}
}
else {
Expand Down
4 changes: 3 additions & 1 deletion server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,9 @@ std::tuple<iscsi_pdu_bhs *, bool, uint64_t> server::receive_pdu(com_client *cons
else {
pdu_obj->set_data({ data_temp, data_length });
}
auto incoming_crc32c = crc32_0x11EDC6F41(data_temp, padded_data_length, { });
std::pair<uint32_t, uint32_t> incoming_crc32c { };
if (digest_chk)
incoming_crc32c = crc32_0x11EDC6F41(data_temp, padded_data_length, { });
delete [] data_temp;

(*ses)->add_bytes_rx(padded_data_length);
Expand Down

0 comments on commit 6a322d4

Please sign in to comment.