From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tobias Bading Newsgroups: gmane.emacs.devel Subject: Re: Syscalls stat() and faccessat() sometimes fail with errno EINTR when accessing SMB share through VPN Date: Fri, 12 Feb 2021 16:24:13 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18379"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Feb 12 16:32:52 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lAaR9-0004g1-M2 for ged-emacs-devel@m.gmane-mx.org; Fri, 12 Feb 2021 16:32:51 +0100 Original-Received: from localhost ([::1]:57366 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAaR8-0006vZ-OS for ged-emacs-devel@m.gmane-mx.org; Fri, 12 Feb 2021 10:32:50 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46606) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAaIr-0000KX-Rf for emacs-devel@gnu.org; Fri, 12 Feb 2021 10:24:17 -0500 Original-Received: from mout.web.de ([212.227.15.4]:45545) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAaIp-0004Wo-R3 for emacs-devel@gnu.org; Fri, 12 Feb 2021 10:24:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1613143453; bh=otdtecDxj+u6qoo0NuEcWPj9uIK+m/Quhvsrpcbtzg8=; h=X-UI-Sender-Class:Subject:From:To:References:Date:In-Reply-To; b=YIeOvdR1SFHMtLG6u2fKnbz8LKUYseE8sSahwejzwggb4GwFJ99O5fXWW9GW3/XWE KrANdIGN1OumECjcJIp/2+16bpJnabvd6A/Y/GIOJyu7AACEOVkg4agibzOhcp4Um6 nBjBaEvW7EFMKdjoVgj/CgmnERohxmV73F1t5dYU= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Original-Received: from [192.168.2.103] ([84.143.159.140]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0M5fhI-1m7syz2ZDs-00xXlM for ; Fri, 12 Feb 2021 16:24:13 +0100 In-Reply-To: Content-Language: en-US X-Provags-ID: V03:K1:GEZKREBSDo3jXk1LCVB6oXC4rm9wvAoM08eAS3bWrq/1YpalLW1 UFJ3qBIcMSq7O/2eIfhb79ivxcVmPcEQEGj27fLqUFLSNHBm3dNuesaRTrV6H/6u1VAOwF6 LWEzt1FQHLIbjivDJgs4kwHtMi+tX53NS3SBBDkLyG1LoPc4nVVOYnVeSe6gHLygRSjt68a xzktuPdjXxHEE1HDJOj9g== X-UI-Out-Filterresults: notjunk:1;V03:K0:JGYrUNdNoOA=:DWjncf7MnOZkmJBE5H00EY A8ENUM/v/iKDcIOBY00V/fopl/cPU/DmbXBEPn/MmL4Ej74DAZS5pBsYOiezkuOkZWz6pjzwy 8FzpLvqlSmbz9KYAZnrfGLChrPTmR1nDMrEKpPVxsHuuvQmcywPr54v6yqv+2fAY2SEILjwKq PvhdZySkJzqkN2xY9CsfdMHMcIUQYec2wpShARnzsAD3AZ5AdREY2sO5wWpS7LDaHKfzHlOe6 b7YKOlY+WUbBCqmjzOtasTrsXGV6at2FB61obKReeQfsIP8Hfb9Sv84o6RDZwO/+GZltV/uO2 LULnMfQOTbkqfoqVJlv5IIw+hGvYuGTDt32ApYrUF1+AunOy0QK6U09GVmzUtPakRvxU20RYl arNUctZzRHro0+KXfJlqmFwo5f6kw/Z0V/dV+Jed4eF20sjRvAuMpPLRjgFjSDniFvluvM4nL CvMDpa2+8nPwmuVXI5W5kUfATbpTbri1qweSCdjFauxM1Q1AkvuEiXuoad+fgt2kbLDrkPf2Q sIYCCIOW1DAF+fn7rIMh4/ZVgn+xAi2kr42zb78gmIntdJLyUGMJ1siTxdZJmGnCv7Y8BKz6k mtMG6QBje4W2xx61IYiKGJbPPcbGB2iUdgS7FM5xS/umre7Gxw4BmqDW6RNK7YaXAT8v/P+k8 wspfxdy1AmU19GS4ilyit1gEpA2aBkl/wv9P5SilDVgT3acnUc8zJatsD9mVMvFPsc68QcnTx 6we7Kh6kZNTQxPuP5iAV9Laug8+PK5HvJBbwYiqfR5/iSuISuP+D7VjRJycTg2o4ITItcrnS Received-SPF: pass client-ip=212.227.15.4; envelope-from=tbading@web.de; helo=mout.web.de X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, NICE_REPLY_A=-0.119, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:264520 Archived-At: Ok, the grep -A2 wasn't that bright XD. With -C2 I just got 16:19:23.935175 --- SIGIO {si_signo=3DSIGIO, si_code=3DSI_KERNEL} --- 16:19:23.937296 faccessat(AT_FDCWD, "/smb/server/share/dir/", F_OK) =3D -1 EINTR (Interrupted system call) [...] 16:19:34.191156 --- SIGIO {si_signo=3DSIGIO, si_code=3DSI_KERNEL} --- 16:19:34.192562 stat("/smb/server/share/dir/subdir", 0x7fff40feb5c0) =3D -1 EINTR (Interrupted system call) [...] 16:19:39.358023 --- SIGCHLD {si_signo=3DSIGCHLD, si_code=3DCLD_EXITED, si_pid=3D68151, si_uid=3D501, si_status=3D0, si_utime=3D1, si_stime=3D1} -= -- 16:19:39.358477 stat("/smb/server/share/dir", 0x7fff40fea8b0) =3D -1 EINTR (Interrupted system call) [...] 16:20:01.111670 --- SIGIO {si_signo=3DSIGIO, si_code=3DSI_KERNEL} --- 16:20:01.113070 stat("/smb/server/share/dir/subdir", 0x7fff40feb5c0) =3D -1 EINTR (Interrupted system call) [...] 16:20:05.519682 --- SIGIO {si_signo=3DSIGIO, si_code=3DSI_KERNEL} --- 16:20:05.520931 stat("/smb/server/share/dir/subdir", 0x7fff40feb5c0) =3D -1 EINTR (Interrupted system call) which makes a bit more sense I guess. Tobias =2D-- On 12.02.21 16:11, Tobias Bading wrote: > Hi. > > Everyone doing alright hacking/working from home? > > Yesterday I encountered a curious problem while using (a self-built) > Emacs 26.3.50 on my GNU/Linux machine at home: > > I've set up the automounter to mount SMB shares of Windows servers in > the office through the company's VPN. This works fine for e.g. "ls -lR > /smb/server/share/dir" in a shell, except for bad performance. The > problems start when I try to work with the same directory from within > Emacs with dired-mode, i.e. a simple C-x C-f /smb/server/share/dir. > Quite regularly I get errors like "dired-get-file-for-visit: File no > longer exists; type =E2=80=98g=E2=80=99 to update Dired buffer", althoug= h nothing has > changed in the directory. > > So I put Emacs under a microscope with > > strace -f -e trace=3D%file -tt emacs 2>&1 | grep --line-buffered -A2 > /smb/ >emacs.log > > which revealed errors like > > faccessat(AT_FDCWD, "/smb/server/share/dir", F_OK) =3D -1 EINTR > (Interrupted system call) > --- SIGIO {si_signo=3DSIGIO, si_code=3DSI_KERNEL} --- > [...] > stat("/smb/server/share/dir", 0x7fffe49383b0) =3D -1 EINTR (Interrupted > system call) > --- SIGIO {si_signo=3DSIGIO, si_code=3DSI_KERNEL} --- > --- SIGIO {si_signo=3DSIGIO, si_code=3DSI_KERNEL} --- > > (The timestamps of the SIGIO lines suggest that these signals have > nothing to do with the EINTR errors reported beforehand, the > timestamps are often over 0.1 seconds apart.) > > So far I've only seen stat() and faccessat() failing with EINTR. The > funny thing is, the man pages of those two system calls don't mention > EINTR at all. man signal(7) also doesn't mention these functions in > the paragraph about SA_RESTART. Anyway, I've checked the source code > of my Emacs 26.3.50 build and found emacs_sigaction_flags() in > src/sysdep.c, which does return 0 (as intended by the dev(s) who wrote > the code). I've changed the implementation to "return SA_RESTART;", > but that had no effect. > > To make sure I didn't mess up my own Emacs 26 git branch somehow, I > did a quick test with the current HEAD of origin/master and "src/emacs > -Q", which seems to have the same problem, revealed by error messages > like "apply: Setting current directory: Interrupted system call, > /smb/server/share/dir/". > > I'm stumped. A (shell-command "ls -lAFNR /smb/server/share/big-dir/") > works fine, as does a "cp -a" of that directory. But when the Emacs > process itself calls stat() or faccessat(), things go sideways? Why? > What am I missing? Are stat() and faccessat() even allowed to fail > with EINTR? Is this a kernel bug, maybe somewhere in the CIFS client > implementation? But an strace of "ls -lAFNR > /smb/server/share/big-dir/" shows not a single EINTR! So why would > only Emacs be affected? > > Please enlighten me... ;) > > Tobias >