[Samba] Samba 4.11 "Stale file handle"

Kacper kacper at kacper.se
Sat Sep 21 16:43:33 UTC 2019


Hello,

After upgrading to Samba 4.11 (from 4.10) I noticed that python
scripts using tempfile.mkstemp fail when run against samba cifs
mounts. Before I submit a bug report, could someone else try this out
so it's not just my setup?

How to reproduce:
1. Mount a Samba 4.11 share using the mount command: mount
//server1/share /tmp/share1
2. Run python script that is using mkstemp:
    import shutil
    import tempfile

    tmp_dest_fd, tmp_dest_name = tempfile.mkstemp(prefix=b'.file_tmp',
dir='/tmp/share1', suffix='test.pdf')
    shutil.move('testfile', tmp_dest_name)

Result:
Traceback (most recent call last):
  File "./test.py", line 9, in <module>
    shutil.move('testfile', tmp_dest_name)
  File "/usr/lib64/python2.7/shutil.py", line 301, in move
    copy2(src, real_dst)
  File "/usr/lib64/python2.7/shutil.py", line 130, in copy2
    copyfile(src, dst)
  File "/usr/lib64/python2.7/shutil.py", line 83, in copyfile
    with open(dst, 'wb') as fdst:
IOError: [Errno 116] Stale file handle: '/tmp/share1/.file_tmplB0NqLtest.pdf'

Expected results:
The operation should succeed without a stale file handle error.

Environment:
Centos 7.6 / 3.10.0-1062.el7.x86_64
Python 3.6 / 2
Samba 4.11

Regards,
Kacper



More information about the samba mailing list