coreos / go-tcmu

Go SCSI emulation via the Linux TCM in Userspace module
Apache License 2.0
53 stars 26 forks source link

command handler doesn't output the read and write errors #9

Open nak3 opened 7 years ago

nak3 commented 7 years ago

Current codes check the result of Read or Write like this:

  n, err := r.ReadAt(cmd.Buf[:length], int64(offset))
    if n < length {
        log.Errorln("read/read failed: unable to copy enough")
        return cmd.MediumError(), nil
    }
    if err != nil {
        log.Errorln("read/read failed: error:", err)
        return cmd.MediumError(), nil
    }

When Read() and Write() return error, they always make n < length true, and so they return before outputting the error.