all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tobias Bading <tbading@web.de>
To: emacs-devel@gnu.org
Subject: Syscalls stat() and faccessat() sometimes fail with errno EINTR when accessing SMB share through VPN
Date: Fri, 12 Feb 2021 16:11:20 +0100	[thread overview]
Message-ID: <b9443111-1cd2-f604-fd21-eecc01a34f9d@web.de> (raw)

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 ‘g’ to update Dired buffer", although nothing has
changed in the directory.

So I put Emacs under a microscope with

strace -f -e trace=%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) = -1 EINTR
(Interrupted system call)
--- SIGIO {si_signo=SIGIO, si_code=SI_KERNEL} ---
[...]
stat("/smb/server/share/dir", 0x7fffe49383b0) = -1 EINTR (Interrupted
system call)
--- SIGIO {si_signo=SIGIO, si_code=SI_KERNEL} ---
--- SIGIO {si_signo=SIGIO, si_code=SI_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




             reply	other threads:[~2021-02-12 15:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-12 15:11 Tobias Bading [this message]
2021-02-12 15:24 ` Syscalls stat() and faccessat() sometimes fail with errno EINTR when accessing SMB share through VPN Tobias Bading
2021-02-12 18:46   ` Tobias Bading
2021-02-14 11:23     ` Tobias Bading
2021-02-14 17:59       ` Matt Armstrong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b9443111-1cd2-f604-fd21-eecc01a34f9d@web.de \
    --to=tbading@web.de \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.