summary refs log tree commit diff
path: root/drivers/scsi/sd.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-23 13:02:03 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-23 13:02:03 -0700
commitf8aea20018aefa51bf818914c9c1ef9006353dbb (patch)
tree36c5ab25fc6808ae635ae69e3f301b11ef52d72f /drivers/scsi/sd.c
parentc3c9897c63ebb0b93b7f78724e38d6ee1da04041 (diff)
parent520a2c2741747062e75f91cd0faddb564fbc64d2 (diff)
downloadlinux-f8aea20018aefa51bf818914c9c1ef9006353dbb.tar.gz
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (21 commits)
  [SCSI] sd: fix computation of the full size of the device
  [SCSI] lib: string_get_size(): don't hang on zero; no decimals on exact
  [SCSI] sun3x_esp: Convert && to ||
  [SCSI] sd: remove command-size switching code
  [SCSI] 3w-9xxx: remove unnecessary local_irq_save/restore for scsi sg copy API
  [SCSI] 3w-xxxx: remove unnecessary local_irq_save/restore for scsi sg copy API
  [SCSI] fix netlink kernel-doc
  [SCSI] sd: Fix handling of NO_SENSE check condition
  [SCSI] export busy state via q->lld_busy_fn()
  [SCSI] refactor sdev/starget/shost busy checking
  [SCSI] mptfusion: Increase scsi-timeouts, similariy to the LSI 4.x driver.
  [SCSI] aic7xxx: Take the LED out of diagnostic mode on PM resume
  [SCSI] aic79xx: user visible misuse wrong SI units (not disk size!)
  [SCSI] ipr: use memory_read_from_buffer()
  [SCSI] aic79xx: fix shadowed variables
  [SCSI] aic79xx: fix shadowed variables, add statics
  [SCSI] aic7xxx: update *_shipped files
  [SCSI] aic7xxx: update .reg files
  [SCSI] aic7xxx: introduce "dont_generate_debug_code" keyword in aicasm parser
  [SCSI] scsi_dh: Initialize path state to be passive when path is not owned
  ...
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r--drivers/scsi/sd.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 43f34c73df12..c9e1242eaf25 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1049,7 +1049,6 @@ static int sd_done(struct scsi_cmnd *SCpnt)
 		good_bytes = sd_completed_bytes(SCpnt);
 		break;
 	case RECOVERED_ERROR:
-	case NO_SENSE:
 		/* Inform the user, but make sure that it's not treated
 		 * as a hard error.
 		 */
@@ -1058,6 +1057,15 @@ static int sd_done(struct scsi_cmnd *SCpnt)
 		memset(SCpnt->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
 		good_bytes = scsi_bufflen(SCpnt);
 		break;
+	case NO_SENSE:
+		/* This indicates a false check condition, so ignore it.  An
+		 * unknown amount of data was transferred so treat it as an
+		 * error.
+		 */
+		scsi_print_sense("sd", SCpnt);
+		SCpnt->result = 0;
+		memset(SCpnt->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
+		break;
 	case ABORTED_COMMAND:
 		if (sshdr.asc == 0x10) { /* DIF: Disk detected corruption */
 			scsi_print_result(SCpnt);
@@ -1071,15 +1079,6 @@ static int sd_done(struct scsi_cmnd *SCpnt)
 			scsi_print_sense("sd", SCpnt);
 			good_bytes = sd_completed_bytes(SCpnt);
 		}
-		if (!scsi_device_protection(SCpnt->device) &&
-		    SCpnt->device->use_10_for_rw &&
-		    (SCpnt->cmnd[0] == READ_10 ||
-		     SCpnt->cmnd[0] == WRITE_10))
-			SCpnt->device->use_10_for_rw = 0;
-		if (SCpnt->device->use_10_for_ms &&
-		    (SCpnt->cmnd[0] == MODE_SENSE_10 ||
-		     SCpnt->cmnd[0] == MODE_SELECT_10))
-			SCpnt->device->use_10_for_ms = 0;
 		break;
 	default:
 		break;
@@ -1432,7 +1431,7 @@ got_data:
 
 	{
 		char cap_str_2[10], cap_str_10[10];
-		u64 sz = sdkp->capacity << ffz(~sector_size);
+		u64 sz = (u64)sdkp->capacity << ilog2(sector_size);
 
 		string_get_size(sz, STRING_UNITS_2, cap_str_2,
 				sizeof(cap_str_2));