Re: Kernel 3.1.0-rc4 oops when connecting iPod
From: Pavel Ivanov
Date: Mon Sep 12 2011 - 22:20:42 EST
On Mon, Sep 12, 2011 at 11:31 AM, Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:
> Yes, the shifts were the wrong way around. I'll leave the 9 in for now,
> we use it in so many places and if we're going to clean it up I'd do it
> in ne go.
>
> Index: linux-2.6/fs/hfsplus/super.c
> ===================================================================
> --- linux-2.6.orig/fs/hfsplus/super.c 2011-09-12 11:20:33.866598100 -0400
> +++ linux-2.6/fs/hfsplus/super.c 2011-09-12 11:20:52.538098052 -0400
> @@ -344,6 +344,7 @@ static int hfsplus_fill_super(struct sup
> struct inode *root, *inode;
> struct qstr str;
> struct nls_table *nls = NULL;
> + u64 last_fs_block, last_fs_page;
> int err;
>
> err = -EINVAL;
> @@ -399,9 +400,13 @@ static int hfsplus_fill_super(struct sup
> if (!sbi->rsrc_clump_blocks)
> sbi->rsrc_clump_blocks = 1;
>
> - err = generic_check_addressable(sbi->alloc_blksz_shift,
> - sbi->total_blocks);
> - if (err) {
> + err = -EFBIG;
> + last_fs_block = sbi->total_blocks - 1;
> + last_fs_page = (last_fs_block << sbi->alloc_blksz_shift) >>
> + PAGE_CACHE_SHIFT;
> +
> + if ((last_fs_block > (sector_t)(~0ULL) >> (sbi->alloc_blksz_shift - 9)) ||
> + (last_fs_page > (pgoff_t)(~0ULL))) {
> printk(KERN_ERR "hfs: filesystem size too large.\n");
> goto out_free_vhdr;
> }
>
Christoph,
This patch works for me.
And could you comment on my PAGE_SIZE question?
>> Also I have a little concern about consistency in using
>> PAGE_CACHE_SHIFT and PAGE_SHIFT. hfsplus_read_wrapper() limits visible
>> block size to PAGE_SIZE, not PAGE_CACHE_SIZE. And although now they
>> are equal comment in linux/pagemap.h clearly says that PAGE_CACHE_SIZE
>> can be bigger than PAGE_SIZE. Is it something that should be fixed in
>> hfsplus_read_wrapper() ?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/