DM-Devel Archive mirror
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Keith Busch <kbusch@kernel.org>
Cc: Mikulas Patocka <mpatocka@redhat.com>,
	Mike Snitzer <snitzer@kernel.org>, Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, dm-devel@lists.linux.dev
Subject: Re: block: fail unaligned bio from submit_bio_noacct()
Date: Sun, 24 Mar 2024 16:02:56 +0800	[thread overview]
Message-ID: <Zf/eMPDG2uotSg4M@fedora> (raw)
In-Reply-To: <ZfzvSguRii37MErS@kbusch-mbp>

On Thu, Mar 21, 2024 at 08:39:06PM -0600, Keith Busch wrote:
> On Fri, Mar 22, 2024 at 10:08:11AM +0800, Ming Lei wrote:
> > On Thu, Mar 21, 2024 at 06:01:41PM +0100, Mikulas Patocka wrote:
> > > I would change it to
> > > 
> > > if (unlikely(((bi_iter.bi_sector | bio_sectors(bio)) & ((queue_logical_block_size(q) >> 9) - 1)) != 0))
> > > 	return false;
> > 
> > What if bio->bi_iter.bi_size isn't aligned with 512? The above check
> > can't find that at all.
> 
> Shouldn't that mean this check doesn't apply to REQ_OP_DRV_IN/OUT?

For REQ_OP_DRV_IN/OUT, only the real user IO command may need the check,
and others needn't this check, maybe they don't use .bi_sector or
.bi_size at all.

> Those ops don't necessarily imply any alignment requirements. It may not
> matter here since it looks like all existing users go through
> blk_execute_rq() instead of submit_bio(), but there are other checks for
> DRV_IN/OUT in this path, so I guess it is supposed to be supported?

This patch focuses on FS bio, and passthough request case is more
complicated, and we even don't have central entry for real user pt IO
request only.


Thanks, 
Ming


  reply	other threads:[~2024-03-24  8:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240321131634.1009972-1-ming.lei@redhat.com>
2024-03-21 15:43 ` block: fail unaligned bio from submit_bio_noacct() Mike Snitzer
2024-03-21 17:01   ` Mikulas Patocka
2024-03-21 22:07     ` Christoph Hellwig
2024-03-22  2:08     ` Ming Lei
2024-03-22  2:39       ` Keith Busch
2024-03-24  8:02         ` Ming Lei [this message]
2024-03-22 10:16       ` Mikulas Patocka

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=Zf/eMPDG2uotSg4M@fedora \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=dm-devel@lists.linux.dev \
    --cc=kbusch@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=snitzer@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
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 read-only IMAP folder(s) and NNTP newsgroup(s).