mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* 2.4 odd behaviour of ramdisk + cramfs
@ 2003-11-13 16:32 Remco van Mook
  2003-11-13 16:45 ` buffer/page cache aliasing? " bert hubert
  2003-11-13 16:59 ` Meelis Roos
  0 siblings, 2 replies; 6+ messages in thread
From: Remco van Mook @ 2003-11-13 16:32 UTC (permalink / raw)
  To: linux-kernel


I am experiencing a problem when I try to run the following script:

#! /bin/sh
cat /flash/modules-2.4.21 > /dev/ram1
mount -t cramfs -o ro /dev/ram1 /lib/modules

Running it once causes the mount to fail with 'cramfs: wrong magic' - 
running it twice will make mount succeed on the second try.

Oddly enough, repeating the 2 lines within the script doesn't work either.

The behaviour has been reproduced by several people with different 2.4 
kernels.

As I need this to go into some boot scripts, I'd like this to work without 
human intervention.

Any suggestions ?

Remco van Mook

Typical kernel config:
2.4.21 unpatched kernel tree
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_SIZE=4096
CONFIG_BLK_DEV_INITRD=y
CONFIG_CRAMFS=y
CONFIG_TMPFS=y
CONFIG_RAMFS=y


^ permalink raw reply	[flat|nested] 6+ messages in thread

* buffer/page cache aliasing? Re: 2.4 odd behaviour of ramdisk + cramfs
  2003-11-13 16:32 2.4 odd behaviour of ramdisk + cramfs Remco van Mook
@ 2003-11-13 16:45 ` bert hubert
  2003-11-13 16:58   ` Remco van Mook
  2003-11-13 16:59 ` Meelis Roos
  1 sibling, 1 reply; 6+ messages in thread
From: bert hubert @ 2003-11-13 16:45 UTC (permalink / raw)
  To: Remco van Mook; +Cc: linux-kernel

On Thu, Nov 13, 2003 at 05:32:49PM +0100, Remco van Mook wrote:

> #! /bin/sh
> cat /flash/modules-2.4.21 > /dev/ram1
> mount -t cramfs -o ro /dev/ram1 /lib/modules
> 
> Running it once causes the mount to fail with 'cramfs: wrong magic' - 
> running it twice will make mount succeed on the second try.

Sounds like buffer/page cache aliasing perhaps? Does it work with other
filesystems? 

-- 
http://www.PowerDNS.com      Open source, database driven DNS Software 
http://lartc.org           Linux Advanced Routing & Traffic Control HOWTO

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: buffer/page cache aliasing? Re: 2.4 odd behaviour of ramdisk + cramfs
  2003-11-13 16:45 ` buffer/page cache aliasing? " bert hubert
@ 2003-11-13 16:58   ` Remco van Mook
  0 siblings, 0 replies; 6+ messages in thread
From: Remco van Mook @ 2003-11-13 16:58 UTC (permalink / raw)
  To: bert hubert; +Cc: linux-kernel

At 17:45 13-11-2003 +0100, bert hubert wrote:
>On Thu, Nov 13, 2003 at 05:32:49PM +0100, Remco van Mook wrote:
>
> > #! /bin/sh
> > cat /flash/modules-2.4.21 > /dev/ram1
> > mount -t cramfs -o ro /dev/ram1 /lib/modules
> >
> > Running it once causes the mount to fail with 'cramfs: wrong magic' -
> > running it twice will make mount succeed on the second try.
>
>Sounds like buffer/page cache aliasing perhaps? Does it work with other
>filesystems?

I've just checked it with an ext2 filesystem - exactly the same thing happens.

Now, what's more interesting is that if I try again with a bigger filesystem
(3MB instead of 750KB) the problem only appears every now and again.

So it's probably got nothing to do with cramfs in particular, but more with the
size of the filesystem.

Remco


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 2.4 odd behaviour of ramdisk + cramfs
  2003-11-13 16:32 2.4 odd behaviour of ramdisk + cramfs Remco van Mook
  2003-11-13 16:45 ` buffer/page cache aliasing? " bert hubert
