mtdblock_ro and ext2 yields panic: block not locked

Eugene Surovegin ebs at innocent.com
Wed Oct 23 13:22:57 EDT 2002


Bill,

At 10:18 AM 10/23/2002, you wrote:
>Care to post the patch?  I'd love to see if it fixes my problem...

Sure :)
Here it is:

diff -ur a/drivers/mtd/mtdblock_ro.c b/drivers/mtd/mtdblock_ro.c
--- a/drivers/mtd/mtdblock_ro.c
+++ b/drivers/mtd/mtdblock_ro.c
@@ -138,10 +138,11 @@
        }

        if (current_request->sector << 9 > mtd->size ||
-         (current_request->sector + current_request->nr_sectors) << 9 > 
mtd->size)
+         (current_request->sector + current_request->current_nr_sectors) 
<< 9 > mtd->size)
        {
          printk("mtd: Attempt to read past end of device!\n");
-        printk("size: %x, sector: %lx, nr_sectors %lx\n", mtd->size, 
current_request->sector, current_request->nr_sectors);
+        printk("size: %x, sector: %lx, nr_sectors %lx\n", mtd->size, 
current_request->sector,
+               current_request->current_nr_sectors);
          end_request(0);
          continue;
        }
@@ -162,7 +163,7 @@

          case READ:
          if (MTD_READ(mtd,current_request->sector<<9,
-                     current_request->nr_sectors << 9,
+                     current_request->current_nr_sectors << 9,
                       &retlen, current_request->buffer) == 0)
             res = 1;
          else
@@ -184,7 +185,7 @@

          // Do the write
          if (MTD_WRITE(mtd,current_request->sector<<9,
-                      current_request->nr_sectors << 9,
+                      current_request->current_nr_sectors << 9,
                        &retlen, current_request->buffer) == 0)
             res = 1;
          else
@@ -287,7 +288,7 @@
  static void __exit cleanup_mtdblock(void)
  {
         unregister_blkdev(MAJOR_NR,DEVICE_NAME);
-       blksize_size[MAJOR_NR] = NULL;
+       blk_size[MAJOR_NR] = NULL;
         blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
  }





  Eugene Surovegin <mailto:ebs at innocent.com>





More information about the linux-mtd mailing list