The commit is pushed to "branch-rh8-4.18.0-193.6.3.vz8.4.x-ovz" and will appear 
at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-193.6.3.vz8.4.11
------>
commit a1e224e1275b5e96d90edba96e3cb43a25437ab1
Author: Maxim Patlasov <mpatla...@virtuozzo.com>
Date:   Fri Mar 18 15:51:06 2016 +0400

    tmpfs: shmem_fallocate must return ERESTARTSYS
    
    shmem_fallocate() is restartable, so it can return ERESTARTSYS if
    signal_pending(). Although fallocate(2) manpage permits EINTR,
    the more places use ERESTARTSYS the better.
    
    https://jira.sw.ru/browse/PSBM-43399
    
    Signed-off-by: Maxim Patlasov <mpatla...@virtuozzo.com>
    Acked-by: Dmitry Monakhov <dmonak...@virtuozzo.com>
    
    mpatlasov@: note, shmem_fallocate() doesn't return ERESTARTSYS to userspace.
    It returns ERESTARTSYS to some internal kernel function that restarts 
syscall
    (I tested this behavior). This is how any other "return -ERESTARTSYS;" 
works.
    
    (cherry picked from vz7 commit 0011c60ac1fde1f735d2474c967b454b9019461a)
    Signed-off-by: Konstantin Khorenko <khore...@virtuozzo.com>
---
 mm/shmem.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index 90211848f742..a2b08da45ac3 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2742,11 +2742,13 @@ static long shmem_fallocate(struct file *file, int 
mode, loff_t offset,
                struct page *page;
 
                /*
-                * Good, the fallocate(2) manpage permits EINTR: we may have
-                * been interrupted because we are using up too much memory.
+                * Although fallocate(2) manpage permits EINTR, the more
+                * places use ERESTARTSYS the better. If we have been
+                * interrupted because we are using up too much memory,
+                * oom-killer used fatal signal and we will die anyway.
                 */
                if (signal_pending(current))
-                       error = -EINTR;
+                       error = -ERESTARTSYS;
                else if (shmem_falloc.nr_unswapped > shmem_falloc.nr_falloced)
                        error = -ENOMEM;
                else
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to