• Paolo Bonzini's avatar
    target: support zero allocation length in REQUEST SENSE · 32a8811f
    Paolo Bonzini authored
    Similar to INQUIRY and MODE SENSE, construct the sense data in a
    buffer and later copy it to the scatterlist.  Do not do anything,
    but still clear a pending unit attention condition, if the allocation
    length is zero.
    
    However, SPC tells us that "If a REQUEST SENSE command is terminated with
    CHECK CONDITION status [and] the REQUEST SENSE command was received on
    an I_T nexus with a pending unit attention condition (i.e., before the
    device server reports CHECK CONDITION status), then the device server
    shall not clear the pending unit attention condition."  Do the
    transport_kmap_data_sg early to detect this case.
    
    It also tells us "Device servers shall not adjust the additional sense
    length to reflect truncation if the allocation length is less than the
    sense data available", so do not do that!  Note that the err variable
    is write-only.
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
    32a8811f
target_core_base.h 26.2 KB