linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jean-Denis Girard <jd.girard@sysnux.pf>
To: linux-btrfs@vger.kernel.org
Subject: Re: Mount error on 32 bits, ok on 64 bits
Date: Mon, 2 Oct 2017 13:12:57 -1000	[thread overview]
Message-ID: <c1a58e8c-0beb-eed0-b731-fc4535d55594@sysnux.pf> (raw)
In-Reply-To: <15e1f555-9557-0854-e910-300d882f321d@libero.it>

Le 02/10/2017 à 11:46, Goffredo Baroncelli a écrit :
> On 10/02/2017 07:59 PM, Jean-Denis Girard wrote:
>> Le 30/09/2017 à 17:29, Jean-Denis Girard a écrit :
>>> Le 28/09/2017 à 19:26, Jean-Denis Girard a écrit :
>>> The problem seems to come from commit c821e7f3 "pass bytes to
>>> btrfs_bio_alloc" (https://patchwork.kernel.org/patch/9763081/): the
>>> system is now running fine on 4.13.4 with only that patch reverted.
>>
>> Same situation with 4.14-rc3: my system cannot mount root file-system.
>> If I revert the patch, the system boots normally. This is 100%
>> reproducible. How can I help resolve that issue?
> 
> 
> Looking at the patch, it seems suspect this chunk:
> 
> @@ -2798,7 +2798,7 @@  static int submit_extent_page(int op, int op_flags, struct extent_io_tree *tree,
>  		}
>  	}
>  
> -	bio = btrfs_bio_alloc(bdev, sector);
> +	bio = btrfs_bio_alloc(bdev, sector << 9);
>  	bio_add_page(bio, page, page_size, offset);
>  	bio->bi_end_io = end_io_func;
>  	bio->bi_private = tree;
> 
> Now sector, is defined as
> 
> 	sector_t   [1]
> 
> which in turn it might be defined as 
> 
> 	unsigned long   [2]
> 
> which on 32bit is 32 bit if CONFIG_LBDAF is _not_ defined (CONFIG_LBDAF == Support for large (2TB+) block devices and files)
> 
> The point is that 
> 
> 	sector << 9 
> 
> may overflow if the disk is bigger than 4GB (and in your case it seems to be 8 GB).
> 
> If I am correct, could you please so kindly to 
> 
> - repllay the patch
> - AND try to replace
> 	bio = btrfs_bio_alloc(bdev, sector << 9);
> with
> 	bio = btrfs_bio_alloc(bdev, (u64)sector << 9);

Hi Goffredo,

Thanks for your reply, analysis and correction: it does work, tested on
4.13-rc3, my system boots fine.


Best regards,
-- 
Jean-Denis Girard

SysNux                   Systèmes   Linux   en   Polynésie  française
https://www.sysnux.pf/   Tél: +689 40.50.10.40 / GSM: +689 87.797.527


      parent reply	other threads:[~2017-10-02 23:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-29  1:29 Mount error on 32 bits, ok on 64 bits Jean-Denis Girard
2017-09-29  5:26 ` Jean-Denis Girard
2017-10-01  3:29   ` Jean-Denis Girard
2017-10-02 17:59     ` Jean-Denis Girard
2017-10-02 21:46       ` Goffredo Baroncelli
2017-10-02 21:50         ` Goffredo Baroncelli
2017-10-02 23:12         ` Jean-Denis Girard [this message]

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=c1a58e8c-0beb-eed0-b731-fc4535d55594@sysnux.pf \
    --to=jd.girard@sysnux.pf \
    --cc=linux-btrfs@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).