All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Reiser <reiser@namesys.com>
To: Alexander Zarochentsev <zam@namesys.com>
Cc: Isaac Chanin <chanin@wpi.edu>, Steve Olivieri <steve86@wpi.edu>,
	reiserfs-list@namesys.com, vs <vs@thebsh.namesys.com>
Subject: Re: Reiser4 SCSI Bug?
Date: Mon, 31 Oct 2005 00:23:43 -0800	[thread overview]
Message-ID: <4365D48F.4000706@namesys.com> (raw)
In-Reply-To: <200510311042.33297.zam@namesys.com>

Alexander Zarochentsev wrote:

>On Monday 31 October 2005 09:24, Alexander Zarochentsev wrote:
>  
>
>>Hi,
>>
>>On Sunday 30 October 2005 02:13, Isaac Chanin wrote:
>>    
>>
>>>Hi Hans,
>>>
>>>I don't think it's a device driver problem.  My fix derived simply from
>>>noticing that the function where the problem originates is bvec_alloc_bs
>>>in fs/bio.c.
>>>
>>>To trace, the problem goes something like:
>>>(fs/reiser4/wander.c) write_jnodes_to_disk_extent -> (fs/bio.c)
>>>bio_alloc -> bio_alloc_bioset -> bvec_alloc_bs
>>>
>>>In any case, BIO_MAX_PAGES is defined to be 256 in include/linux/bio.h,
>>>thus bvec_alloc_bs returns null, likewise bio_alloc_bioset does the
>>>same, as does bio_alloc.  And thus the error in wander.c.
>>>
>>>Looking at the problem from the other direction, the max_blocks check
>>>that was already in wander.c looks like:
>>>
>>>max_blocks = bdev_get_queue(super->s_bdev)->max_sectors >>
>>>(super->s_blocksize_bits - 9);
>>>
>>>I'd look into the construction of the super block around
>>>s_blocksize_bits, or however max_sectors is derived, to see if there're
>>>any problems there (I suppose a device driver very well could be giving
>>>a bad value that gets used somewhere in that code), but I really don't
>>>know the reiser4 code well enough to do so.  In any case, as a temporary
>>>(or perhaps permanent, as it seems that the limit is hardcoded in the
>>>kernel anyways) solution it would probably be better to put the min(256,
>>>...) check around where max_blocks is set rather than around nr_blocks
>>>inside the while loop.
>>>      
>>>
>>fs/mpage.c  uses bio.h:bio_get_nr_vecs() as below:
>>...
>>alloc_new:
>>	if (bio == NULL) {
>>		bio = mpage_alloc(bdev, blocks[0] << (blkbits - 9),
>>			  	min_t(int, nr_pages, bio_get_nr_vecs(bdev)),
>>				GFP_KERNEL);
>>		if (bio == NULL)
>>			goto confused;
>>	}
>>...
>>
>>would you please check whether the following patch helps as your one does:
>>
>>-----------------------------------------
>>diff --git a/wander.c b/wander.c
>>index 4038000..b606063 100644
>>--- a/wander.c
>>+++ b/wander.c
>>@@ -731,9 +731,7 @@ static int write_jnodes_to_disk_extent(
>> 	assert("zam-570", nr > 0);
>>
>> 	block = *block_p;
>>-	max_blocks =
>>-		bdev_get_queue(super->s_bdev)->max_sectors >>
>>-		(super-> s_blocksize_bits - 9);
>>+	max_blocks = bio_get_nr_vecs(super->s_bdev);
>>
>> 	while (nr > 0) {
>> 		struct bio *bio;
>>======================
>>    
>>
>
>I understood, mpage_writepages() has no such a problem because it 
>submits not more than PAGEVEC_SIZE pages by one BIO.  It does not need to 
>limit bio size by BIO_MAX_PAGES but reiser4 does.
>
>Thanks a lot, Isaac.
>
>I agree with Hans that we should use a constant from the public bio interface 
>rather than a number.
>
>-------------------------------------------
>--- a/wander.c
>+++ b/wander.c
>@@ -731,9 +731,7 @@ static int write_jnodes_to_disk_extent(
>        assert("zam-570", nr > 0);
>
>        block = *block_p;
>-       max_blocks =
>-               bdev_get_queue(super->s_bdev)->max_sectors >>
>-               (super-> s_blocksize_bits - 9);
>+       max_blocks = min(bio_get_nr_vecs(super->s_bdev), BIO_MAX_PAGES);
>
>        while (nr > 0) {
>                struct bio *bio;
>
>=======================
>
>  
>
Please put a thank you to Isaac in the source, and put some solution of
your choice in the patch collection for us to send to akpm.

  reply	other threads:[~2005-10-31  8:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-28 17:49 Reiser4 SCSI Bug? Steve Olivieri
2005-10-29  0:27 ` Isaac Chanin
2005-10-29 16:06   ` Hans Reiser
2005-10-29 23:13     ` Isaac Chanin
2005-10-29 23:18       ` Hans Reiser
2005-10-29 23:33         ` Isaac Chanin
2005-10-30  3:22           ` Hans Reiser
2005-10-30  0:35             ` Isaac Chanin
2005-10-30  6:42               ` Hans Reiser
2005-10-31  2:18                 ` Steve Olivieri
2005-10-31  3:48                   ` Isaac Chanin
2005-10-31 18:31                     ` Steve Olivieri
2005-10-31  6:24       ` Alexander Zarochentsev
2005-10-31  7:42         ` Alexander Zarochentsev
2005-10-31  8:23           ` Hans Reiser [this message]
2005-10-30 22:36 ` Michael James

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=4365D48F.4000706@namesys.com \
    --to=reiser@namesys.com \
    --cc=chanin@wpi.edu \
    --cc=reiserfs-list@namesys.com \
    --cc=steve86@wpi.edu \
    --cc=vs@thebsh.namesys.com \
    --cc=zam@namesys.com \
    /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.