public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Kanchan Joshi <joshi.k@samsung.com>
To: axboe@kernel.dk, martin.petersen@oracle.com, kbusch@kernel.org,
	hch@lst.de, brauner@kernel.org
Cc: asml.silence@gmail.com, dw@davidwei.uk, io-uring@vger.kernel.org,
	linux-nvme@lists.infradead.org, linux-block@vger.kernel.org,
	gost.dev@samsung.com, Anuj Gupta <anuj20.g@samsung.com>,
	Kanchan Joshi <joshi.k@samsung.com>
Subject: [PATCH 03/10] block: copy result back to user meta buffer correctly in case of split
Date: Fri, 26 Apr 2024 00:09:36 +0530	[thread overview]
Message-ID: <20240425183943.6319-4-joshi.k@samsung.com> (raw)
In-Reply-To: <20240425183943.6319-1-joshi.k@samsung.com>

From: Anuj Gupta <anuj20.g@samsung.com>

In case of split, the len and offset of bvec gets updated in the iter.
Use it to fetch the right bvec, and copy it back to user meta buffer.

Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
Signed-off-by: Kanchan Joshi <joshi.k@samsung.com>
---
 block/bio-integrity.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index c1955f01412e..b4042414a08f 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -108,11 +108,15 @@ static void bio_integrity_uncopy_user(struct bio_integrity_payload *bip)
 	unsigned short nr_vecs = bip->bip_max_vcnt - 1;
 	struct bio_vec *copy = &bip->bip_vec[1];
 	size_t bytes = bip->bip_iter.bi_size;
+	struct bio_vec copy_bvec, src_bvec;
 	struct iov_iter iter;
 	int ret;
 
-	iov_iter_bvec(&iter, ITER_DEST, copy, nr_vecs, bytes);
-	ret = copy_to_iter(bvec_virt(bip->bip_vec), bytes, &iter);
+	copy_bvec = mp_bvec_iter_bvec(copy, bip->bip_iter);
+	src_bvec = mp_bvec_iter_bvec(bip->bip_vec, bip->bip_iter);
+
+	iov_iter_bvec(&iter, ITER_DEST, &copy_bvec, nr_vecs, bytes);
+	ret = copy_to_iter(bvec_virt(&src_bvec), bytes, &iter);
 	WARN_ON_ONCE(ret != bytes);
 
 	bio_integrity_unpin_bvec(copy, nr_vecs, true);
-- 
2.25.1


  parent reply	other threads:[~2024-04-25 18:47 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20240425184649epcas5p42f6ddbfb1c579f043a919973c70ebd03@epcas5p4.samsung.com>
2024-04-25 18:39 ` [PATCH 00/10] Read/Write with meta/integrity Kanchan Joshi
2024-04-25 18:39   ` [PATCH 01/10] block: set bip_vcnt correctly Kanchan Joshi
2024-04-27  7:02     ` Christoph Hellwig
2024-04-27 14:16       ` Keith Busch
2024-04-29 10:59         ` Kanchan Joshi
2024-05-01  7:45         ` Christoph Hellwig
2024-05-01  8:03           ` Keith Busch
2024-04-25 18:39   ` [PATCH 02/10] block: copy bip_max_vcnt vecs instead of bip_vcnt during clone Kanchan Joshi
2024-04-27  7:03     ` Christoph Hellwig
2024-04-29 11:28       ` Kanchan Joshi
2024-04-29 12:04         ` Keith Busch
2024-04-29 17:07           ` Christoph Hellwig
2024-04-30  8:25             ` Keith Busch
2024-05-01  7:46               ` Christoph Hellwig
2024-05-01  7:50         ` Christoph Hellwig
2024-04-25 18:39   ` Kanchan Joshi [this message]
2024-04-27  7:04     ` [PATCH 03/10] block: copy result back to user meta buffer correctly in case of split Christoph Hellwig
2024-04-25 18:39   ` [PATCH 04/10] block: avoid unpinning/freeing the bio_vec incase of cloned bio Kanchan Joshi
2024-04-27  7:05     ` Christoph Hellwig
2024-04-29 11:40       ` Kanchan Joshi
2024-04-29 17:09         ` Christoph Hellwig
2024-05-01 13:02           ` Kanchan Joshi
2024-05-02  7:12             ` Christoph Hellwig
2024-05-03 12:01               ` Kanchan Joshi
2024-04-25 18:39   ` [PATCH 05/10] block, nvme: modify rq_integrity_vec function Kanchan Joshi
2024-04-27  7:18     ` Christoph Hellwig
2024-04-29 11:34       ` Kanchan Joshi
2024-04-29 17:11         ` Christoph Hellwig
2024-04-25 18:39   ` [PATCH 06/10] block: modify bio_integrity_map_user argument Kanchan Joshi
2024-04-27  7:19     ` Christoph Hellwig
2024-04-25 18:39   ` [PATCH 07/10] block: define meta io descriptor Kanchan Joshi
2024-04-25 18:39   ` [PATCH 08/10] io_uring/rw: add support to send meta along with read/write Kanchan Joshi
2024-04-26 14:25     ` Jens Axboe
2024-04-29 20:11       ` Kanchan Joshi
2024-04-25 18:39   ` [PATCH 09/10] block: add support to send meta buffer Kanchan Joshi
2024-04-26 15:21     ` Keith Busch
2024-04-29 11:47       ` Kanchan Joshi
2024-04-25 18:39   ` [PATCH 10/10] nvme: add separate handling for user integrity buffer Kanchan Joshi
2024-04-25 19:56     ` Keith Busch
2024-04-26 10:57     ` kernel test robot
2024-04-26 14:19   ` [PATCH 00/10] Read/Write with meta/integrity 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=20240425183943.6319-4-joshi.k@samsung.com \
    --to=joshi.k@samsung.com \
    --cc=anuj20.g@samsung.com \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=brauner@kernel.org \
    --cc=dw@davidwei.uk \
    --cc=gost.dev@samsung.com \
    --cc=hch@lst.de \
    --cc=io-uring@vger.kernel.org \
    --cc=kbusch@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=martin.petersen@oracle.com \
    /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