@ 2003-11-13 16:59 ` Meelis Roos
  2003-11-13 17:13   ` Remco van Mook
  1 sibling, 1 reply; 6+ messages in thread
From: Meelis Roos @ 2003-11-13 16:59 UTC (permalink / raw)
  To: remco, linux-kernel

RvM> Running it once causes the mount to fail with 'cramfs: wrong magic' - 

Debian kernel has a patch to help cramfs initrd's work. The symptoms
wothout the patch are very similar. This is the patch, extracted from
Debian kernel-source package:

diff -urN linux-2.4.22.orig/fs/block_dev.c linux-2.4.22/fs/block_dev.c
--- linux-2.4.22.orig/fs/block_dev.c     2003-06-01 13:06:32.000000000 +1000
+++ linux-2.4.22/fs/block_dev.c  2003-06-01 20:43:53.000000000 +1000
@@ -95,7 +95,7 @@
        sync_buffers(dev, 2);
        blksize_size[MAJOR(dev)][MINOR(dev)] = size;
        bdev->bd_inode->i_blkbits = blksize_bits(size);
-       kill_bdev(bdev);
+       invalidate_bdev(bdev, 1);
        bdput(bdev);
        return 0;
 }

-- 
Meelis Roos (mroos@linux.ee)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 2.4 odd behaviour of ramdisk + cramfs
  2003-11-13 16:59 ` Meelis Roos
@ 2003-11-13 17:13   ` Remco van Mook
  2003-11-13 17:41     ` Meelis Roos
  0 siblings, 1 reply; 6+ messages in thread
From: Remco van Mook @ 2003-11-13 17:13 UTC (permalink / raw)
  To: Meelis Roos, linux-kernel


Hello Meelis,

thank you ! This patch works for me.

Does it have any side effects or might I suggest that this one is merged 
into the mainstream kernel ?

Cheers,

Remco van Mook

At 18:59 13-11-2003 +0200, Meelis Roos wrote:
>RvM> Running it once causes the mount to fail with 'cramfs: wrong magic' -
>
>Debian kernel has a patch to help cramfs initrd's work. The symptoms
>wothout the patch are very similar. This is the patch, extracted from
>Debian kernel-source package:
>
>diff -urN linux-2.4.22.orig/fs/block_dev.c linux-2.4.22/fs/block_dev.c
>--- linux-2.4.22.orig/fs/block_dev.c     2003-06-01 13:06:32.000000000 +1000
>+++ linux-2.4.22/fs/block_dev.c  2003-06-01 20:43:53.000000000 +1000
>@@ -95,7 +95,7 @@
>         sync_buffers(dev, 2);
>         blksize_size[MAJOR(dev)][MINOR(dev)] = size;
>         bdev->bd_inode->i_blkbits = blksize_bits(size);
>-       kill_bdev(bdev);
>+       invalidate_bdev(bdev, 1);
>         bdput(bdev);
>         return 0;
>  }
>
>--
>Meelis Roos (mroos@linux.ee)
>-
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at  http://www.tux.org/lkml/


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 2.4 odd behaviour of ramdisk + cramfs
  2003-11-13 17:13   ` Remco van Mook
@ 2003-11-13 17:41     ` Meelis Roos
  0 siblings, 0 replies; 6+ messages in thread
From: Meelis Roos @ 2003-11-13 17:41 UTC (permalink / raw)
  To: Remco van Mook; +Cc: linux-kernel

> Does it have any side effects or might I suggest that this one is merged
> into the mainstream kernel ?

None that I know. It is included in Debian unstable packaged 2.4 kernels
for all archs. I use it successfully on x86 with custom kernel.

-- 
Meelis Roos (mroos@linux.ee)


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-11-13 17:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-13 16:32 2.4 odd behaviour of ramdisk + cramfs Remco van Mook
2003-11-13 16:45 ` buffer/page cache aliasing? " bert hubert
2003-11-13 16:58   ` Remco van Mook
2003-11-13 16:59 ` Meelis Roos
2003-11-13 17:13   ` Remco van Mook
2003-11-13 17:41     ` Meelis Roos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®