pmemblk.c: fix one logic bug - read always with write
authordennis.wu <dennis.wu@intel.com>
Sat, 21 May 2022 15:27:35 +0000 (23:27 +0800)
committerdennis.wu <dennis.wu@intel.com>
Sat, 21 May 2022 22:30:20 +0000 (06:30 +0800)
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 <dennis.wu@intel.com>
engines/pmemblk.c

index fc6358e8e11f3730fc6163127830aaf5bc1ebf7a..849d8a15a0da59d07209c2475b78a1e4098c143a 100644 (file)
@@ -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;