Deleted Added
full compact
ctl_backend_block.c (278672) ctl_backend_block.c (282565)
1/*-
2 * Copyright (c) 2003 Silicon Graphics International Corp.
3 * Copyright (c) 2009-2011 Spectra Logic Corporation
4 * Copyright (c) 2012 The FreeBSD Foundation
5 * All rights reserved.
6 *
7 * Portions of this software were developed by Edward Tomasz Napierala
8 * under sponsorship from the FreeBSD Foundation.

--- 26 unchanged lines hidden (view full) ---

35 * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl_backend_block.c#5 $
36 */
37/*
38 * CAM Target Layer driver backend for block devices.
39 *
40 * Author: Ken Merry <ken@FreeBSD.org>
41 */
42#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2003 Silicon Graphics International Corp.
3 * Copyright (c) 2009-2011 Spectra Logic Corporation
4 * Copyright (c) 2012 The FreeBSD Foundation
5 * All rights reserved.
6 *
7 * Portions of this software were developed by Edward Tomasz Napierala
8 * under sponsorship from the FreeBSD Foundation.

--- 26 unchanged lines hidden (view full) ---

35 * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl_backend_block.c#5 $
36 */
37/*
38 * CAM Target Layer driver backend for block devices.
39 *
40 * Author: Ken Merry <ken@FreeBSD.org>
41 */
42#include <sys/cdefs.h>
43__FBSDID("$FreeBSD: head/sys/cam/ctl/ctl_backend_block.c 278672 2015-02-13 13:26:23Z mav $");
43__FBSDID("$FreeBSD: head/sys/cam/ctl/ctl_backend_block.c 282565 2015-05-06 19:47:31Z mav $");
44
45#include <sys/param.h>
46#include <sys/systm.h>
47#include <sys/kernel.h>
48#include <sys/types.h>
49#include <sys/kthread.h>
50#include <sys/bio.h>
51#include <sys/fcntl.h>

--- 464 unchanged lines hidden (view full) ---

516
517 /*
518 * If there are any errors from the backing device, we fail the
519 * entire I/O with a medium error.
520 */
521 if (beio->num_errors > 0) {
522 if (error == EOPNOTSUPP) {
523 ctl_set_invalid_opcode(&io->scsiio);
44
45#include <sys/param.h>
46#include <sys/systm.h>
47#include <sys/kernel.h>
48#include <sys/types.h>
49#include <sys/kthread.h>
50#include <sys/bio.h>
51#include <sys/fcntl.h>

--- 464 unchanged lines hidden (view full) ---

516
517 /*
518 * If there are any errors from the backing device, we fail the
519 * entire I/O with a medium error.
520 */
521 if (beio->num_errors > 0) {
522 if (error == EOPNOTSUPP) {
523 ctl_set_invalid_opcode(&io->scsiio);
524 } else if (error == ENOSPC) {
524 } else if (error == ENOSPC || error == EDQUOT) {
525 ctl_set_space_alloc_fail(&io->scsiio);
526 } else if (beio->bio_cmd == BIO_FLUSH) {
527 /* XXX KDM is there is a better error here? */
528 ctl_set_internal_failure(&io->scsiio,
529 /*sks_valid*/ 1,
530 /*retry_count*/ 0xbad2);
531 } else
532 ctl_set_medium_error(&io->scsiio);

--- 200 unchanged lines hidden (view full) ---

733 * return the I/O to the user.
734 */
735 if (error != 0) {
736 char path_str[32];
737
738 ctl_scsi_path_string(io, path_str, sizeof(path_str));
739 printf("%s%s command returned errno %d\n", path_str,
740 (beio->bio_cmd == BIO_READ) ? "READ" : "WRITE", error);
525 ctl_set_space_alloc_fail(&io->scsiio);
526 } else if (beio->bio_cmd == BIO_FLUSH) {
527 /* XXX KDM is there is a better error here? */
528 ctl_set_internal_failure(&io->scsiio,
529 /*sks_valid*/ 1,
530 /*retry_count*/ 0xbad2);
531 } else
532 ctl_set_medium_error(&io->scsiio);

--- 200 unchanged lines hidden (view full) ---

733 * return the I/O to the user.
734 */
735 if (error != 0) {
736 char path_str[32];
737
738 ctl_scsi_path_string(io, path_str, sizeof(path_str));
739 printf("%s%s command returned errno %d\n", path_str,
740 (beio->bio_cmd == BIO_READ) ? "READ" : "WRITE", error);
741 if (error == ENOSPC) {
741 if (error == ENOSPC || error == EDQUOT) {
742 ctl_set_space_alloc_fail(&io->scsiio);
743 } else
744 ctl_set_medium_error(&io->scsiio);
745 ctl_complete_beio(beio);
746 return;
747 }
748
749 /*

--- 140 unchanged lines hidden (view full) ---

890 /*now*/ NULL, /*then*/&beio->ds_t0);
891 mtx_unlock(&be_lun->io_lock);
892
893 /*
894 * If we got an error, set the sense data to "MEDIUM ERROR" and
895 * return the I/O to the user.
896 */
897 if (error != 0) {
742 ctl_set_space_alloc_fail(&io->scsiio);
743 } else
744 ctl_set_medium_error(&io->scsiio);
745 ctl_complete_beio(beio);
746 return;
747 }
748
749 /*

--- 140 unchanged lines hidden (view full) ---

890 /*now*/ NULL, /*then*/&beio->ds_t0);
891 mtx_unlock(&be_lun->io_lock);
892
893 /*
894 * If we got an error, set the sense data to "MEDIUM ERROR" and
895 * return the I/O to the user.
896 */
897 if (error != 0) {
898 if (error == ENOSPC) {
898 if (error == ENOSPC || error == EDQUOT) {
899 ctl_set_space_alloc_fail(&io->scsiio);
900 } else
901 ctl_set_medium_error(&io->scsiio);
902 ctl_complete_beio(beio);
903 return;
904 }
905
906 /*

--- 2041 unchanged lines hidden ---
899 ctl_set_space_alloc_fail(&io->scsiio);
900 } else
901 ctl_set_medium_error(&io->scsiio);
902 ctl_complete_beio(beio);
903 return;
904 }
905
906 /*

--- 2041 unchanged lines hidden ---