[PATCH] tmpfs: don't interrupt fallocate with EINTR

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

I have a program that sets up a periodic timer with 10ms interval. When
the program attempts to call fallocate on tmpfs, it goes into an infinite
loop. fallocate takes longer than 10ms, so it gets interrupted by a
signal and it returns EINTR. On EINTR, the fallocate call is restarted,
going into the same loop again.

fallocate(19, FALLOC_FL_KEEP_SIZE, 0, 206057565) = -1 EINTR (Přerušené volání systému)
--- SIGALRM {si_signo=SIGALRM, si_code=SI_TIMER, si_timerid=0, si_overrun=0, si_int=0, si_ptr=NULL} ---
sigreturn({mask=[]})                    = -1 EINTR (Přerušené volání systému)
fallocate(19, FALLOC_FL_KEEP_SIZE, 0, 206057565) = -1 EINTR (Přerušené volání systému)
--- SIGALRM {si_signo=SIGALRM, si_code=SI_TIMER, si_timerid=0, si_overrun=0, si_int=0, si_ptr=NULL} ---
sigreturn({mask=[]})                    = -1 EINTR (Přerušené volání systému)
fallocate(19, FALLOC_FL_KEEP_SIZE, 0, 206057565) = -1 EINTR (Přerušené volání systému)
--- SIGALRM {si_signo=SIGALRM, si_code=SI_TIMER, si_timerid=0, si_overrun=0, si_int=0, si_ptr=NULL} ---
sigreturn({mask=[]})                    = -1 EINTR (Přerušené volání systému)
fallocate(19, FALLOC_FL_KEEP_SIZE, 0, 206057565) = -1 EINTR (Přerušené volání systému)
--- SIGALRM {si_signo=SIGALRM, si_code=SI_TIMER, si_timerid=0, si_overrun=0, si_int=0, si_ptr=NULL} ---
sigreturn({mask=[]})                    = -1 EINTR (Přerušené volání systému)

Should there be fatal_signal_pending instead of signal_pending in the
shmem_fallocate loop?

Signed-off-by: Mikulas Patocka <mpatocka@xxxxxxxxxx>

---
 mm/shmem.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/mm/shmem.c
===================================================================
--- linux-2.6.orig/mm/shmem.c	2024-01-18 19:18:31.000000000 +0100
+++ linux-2.6/mm/shmem.c	2024-03-04 19:05:25.000000000 +0100
@@ -3143,7 +3143,7 @@ static long shmem_fallocate(struct file
 		 * Good, the fallocate(2) manpage permits EINTR: we may have
 		 * been interrupted because we are using up too much memory.
 		 */
-		if (signal_pending(current))
+		if (fatal_signal_pending(current))
 			error = -EINTR;
 		else if (shmem_falloc.nr_unswapped > shmem_falloc.nr_falloced)
 			error = -ENOMEM;

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux