All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Ivanov <paivanof@gmail.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Hin-Tak Leung <hintak_leung@yahoo.co.uk>,
	linux-fsdevel@vger.kernel.org,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Christoph Hellwig <hch@tuxera.com>
Subject: Re: Kernel 3.1.0-rc4 oops when connecting iPod
Date: Mon, 12 Sep 2011 22:20:01 -0400	[thread overview]
Message-ID: <CAG1a4rsKQexL8vhAAoJDtnEvqH0rDvPQCiBGM74EH-+pZ9+WPg@mail.gmail.com> (raw)
In-Reply-To: <20110912153129.GA10625@infradead.org>

On Mon, Sep 12, 2011 at 11:31 AM, Christoph Hellwig <hch@infradead.org> 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() ?

WARNING: multiple messages have this Message-ID (diff)
From: Pavel Ivanov <paivanof@gmail.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Hin-Tak Leung <hintak_leung@yahoo.co.uk>,
	linux-fsdevel@vger.kernel.org,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Christoph Hellwig <hch@tuxera.com>
Subject: Re: Kernel 3.1.0-rc4 oops when connecting iPod
Date: Mon, 12 Sep 2011 22:20:01 -0400	[thread overview]
Message-ID: <CAG1a4rsKQexL8vhAAoJDtnEvqH0rDvPQCiBGM74EH-+pZ9+WPg@mail.gmail.com> (raw)
In-Reply-To: <20110912153129.GA10625@infradead.org>

On Mon, Sep 12, 2011 at 11:31 AM, Christoph Hellwig <hch@infradead.org> 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-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2011-09-13  2:20 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-03  3:08 Kernel 3.1.0-rc4 oops when connecting iPod Pavel Ivanov
2011-09-03  3:59 ` Hin-Tak Leung
2011-09-03  3:59   ` Hin-Tak Leung
2011-09-03  4:37   ` Pavel Ivanov
2011-09-03  6:57     ` Hin-Tak Leung
2011-09-03 20:52       ` Pavel Ivanov
2011-09-03 20:52         ` Pavel Ivanov
2011-09-03 23:35         ` Hin-Tak Leung
2011-09-03 23:35           ` Hin-Tak Leung
2011-09-03 23:59           ` Pavel Ivanov
2011-09-03 23:59             ` Pavel Ivanov
2011-09-04  0:37             ` Hin-Tak Leung
2011-09-06  4:35               ` Pavel Ivanov
2011-09-06  4:35                 ` Pavel Ivanov
2011-09-06  5:12                 ` Hin-Tak Leung
2011-09-06  5:12                   ` Hin-Tak Leung
2011-09-06 15:09                   ` Pavel Ivanov
2011-09-06 15:09                     ` Pavel Ivanov
2011-09-11  3:52                     ` Pavel Ivanov
2011-09-11  3:52                       ` Pavel Ivanov
2011-09-11 13:46                       ` Hin-Tak Leung
2011-09-11 13:46                         ` Hin-Tak Leung
2011-09-11 14:14                         ` Christoph Hellwig
2011-09-11 14:12                       ` Christoph Hellwig
2011-09-12 14:34                       ` Christoph Hellwig
2011-09-12 15:19                         ` Pavel Ivanov
2011-09-12 15:19                           ` Pavel Ivanov
2011-09-12 15:31                           ` Christoph Hellwig
2011-09-13  2:20                             ` Pavel Ivanov [this message]
2011-09-13  2:20                               ` Pavel Ivanov
2011-09-14 17:42                               ` Christoph Hellwig
2011-09-15 14:35                                 ` Christoph Hellwig
2011-09-12 15:57                           ` Hin-Tak Leung
2011-09-07 17:59                 ` Seth Forshee
2011-09-07 17:59                   ` Seth Forshee
2011-09-08  3:13                   ` Hin-Tak Leung
2011-09-08  3:13                     ` Hin-Tak Leung
2011-09-08 16:23                     ` Seth Forshee
2011-09-09 12:48                       ` Christoph Hellwig
2011-09-11  3:32                       ` Pavel Ivanov
2011-09-11  3:32                         ` Pavel Ivanov
2011-09-11 14:10                         ` Christoph Hellwig
2011-09-12 14:00                           ` Pavel Ivanov
2011-09-12 15:27                             ` [PATCH] hfsplus: Fix kfree of wrong vhdr pointers Seth Forshee
2011-09-12 15:28                               ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAG1a4rsKQexL8vhAAoJDtnEvqH0rDvPQCiBGM74EH-+pZ9+WPg@mail.gmail.com \
    --to=paivanof@gmail.com \
    --cc=hch@infradead.org \
    --cc=hch@tuxera.com \
    --cc=hintak_leung@yahoo.co.uk \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.