ctl_backend_block.c (287875) | ctl_backend_block.c (287912) |
---|---|
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 287875 2015-09-16 21:43:51Z mav $"); | 43__FBSDID("$FreeBSD: head/sys/cam/ctl/ctl_backend_block.c 287912 2015-09-17 12:52:18Z 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> --- 485 unchanged lines hidden (view full) --- 537 ctl_set_space_alloc_fail(&io->scsiio); 538 } else if (error == EROFS || error == EACCES) { 539 ctl_set_hw_write_protected(&io->scsiio); 540 } else if (beio->bio_cmd == BIO_FLUSH) { 541 /* XXX KDM is there is a better error here? */ 542 ctl_set_internal_failure(&io->scsiio, 543 /*sks_valid*/ 1, 544 /*retry_count*/ 0xbad2); | 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> --- 485 unchanged lines hidden (view full) --- 537 ctl_set_space_alloc_fail(&io->scsiio); 538 } else if (error == EROFS || error == EACCES) { 539 ctl_set_hw_write_protected(&io->scsiio); 540 } else if (beio->bio_cmd == BIO_FLUSH) { 541 /* XXX KDM is there is a better error here? */ 542 ctl_set_internal_failure(&io->scsiio, 543 /*sks_valid*/ 1, 544 /*retry_count*/ 0xbad2); |
545 } else 546 ctl_set_medium_error(&io->scsiio); | 545 } else { 546 ctl_set_medium_error(&io->scsiio, 547 beio->bio_cmd == BIO_READ); 548 } |
547 ctl_complete_beio(beio); 548 return; 549 } 550 551 /* 552 * If this is a write, a flush, a delete or verify, we're all done. 553 * If this is a read, we can now send the data to the user. 554 */ --- 198 unchanged lines hidden (view full) --- 753 /*now*/ NULL, /*then*/&beio->ds_t0); 754 mtx_unlock(&be_lun->io_lock); 755 756 /* 757 * If we got an error, set the sense data to "MEDIUM ERROR" and 758 * return the I/O to the user. 759 */ 760 if (error != 0) { | 549 ctl_complete_beio(beio); 550 return; 551 } 552 553 /* 554 * If this is a write, a flush, a delete or verify, we're all done. 555 * If this is a read, we can now send the data to the user. 556 */ --- 198 unchanged lines hidden (view full) --- 755 /*now*/ NULL, /*then*/&beio->ds_t0); 756 mtx_unlock(&be_lun->io_lock); 757 758 /* 759 * If we got an error, set the sense data to "MEDIUM ERROR" and 760 * return the I/O to the user. 761 */ 762 if (error != 0) { |
761 char path_str[32]; 762 763 ctl_scsi_path_string(io, path_str, sizeof(path_str)); 764 printf("%s%s command returned errno %d\n", path_str, 765 (beio->bio_cmd == BIO_READ) ? "READ" : "WRITE", error); | |
766 if (error == ENOSPC || error == EDQUOT) { 767 ctl_set_space_alloc_fail(&io->scsiio); 768 } else if (error == EROFS || error == EACCES) { 769 ctl_set_hw_write_protected(&io->scsiio); | 763 if (error == ENOSPC || error == EDQUOT) { 764 ctl_set_space_alloc_fail(&io->scsiio); 765 } else if (error == EROFS || error == EACCES) { 766 ctl_set_hw_write_protected(&io->scsiio); |
770 } else 771 ctl_set_medium_error(&io->scsiio); | 767 } else { 768 ctl_set_medium_error(&io->scsiio, 769 beio->bio_cmd == BIO_READ); 770 } |
772 ctl_complete_beio(beio); 773 return; 774 } 775 776 /* 777 * If this is a write or a verify, we're all done. 778 * If this is a read, we can now send the data to the user. 779 */ --- 149 unchanged lines hidden (view full) --- 929 * If we got an error, set the sense data to "MEDIUM ERROR" and 930 * return the I/O to the user. 931 */ 932 if (error != 0) { 933 if (error == ENOSPC || error == EDQUOT) { 934 ctl_set_space_alloc_fail(&io->scsiio); 935 } else if (error == EROFS || error == EACCES) { 936 ctl_set_hw_write_protected(&io->scsiio); | 771 ctl_complete_beio(beio); 772 return; 773 } 774 775 /* 776 * If this is a write or a verify, we're all done. 777 * If this is a read, we can now send the data to the user. 778 */ --- 149 unchanged lines hidden (view full) --- 928 * If we got an error, set the sense data to "MEDIUM ERROR" and 929 * return the I/O to the user. 930 */ 931 if (error != 0) { 932 if (error == ENOSPC || error == EDQUOT) { 933 ctl_set_space_alloc_fail(&io->scsiio); 934 } else if (error == EROFS || error == EACCES) { 935 ctl_set_hw_write_protected(&io->scsiio); |
937 } else 938 ctl_set_medium_error(&io->scsiio); | 936 } else { 937 ctl_set_medium_error(&io->scsiio, 938 beio->bio_cmd == BIO_READ); 939 } |
939 ctl_complete_beio(beio); 940 return; 941 } 942 943 /* 944 * If this is a write or a verify, we're all done. 945 * If this is a read, we can now send the data to the user. 946 */ --- 2042 unchanged lines hidden --- | 940 ctl_complete_beio(beio); 941 return; 942 } 943 944 /* 945 * If this is a write or a verify, we're all done. 946 * If this is a read, we can now send the data to the user. 947 */ --- 2042 unchanged lines hidden --- |