public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] test/file-verify.t: Don't run over mlock limit when run as non-root
@ 2023-04-20 18:57 Gabriel Krisman Bertazi
  2023-04-20 19:04 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Gabriel Krisman Bertazi @ 2023-04-20 18:57 UTC (permalink / raw)
  To: axboe; +Cc: io-uring, Gabriel Krisman Bertazi

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 <[email protected]>
---
 test/file-verify.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

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++)
-- 
2.40.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] test/file-verify.t: Don't run over mlock limit when run as non-root
  2023-04-20 18:57 [PATCH] test/file-verify.t: Don't run over mlock limit when run as non-root Gabriel Krisman Bertazi
@ 2023-04-20 19:04 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2023-04-20 19:04 UTC (permalink / raw)
  To: Gabriel Krisman Bertazi; +Cc: io-uring


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,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-04-20 19:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-20 18:57 [PATCH] test/file-verify.t: Don't run over mlock limit when run as non-root Gabriel Krisman Bertazi
2023-04-20 19:04 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox