1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

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 commit is contained in:
Jeremy Allison -
parent d666b958bc
commit 07dffc4ee9
4 changed files with 30 additions and 6 deletions

View 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;

View 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));

View 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

View 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);
}