Fix to allow a timestamp of zero to cause an instantaneous changenotify
authorJeremy Allison <jra@samba.org>
Wed, 20 Sep 2000 19:00:21 +0000 (19:00 +0000)
committerJeremy Allison <jra@samba.org>
Wed, 20 Sep 2000 19:00:21 +0000 (19:00 +0000)
scan - then call this from renames. This allows instantaneous update for
W2k renames.
Jeremy.
(This used to be commit 07dffc4ee931cbc61197e2da277df9c404a77469)

source3/smbd/notify_hash.c
source3/smbd/notify_kernel.c
source3/smbd/nttrans.c
source3/smbd/reply.c

index fe09d9cf9df8eb971ac27139018f812ad1381549..95d430d23bc489e372901f0e7c6ad75933e1d4c3 100644 (file)
@@ -116,14 +116,15 @@ static void *hash_register_notify(connection_struct *conn, char *path, uint32 fl
 }
 
 /****************************************************************************
-check if a change notify should be issued 
+ Check if a change notify should be issued.
+ A time of zero means instantaneous check - don't modify the last check time.
 *****************************************************************************/
 static BOOL hash_check_notify(connection_struct *conn, uint16 vuid, char *path, uint32 flags, void *datap, time_t t)
 {
        struct change_data *data = (struct change_data *)datap;
        struct change_data data2;
 
-       if (t < data->last_check_time + lp_change_notify_timeout()) return False;
+       if (t && t < data->last_check_time + lp_change_notify_timeout()) return False;
 
        if (!become_user(conn,vuid)) return True;
        if (!become_service(conn,True)) {
@@ -140,7 +141,9 @@ static BOOL hash_check_notify(connection_struct *conn, uint16 vuid, char *path,
                return True;
        }
 
-       data->last_check_time = t;          
+       if (t)
+               data->last_check_time = t;
+
        unbecome_user();
 
        return False;
index c5172540483327212cc7bf38587b459c2eff1845..db823601f1919d2252f4dd94928b61fc3675574e 100644 (file)
@@ -74,12 +74,17 @@ static void signal_handler(int signal, siginfo_t *info, void *unused)
 
 
 /****************************************************************************
-check if a change notify should be issued 
+ Check if a change notify should be issued.
+ time zero means instantaneous check (used for hash). Ignore this (normal method
+ will be used instead).
 *****************************************************************************/
 static BOOL kernel_check_notify(connection_struct *conn, uint16 vuid, char *path, uint32 flags, void *datap, time_t t)
 {
        struct change_data *data = (struct change_data *)datap;
 
+       if (!t)
+               return False;
+
        if (data->directory_handle != (int)fd_pending) return False;
 
        DEBUG(3,("kernel change notify on %s fd=%d\n", path, (int)fd_pending));
index 8147a3adacd047629a5a13178a9150e3953e66f0..1599f01aa5b941eed0438e95f24ad6a01932c707 100644 (file)
@@ -1473,11 +1473,18 @@ static int call_nt_transact_rename(connection_struct *conn,
           fsp->fsp_name, new_name));
 
     outsize = -1;
+
+       /*
+        * Win2k needs a changenotify request response before it will
+        * update after a rename..
+        */
+
+       process_pending_change_notify_queue((time_t)0);
   }
 
   return(outsize);
 }
-   
+
 
 /****************************************************************************
  Reply to query a security descriptor - currently this is not implemented (it
index 397cae62217fa98da0a0a9a78e4db8722df9cffb..9dd5a9ef68d87d5449b3db5fd0454abe4712a4a9 100644 (file)
@@ -3639,8 +3639,17 @@ int reply_mv(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, in
   DEBUG(3,("reply_mv : %s -> %s\n",name,newname));
 
   outsize = rename_internals(conn, inbuf, outbuf, name, newname, False);
-  if(outsize == 0) 
+  if(outsize == 0) {
+
+       /*
+     * Win2k needs a changenotify request response before it will
+     * update after a rename..
+     */
+
+    process_pending_change_notify_queue((time_t)0);
+
     outsize = set_message(outbuf,0,0,True);
+  }
   
   return(outsize);
 }