* [PATCH] squashfs broken when pageszie > blocksize
@ 2009-04-13 19:57 Doug Chapman
2009-04-13 22:51 ` Phillip Lougher
0 siblings, 1 reply; 4+ messages in thread
From: Doug Chapman @ 2009-04-13 19:57 UTC (permalink / raw)
To: linux-kernel; +Cc: phillip
Squashfs is broken on any system where the pageszie is larger than either
the block size of the squashfs image or larger than the metadata size (8192).
This is easily fixed by ensuring cache->pages is always > 0.
Signed-off-by: Doug Chapman <doug.chapman@hp.com>
Cc: Phillip Lougher <phillip@lougher.demon.co.uk>
---
diff --git a/fs/squashfs/cache.c b/fs/squashfs/cache.c
index 1c4739e..c31aa89 100644
--- a/fs/squashfs/cache.c
+++ b/fs/squashfs/cache.c
@@ -252,6 +252,7 @@ struct squashfs_cache *squashfs_cache_init(char *name, int entries,
cache->entries = entries;
cache->block_size = block_size;
cache->pages = block_size >> PAGE_CACHE_SHIFT;
+ cache->pages = cache->pages?cache->pages:1;
cache->name = name;
cache->num_waiters = 0;
spin_lock_init(&cache->lock);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] squashfs broken when pageszie > blocksize
2009-04-13 19:57 [PATCH] squashfs broken when pageszie > blocksize Doug Chapman
@ 2009-04-13 22:51 ` Phillip Lougher
2009-04-17 13:20 ` Geert Uytterhoeven
0 siblings, 1 reply; 4+ messages in thread
From: Phillip Lougher @ 2009-04-13 22:51 UTC (permalink / raw)
To: Doug Chapman; +Cc: linux-kernel
Doug Chapman wrote:
> Squashfs is broken on any system where the pageszie is larger than either
> the block size of the squashfs image or larger than the metadata size (8192).
> This is easily fixed by ensuring cache->pages is always > 0.
>
> Signed-off-by: Doug Chapman <doug.chapman@hp.com>
> Cc: Phillip Lougher <phillip@lougher.demon.co.uk>
>
Good catch. BTW what is the page size on ia64?
For completeness there should also be a mount time check that
the block size used in the Squashfs filesystem is at least as
large as the pagesize. This doesn't matter for metadata
(size 8192), but does matter for data blocks, because Squashfs
read_page doesn't handle block_size < pagesize.
Squashfs read_page used to handle block_size < pagesize but I
removed that code when I removed filesystem support for block_sizes
< 4K. If ia64 users (or any other architecture with larger than
4K pagesizes) want to use Squashfs filesystems with blocksizes less
than their pagesize, then I can put that code back in.
Phillip
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] squashfs broken when pageszie > blocksize
2009-04-13 22:51 ` Phillip Lougher
@ 2009-04-17 13:20 ` Geert Uytterhoeven
2009-04-21 0:02 ` [Squashfs-devel] " Phillip Lougher
0 siblings, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2009-04-17 13:20 UTC (permalink / raw)
To: Phillip Lougher; +Cc: Doug Chapman, linux-kernel, squashfs-devel
On Mon, 13 Apr 2009, Phillip Lougher wrote:
> Doug Chapman wrote:
> > Squashfs is broken on any system where the pageszie is larger than either
> > the block size of the squashfs image or larger than the metadata size
> > (8192).
> > This is easily fixed by ensuring cache->pages is always > 0.
> >
> > Signed-off-by: Doug Chapman <doug.chapman@hp.com>
> > Cc: Phillip Lougher <phillip@lougher.demon.co.uk>
>
> Good catch. BTW what is the page size on ia64?
A quick grep on PAGE_{SIZE,SHIFT} in asm/page.h shows:
ia64, mips, sh: 4/8/16/64 KiB
parisc: 4/16/64 KiB
alpha, cris: 8 KiB
powerpc: 4/16/64/256 KiB
> For completeness there should also be a mount time check that
> the block size used in the Squashfs filesystem is at least as
> large as the pagesize. This doesn't matter for metadata
> (size 8192), but does matter for data blocks, because Squashfs
> read_page doesn't handle block_size < pagesize.
>
> Squashfs read_page used to handle block_size < pagesize but I
> removed that code when I removed filesystem support for block_sizes
> < 4K. If ia64 users (or any other architecture with larger than
> 4K pagesizes) want to use Squashfs filesystems with blocksizes less
> than their pagesize, then I can put that code back in.
So I think it's a good idea to resurrect that code...
With kind regards,
Geert Uytterhoeven
Software Architect
Sony Techsoft Centre Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
Phone: +32 (0)2 700 8453
Fax: +32 (0)2 700 8622
E-mail: Geert.Uytterhoeven@sonycom.com
Internet: http://www.sony-europe.com/
A division of Sony Europe (Belgium) N.V.
VAT BE 0413.825.160 · RPR Brussels
Fortis · BIC GEBABEBB · IBAN BE41293037680010
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [Squashfs-devel] [PATCH] squashfs broken when pageszie > blocksize
2009-04-17 13:20 ` Geert Uytterhoeven
@ 2009-04-21 0:02 ` Phillip Lougher
0 siblings, 0 replies; 4+ messages in thread
From: Phillip Lougher @ 2009-04-21 0:02 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: squashfs-devel, linux-kernel, Doug Chapman
Geert Uytterhoeven wrote:
> A quick grep on PAGE_{SIZE,SHIFT} in asm/page.h shows:
>
> ia64, mips, sh: 4/8/16/64 KiB
> parisc: 4/16/64 KiB
> alpha, cris: 8 KiB
> powerpc: 4/16/64/256 KiB
>
>> For completeness there should also be a mount time check that
>> the block size used in the Squashfs filesystem is at least as
>> large as the pagesize. This doesn't matter for metadata
>> (size 8192), but does matter for data blocks, because Squashfs
>> read_page doesn't handle block_size < pagesize.
>>
>> Squashfs read_page used to handle block_size < pagesize but I
>> removed that code when I removed filesystem support for block_sizes
>> < 4K. If ia64 users (or any other architecture with larger than
>> 4K pagesizes) want to use Squashfs filesystems with blocksizes less
>> than their pagesize, then I can put that code back in.
>
> So I think it's a good idea to resurrect that code...
>
Yes, something else to add to my ASAP TODO list.
Phillip
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-04-21 0:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-13 19:57 [PATCH] squashfs broken when pageszie > blocksize Doug Chapman
2009-04-13 22:51 ` Phillip Lougher
2009-04-17 13:20 ` Geert Uytterhoeven
2009-04-21 0:02 ` [Squashfs-devel] " Phillip Lougher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome