All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Y. D." <duyuyang@gmail.com>
To: xen-devel <xen-devel@lists.xensource.com>
Cc: Keir Fraser <keir.fraser@eu.citrix.com>
Subject: BUG in blkback? on bio generation
Date: Thu, 25 Dec 2008 15:44:52 +0800	[thread overview]
Message-ID: <200812251544471829730@gmail.com> (raw)

Hi,

Merry Christmas.

I am reading code in blkback.c, while I find that the bio generation might be really bad. 
The bio_add_page() returns length of added bio vector, so if it fails it returns 0.
Therefore, should not bio_add_page() be negated in the while() loop condition??

        for (i = 0; i < nseg; i++) {           
                if (((int)preq.sector_number|(int)seg[i].nsec) &
                    ((bdev_hardsect_size(preq.bdev) >> 9) - 1)) {
                        DPRINTK("Misaligned I/O request from domain %d",
                                blkif->domid);         
                        goto fail_put_bio;     
                }             

                while ((bio == NULL) ||           
          -------->(bio_add_page(bio,                           
                                     virt_to_page(vaddr(pending_req, i)),
                                     seg[i].nsec << 9,              
                                     seg[i].buf & ~PAGE_MASK) == 0)) {
                        bio = biolist[nbio++] = bio_alloc(GFP_KERNEL, nseg-i);
                        if (unlikely(bio == NULL))             
                                goto fail_put_bio;                                                                                                             

                        bio->bi_bdev    = preq.bdev;   
                        bio->bi_private = pending_req; 
                        bio->bi_end_io  = end_block_io_op;
                        bio->bi_sector  = preq.sector_number;                                                                                                  
                }             

                preq.sector_number += seg[i].nsec;
        }

Cheers,
Shawn

             reply	other threads:[~2008-12-25  7:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-25  7:44 Y. D. [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-12-25  7:48 BUG in blkback? on bio generation Y. D.

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=200812251544471829730@gmail.com \
    --to=duyuyang@gmail.com \
    --cc=keir.fraser@eu.citrix.com \
    --cc=xen-devel@lists.xensource.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.