e2fsck "short read error" when checking partition

From: mpakovic (root@fdn.com)
Date: Mon Feb 21 2000 - 02:54:29 EST


I have discovered a bug which causes e2fsck to return with a "Attempt to
read block from filesystem resulted in short read..." when checking
certain partitions. First my pertinent setup:

  /dev/hda 20 GB WD drive
  /dev/hdb 6 GB Quantum drive
  /dev/hdc 13 GB Maxtor drive with geometry [1653/255/63] (3 partitions)
  /dev/hdd LS-120

Since kernel 2.3.40, I have been getting "short read" errors when
attempting to e2fsck /dev/hdc2 and /dev/hdc3. I traced the problem to
fs/partitions/check.c. In the function grok_partitions, if the size input
argument is 0, the blk_size[dev->major] is set to NULL, and never
updated.
When the LS-120 (/dev/hdd) is processed in this function, since
there is no disk in the drive, the size argument is 0, and the
blk_size[dev->major] is set to NULL. This erases the previous pointer
which contained the partition information for /dev/hdc! The fix I'm
using is below, but I don't know if it's the correct way to fix the
problem.

diff -U 3 ./check.c /usr/src/linux/fs/partitions/check.c
--- ./check.c Sun Feb 20 15:21:29 2000
+++ /usr/src/linux/fs/partitions/check.c Mon Feb 21 02:19:25 2000
@@ -396,11 +396,16 @@
         int first_minor = drive << dev->minor_shift;
         int end_minor = first_minor + dev->max_p;
 
- blk_size[dev->major] = NULL;
+ if(!dev->sizes)
+ blk_size[dev->major] = NULL;
+
         dev->part[first_minor].nr_sects = size;
         /* No Such Agen^Wdevice or no minors to use for partitions */
         if (!size || minors == 1)
                 return;
+
+ blk_size[dev->major] = NULL;
+
         check_partition(dev, MKDEV(dev->major, first_minor), 1 + first_minor);
 
          /*
cut--------------------------------------------------------------------------

The first block to report a short read error on /dev/hdc3 was 2492572, and
the next was 2623358. Why with the blk_size[dev->major] (for major 22)
set to NULL, didn't I get "short read" errors for every block? Or on the
other hand, why did I get "short read" errors at all?

V/R

Michael Pakovic

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Feb 23 2000 - 21:00:27 EST