]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] fix 2.5.20 ramdisk
authorRussell King <rmk@arm.linux.org.uk>
Tue, 4 Jun 2002 02:28:48 +0000 (19:28 -0700)
committerLinus Torvalds <torvalds@penguin.transmeta.com>
Tue, 4 Jun 2002 02:28:48 +0000 (19:28 -0700)
2.5.20 seems to be incapable of executing binaries in a ramdisk-based
root filesystem.  The ramdisk in question is an ext2fs, with a 1K
block size loaded via the compressed ramdisk loader in do_mounts().

It appears that, in the case of a 1K block sized filesystem, we attempt
to read two 512-byte sectors into a BIO vector.  The first one is copied
into the first 512 bytes.  The second sector, however, is copied over
the first 512 bytes.  Obviously not what we really want.

Rev. 2, slightly cleaned up:

drivers/block/rd.c

index da9d26130d71fd46b5ad37d655675c3337c4d62d..e3ea81006e4aeb687ea2d2d041f29b7f3148ea1d 100644 (file)
@@ -144,6 +144,7 @@ static int rd_blkdev_pagecache_IO(int rw, struct bio_vec *vec,
 {
        struct address_space * mapping;
        unsigned long index;
+       unsigned int vec_offset;
        int offset, size, err;
 
        err = 0;
@@ -152,6 +153,7 @@ static int rd_blkdev_pagecache_IO(int rw, struct bio_vec *vec,
        index = sector >> (PAGE_CACHE_SHIFT - 9);
        offset = (sector << 9) & ~PAGE_CACHE_MASK;
        size = vec->bv_len;
+       vec_offset = vec->bv_offset;
 
        do {
                int count;
@@ -186,13 +188,14 @@ static int rd_blkdev_pagecache_IO(int rw, struct bio_vec *vec,
                if (rw == READ) {
                        src = kmap(page);
                        src += offset;
-                       dst = kmap(vec->bv_page) + vec->bv_offset;
+                       dst = kmap(vec->bv_page) + vec_offset;
                } else {
                        dst = kmap(page);
                        dst += offset;
-                       src = kmap(vec->bv_page) + vec->bv_offset;
+                       src = kmap(vec->bv_page) + vec_offset;
                }
                offset = 0;
+               vec_offset += count;
 
                memcpy(dst, src, count);