Samba 3.0.32 - internal change notify "legacy" mechanism

Dina Fine dina at
Mon Dec 29 14:22:38 GMT 2008


Attached is a new vfs change notify module. The module handles only the
directory content notifications. Of course it can be expended also to
scan the directory if needed. But since we were not interested in the
internal change notify mechanism, the filters are returned empty
(despite the fact that only some of bits are actually handled).

The module only stats a directory every 10 seconds (configurable via
smb.conf) using the timed events supplied as part of sys_notify_ctx
The event path is returned with NULL path to trigger general
notification. I needed to fix some paths in the samba which didn't
handle well this NULL path (although the samba change notify
architecture does assumes that the path can be empty for general

Also I changed the notify_fsp (notify.c) where the num_changes is > 1000
or name == NULL. I understand the logic there to remove all changes and
to put -1 on changes_num (meaning general notification will be sent).
But after this changes the function just returns? Why? If there are
pending requests why not to send the general notification to the pending
client? So I did fix that. Please tell me I the fix is wrong and I just
misunderstood something.

Dina Fine - Exanet - Core Technologies

-----Original Message-----
From: at
[ at lists.samba.o
rg] On Behalf Of Volker Lendecke
Sent: Wednesday, December 10, 2008 12:16 AM
To: Shlomi Yaakobovich
Cc: samba-technical at
Subject: Re: Samba 3.0.32 - internal change notify "legacy" mechanism

On Mon, Dec 08, 2008 at 06:31:20PM +0200, Shlomi Yaakobovich wrote:
> Thanks for the answer. I looked at the vfs_notify_fam.c code, it was 
> quite helpful. If I get your idea correctly, you propose I create a 
> new VFS module (e.g. vfs_notify), implement only the 
> SMB_VFS_OP_NOTIFY_WATCH operation (and not all the FAM related code I 
> can find in the original module). This OP receives all the required 
> data for change notify mechanism (e.g. path of the directory, fsp as 
> private_data). Create a local list of watchers. The watch will use the

> talloc_set_destructor in a similar way like fam_notify does, to remove

> the watched entry from the list.
> Additionally, create some local function in this module, and use 
> event_add_timed to schedule it (over and over, as long as the watch is

> required). Set this timer when the watch is created I presume. Then 
> implement older logic of notify mechanism in this function (i.e. stat 
> of directory, readdir, etc.). Possibly even take the older code as is 
> to avoid complications... If found that NOTIFY is required, call the 
> callback that was provided with the watch request.
> Let me know if I got this right.

Yep, that pretty much covers it. Please send the module to
samba-technical at once you've done it for upstream inclusion!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: change_notify_patch
Type: application/octet-stream
Size: 18133 bytes
Desc: change_notify_patch
Url :

More information about the samba-technical mailing list