Bug 5307 - "Notify Change" doesn't notify correctly
Summary: "Notify Change" doesn't notify correctly
Status: RESOLVED FIXED
Alias: None
Product: Samba 3.2
Classification: Unclassified
Component: File services (show other bugs)
Version: 3.2.0
Hardware: x86 Linux
: P3 normal
Target Milestone: ---
Assignee: Volker Lendecke
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-05 23:07 UTC by Ricardo Santos
Modified: 2008-03-06 03:05 UTC (History)
0 users

See Also:


Attachments
Samba log (debug=10) after re-chmod with notify (69.83 KB, text/plain)
2008-03-05 23:09 UTC, Ricardo Santos
no flags Details
proposed patch (799 bytes, patch)
2008-03-06 00:17 UTC, Volker Lendecke
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ricardo Santos 2008-03-05 23:07:26 UTC
I have a samba-3.2.0pre2 compiled on a x86 (Fedora 8) acting like a Domain Master and File Server for an IIS7 on Windows Server 2008.

The SMB client (Windows) was connected and waiting for any change on test.aspx. I overwrite this file directly on linux:

$ echo 'testing123' >test.aspx

And tailing on samba.log (debug=10), samba didn't send anything about the change

But, when I simple re-chmod the file, samba sent the change notification

$ chmod 0600 test.aspx

I'm really concerned in resolve this and available to help you
Comment 1 Ricardo Santos 2008-03-05 23:09:43 UTC
Created attachment 3160 [details]
Samba log (debug=10) after re-chmod with notify
Comment 2 Ricardo Santos 2008-03-05 23:26:02 UTC
I wasn't using the notify_fam module. So I activate it. Now notify is sent on write and chmod too, but has no effect to client (Windows).

See the log:

[2008/03/06 02:18:59, 10] modules/vfs_notify_fam.c:fam_handler(155)
  Got FAMCode 1 for test.aspx
[2008/03/06 02:18:59, 10] modules/vfs_notify_fam.c:fam_handler(166)
  Ignoring code FAMCode 1 for file test.aspx
[2008/03/06 02:18:59, 10] modules/vfs_notify_fam.c:fam_handler(155)
  Got FAMCode 1 for test.aspx
[2008/03/06 02:18:59, 10] modules/vfs_notify_fam.c:fam_handler(166)
  Ignoring code FAMCode 1 for file test.aspx
[2008/03/06 02:18:59, 10] modules/vfs_notify_fam.c:fam_handler(155)
  Got FAMCode 1 for test.aspx
[2008/03/06 02:18:59, 10] modules/vfs_notify_fam.c:fam_handler(166)
  Ignoring code FAMCode 1 for file test.aspx
[2008/03/06 02:18:59, 10] modules/vfs_notify_fam.c:fam_handler(155)
  Got FAMCode 1 for test.aspx
[2008/03/06 02:18:59, 10] modules/vfs_notify_fam.c:fam_handler(166)
  Ignoring code FAMCode 1 for file test.aspx

On write or chmod the messages are identical
Comment 3 Volker Lendecke 2008-03-06 00:17:16 UTC
Created attachment 3161 [details]
proposed patch

Can you try the attached patch?

Thanks,

Volker
Comment 4 Ricardo Santos 2008-03-06 00:18:24 UTC
I made some changes on modules/vfs_notify_fam.c (line 157) to avoid that FAMCode 1 (FAMChanged) to be ignored:

        switch (fam_event.code) {
---- INSERTED BY ME ----
        case FAMChanged:
                ne.action = NOTIFY_ACTION_MODIFIED;
                break;
---- END OF INSERTION ----
        case FAMCreated:
                ne.action = NOTIFY_ACTION_ADDED;
                break;
        case FAMDeleted:
                ne.action = NOTIFY_ACTION_REMOVED;
                break;
        default:
                DEBUG(10, ("Ignoring code FAMCode %d for file %s\n",
                           (int)fam_event.code, fam_event.filename));
                return;
        }

Now all seems right!

diff vfs_notify_fam.ori.c vfs_notify_fam.c
157a158,160
>       case FAMChanged:
>               ne.action = NOTIFY_ACTION_MODIFIED;
>               break;


(In reply to comment #2)
> [2008/03/06 02:18:59, 10] modules/vfs_notify_fam.c:fam_handler(155)
>   Got FAMCode 1 for test.aspx
> [2008/03/06 02:18:59, 10] modules/vfs_notify_fam.c:fam_handler(166)
>   Ignoring code FAMCode 1 for file test.aspx
Comment 5 Ricardo Santos 2008-03-06 00:21:03 UTC
Incredible!!! I made exactly the same thing that you! :)

(In reply to comment #3)
> Can you try the attached patch?

Yes, "our" patch really works

Comment 6 Volker Lendecke 2008-03-06 03:05:20 UTC
Pushed the patch