[RHEL8,COMMIT] tmpfs: shmem_fallocate must return ERESTARTSYS

Submitted by Konstantin Khorenko on Oct. 2, 2020, 4:08 p.m.

Details

Message ID 202010021608.092G8lA7141025@finist-co8.sw.ru
State New
Headers show

Patch hide | download patch | download mbox

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