Deleting a file on NFS/SMB share takes really long


copying this issue over form Github as advised by phillxnet.

I am currently using Rockstor to host my 12TB (4TB + 8TB) BTRFS single drive pool. My Linux hosts connect to Rockstor via NFS using the following /etc/fstab entry:

// /Share cifs nounix,defaults,gid=1002,file_mode=0775,dir_mode=0775,user=x,password=x,rw 0 0

The NFS share is exported as follows on the Rockstor host:

/export/Share *(rw,async,no_subtree_check,all_squash,anonuid=0,anongid=2000)

Deleting a file however I noticed takes a really long time (sometimes well over 30s), and checking with strace -r I noticed most of the time is spent executing unlinkat(AT_FDCWD, "File", 0) = 0. Deleting the file directly on the host itself is almost instant. The same thing happens on macOS mounting the share via SMB.

Does anyone know what the cause of this could be? Unfortunately, this renders my storage array pretty much useless.

Hello @AlexLardschneider,

Your fstab entry is for mounting via SMB (cifs is an SMB protocol), not NFS.

Mounting via NFS would be something like this: /Share nfs4 rw,hard,intr,rsize=8192,wsize=8192,timeo=14 0 0

However, that doesn’t explain your slow delete via SMB. If it’s deleting on the host quickly and from a MacOS client, then I suspect it may be something with your particular Linux Distro or there’s very poor network performance between your Linux client and your Rockstor server.

Thank you. I guess I got confused between CIFS and NFS. The share on Debian is now mounted via NFS, but the issue still persists, both on the Debian and the macOS machine.

I just checked networking, and between the two machines, running both on the same ESXi host I get around 9Gbps with below 1ms ping, so I guess networking is not a problem.

Creating files or directories is also almost instant, so that would rule out networking issues.

That’s quite odd for deletes to be taking that long. I have several windows clients attached to my Rockstor server via SMB and haven’t noticed any issues with deleting files.

If you run “dmesg” on your Rockstor server, are there any entries that look out of place to you?

Just checked dmesg and I can’t find anything suspicious in the logs.

1 Like

Hmmm…very odd.

Can you run an nfsstat -c from the Linux client and post the output?

Also, I noticed you have another thread opened regarding high CPU usage. This high CPU usage could be the cause for the deletions taking a long time.

Could you install htop on your Rockstor host? I find it to be more useful than top to identify a task that’s hogging CPU.

Also, is the VM a single vCPU with 2 cores, or 2 single core vCPUs? I’ve found with virtualization that multiple single core vCPUs tend to have better performance than a single multi core vCPU.

You do not delete, but move it to another file system - it is copied to “thrash” somewhere,and the unlinked - “expunged”. Place a thrash directory in the Samba mounted file system to make the “unlinking” faster.

I think you’re thinking of vfs_recycle, which isn’t enabled in the samba config by default.

1 Like