Samba share directory can't rename.

akong

Dabbler
Joined
Mar 5, 2014
Messages
26
Hello,
I use truenas scale latest version.I open smb share.Some directories cannot be renamed. If you move the directory to the upper level, it will pop up that someone has opened the file, but we are very sure that no one has opened the file. What is the problem?
 

akong

Dabbler
Joined
Mar 5, 2014
Messages
26
My Truenas has join AD.If A user create abc directory.Sometimes A user can't rename abc directory.But B user can rename abc directory.What is this problem?
I has add domain users permission to full control.
 

bcat

Explorer
Joined
Oct 20, 2022
Messages
84
FWIW, I noticed a similar issue the other day and can repro it as follows:
  1. Create a new directory under the root of an SMB share.
  2. Create a file in the new directory. Open the file in an application (i.e., a text file in Notepad is fine).
  3. Close the file.
  4. Try to rename the directory.
This gives the error "The action can't be completed because the folder or a file in it is open in another program." It's like a file is staying locked, but I don't see anything related under "locked files" in smbstatus. Weird.

This is on a workgroup, no Active Directory involved.

For what it's worth, I can delete the directory when this happens, just not rename it.
 
Last edited:

nash0r

Cadet
Joined
Apr 29, 2023
Messages
2
Did either of you figure this one out? I have the exact same problem. If I have opened a file inside a samba share folder, then I cannot rename the folder after (via Windows 10). If I do not open a file in a folder, I can rename it. I can reproduce the same as steps 1-4 as listed by bcat. Additionally, I cannot move the folder (which is technically a rename).

Also not using Active Directory. This is a virtually brand new TrueNAS Scale install, so pretty much defaults across the board. I have ensured I am logged into the Samba share with my personal user account (not a guest account).
 
Joined
May 1, 2023
Messages
5
I also just noticed this on TrueNAS-SCALE-22.12.2. I am using Active Directory. I have verified the behavior on multiple Windows 11 installs and even Windows Server 2022. I first noticed with a FLAC file. I have verified that the application that opened the file is fully closed. Resource Monitor and even tools like ProcessExplorer show no open handles to files on the mapped SMB share. It happens with other file types. I have a folder with a few JPG and if I open one, I can no longer rename the parent folder after closing the file. If I disable the SMB share in Scale web-ui and re-enable I can rename the folder again. Tested against two Windows 11 machines, same behavior. Even stranger, I am able to delete or cut all of the files from the directory. None of the files are locked. Once the files are moved or deleted, I can then rename the locked directory. If I put the files back in the directory, it becomes locked again
 

donky353

Cadet
Joined
May 1, 2023
Messages
7
I am having the same issue on multiple Scale installs. Am running 2 different setups

Setup 1:
- TrueNAS-22.12.1
- Local truenas users
- Windows SMB Users

Setup 2:
- TrueNAS-22.12.0
- AD Integration
- Windows SMB users authenticating with AD

The situation. If I have a folder with other folders/files in it and copy that folder I am unable to rename that folder. Other users are able to rename that folder, I am also able to delete that folder without any issues. If I reboot my windows computer I am then able to rename that folder without issue. I have mix of windows 10 and windows 11 clients, all with the same issues. The issue can also be replicated accross both truenas setups, both of which are in independent locations and are totally independent from each other. As far as I can tell we have been experiencing this issue for as long as we have been using scale. We are using ACL's to manage permissions.

Running smbstatus in the truenas shell shows no locks for the given files/folders. Have also tried renaming the folders via PowerShell with the following error:

Access to the path 'G:\...\' is denied.

Any assistance here would be greatly appreciated.
 
