diff options
author | Renato Botelho <renato@netgate.com> | 2017-01-09 12:11:05 -0200 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2017-01-09 12:11:05 -0200 |
commit | 681a482d8fc4bfc14a24f7a9d75cca6337f2a520 (patch) | |
tree | 08368e0c4dcea4baa16f4a34b2cc104c42e1ed27 /sys/cam/ctl/ctl_backend_block.c | |
parent | cbeab2a9b6b7ac70992175202f35fcc05a5821d5 (diff) | |
parent | 91f6edbb8913d163d5c16fb615e84baf8a16d390 (diff) | |
download | FreeBSD-src-681a482d8fc4bfc14a24f7a9d75cca6337f2a520.zip FreeBSD-src-681a482d8fc4bfc14a24f7a9d75cca6337f2a520.tar.gz |
Merge remote-tracking branch 'origin/stable/10' into devel
Diffstat (limited to 'sys/cam/ctl/ctl_backend_block.c')
-rw-r--r-- | sys/cam/ctl/ctl_backend_block.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c index 924455d..8fa93cf 100644 --- a/sys/cam/ctl/ctl_backend_block.c +++ b/sys/cam/ctl/ctl_backend_block.c @@ -203,7 +203,8 @@ struct ctl_be_block_io { int num_bios_sent; int num_bios_done; int send_complete; - int num_errors; + int first_error; + uint64_t first_error_offset; struct bintime ds_t0; devstat_tag_type ds_tag_type; devstat_trans_flags ds_trans_type; @@ -489,8 +490,12 @@ ctl_be_block_biodone(struct bio *bio) error = bio->bio_error; mtx_lock(&be_lun->io_lock); - if (error != 0) - beio->num_errors++; + if (error != 0 && + (beio->first_error == 0 || + bio->bio_offset < beio->first_error_offset)) { + beio->first_error = error; + beio->first_error_offset = bio->bio_offset; + } beio->num_bios_done++; @@ -523,7 +528,8 @@ ctl_be_block_biodone(struct bio *bio) * If there are any errors from the backing device, we fail the * entire I/O with a medium error. */ - if (beio->num_errors > 0) { + error = beio->first_error; + if (error != 0) { if (error == EOPNOTSUPP) { ctl_set_invalid_opcode(&io->scsiio); } else if (error == ENOSPC || error == EDQUOT) { |