From owner-svn-src-all@FreeBSD.ORG Fri Feb 21 18:32:45 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E4B60B1A; Fri, 21 Feb 2014 18:32:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D068E1DB9; Fri, 21 Feb 2014 18:32:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s1LIWjo4097439; Fri, 21 Feb 2014 18:32:45 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s1LIWjh0097438; Fri, 21 Feb 2014 18:32:45 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201402211832.s1LIWjh0097438@svn.freebsd.org> From: Alexander Motin Date: Fri, 21 Feb 2014 18:32:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r262299 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Feb 2014 18:32:46 -0000 Author: mav Date: Fri Feb 21 18:32:45 2014 New Revision: 262299 URL: http://svnweb.freebsd.org/changeset/base/262299 Log: MFC r261538: Make CTL block backend return proper error code for operations unsupposed by the underlying device. Modified: stable/10/sys/cam/ctl/ctl_backend_block.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_backend_block.c Fri Feb 21 16:14:40 2014 (r262298) +++ stable/10/sys/cam/ctl/ctl_backend_block.c Fri Feb 21 18:32:45 2014 (r262299) @@ -512,6 +512,7 @@ ctl_be_block_biodone(struct bio *bio) struct ctl_be_block_io *beio; struct ctl_be_block_lun *be_lun; union ctl_io *io; + int error; beio = bio->bio_caller1; be_lun = beio->lun; @@ -519,8 +520,9 @@ ctl_be_block_biodone(struct bio *bio) DPRINTF("entered\n"); + error = bio->bio_error; mtx_lock(&be_lun->lock); - if (bio->bio_error != 0) + if (error != 0) beio->num_errors++; beio->num_bios_done++; @@ -552,7 +554,9 @@ ctl_be_block_biodone(struct bio *bio) * entire I/O with a medium error. */ if (beio->num_errors > 0) { - if (beio->bio_cmd == BIO_FLUSH) { + if (error == EOPNOTSUPP) { + ctl_set_invalid_opcode(&io->scsiio); + } else if (beio->bio_cmd == BIO_FLUSH) { /* XXX KDM is there is a better error here? */ ctl_set_internal_failure(&io->scsiio, /*sks_valid*/ 1,