Bug 12156 - File change notify does not occur on file rename
Summary: File change notify does not occur on file rename
Status: RESOLVED DUPLICATE of bug 11717
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.3.8
Hardware: All Mac OS X
: P5 major (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-16 15:50 UTC by Marcel Bischoff
Modified: 2016-08-19 14:36 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel Bischoff 2016-08-16 15:50:31 UTC
The original bug was filed in the Ubuntu Launchpad: https://bugs.launchpad.net/ubuntu/+source/samba/+bug/1576594

Here is a verbatim copy of the issue and my addition.

----- snip -----

What happened:

MacOS 10.11.4 connecting to Samba 4.3.8 on Ubuntu Server 16.04

Upon rename of file by another process on the system, Samba does not notify connected clients of update (directory listing does not refresh). New file/directory creation works just fine, as does moving a file to another directory.

For example, if I have a samba share called "CatPics" pointing at /mnt/CatPics, I can ssh into the machine, "cd /mnt/CatPics" and enter "touch LongCat.jpg", creating the file. This will cause a notify of the update to connected clients which will then display that file. If I then enter "mv LongCat.jpg CeilingCat.jpg", connected OSX clients are not notified of the rename (and attempting to open the file through samba will fail, as it no longer exists). "LongCat.jpg" continues to appear in the directory listing. If you move LongCat.jpg to another directory through SSH, the display refreshes but continues to display the old filename in the new location.

Filesystem in this case is BTRFS, but have confirmed the issue also occurs on EXT4, so not an issue there.

I have tested this same process on Windows 10 clients and it works fine.

That said, I've tested with the OSX client against older versions of Samba (3.6.25 in this case) and that also works fine, so it seems to be an interaction between the two.

Note that this is also more of a problem than you might think, as in Apple's infinite wisdom, OSX doesn't have a refresh button, so you can't manually update the directory listing...

What should have happened:

In the example above, OSX client should have refreshed directory listing and displayed "CeilingCat.jpg".

Ubuntu version:

Description:	Ubuntu 16.04 LTS
Release:	16.04

Samba package version:

samba:
  Installed: 2:4.3.8+dfsg-0ubuntu1
  Candidate: 2:4.3.8+dfsg-0ubuntu1
  Version table:
 *** 2:4.3.8+dfsg-0ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
        100 /var/lib/dpkg/status

----- snip -----

I can confirm this exact behavior. When connecting via CIFS, a proper notification is sent. When connecting via SMB2 or SMB3 protocol, the notification is not sent. This affects for example creating folders, where the default naming is something like "Untitled Folder" and is then changed to the name it should be. The name never changes from "Untitled Folder" on a another Mac OS X client until the share is unmounted and mounted again.

Testing this on a Linux client, the notification is also not sent but a refresh of the folder contents shows the updated information. This is where Mac OS X apparently falls short as there is no way to successfully refresh the SMB Finder window. The usual AppleScript approach via `tell application "Finder" to tell front window to update every item` simply hides the renamed item until you browser away from the folder and back again. The latter is clearly a Mac OS X issue, while the former a problem of Samba.
Comment 1 Ralph Böhme 2016-08-19 14:36:59 UTC
See comment #3 in bug 11717.

*** This bug has been marked as a duplicate of bug 11717 ***