Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Feb 2014 18:33:55 +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-9@freebsd.org
Subject:   svn commit: r262300 - stable/9/sys/cam/ctl
Message-ID:  <201402211833.s1LIXt97097643@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Fri Feb 21 18:33:54 2014
New Revision: 262300
URL: http://svnweb.freebsd.org/changeset/base/262300

Log:
  MFC r261538:
  Make CTL block backend return proper error code for operations unsupposed
  by the underlying device.

Modified:
  stable/9/sys/cam/ctl/ctl_backend_block.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/cam/ctl/ctl_backend_block.c
==============================================================================
--- stable/9/sys/cam/ctl/ctl_backend_block.c	Fri Feb 21 18:32:45 2014	(r262299)
+++ stable/9/sys/cam/ctl/ctl_backend_block.c	Fri Feb 21 18:33:54 2014	(r262300)
@@ -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,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201402211833.s1LIXt97097643>