ctl_backend_block.c (287670) | ctl_backend_block.c (287760) |
---|---|
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 287670 2015-09-11 14:33:05Z mav $"); | 43__FBSDID("$FreeBSD: head/sys/cam/ctl/ctl_backend_block.c 287760 2015-09-13 16:49:41Z 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> --- 451 unchanged lines hidden (view full) --- 503 * If there are any errors from the backing device, we fail the 504 * entire I/O with a medium error. 505 */ 506 if (beio->num_errors > 0) { 507 if (error == EOPNOTSUPP) { 508 ctl_set_invalid_opcode(&io->scsiio); 509 } else if (error == ENOSPC || error == EDQUOT) { 510 ctl_set_space_alloc_fail(&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> --- 451 unchanged lines hidden (view full) --- 503 * If there are any errors from the backing device, we fail the 504 * entire I/O with a medium error. 505 */ 506 if (beio->num_errors > 0) { 507 if (error == EOPNOTSUPP) { 508 ctl_set_invalid_opcode(&io->scsiio); 509 } else if (error == ENOSPC || error == EDQUOT) { 510 ctl_set_space_alloc_fail(&io->scsiio); |
511 } else if (error == EROFS || error == EACCES) { 512 ctl_set_hw_write_protected(&io->scsiio); |
|
511 } else if (beio->bio_cmd == BIO_FLUSH) { 512 /* XXX KDM is there is a better error here? */ 513 ctl_set_internal_failure(&io->scsiio, 514 /*sks_valid*/ 1, 515 /*retry_count*/ 0xbad2); 516 } else 517 ctl_set_medium_error(&io->scsiio); 518 ctl_complete_beio(beio); --- 196 unchanged lines hidden (view full) --- 715 if (error != 0) { 716 char path_str[32]; 717 718 ctl_scsi_path_string(io, path_str, sizeof(path_str)); 719 printf("%s%s command returned errno %d\n", path_str, 720 (beio->bio_cmd == BIO_READ) ? "READ" : "WRITE", error); 721 if (error == ENOSPC || error == EDQUOT) { 722 ctl_set_space_alloc_fail(&io->scsiio); | 513 } else if (beio->bio_cmd == BIO_FLUSH) { 514 /* XXX KDM is there is a better error here? */ 515 ctl_set_internal_failure(&io->scsiio, 516 /*sks_valid*/ 1, 517 /*retry_count*/ 0xbad2); 518 } else 519 ctl_set_medium_error(&io->scsiio); 520 ctl_complete_beio(beio); --- 196 unchanged lines hidden (view full) --- 717 if (error != 0) { 718 char path_str[32]; 719 720 ctl_scsi_path_string(io, path_str, sizeof(path_str)); 721 printf("%s%s command returned errno %d\n", path_str, 722 (beio->bio_cmd == BIO_READ) ? "READ" : "WRITE", error); 723 if (error == ENOSPC || error == EDQUOT) { 724 ctl_set_space_alloc_fail(&io->scsiio); |
725 } else if (error == EROFS || error == EACCES) { 726 ctl_set_hw_write_protected(&io->scsiio); |
|
723 } else 724 ctl_set_medium_error(&io->scsiio); 725 ctl_complete_beio(beio); 726 return; 727 } 728 729 /* 730 * If this is a write or a verify, we're all done. --- 149 unchanged lines hidden (view full) --- 880 881 /* 882 * If we got an error, set the sense data to "MEDIUM ERROR" and 883 * return the I/O to the user. 884 */ 885 if (error != 0) { 886 if (error == ENOSPC || error == EDQUOT) { 887 ctl_set_space_alloc_fail(&io->scsiio); | 727 } else 728 ctl_set_medium_error(&io->scsiio); 729 ctl_complete_beio(beio); 730 return; 731 } 732 733 /* 734 * If this is a write or a verify, we're all done. --- 149 unchanged lines hidden (view full) --- 884 885 /* 886 * If we got an error, set the sense data to "MEDIUM ERROR" and 887 * return the I/O to the user. 888 */ 889 if (error != 0) { 890 if (error == ENOSPC || error == EDQUOT) { 891 ctl_set_space_alloc_fail(&io->scsiio); |
892 } else if (error == EROFS || error == EACCES) { 893 ctl_set_hw_write_protected(&io->scsiio); |
|
888 } else 889 ctl_set_medium_error(&io->scsiio); 890 ctl_complete_beio(beio); 891 return; 892 } 893 894 /* 895 * If this is a write or a verify, we're all done. --- 2044 unchanged lines hidden --- | 894 } else 895 ctl_set_medium_error(&io->scsiio); 896 ctl_complete_beio(beio); 897 return; 898 } 899 900 /* 901 * If this is a write or a verify, we're all done. --- 2044 unchanged lines hidden --- |