Commit 56b63427 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] loop: BIO handling fix

From: Ben Slusky <sluskyb@paranoiacs.org>

One more patch --- this fixes a minor bio handling bug in the filebacked
code path. I'd fixed it incidentally in the loop-recycle patch.

I don't think you could actually see damage from this bug unless you
run device mapper on top of loop devices, but still this is the correct
behavior.
parent 3185e663
...@@ -264,12 +264,10 @@ do_lo_send(struct loop_device *lo, struct bio_vec *bvec, int bsize, loff_t pos) ...@@ -264,12 +264,10 @@ do_lo_send(struct loop_device *lo, struct bio_vec *bvec, int bsize, loff_t pos)
static int static int
lo_send(struct loop_device *lo, struct bio *bio, int bsize, loff_t pos) lo_send(struct loop_device *lo, struct bio *bio, int bsize, loff_t pos)
{ {
unsigned vecnr; struct bio_vec *bvec;
int ret = 0; int i, ret = 0;
for (vecnr = 0; vecnr < bio->bi_vcnt; vecnr++) {
struct bio_vec *bvec = &bio->bi_io_vec[vecnr];
bio_for_each_segment(bvec, bio, i) {
ret = do_lo_send(lo, bvec, bsize, pos); ret = do_lo_send(lo, bvec, bsize, pos);
if (ret < 0) if (ret < 0)
break; break;
...@@ -333,12 +331,10 @@ do_lo_receive(struct loop_device *lo, ...@@ -333,12 +331,10 @@ do_lo_receive(struct loop_device *lo,
static int static int
lo_receive(struct loop_device *lo, struct bio *bio, int bsize, loff_t pos) lo_receive(struct loop_device *lo, struct bio *bio, int bsize, loff_t pos)
{ {
unsigned vecnr; struct bio_vec *bvec;
int ret = 0; int i, ret = 0;
for (vecnr = 0; vecnr < bio->bi_vcnt; vecnr++) {
struct bio_vec *bvec = &bio->bi_io_vec[vecnr];
bio_for_each_segment(bvec, bio, i) {
ret = do_lo_receive(lo, bvec, bsize, pos); ret = do_lo_receive(lo, bvec, bsize, pos);
if (ret < 0) if (ret < 0)
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment