Date: Thu, 5 Jan 2017 11:37:47 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r311418 - stable/11/sys/cam/ctl Message-ID: <201701051137.v05BblhE053996@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Thu Jan 5 11:37:46 2017 New Revision: 311418 URL: https://svnweb.freebsd.org/changeset/base/311418 Log: MFC r310298: Improve error handling when I/O split between several BIOs. If we get several error codes, handle one with lowest offset. Modified: stable/11/sys/cam/ctl/ctl_backend_block.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_backend_block.c Thu Jan 5 11:36:52 2017 (r311417) +++ stable/11/sys/cam/ctl/ctl_backend_block.c Thu Jan 5 11:37:46 2017 (r311418) @@ -201,7 +201,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; @@ -486,8 +487,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++; @@ -520,7 +525,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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701051137.v05BblhE053996>