[kernel] r17400 - in dists/lenny/linux-2.6/debian: . patches/bugfix/all patches/series

Dann Frazier dannf at alioth.debian.org
Mon May 16 00:56:32 UTC 2011


Author: dannf
Date: Mon May 16 00:56:30 2011
New Revision: 17400

Log:
scsi: fix medium error problems with some arrays which can cause data corruption

Added:
   dists/lenny/linux-2.6/debian/patches/bugfix/all/fix-medium-error-problems-with-some-arrays-which-can-cause-data-corruption.patch
Modified:
   dists/lenny/linux-2.6/debian/changelog
   dists/lenny/linux-2.6/debian/patches/series/27

Modified: dists/lenny/linux-2.6/debian/changelog
==============================================================================
--- dists/lenny/linux-2.6/debian/changelog	Mon May 16 00:56:22 2011	(r17399)
+++ dists/lenny/linux-2.6/debian/changelog	Mon May 16 00:56:30 2011	(r17400)
@@ -8,6 +8,8 @@
 
   [ dann frazier ]
   * Include selected backports from 2.6.27.59:
+    - scsi: fix medium error problems with some arrays which can cause
+            data corruption
 
  -- Ben Hutchings <ben at decadent.org.uk>  Mon, 29 Nov 2010 02:01:24 +0000
 

Added: dists/lenny/linux-2.6/debian/patches/bugfix/all/fix-medium-error-problems-with-some-arrays-which-can-cause-data-corruption.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/lenny/linux-2.6/debian/patches/bugfix/all/fix-medium-error-problems-with-some-arrays-which-can-cause-data-corruption.patch	Mon May 16 00:56:30 2011	(r17400)
@@ -0,0 +1,58 @@
+commit 26398c096c180d5f02b0f379c12994cc8c639157
+Author: James Bottomley <James.Bottomley at suse.de>
+Date:   Fri Dec 17 15:36:34 2010 -0500
+
+    fix medium error problems with some arrays which can cause data corruption
+    
+    commit a8733c7baf457b071528e385a0b7d4aaec79287c upstream.
+    
+    Our current handling of medium error assumes that data is returned up
+    to the bad sector.  This assumption holds good for all disk devices,
+    all DIF arrays and most ordinary arrays.  However, an LSI array engine
+    was recently discovered which reports a medium error without returning
+    any data.  This means that when we report good data up to the medium
+    error, we've reported junk originally in the buffer as good.  Worse,
+    if the read consists of requested data plus a readahead, and the error
+    occurs in readahead, we'll just strip off the readahead and report
+    junk up to userspace as good data with no error.
+    
+    The fix for this is to have the error position computation take into
+    account the amount of data returned by the driver using the scsi
+    residual data.  Unfortunately, not every driver fills in this data,
+    but for those who don't, it's set to zero, which means we'll think a
+    full set of data was transferred and the behaviour will be identical
+    to the prior behaviour of the code (believe the buffer up to the error
+    sector).  All modern drivers seem to set the residual, so that should
+    fix up the LSI failure/corruption case.
+    
+    Reported-by: Douglas Gilbert <dgilbert at interlog.com>
+    Signed-off-by: James Bottomley <James.Bottomley at suse.de>
+    Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>
+    [dannf: backported to Debian's 2.6.26]
+
+diff -urpN linux-source-2.6.26.orig/drivers/scsi/sd.c linux-source-2.6.26/drivers/scsi/sd.c
+--- linux-source-2.6.26.orig/drivers/scsi/sd.c	2008-07-13 23:51:29.000000000 +0200
++++ linux-source-2.6.26/drivers/scsi/sd.c	2011-05-10 17:29:03.605180930 +0200
+@@ -944,6 +944,12 @@ static int sd_done(struct scsi_cmnd *SCp
+ 	int sense_valid = 0;
+ 	int sense_deferred = 0;
+ 	int info_valid;
++	/*
++	 * resid is optional but mostly filled in.  When it's unused,
++	 * its value is zero, so we assume the whole buffer transferred
++	 */
++	unsigned int transferred = scsi_bufflen(scmd) - scsi_get_resid(scmd);
++	unsigned int good_bytes;
+ 
+ 	if (result) {
+ 		sense_valid = scsi_command_normalize_sense(SCpnt, &sshdr);
+@@ -997,7 +1003,8 @@ static int sd_done(struct scsi_cmnd *SCp
+ 		/* This computation should always be done in terms of
+ 		 * the resolution of the device's medium.
+ 		 */
+-		good_bytes = (bad_lba - start_lba)*SCpnt->device->sector_size;
++		good_bytes = min((bad_lba - start_lba) * 
++				 SCpnt->device->sector_size, transferred);
+ 		break;
+ 	case RECOVERED_ERROR:
+ 	case NO_SENSE:

Modified: dists/lenny/linux-2.6/debian/patches/series/27
==============================================================================
--- dists/lenny/linux-2.6/debian/patches/series/27	Mon May 16 00:56:22 2011	(r17399)
+++ dists/lenny/linux-2.6/debian/patches/series/27	Mon May 16 00:56:30 2011	(r17400)
@@ -1,3 +1,4 @@
 + bugfix/all/md-deal-with-merge_bvec_fn-in-component-devices-bett.patch
 + bugfix/all/dm-Deal-with-merge_bvec_fn-in-component-devices-bett.patch
 + bugfix/all/rt2x00-Fix-memleak-when-RTS-CTS-fails.patch
++ bugfix/all/fix-medium-error-problems-with-some-arrays-which-can-cause-data-corruption.patch



More information about the Kernel-svn-changes mailing list