Re: [PATCH] hfsplus: fix cross-page bio requests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux