From: Christoph Hellwig <hch@lst.de>
To: Coly Li <colyli@suse.de>
Cc: hch@lst.de, Kent Overstreet <kent.overstreet@gmail.com>,
ming.lei@redhat.com, linux-bcachefs@vger.kernel.org
Subject: Re: bug in bcachefs -> bio_copy_data_iter
Date: Sat, 23 Apr 2022 19:31:23 +0200 [thread overview]
Message-ID: <20220423173123.GA29024@lst.de> (raw)
In-Reply-To: <84ff96fe-ff4b-b58b-b732-88e87fe0b502@suse.de>
On Wed, Nov 10, 2021 at 08:02:06PM +0800, Coly Li wrote:
>> looks like it should be functionally equivalent), but clearly I'm missing
>> something... wonder if there might be some relation to the bug you guys hit in
>> bcache with bvec_virt.
>>
>> Any ideas?
>
> I experience similar one in bcache code during my recent development,
Can you try this patch?
diff --git a/block/bio.c b/block/bio.c
index 4259125e16ab2..ac29c87c6735c 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1336,10 +1336,12 @@ void bio_copy_data_iter(struct bio *dst, struct bvec_iter *dst_iter,
struct bio_vec src_bv = bio_iter_iovec(src, *src_iter);
struct bio_vec dst_bv = bio_iter_iovec(dst, *dst_iter);
unsigned int bytes = min(src_bv.bv_len, dst_bv.bv_len);
- void *src_buf;
+ void *src_buf = bvec_kmap_local(&src_bv);
+ void *dst_buf = bvec_kmap_local(&dst_bv);
- src_buf = bvec_kmap_local(&src_bv);
- memcpy_to_bvec(&dst_bv, src_buf);
+ memcpy(dst_buf, src_buf, bytes);
+
+ kunmap_local(dst_buf);
kunmap_local(src_buf);
bio_advance_iter_single(src, src_iter, bytes);
next prev parent reply other threads:[~2022-04-23 17:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-09 22:04 bug in bcachefs -> bio_copy_data_iter Kent Overstreet
2021-11-10 12:02 ` Coly Li
2022-04-23 17:31 ` Christoph Hellwig [this message]
2022-05-07 18:28 ` Kent Overstreet
2022-05-08 7:41 ` Coly Li
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=20220423173123.GA29024@lst.de \
--to=hch@lst.de \
--cc=colyli@suse.de \
--cc=kent.overstreet@gmail.com \
--cc=linux-bcachefs@vger.kernel.org \
--cc=ming.lei@redhat.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