linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "hch@infradead.org" <hch@infradead.org>
To: Sergei Antonov <saproj@gmail.com>
Cc: Anton Altaparmakov <anton@tuxera.com>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	Anton Altaparmakov <aia21@cam.ac.uk>,
	Al Viro <viro@zeniv.linux.org.uk>,
	"hch@infradead.org" <hch@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Vyacheslav Dubeyko <slava@dubeyko.com>,
	Hin-Tak Leung <htl10@users.sourceforge.net>,
	Sougata Santra <sougata@tuxera.com>
Subject: Re: [PATCH] hfsplus: fix cross-page bio requests
Date: Tue, 9 Jun 2015 22:05:08 -0700	[thread overview]
Message-ID: <20150610050508.GB11894@infradead.org> (raw)
In-Reply-To: <CABikg9wzw8eisscJAK1sHV2sJOhPcmq9dsTJcsFreRjbkyJBvw@mail.gmail.com>

On Wed, Jun 10, 2015 at 01:53:47AM +0200, Sergei Antonov wrote:
> >> +     bio = bio_alloc(GFP_NOIO, 1);
> >> +     if (!bio)
> >> +             return -ENOMEM;
> >> +     bio->bi_iter.bi_sector = sector;
> >> +     bio->bi_bdev = sb->s_bdev;
> >> +     bio->bi_vcnt = 1;
> >> +     bio->bi_iter.bi_size = io_size;
> >> +     bio->bi_io_vec[0].bv_page = virt_to_page(buf);
> >> +     bio->bi_io_vec[0].bv_offset = offset_in_page(buf);
> >> +     bio->bi_io_vec[0].bv_len = io_size;
> >>       ret = submit_bio_wait(rw, bio);
> >
> > I think you need to rethink this.  Think of what you are doing: You are adding a single page to the bio but then submitting io that exceeds the page...
> 
> I'm not adding a single page, I'm adding a single vector.
> This "bio->bi_vcnt = 1; bio->bi_io_vec[0].bv_page = ...; etc."
> approach can be found in a number of places in the kernel. Just
> followed other people's example. And I tested the code too :).

And we're getting right of it because it's problematic.  Please allocate
an optimistic numbero of vectors in bio_alloc and use
bio_add_page as only that takes care of the block driver limits
properly.

      reply	other threads:[~2015-06-10  5:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-10  9:02 [PATCH] hfsplus: fix cross-page bio requests Sergei Antonov
2015-04-10 16:48 ` Viacheslav Dubeyko
2015-06-07 20:05   ` Sergei Antonov
2015-06-07 20:09     ` Sergei Antonov
2015-06-08 17:03       ` Viacheslav Dubeyko
2015-06-08 17:20         ` Sergei Antonov
2015-06-09 16:36           ` Viacheslav Dubeyko
2015-06-09 22:32 ` Anton Altaparmakov
2015-06-09 23:53   ` Sergei Antonov
2015-06-10  5:05     ` hch [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=20150610050508.GB11894@infradead.org \
    --to=hch@infradead.org \
    --cc=aia21@cam.ac.uk \
    --cc=akpm@linux-foundation.org \
    --cc=anton@tuxera.com \
    --cc=htl10@users.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=saproj@gmail.com \
    --cc=slava@dubeyko.com \
    --cc=sougata@tuxera.com \
    --cc=viro@zeniv.linux.org.uk \
    /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).