SFoskett
Dabbler
- Joined
- Jul 28, 2016
- Messages
- 37
I've had a bit of an issue with CIFS shares not updating as new files are added. For example, if I SCP a video file from one machine to another, it will not show up in clients connected via SMB/Samba (what FreeNAS still calls CIFS). The same is true if I ssh to the FreeNAS machine and move or remove a file, or if I update a directory with rsync.
Essentially, Samba isn't getting the message that the underlying filesystem has changed outside its domain. And it never gets the message unless I log out and back in. I literally have days-old file ghosts sitting there.
This is a long-standing issue with Samba (I've been using it since the 1990's!) since it maintains its own cache of directory contents. There are a number of options to tune its behavior, including the classic "refresh = 1" flag which is set by default in FreeNAS. This does not fix my issue, however.
Recent releases of Samba have a new option: "kernel change notify = yes". This allows the kernel to notify Samba when directory contents have changed. This should completely resolve this issue, but there are instances of it causing problems in FreeBSD, including high CPU usage for smbd and general instability.
"kernel change notify = no" is the default in FreeNAS. To see if it would help, I changed this to "yes" on my system. It immediately cured my issue, with moves and copies showing up almost instantly. However, I am concerned about leaving it on, since my FreeNAS hasn't been all that stable to begin with.
There are client-side tweaks that are often recommended, but these are not acceptable for me. First, most eliminate the inherent caching benefits added to SMB2.0, which is quite inelegant. Second, I'm all-Mac, so those tweaks don't exist.
Any thoughts on kernel change notify?
Essentially, Samba isn't getting the message that the underlying filesystem has changed outside its domain. And it never gets the message unless I log out and back in. I literally have days-old file ghosts sitting there.
This is a long-standing issue with Samba (I've been using it since the 1990's!) since it maintains its own cache of directory contents. There are a number of options to tune its behavior, including the classic "refresh = 1" flag which is set by default in FreeNAS. This does not fix my issue, however.
Recent releases of Samba have a new option: "kernel change notify = yes". This allows the kernel to notify Samba when directory contents have changed. This should completely resolve this issue, but there are instances of it causing problems in FreeBSD, including high CPU usage for smbd and general instability.
"kernel change notify = no" is the default in FreeNAS. To see if it would help, I changed this to "yes" on my system. It immediately cured my issue, with moves and copies showing up almost instantly. However, I am concerned about leaving it on, since my FreeNAS hasn't been all that stable to begin with.
There are client-side tweaks that are often recommended, but these are not acceptable for me. First, most eliminate the inherent caching benefits added to SMB2.0, which is quite inelegant. Second, I'm all-Mac, so those tweaks don't exist.
Any thoughts on kernel change notify?