From: Mikulas Patocka <mpatocka@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>, Keith Busch <kbusch@kernel.org>,
Sagi Grimberg <sagi@grimberg.me>,
Mike Snitzer <snitzer@kernel.org>,
Milan Broz <gmazyland@gmail.com>,
Anuj gupta <anuj1072538@gmail.com>,
linux-block@vger.kernel.org, dm-devel@lists.linux.dev,
linux-nvme@lists.infradead.org
Subject: Re: [PATCH 1/2 v3] block: change rq_integrity_vec to respect the iterator
Date: Mon, 27 May 2024 17:37:28 +0200 (CEST) [thread overview]
Message-ID: <34bda7d9-378c-5d2-6fd-138a71140cf@redhat.com> (raw)
In-Reply-To: <20240523171922.GA5892@lst.de>
On Thu, 23 May 2024, Christoph Hellwig wrote:
> On Thu, May 23, 2024 at 06:54:47PM +0200, Mikulas Patocka wrote:
> >
> > However, the function rq_integrity_vec has a bug - it returns the first
> > vector of the bio's metadata and completely disregards the metadata
> > iterator that was advanced when the bio was split. Thus, the second bio
> > uses the same metadata as the first bio and this leads to metadata
> > corruption.
> >
> > This commit changes rq_integrity_vec, so that it calls mp_bvec_iter_bvec
> > instead of returning the first vector. mp_bvec_iter_bvec reads the
> > iterator and advances the vector by the iterator.
>
> mp_bvec_iter_bvec does not advance the bvec_iter, it just uses the
> iter to build a bvec for the current position in the iter.
>
> Also please fix the commit log to not use more than 73 characters,
> as-is it will be unreadable in git show output or email replies.
OK. I thought that the limit was 74.
> > -static inline struct bio_vec *rq_integrity_vec(struct request *rq)
> > +static inline struct bio_vec rq_integrity_vec(struct request *rq)
> > {
> > if (WARN_ON_ONCE(queue_max_integrity_segments(rq->q) > 1))
> > + return (struct bio_vec){ };
> > + return mp_bvec_iter_bvec(rq->bio->bi_integrity->bip_vec,
> > + rq->bio->bi_integrity->bip_iter);
>
> The queue_max_integrity_segments check can go away now. Once you
> use the bvec_iter the function works just fine for multiple
> integrity segments and always returns the one at the current iter
> position. That should preferably also documented in a comment.
Yes, I dropped this and I am resending a new version.
> (I'm also pretty sure I've already written this in reply to Anuj's
> version of the patch)
Mikulas
next prev parent reply other threads:[~2024-05-27 15:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-23 16:53 [PATCH 0/2 v3] dm-crypt support for per-sector NVMe metadata Mikulas Patocka
2024-05-23 16:54 ` [PATCH 1/2 v3] block: change rq_integrity_vec to respect the iterator Mikulas Patocka
2024-05-23 17:19 ` Christoph Hellwig
2024-05-27 15:37 ` Mikulas Patocka [this message]
2024-05-23 16:57 ` [PATCH 2/2 v3] dm-crypt: support for per-sector NVMe metadata 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=34bda7d9-378c-5d2-6fd-138a71140cf@redhat.com \
--to=mpatocka@redhat.com \
--cc=anuj1072538@gmail.com \
--cc=axboe@kernel.dk \
--cc=dm-devel@lists.linux.dev \
--cc=gmazyland@gmail.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
--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