Jean-Baptiste Denis
2025-Jul-30 11:29 UTC
[Samba] Sequence of actions resulting in data loss
Hello everybody, I've got a cifs mount and some operations result in data loss. I'd like to know if this is expected or not. I've seen it for all distributions I could try so far RHEL 8/9/10, Debian unstable, Ubuntu 20.04, 2404, 25.04. Here is a reproducer (the initial issue was in the Spyder IDE, just editing a script file while it was executed): root at rhel10:~# smbd --version Version 4.21.3 root at rhel10:~# mount.cifs --version mount.cifs version: 7.1 root at rhel10:~# uname -r 6.12.0-55.24.1.el10_0.x86_64 root at rhel10:~# mount /mnt/data root at rhel10:~# grep /mnt/data /etc/fstab /proc/mounts /etc/fstab://localhost/data /mnt/data cifs uid=1000,gid=1000,user,credentials=/home/jbdenis/.smbcreds_data 0 0 /proc/mounts://localhost/data /mnt/data cifs rw,nosuid,nodev,noexec,relatime,vers=3.1.1,cache=strict,upcall_target=app,username=jbdenis,uid=1000,forceuid,gid=1000,forcegid,addr=0000:0000:0000:0000:0000:0000:0000:0001,file_mode=0755,dir_mode=0755,soft,nounix,serverino,mapposix,reparse=nfs,rsize=4194304,wsize=4194304,bsize=1048576,retrans=1,echo_interval=60,actimeo=1,closetimeo=1 0 0 root at rhel10:~# cd /mnt/data/ root at rhel10:/mnt/data# cat reproducer2.sh #!/usr/bin/bash echo -e "sleep 5" > X.sh bash X.sh & echo "new content" > x sleep 1 mv x X.sh wait cat X.sh Here is the output: root at rhel10:/mnt/data# ls -a1 . .. reproducer2.sh root at rhel10:/mnt/data# bash reproducer2.sh mv: cannot move 'x' to 'X.sh': Permission denied cat: X.sh: No such file or directory The X.sh has been deleted. Imagine that the X.sh was an important file that a user was working on in its IDE. I've got this issue on two differents NAS filer (Isilon, VASTData), a windows share from a windows server and a local samba server. I've opened a ticket at redhat (#04214716). What do you think, any idea or suggestions ? Did I miss something obvious ? Thank you for your help. Jean-Baptiste
On 7/30/25 1:29 PM, Jean-Baptiste Denis via samba wrote:> I've got a cifs mount and some operations result in data loss. I'd like > to know if this is expected or not.what it your expectation? Running this on a local filesystem gives: $ bash reproducer.sh new content In theory, the rename should fail on an SMB server as the destination of the rename has an open. Windows specs mandate that this must fail with STATUS_ACCESS_DENIED. But: Samba had a bug until very recently where it would not check this. Iirc I fixed this as part of a larger changeset that went into 4.22. https://bugzilla.samba.org/show_bug.cgi?id=15608 Cheers! -slow -- SerNet Samba Team Lead https://sernet.de/ Samba Team Member https://samba.org/ Samba Support and Dev https://samba.plus/services/ SAMBA+ packages https://samba.plus/products/samba -------------- next part -------------- A non-text attachment was scrubbed... Name: OpenPGP_signature.asc Type: application/pgp-signature Size: 840 bytes Desc: OpenPGP digital signature URL: <http://lists.samba.org/pipermail/samba/attachments/20250730/cdb48e8f/OpenPGP_signature.sig>