The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git after ark-5.14 ------> commit f33430218b2519e64010ee927fa11ce8d2c29c8c Author: Maxim Patlasov <mpatla...@virtuozzo.com> Date: Fri Oct 1 19:38:37 2021 +0300
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> (cherry-picked from vz8 commit 3eb592c3bd9b ("tmpfs: shmem_fallocate must return ERESTARTSYS")) Signed-off-by: Nikita Yushchenko <nikita.yushche...@virtuozzo.com> --- mm/shmem.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index 4bce39662d70..6ba6b558d7c1 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -2728,11 +2728,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