[Devel] [PATCH RHEL7 COMMIT] tmpfs: shmem_fallocate must return ERESTARTSYS
Konstantin Khorenko
khorenko at virtuozzo.com
Fri Mar 18 04:51:06 PDT 2016
The commit is pushed to "branch-rh7-3.10.0-327.10.1.vz7.12.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.10.1.vz7.12.3
------>
commit 9a8a63e554af6533abad4d06d387ee219d365b8c
Author: Maxim Patlasov <mpatlasov at 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 <mpatlasov at virtuozzo.com>
Acked-by: Dmitry Monakhov <dmonakhov at 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.
---
mm/shmem.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index e6c8126..f768e27 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2202,11 +2202,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
More information about the Devel
mailing list