Skip to contentSkip to conversation

handle buffered writes in read-write test

PATCH Applied Dylan Yudaken 2 participants 2 messages Aug 15, 2022 io_uring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 handle buffered writes in read-write test

When buffered writes are used then two things change:
1 - signals will propogate to the submit() call (as they would be effectively ignored when going async)
2 - CQE ordering will change

Fix the read-write for both of these cases by ignoring the signal and handling CQE ordering.

---
 test/read-write.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
test/read-write.c +4 -1
index c5cc469f258d..f50e8242afa4 100644
@@ -759,6 +759,7 @@ static int test_write_efbig(void)
 			goto err;
 		}
 		io_uring_prep_writev(sqe, fd, &vecs[i], 1, off);
+		io_uring_sqe_set_data64(sqe, i);
 		off += BS;
 	}
 
@@ -774,7 +775,7 @@ static int test_write_efbig(void)
 			fprintf(stderr, "wait_cqe=%d\n", ret);
 			goto err;
 		}
-		if (i < 16) {
+		if (cqe->user_data < 16) {
 			if (cqe->res != BS) {
 				fprintf(stderr, "bad write: %d\n", cqe->res);
 				goto err;
@@ -819,6 +820,8 @@ int main(int argc, char *argv[])
 		t_create_file(fname, FILE_SIZE);
 	}
 
+	signal(SIGXFSZ, SIG_IGN);
+
 	vecs = t_create_buffers(BUFFERS, BS);
 
 	/* if we don't have nonvec read, skip testing that */

base-commit: 15cc446cb8b0caa5c939423d31182eba66141539

Signature · 1 line
2.30.2
maintainer Applied
#1 lore raw
Quoted 9 lines · Dylan Yudaken

When buffered writes are used then two things change:
1 - signals will propogate to the submit() call (as they would be effectively ignored when going async)
2 - CQE ordering will change

Fix the read-write for both of these cases by ignoring the signal and handling CQE ordering.

[...]

Applied, thanks!

[1/1] handle buffered writes in read-write test

      commit: 9adc7ddb158e773c48e25aa1fab7f9f6912a458e

Best regards,

Signature · 1 line
Jens Axboe