public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kent Overstreet <kent.overstreet@gmail.com>
To: Ming Lei <tom.leiming@gmail.com>
Cc: Ming Lin <mlin@kernel.org>, Jens Axboe <axboe@kernel.dk>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	torvalds@linux-foundation.org
Subject: Re: e827091cb1 "block: merge: get the 1st and last bvec via helpers" broken
Date: Sat, 12 Mar 2016 05:02:56 -0900	[thread overview]
Message-ID: <20160312140256.GA29313@kmo-pixel> (raw)
In-Reply-To: <20160312134843.GA27821@kmo-pixel>

Here's the output of the patch below:

generic/036 11s ...run fstests generic/036 at 2016-03-12 13:58:21
end 4096 0 ffffea0001d611c0 end2 1024 0 ffffea0001d611c0
len 1024 offset 0 page ffffea0001d611c0
KGDB: Waiting for remote debugger

Your code gives a biovec with bv_len of 4096, the old code gives a biovec with
bv_len of 1024 (and then we dump every biovec, we see that the bio had only a
single biovec that did indeed have bv_len == 1024).

bio_get_last_bvec() is broken, please revert your patch for v4.5.

diff --git a/block/blk-merge.c b/block/blk-merge.c
index 261353166d..231aec4fa3 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -318,6 +318,34 @@ static int blk_phys_contig_segment(struct request_queue *q, struct bio *bio,
 	bio_get_last_bvec(bio, &end_bv);
 	bio_get_first_bvec(nxt, &nxt_bv);
 
+	{
+		struct bvec_iter iter;
+		struct bio_vec end2, bv;
+
+		bio_for_each_segment(end2, bio, iter)
+			if (end2.bv_len == iter.bi_size)
+				break;
+
+		if (end_bv.bv_len	!= end2.bv_len ||
+		    end_bv.bv_offset	!= end2.bv_offset ||
+		    end_bv.bv_page	!= end2.bv_page) {
+			printk(KERN_ERR "end %u %u %p end2 %u %u %p\n",
+			      end_bv.bv_len,
+			      end_bv.bv_offset,
+			      end_bv.bv_page,
+			      end2.bv_len,
+			      end2.bv_offset,
+			      end2.bv_page);
+
+			bio_for_each_segment(bv, bio, iter)
+				printk(KERN_ERR "len %u offset %u page %p\n",
+				       bv.bv_len,
+				       bv.bv_offset,
+				       bv.bv_page);
+			BUG();
+		}
+	}
+
 	if (!BIOVEC_PHYS_MERGEABLE(&end_bv, &nxt_bv))
 		return 0;
 

  reply	other threads:[~2016-03-12 14:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-12  7:43 e827091cb1 "block: merge: get the 1st and last bvec via helpers" broken Kent Overstreet
2016-03-12  8:04 ` Ming Lin
2016-03-12  8:49 ` Ming Lei
2016-03-12  9:24   ` Kent Overstreet
2016-03-12 10:36     ` Ming Lei
2016-03-12 12:12       ` Kent Overstreet
2016-03-12 13:33         ` Ming Lei
2016-03-12 13:48           ` Kent Overstreet
2016-03-12 14:02             ` Kent Overstreet [this message]
2016-03-12 14:25               ` Ming Lei
2016-03-12 14:36                 ` Kent Overstreet
2016-03-12 14:39                   ` Ming Lei
2016-03-12 19:51                     ` Linus Torvalds
2016-03-12 21:14                       ` Jens Axboe

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=20160312140256.GA29313@kmo-pixel \
    --to=kent.overstreet@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mlin@kernel.org \
    --cc=tom.leiming@gmail.com \
    --cc=torvalds@linux-foundation.org \
    /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