diff mbox series

test/file-verify.t: Don't run over mlock limit when run as non-root

Message ID 20230420185728.4104-1-krisman@suse.de (mailing list archive)
State New
Headers show
Series test/file-verify.t: Don't run over mlock limit when run as non-root | expand

Commit Message

Gabriel Krisman Bertazi April 20, 2023, 6:57 p.m. UTC
test/file-verify tries to get 2MB of pinned memory at once, which is
higher than the default allowed for non-root users in older
kernels (64kb before v5.16, nowadays 8mb).  Skip the test for non-root
users if the registration fails instead of failing the test.

Signed-off-by: Gabriel Krisman Bertazi <krisman@suse.de>
---
 test/file-verify.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Jens Axboe April 20, 2023, 7:04 p.m. UTC | #1
On Thu, 20 Apr 2023 14:57:28 -0400, Gabriel Krisman Bertazi wrote:
> test/file-verify tries to get 2MB of pinned memory at once, which is
> higher than the default allowed for non-root users in older
> kernels (64kb before v5.16, nowadays 8mb).  Skip the test for non-root
> users if the registration fails instead of failing the test.
> 
> 

Applied, thanks!

[1/1] test/file-verify.t: Don't run over mlock limit when run as non-root
      commit: b7f85996a5cb290fc2ad7d2f4d7341fc54321016

Best regards,
diff mbox series

Patch

diff --git a/test/file-verify.c b/test/file-verify.c
index f33b24a..89cbb02 100644
--- a/test/file-verify.c
+++ b/test/file-verify.c
@@ -381,9 +381,12 @@  static int test(struct io_uring *ring, const char *fname, int buffered,
 			v[i].iov_base = buf[i];
 			v[i].iov_len = CHUNK_SIZE;
 		}
-		ret = io_uring_register_buffers(ring, v, READ_BATCH);
+		ret = t_register_buffers(ring, v, READ_BATCH);
 		if (ret) {
-			fprintf(stderr, "Error buffer reg %d\n", ret);
+			if (ret == T_SETUP_SKIP) {
+				ret = 0;
+				goto free_bufs;
+			}
 			goto err;
 		}
 	}
@@ -477,6 +480,7 @@  static int test(struct io_uring *ring, const char *fname, int buffered,
 done:
 	if (registered)
 		io_uring_unregister_buffers(ring);
+free_bufs:
 	if (vectored) {
 		for (j = 0; j < READ_BATCH; j++)
 			for (i = 0; i < nr_vecs; i++)