fs.aio-nr accounts number of aio events requested by user via io_setup()
syscall. The kernel usually creates more events than was requested.
CRIU doesn't care about the number of requested events, it cares only
about created events. So while restoring the process CRIU requests
in io_setup() the number of actually created events. This leads
to inconsistent value of fs.aio-nr after the restore.

Let's account in fs.aio-nr a number of created events, not requested.

https://jira.sw.ru/browse/PSBM-47209

Signed-off-by: Andrey Ryabinin <aryabi...@virtuozzo.com>
---
 fs/aio.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/aio.c b/fs/aio.c
index 29d02ab..19ebcd1 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -633,12 +633,12 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
 
        /* limit the number of system wide aios */
        spin_lock(&ve->aio_nr_lock);
-       if (ve->aio_nr + nr_events > ve->aio_max_nr ||
-           ve->aio_nr + nr_events < ve->aio_nr) {
+       if (ve->aio_nr + ctx->nr_events > ve->aio_max_nr ||
+           ve->aio_nr + ctx->nr_events < ve->aio_nr) {
                spin_unlock(&ve->aio_nr_lock);
                goto out_cleanup;
        }
-       ve->aio_nr += ctx->max_reqs;
+       ve->aio_nr += ctx->nr_events;
        spin_unlock(&ve->aio_nr_lock);
 
        /* now link into global list. */
-- 
2.7.3

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to