Joined
May 1, 2023
Messages
5
There does seem to be something on the client (Windows) side that is confused. Once I have locked a folder (by opening a file within), I can no longer rename or move that folder, as mentioned. If I go to another Windows machine and access the same share, I have no issues renaming or moving that same folder. If I the open a file from that same directory from the second client, the folder becomes locked for that client. If I reboot either Windows machine, the folder is then renamable, but only for the client that rebooted. The client seems to mistakenly mark the folder as locked and does not release it until the client is rebooted or the drive mapping is temporarily disconnected. I previously mentioned that locked folders could be temporarily fixed by disabling and re-enabling the SMB share in Scale. I began to suspect that simply disconnecting the share in Windows (which happens when disabling the share in Scale) would have the same effect. I disabled my Windows network adapter and after enabling, the folders were unlocked. Opening any file locks them again. I do wonder if something changed via a Windows update. Which is why we are all seeing this now. Even so, I hope someone can find a workaround. Perhaps a SMB auxiliary setting, etc.
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,553
There does seem to be something on the client (Windows) side that is confused. Once I have locked a folder (by opening a file within), I can no longer rename or move that folder, as mentioned. If I go to another Windows machine and access the same share, I have no issues renaming or moving that same folder. If I the open a file from that same directory from the second client, the folder becomes locked for that client. If I reboot either Windows machine, the folder is then renamable, but only for the client that rebooted. The client seems to mistakenly mark the folder as locked and does not release it until the client is rebooted or the drive mapping is temporarily disconnected. I previously mentioned that locked folders could be temporarily fixed by disabling and re-enabling the SMB share in Scale. I began to suspect that simply disconnecting the share in Windows (which happens when disabling the share in Scale) would have the same effect. I disabled my Windows network adapter and after enabling, the folders were unlocked. Opening any file locks them again. I do wonder if something changed via a Windows update. Which is why we are all seeing this now. Even so, I hope someone can find a workaround. Perhaps a SMB auxiliary setting, etc.
Samba will check for files open by the current smbd process prior to renames, but not those of other processes (an optimization). Run `smbstatus` to see what locks are held within the dir and you will probably have your answer about what is going on.
 

donky353

Cadet
Joined
May 1, 2023
Messages
7
Samba will check for files open by the current smbd process prior to renames, but not those of other processes (an optimization). Run `smbstatus` to see what locks are held within the dir and you will probably have your answer about what is going on.
I did check smbstatus on the server, when the file is actually open it does show a lock on that file. however as soon as the file is closed the lock is removed in samba.

Also if it were a samba lock wouldn't that also prevent other users / computers from being able to rename the file as well?
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,553
I did check smbstatus on the server, when the file is actually open it does show a lock on that file. however as soon as the file is closed the lock is removed in samba.

Also if it were a samba lock wouldn't that also prevent other users / computers from being able to rename the file as well?
Depends on context.


 

donky353

Cadet
Joined
May 1, 2023
Messages
7
For more context I have replicated the issue and taken a screenshot of the smbstatus command results at the same time as getting the error message from windows of the file being open. As far as I can tell the file trying to be renamed in Windows is not locked by samba.
 

Attachments

  • 1683036063891.png
    1683036063891.png
    16.6 KB · Views: 227
  • PJZvtheCJU.png
    PJZvtheCJU.png
    19 KB · Views: 223

donky353

Cadet
Joined
May 1, 2023
Messages
7
I was able to increase the SMB logging level to debug and the following is the output at the time of trying to rename the same file as above. To be honest I am really not sure what I am looking at here, any assistance in deciphering these logs would be greatly appreciated.

