summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-09-20 19:00:21 +0000
committerJeremy Allison <jra@samba.org>2000-09-20 19:00:21 +0000
commit7a3795d5df8dc1b2e3d2afe2a9e12db34d80e305 (patch)
tree20e18e2536a3c0ba917921f06a458351b545c7ce
parent13904f585cbc4ccd5a366c288e6a32af44c30d27 (diff)
downloadsamba-7a3795d5df8dc1b2e3d2afe2a9e12db34d80e305.tar.gz
samba-7a3795d5df8dc1b2e3d2afe2a9e12db34d80e305.tar.bz2
samba-7a3795d5df8dc1b2e3d2afe2a9e12db34d80e305.zip
Fix to allow a timestamp of zero to cause an instantaneous changenotify
scan - then call this from renames. This allows instantaneous update for W2k renames. Jeremy. (This used to be commit 07dffc4ee931cbc61197e2da277df9c404a77469)
-rw-r--r--source3/smbd/notify_hash.c9
-rw-r--r--source3/smbd/notify_kernel.c7
-rw-r--r--source3/smbd/nttrans.c9
-rw-r--r--source3/smbd/reply.c11
4 files changed, 30 insertions, 6 deletions
diff --git a/source3/smbd/notify_hash.c b/source3/smbd/notify_hash.c
index fe09d9cf9d..95d430d23b 100644
--- a/source3/smbd/notify_hash.c
+++ b/source3/smbd/notify_hash.c
@@ -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;
diff --git a/source3/smbd/notify_kernel.c b/source3/smbd/notify_kernel.c
index c517254048..db823601f1 100644
--- a/source3/smbd/notify_kernel.c
+++ b/source3/smbd/notify_kernel.c
@@ -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));
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 8147a3adac..1599f01aa5 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -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
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 397cae6221..9dd5a9ef68 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -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);
}