linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Possible timeout problem when opening a file twice on a SMB mount
@ 2019-09-20 10:57 Moritz M
  2019-09-20 23:26 ` Pavel Shilovsky
  0 siblings, 1 reply; 15+ messages in thread
From: Moritz M @ 2019-09-20 10:57 UTC (permalink / raw)
  To: linux-cifs

Hello,

I've some trouble with saving files with a particular software, LyX[0] 
in this case.
The problem is that saving a file on a SMB share makes the programm 
freeze for 30 s
due to creating an empty temp file.

While investigating I created a small python script which mimics 
(compared the strace output)
the LyX behaviour and also freezes the python script for 30 s.
That makes me believe that it could be a cifs problem.

The python script is:

#!/usr/bin/env python3

import os, sys

fd = os.open( "/mnt/share/foo.txt", 
os.O_RDWR|os.O_CREAT|os.O_EXCL|os.O_CLOEXEC, 0o600 )
fd = os.access( "/mnt/share/foo.txt", os.F_OK )
fd = os.chmod( "/mnt/share/foo.txt", 0o755 )
fd = os.open( "/mnt/share/foo.txt", os.O_WRONLY|os.O_CREAT|os.O_TRUNC, 
0o666 )

# Close opened file
os.close( fd )


Stracing it with

strace -f -t -T -e trace=openat,close,chmod,access python open.py

gives

23:18:52 openat(AT_FDCWD, "/mnt/share/foo.txt", 
O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0600) = 3 <0.002434>
23:18:52 access("/mnt/share/foo.txt", F_OK) = 0 <0.000091>
23:18:52 chmod("/mnt/share/foo.txt", 0755) = 0 <0.000168>
23:18:52 openat(AT_FDCWD, "/mnt/share/foo.txt", 
O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = 4 <30.033585>

The second openat call takes 30 s and freezes the script.

When doing a os.close( fd ) after first open in the python script it 
works as expected:

23:22:11 openat(AT_FDCWD, "/mnt/share/foo.txt", 
O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0600) = 3 <0.002464>
23:22:11 close(3)                       = 0 <0.001652>
23:22:11 access("/mnt/share/foo.txt", F_OK) = 0 <0.000082>
23:22:11 chmod("/mnt/share/foo.txt", 0755) = 0 <0.000175>
23:22:11 openat(AT_FDCWD, "/mnt/share/foo.txt", 
O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = 3 <0.003221>

My setup ist (server is a Synology Diskstation):

$ uname -r
5.1.21-1-MANJARO

$ mount.cifs -V
mount.cifs version: 6.8

$ samba --version
Version 4.4.16


Display Internal CIFS Data Structures for Debugging
---------------------------------------------------
CIFS Version 2.19
Features: 
DFS,FSCACHE,STATS,DEBUG,ALLOW_INSECURE_LEGACY,CIFS_POSIX,UPCALL(SPNEGO),XATTR,ACL
CIFSMaxBufSize: 16384
Active VFS Requests: 0
Servers:
Number of credits: 510 Dialect 0x311
1) Name: x.x.x.x Uses: 1 Capability: 0x300045	Session Status: 1 TCP 
status: 1 Instance: 1
	Local Users To Server: 1 SecMode: 0x1 Req On Wire: 0 SessionId: 
0x14e3311d
	Shares:
	0) IPC: \\server\IPC$ Mounts: 1 DevInfo: 0x0 Attributes: 0x0
	PathComponentMax: 0 Status: 1 type: 0 Serial Number: 0x0
	Share Capabilities: None	Share Flags: 0x0
	tid: 0xf1884345	Maximal Access: 0x1f00a9

	1) \\server\share Mounts: 1 DevInfo: 0x20 Attributes: 0x5006f
	PathComponentMax: 255 Status: 1 type: DISK Serial Number: 0x1dc3f115
	Share Capabilities: None Aligned, Partition Aligned,	Share Flags: 0x800
	tid: 0xe3ad48c8	Optimal sector size: 0x200	Maximal Access: 0x1f01ff

	MIDs:



Does anybody has a clue why it takes exactly 30 s when opening a file 
twice?
Even more important: how can I prevent it?
Any help is appreciated.

Thanks
Moritz

[0]: https://www.lyx.org/


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2019-10-31 21:01 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-20 10:57 Possible timeout problem when opening a file twice on a SMB mount Moritz M
2019-09-20 23:26 ` Pavel Shilovsky
2019-09-23 14:04   ` Moritz M
2019-09-24 18:11     ` ronnie sahlberg
2019-09-24 19:05       ` Pavel Shilovsky
2019-09-24 21:06         ` Pavel Shilovsky
2019-09-25 19:23           ` Moritz M
2019-09-25 20:54             ` Pavel Shilovsky
2019-09-26 10:53               ` Moritz M
2019-09-26 18:58                 ` Pavel Shilovsky
2019-10-30 13:26                   ` Moritz M
2019-10-30 21:51                     ` Pavel Shilovsky
2019-10-31  9:20                       ` Moritz M
2019-10-31 21:01                         ` Pavel Shilovsky
2019-09-24 19:33       ` Moritz M

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).