[2023/05/02 11:36:09.675793, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:667(notifyd_trigger) notifyd_trigger: Trying path /mnt [2023/05/02 11:36:09.675856, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:667(notifyd_trigger) notifyd_trigger: Trying path /mnt/poolA [2023/05/02 11:36:09.675925, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:667(notifyd_trigger) notifyd_trigger: Trying path /mnt/poolA/datasetMain [2023/05/02 11:36:09.675993, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:667(notifyd_trigger) notifyd_trigger: Trying path /mnt/poolA/datasetMain/Forerunner3DP [2023/05/02 11:36:09.676038, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:667(notifyd_trigger) notifyd_trigger: Trying path /mnt/poolA/datasetMain/Forerunner3DP/Job Files [2023/05/02 11:36:09.676118, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/lib/messages.c:421(messaging_recv_cb) messaging_recv_cb: Received message 0x31b len 105 (num_fds:0) from 1846392 [2023/05/02 11:36:09.676177, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:647(notifyd_trigger) notifyd_trigger: Got trigger_msg action=5, filter=2, path=/mnt/poolA/datasetMain/Forerunner3DP/Job Files/zz.JOB #.zz - itNate Test - Copy1 [2023/05/02 11:36:09.676223, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:667(notifyd_trigger) notifyd_trigger: Trying path /mnt [2023/05/02 11:36:09.676265, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:667(notifyd_trigger) notifyd_trigger: Trying path /mnt/poolA [2023/05/02 11:36:09.676328, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:667(notifyd_trigger) notifyd_trigger: Trying path /mnt/poolA/datasetMain [2023/05/02 11:36:09.676379, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:667(notifyd_trigger) notifyd_trigger: Trying path /mnt/poolA/datasetMain/Forerunner3DP [2023/05/02 11:36:09.676421, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:667(notifyd_trigger) notifyd_trigger: Trying path /mnt/poolA/datasetMain/Forerunner3DP/Job Files [2023/05/02 11:36:09.973785, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/lib/messages.c:421(messaging_recv_cb) messaging_recv_cb: Received message 0x31a len 79 (num_fds:0) from 1846392 [2023/05/02 11:36:09.973863, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:544(notifyd_rec_change) notifyd_rec_change: Got 79 bytes from 1846392 [2023/05/02 11:36:09.973913, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:521(notifyd_parse_rec_change) notifyd_parse_rec_change: Got rec_change_msg filter=2, subdir_filter=0, private_data=0x55c583ee0f40, path=/mnt/poolA/datasetMain/Forerunner3DP/Job Files [2023/05/02 11:36:09.973979, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:357(notifyd_apply_rec_change) notifyd_apply_rec_change: path=/mnt/poolA/datasetMain/Forerunner3DP/Job Files, filter=2, subdir_filter=0, private_data=0x55c583ee0f40 [2023/05/02 11:36:09.974077, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notify_inotify.c:446(inotify_watch) inotify_add_watch for /mnt/poolA/datasetMain/Forerunner3DP/Job Files mask 210003c0 returned wd 5 [2023/05/02 11:36:09.974129, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:449(notifyd_apply_rec_change) notifyd_apply_rec_change: /mnt/poolA/datasetMain/Forerunner3DP/Job Files has 1 instances [2023/05/02 11:36:10.092982, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/lib/messages.c:421(messaging_recv_cb) messaging_recv_cb: Received message 0x31a len 79 (num_fds:0) from 1846392 [2023/05/02 11:36:10.093074, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:544(notifyd_rec_change) notifyd_rec_change: Got 79 bytes from 1846392 [2023/05/02 11:36:10.093107, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:521(notifyd_parse_rec_change) notifyd_parse_rec_change: Got rec_change_msg filter=21, subdir_filter=0, private_data=0x55c583edb2a0, path=/mnt/poolA/datasetMain/Forerunner3DP/Job Files [2023/05/02 11:36:10.093135, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:357(notifyd_apply_rec_change) notifyd_apply_rec_change: path=/mnt/poolA/datasetMain/Forerunner3DP/Job Files, filter=21, subdir_filter=0, private_data=0x55c583edb2a0 [2023/05/02 11:36:10.093209, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notify_inotify.c:446(inotify_watch) inotify_add_watch for /mnt/poolA/datasetMain/Forerunner3DP/Job Files mask 210003c6 returned wd 5 [2023/05/02 11:36:10.093241, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:449(notifyd_apply_rec_change) notifyd_apply_rec_change: /mnt/poolA/datasetMain/Forerunner3DP/Job Files has 2 instances [2023/05/02 11:36:23.992526, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/lib/messages.c:421(messaging_recv_cb) messaging_recv_cb: Received message 0x31a len 55 (num_fds:0) from 1846923 [2023/05/02 11:36:23.992626, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:544(notifyd_rec_change) notifyd_rec_change: Got 55 bytes from 1846923 [2023/05/02 11:36:23.992693, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:521(notifyd_parse_rec_change) notifyd_parse_rec_change: Got rec_change_msg filter=95, subdir_filter=95, private_data=0x55c583edea70, path=/mnt/poolA/datasetMain [2023/05/02 11:36:23.992740, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:357(notifyd_apply_rec_change) notifyd_apply_rec_change: path=/mnt/poolA/datasetMain, filter=95, subdir_filter=95, private_data=0x55c583edea70 [2023/05/02 11:36:23.992805, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notify_inotify.c:446(inotify_watch) inotify_add_watch for /mnt/poolA/datasetMain mask 210003c6 returned wd 6 [2023/05/02 11:36:23.992852, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:449(notifyd_apply_rec_change) notifyd_apply_rec_change: /mnt/poolA/datasetMain has 1 instances [2023/05/02 11:36:23.994168, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/lib/messages.c:421(messaging_recv_cb) messaging_recv_cb: Received message 0x31a len 55 (num_fds:0) from 1846924 [2023/05/02 11:36:23.994240, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:544(notifyd_rec_change) notifyd_rec_change: Got 55 bytes from 1846924 [2023/05/02 11:36:23.994287, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:521(notifyd_parse_rec_change) notifyd_parse_rec_change: Got rec_change_msg filter=95, subdir_filter=95, private_data=0x55c583edea70, path=/mnt/poolA/datasetMain [2023/05/02 11:36:23.994332, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:357(notifyd_apply_rec_change) notifyd_apply_rec_change: path=/mnt/poolA/datasetMain, filter=95, subdir_filter=95, private_data=0x55c583edea70 [2023/05/02 11:36:23.994386, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notify_inotify.c:446(inotify_watch) inotify_add_watch for /mnt/poolA/datasetMain mask 210003c6 returned wd 6 [2023/05/02 11:36:23.994429, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:449(notifyd_apply_rec_change) notifyd_apply_rec_change: /mnt/poolA/datasetMain has 2 instances [2023/05/02 11:36:24.002384, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/lib/messages.c:421(messaging_recv_cb) messaging_recv_cb: Received message 0x31a len 100 (num_fds:0) from 1846924 [2023/05/02 11:36:24.002456, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:544(notifyd_rec_change) notifyd_rec_change: Got 100 bytes from 1846924 [2023/05/02 11:36:24.002501, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:521(notifyd_parse_rec_change) notifyd_parse_rec_change: Got rec_change_msg filter=95, subdir_filter=95, private_data=0x55c583ef0130, path=/mnt/poolA/datasetMain/Forerunner3DP/Job Files/_Archived Jobs/_2022 [2023/05/02 11:36:24.002558, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:357(notifyd_apply_rec_change) notifyd_apply_rec_change: path=/mnt/poolA/datasetMain/Forerunner3DP/Job Files/_Archived Jobs/_2022, filter=95, subdir_filter=95, private_data=0x55c583ef0130 [2023/05/02 11:36:24.002694, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notify_inotify.c:446(inotify_watch) inotify_add_watch for /mnt/poolA/datasetMain/Forerunner3DP/Job Files/_Archived Jobs/_2022 mask 210003c6 returned wd 7 [2023/05/02 11:36:24.002748, 10, pid=1845992, effective(0, 0), real(0, 0)] ../../source3/smbd/notifyd/notifyd.c:449(notifyd_apply_rec_change) notifyd_apply_rec_change: /mnt/poolA/datasetMain/Forerunner3DP/Job Files/_Archived Jobs/_2022 has 1 instances

Thankyou
 

makmillion

Cadet
Joined
Oct 18, 2022
Messages
7
I have been having this same issue since upgrading to Bluefin and I have not had any luck figuring it out. Has anybody else found the cause and/or a solution?
 

makmillion

Cadet
Joined
Oct 18, 2022
Messages
7
None here. I think it's going to take some input from ixSystems.
I found this post while researching this issue, so I disconnected and mapped my smb share from Windows using the IP instead of the host-name and it seems to have worked as well as it did for them.
Instead of it happening with every folder and file I add, it has happened a total of 14 times during 5'ish hours of work and well over 1,000 files and folders. Prior to this I had disconnected and mapped my smb share using the host-name and I made it almost 5 minutes before the issue started happening again.
 

nash0r

Cadet
Joined
Apr 29, 2023
Messages
2
I can also report that changing my drive my mapping from \\HOSTNAME\SHARE to \\IP.ADDRESS\SHARE has fixed the issue (so far, limited testing) for me. I could reproduce the issue 100% of the time before, and my first few tests after the change have been successful (no issue). Whether there's a non-zero chance of it still happening, I am not sure as I have not done enough testing. But at least it's no longer 100%!
 

Catullus

Cadet
Joined
Mar 13, 2023
Messages
2
Try disabling thumbnail generation (and deleting any thumbs.db files that already exist). That solved the problem for me.
 
Top