[Devel] [PATCH RHEL7 COMMIT] fs/aio: show real number of aio events in fs.aio-nr sysctl

Konstantin Khorenko khorenko at virtuozzo.com
Fri May 20 08:17:05 PDT 2016


The commit is pushed to "branch-rh7-3.10.0-327.18.2.vz7.14.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.18.2.vz7.14.5
------>
commit 280363c520967aab9be356c0e6b37ca02109ebea
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date:   Fri May 20 19:17:05 2016 +0400

    fs/aio: show real number of aio events in fs.aio-nr sysctl
    
    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 show in fs.aio-nr a number of created events, not requested.
    
    https://jira.sw.ru/browse/PSBM-47209
    
    Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
    Acked-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 fs/aio.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/aio.c b/fs/aio.c
index ee72178..0f00aa0 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -636,12 +636,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. */


More information about the Devel mailing list