Add valgrind handling: data read from io_submit was not being marked

properly. Manually mark it.

This might be better done by improving the valgrind wrapper for
io_submit.
This commit is contained in:
Justin Husted 2019-10-04 14:18:33 -07:00 committed by Kent Overstreet
parent 94980e1892
commit e1ed5557bf
2 changed files with 15 additions and 4 deletions

View File

@ -12,10 +12,11 @@ Dependencies:
* libzstd
* pkg-config
* zlib1g
* valgrind
On debian, you can install these with
apt install -y pkg-config libaio-dev libblkid-dev libkeyutils-dev \
liblz4-dev libscrypt-dev libsodium-dev liburcu-dev libzstd-dev \
uuid-dev zlib1g-dev
uuid-dev zlib1g-dev valgrind
Then, just make && make install

View File

@ -10,6 +10,8 @@
#include <libaio.h>
#include <valgrind/memcheck.h>
#include <linux/bio.h>
#include <linux/blkdev.h>
#include <linux/completion.h>
@ -45,12 +47,20 @@ void generic_make_request(struct bio *bio)
iov = alloca(sizeof(*iov) * i);
i = 0;
bio_for_each_segment(bv, bio, iter)
bio_for_each_segment(bv, bio, iter) {
void *start = page_address(bv.bv_page) + bv.bv_offset;
size_t len = bv.bv_len;
iov[i++] = (struct iovec) {
.iov_base = page_address(bv.bv_page) + bv.bv_offset,
.iov_len = bv.bv_len,
.iov_base = start,
.iov_len = len,
};
/* To be pedantic it should only be on IO completion. */
if (bio_op(bio) == REQ_OP_READ)
VALGRIND_MAKE_MEM_DEFINED(start, len);
}
struct iocb iocb = {
.data = bio,
.aio_fildes = bio->bi_opf & REQ_FUA