From b60ccee9a1f0ce878c7270938143a29e6d1eb108 Mon Sep 17 00:00:00 2001 From: "dennis.wu" Date: Sat, 21 May 2022 23:27:35 +0800 Subject: [PATCH] pmemblk.c: fix one logic bug - read always with write logic issue,if read success and return 0, then pmemblk_write called as well: if (io_u->ddir == DDIR_READ && 0 != pmemblk_read(pmb->pmb_pool, buf, off)) { io_u->error = errno; break; } else if (0 != pmemblk_write(pmb->pmb_pool, buf, off)) { io_u->error = errno; break; } Signed-off-by: dennis.wu --- engines/pmemblk.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/engines/pmemblk.c b/engines/pmemblk.c index fc6358e8..849d8a15 100644 --- a/engines/pmemblk.c +++ b/engines/pmemblk.c @@ -375,10 +375,11 @@ static enum fio_q_status fio_pmemblk_queue(struct thread_data *td, off /= pmb->pmb_bsize; len /= pmb->pmb_bsize; while (0 < len) { - if (io_u->ddir == DDIR_READ && - 0 != pmemblk_read(pmb->pmb_pool, buf, off)) { - io_u->error = errno; - break; + if (io_u->ddir == DDIR_READ) { + if (0 != pmemblk_read(pmb->pmb_pool, buf, off)) { + io_u->error = errno; + break; + } } else if (0 != pmemblk_write(pmb->pmb_pool, buf, off)) { io_u->error = errno; break; -- 2.25.1