Linux-Raid Archives on lore.kernel.org
 help / color / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: Christoph Hellwig <hch@lst.de>, Tejun Heo <tj@kernel.org>,
	Coly Li <colyli@suse.de>, Song Liu <song@kernel.org>,
	device-mapper development <dm-devel@redhat.com>,
	linux-bcache <linux-bcache@vger.kernel.org>,
	"open list:SOFTWARE RAID (Multiple Disks) SUPPORT" 
	<linux-raid@vger.kernel.org>,
	linux-s390 <linux-s390@vger.kernel.org>,
	linux-block <linux-block@vger.kernel.org>
Subject: Re: [PATCH 05/10] block: do not reassig ->bi_bdev when partition remapping
Date: Mon, 25 Jan 2021 19:21:50 +0100
Message-ID: <20210125182150.GA15367@lst.de> (raw)
In-Reply-To: <22e0f687-3165-e9d1-e1bd-9769a11dc0ea@kernel.dk>

On Mon, Jan 25, 2021 at 11:19:23AM -0700, Jens Axboe wrote:
> On 1/25/21 11:18 AM, Christoph Hellwig wrote:
> > On Mon, Jan 25, 2021 at 11:15:04AM -0700, Jens Axboe wrote:
> >> On 1/25/21 11:13 AM, Christoph Hellwig wrote:
> >>> On Mon, Jan 25, 2021 at 11:03:24AM -0700, Jens Axboe wrote:
> >>>> Partition table entries are not in disk order.
> >>>
> >>> And the issue shows up with the series just up to the this patch,
> >>> without any later patches?
> >>
> >> At that patch specifically. I bisected it, and then I double checked
> >> by running the previous commit (boots fine), then apply this one, and
> >> then I run into that error. So it should be 100% reliable.
> > 
> > Ok, I have an idea.  With EOD message you mean this printk, right:
> > 
> > 	pr_info_ratelimited("attempt to access beyond end of device\n"
> >                             "%s: rw=%d, want=%llu, limit=%llu\n",
> > 			    ...
> > 
> > right?
> 
> Yep

Can you give this untested patch a spin?  This should fix the
case where we check the eod for the original partition with the
remapped bi_sectors.  Looking into a local reproducer now.

diff --git a/block/blk-core.c b/block/blk-core.c
index 88f60890443264..6253a2f9a1c08f 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -813,13 +813,16 @@ static noinline_for_stack bool submit_bio_checks(struct bio *bio)
 
 	if (should_fail_bio(bio))
 		goto end_io;
+
 	if (unlikely(bio_check_ro(bio)))
 		goto end_io;
-	if (unlikely(bio_check_eod(bio)))
-		goto end_io;
-	if (bio->bi_bdev->bd_partno && !bio_flagged(bio, BIO_REMAPPED) &&
-	    unlikely(blk_partition_remap(bio)))
-		goto end_io;
+	if (!bio_flagged(bio, BIO_REMAPPED)) {
+		if (unlikely(bio_check_eod(bio)))
+			goto end_io;
+		if (bio->bi_bdev->bd_partno &&
+		    unlikely(blk_partition_remap(bio)))
+			goto end_io;
+	}
 
 	/*
 	 * Filter flush bio's early so that bio based drivers without flush

  reply index

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-24 10:02 store a pointer to the block_device in struct bio (again) v2 Christoph Hellwig
2021-01-24 10:02 ` [PATCH 01/10] brd: remove the end of device check in brd_do_bvec Christoph Hellwig
2021-01-25 13:51   ` Johannes Thumshirn
2021-01-24 10:02 ` [PATCH 02/10] dcssblk: remove the end of device check in dcssblk_submit_bio Christoph Hellwig
2021-01-25 13:52   ` Johannes Thumshirn
2021-01-24 10:02 ` [PATCH 03/10] block: store a block_device pointer in struct bio Christoph Hellwig
2021-01-24 10:02 ` [PATCH 04/10] block: simplify submit_bio_checks a bit Christoph Hellwig
2021-01-25 14:02   ` Johannes Thumshirn
2021-01-24 10:02 ` [PATCH 05/10] block: do not reassig ->bi_bdev when partition remapping Christoph Hellwig
2021-01-25 17:53   ` Jens Axboe
2021-01-25 17:55     ` Christoph Hellwig
     [not found]       ` <2b600368-96fa-7caf-f05b-321de616f7c9@kernel.dk>
2021-01-25 18:03         ` Jens Axboe
2021-01-25 18:13           ` Christoph Hellwig
2021-01-25 18:15             ` Jens Axboe
2021-01-25 18:18               ` Christoph Hellwig
2021-01-25 18:19                 ` Jens Axboe
2021-01-25 18:21                   ` Christoph Hellwig [this message]
2021-01-25 18:31                     ` Jens Axboe
2021-01-24 10:02 ` [PATCH 06/10] block: use ->bi_bdev for bio based I/O accounting Christoph Hellwig
2021-01-24 10:02 ` [PATCH 07/10] blk-mq: use ->bi_bdev for " Christoph Hellwig
2021-01-24 10:02 ` [PATCH 08/10] block: add a disk_uevent helper Christoph Hellwig
2021-01-25 14:14   ` Johannes Thumshirn
2021-01-24 10:02 ` [PATCH 09/10] block: remove DISK_PITER_REVERSE Christoph Hellwig
2021-01-24 10:02 ` [PATCH 10/10] block: use an xarray for disk->part_tbl Christoph Hellwig
2021-01-25 16:24 ` store a pointer to the block_device in struct bio (again) v2 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=20210125182150.GA15367@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=colyli@suse.de \
    --cc=dm-devel@redhat.com \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=song@kernel.org \
    --cc=tj@kernel.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

Linux-Raid Archives on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-raid/0 linux-raid/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-raid linux-raid/ https://lore.kernel.org/linux-raid \
		linux-raid@vger.kernel.org
	public-inbox-index linux-raid

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-raid


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git