svn commit: samba r20916 - in branches: SAMBA_3_0/source/include
SAMBA_3_0/source/lib SAMBA_3_0/source/locking
SAMBA_3_0/source/smbd SAMBA_3_0_24/source/include
SAMBA_3_0_24/source/lib SAMBA_3_0_24/source/locking
SAMBA_3_0_24/source/smbd
jra at samba.org
jra at samba.org
Fri Jan 19 21:46:13 GMT 2007
Author: jra
Date: 2007-01-19 21:46:12 +0000 (Fri, 19 Jan 2007)
New Revision: 20916
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20916
Log:
Add in the delete on close final fix - but only enabled
with -DDEVELOPER.
Jeremy.
Modified:
branches/SAMBA_3_0/source/include/messages.h
branches/SAMBA_3_0/source/lib/dummysmbd.c
branches/SAMBA_3_0/source/locking/locking.c
branches/SAMBA_3_0/source/smbd/close.c
branches/SAMBA_3_0/source/smbd/filename.c
branches/SAMBA_3_0/source/smbd/server.c
branches/SAMBA_3_0/source/smbd/statcache.c
branches/SAMBA_3_0_24/source/include/messages.h
branches/SAMBA_3_0_24/source/lib/dummysmbd.c
branches/SAMBA_3_0_24/source/locking/locking.c
branches/SAMBA_3_0_24/source/smbd/close.c
branches/SAMBA_3_0_24/source/smbd/filename.c
branches/SAMBA_3_0_24/source/smbd/server.c
branches/SAMBA_3_0_24/source/smbd/statcache.c
Changeset:
Modified: branches/SAMBA_3_0/source/include/messages.h
===================================================================
--- branches/SAMBA_3_0/source/include/messages.h 2007-01-19 21:29:46 UTC (rev 20915)
+++ branches/SAMBA_3_0/source/include/messages.h 2007-01-19 21:46:12 UTC (rev 20916)
@@ -72,6 +72,7 @@
#define MSG_SMB_INJECT_FAULT 3012
#define MSG_SMB_BLOCKING_LOCK_CANCEL 3013
#define MSG_SMB_NOTIFY 3014
+#define MSG_SMB_STAT_CACHE_DELETE 3015
/* winbind messages */
#define MSG_WINBIND_FINISHED 4001
Modified: branches/SAMBA_3_0/source/lib/dummysmbd.c
===================================================================
--- branches/SAMBA_3_0/source/lib/dummysmbd.c 2007-01-19 21:29:46 UTC (rev 20915)
+++ branches/SAMBA_3_0/source/lib/dummysmbd.c 2007-01-19 21:46:12 UTC (rev 20916)
@@ -53,3 +53,7 @@
{
return NULL;
}
+
+void send_stat_cache_delete_message(const char *name)
+{
+}
Modified: branches/SAMBA_3_0/source/locking/locking.c
===================================================================
--- branches/SAMBA_3_0/source/locking/locking.c 2007-01-19 21:29:46 UTC (rev 20915)
+++ branches/SAMBA_3_0/source/locking/locking.c 2007-01-19 21:46:12 UTC (rev 20916)
@@ -1281,6 +1281,10 @@
set_delete_on_close_lck(lck, delete_on_close, tok);
+ if (fsp->is_directory) {
+ send_stat_cache_delete_message(fsp->fsp_name);
+ }
+
TALLOC_FREE(lck);
return True;
}
Modified: branches/SAMBA_3_0/source/smbd/close.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/close.c 2007-01-19 21:29:46 UTC (rev 20915)
+++ branches/SAMBA_3_0/source/smbd/close.c 2007-01-19 21:46:12 UTC (rev 20916)
@@ -431,6 +431,7 @@
become_user(fsp->conn, fsp->vuid);
became_user = True;
}
+ send_stat_cache_delete_message(fsp->fsp_name);
set_delete_on_close_lck(lck, True, ¤t_user.ut);
if (became_user) {
unbecome_user();
Modified: branches/SAMBA_3_0/source/smbd/filename.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/filename.c 2007-01-19 21:29:46 UTC (rev 20915)
+++ branches/SAMBA_3_0/source/smbd/filename.c 2007-01-19 21:46:12 UTC (rev 20916)
@@ -462,6 +462,12 @@
}
} /* end else */
+#ifdef DEVELOPER
+ if (VALID_STAT(st) && get_delete_on_close_flag(st.st_dev, st.st_ino)) {
+ return NT_STATUS_DELETE_PENDING;
+ }
+#endif
+
/*
* Add to the dirpath that we have resolved so far.
*/
Modified: branches/SAMBA_3_0/source/smbd/server.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/server.c 2007-01-19 21:29:46 UTC (rev 20915)
+++ branches/SAMBA_3_0/source/smbd/server.c 2007-01-19 21:46:12 UTC (rev 20916)
@@ -83,6 +83,18 @@
}
+/*******************************************************************
+ Delete a statcache entry.
+ ********************************************************************/
+
+static void smb_stat_cache_delete(int msg_type, struct process_id src,
+ void *buf, size_t len)
+{
+ const char *name = (const char *)buf;
+ DEBUG(10,("smb_stat_cache_delete: delete name %s\n", name));
+ stat_cache_delete(name);
+}
+
/****************************************************************************
Terminate signal.
****************************************************************************/
@@ -422,6 +434,7 @@
message_register(MSG_SHUTDOWN, msg_exit_server);
message_register(MSG_SMB_FILE_RENAME, msg_file_was_renamed);
message_register(MSG_SMB_CONF_UPDATED, smb_conf_updated);
+ message_register(MSG_SMB_STAT_CACHE_DELETE, smb_stat_cache_delete);
#ifdef DEVELOPER
message_register(MSG_SMB_INJECT_FAULT, msg_inject_fault);
Modified: branches/SAMBA_3_0/source/smbd/statcache.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/statcache.c 2007-01-19 21:29:46 UTC (rev 20915)
+++ branches/SAMBA_3_0/source/smbd/statcache.c 2007-01-19 21:46:12 UTC (rev 20916)
@@ -285,6 +285,40 @@
}
}
+/***************************************************************************
+ Tell all smbd's to delete an entry.
+**************************************************************************/
+
+void send_stat_cache_delete_message(const char *name)
+{
+#ifdef DEVELOPER
+ message_send_all(conn_tdb_ctx(),
+ MSG_SMB_STAT_CACHE_DELETE,
+ name,
+ strlen(name)+1,
+ True,
+ NULL);
+#endif
+}
+
+/***************************************************************************
+ Delete an entry.
+**************************************************************************/
+
+void stat_cache_delete(const char *name)
+{
+ char *lname = strdup_upper(name);
+
+ if (!lname) {
+ return;
+ }
+ DEBUG(10,("stat_cache_delete: deleting name [%s] -> %s\n",
+ lname, name ));
+
+ tdb_delete_bystring(tdb_stat_cache, lname);
+ SAFE_FREE(lname);
+}
+
/***************************************************************
Compute a hash value based on a string key value.
The function returns the bucket index number for the hashed key.
Modified: branches/SAMBA_3_0_24/source/include/messages.h
===================================================================
--- branches/SAMBA_3_0_24/source/include/messages.h 2007-01-19 21:29:46 UTC (rev 20915)
+++ branches/SAMBA_3_0_24/source/include/messages.h 2007-01-19 21:46:12 UTC (rev 20916)
@@ -71,6 +71,8 @@
#define MSG_SMB_FILE_RENAME 3011
#define MSG_SMB_INJECT_FAULT 3012
#define MSG_SMB_BLOCKING_LOCK_CANCEL 3013
+#define MSG_SMB_NOTIFY 3014
+#define MSG_SMB_STAT_CACHE_DELETE 3015
/* winbind messages */
#define MSG_WINBIND_FINISHED 4001
Modified: branches/SAMBA_3_0_24/source/lib/dummysmbd.c
===================================================================
--- branches/SAMBA_3_0_24/source/lib/dummysmbd.c 2007-01-19 21:29:46 UTC (rev 20915)
+++ branches/SAMBA_3_0_24/source/lib/dummysmbd.c 2007-01-19 21:46:12 UTC (rev 20916)
@@ -53,3 +53,7 @@
{
return NULL;
}
+
+void send_stat_cache_delete_message(const char *name)
+{
+}
Modified: branches/SAMBA_3_0_24/source/locking/locking.c
===================================================================
--- branches/SAMBA_3_0_24/source/locking/locking.c 2007-01-19 21:29:46 UTC (rev 20915)
+++ branches/SAMBA_3_0_24/source/locking/locking.c 2007-01-19 21:46:12 UTC (rev 20916)
@@ -1281,6 +1281,10 @@
set_delete_on_close_lck(lck, delete_on_close, tok);
+ if (fsp->is_directory) {
+ send_stat_cache_delete_message(fsp->fsp_name);
+ }
+
TALLOC_FREE(lck);
return True;
}
Modified: branches/SAMBA_3_0_24/source/smbd/close.c
===================================================================
--- branches/SAMBA_3_0_24/source/smbd/close.c 2007-01-19 21:29:46 UTC (rev 20915)
+++ branches/SAMBA_3_0_24/source/smbd/close.c 2007-01-19 21:46:12 UTC (rev 20916)
@@ -431,6 +431,7 @@
become_user(fsp->conn, fsp->vuid);
became_user = True;
}
+ send_stat_cache_delete_message(fsp->fsp_name);
set_delete_on_close_lck(lck, True, ¤t_user.ut);
if (became_user) {
unbecome_user();
Modified: branches/SAMBA_3_0_24/source/smbd/filename.c
===================================================================
--- branches/SAMBA_3_0_24/source/smbd/filename.c 2007-01-19 21:29:46 UTC (rev 20915)
+++ branches/SAMBA_3_0_24/source/smbd/filename.c 2007-01-19 21:46:12 UTC (rev 20916)
@@ -462,6 +462,12 @@
}
} /* end else */
+#ifdef DEVELOPER
+ if (VALID_STAT(st) && get_delete_on_close_flag(st.st_dev, st.st_ino)) {
+ return NT_STATUS_DELETE_PENDING;
+ }
+#endif
+
/*
* Add to the dirpath that we have resolved so far.
*/
Modified: branches/SAMBA_3_0_24/source/smbd/server.c
===================================================================
--- branches/SAMBA_3_0_24/source/smbd/server.c 2007-01-19 21:29:46 UTC (rev 20915)
+++ branches/SAMBA_3_0_24/source/smbd/server.c 2007-01-19 21:46:12 UTC (rev 20916)
@@ -73,6 +73,18 @@
}
+/*******************************************************************
+ Delete a statcache entry.
+ ********************************************************************/
+
+static void smb_stat_cache_delete(int msg_type, struct process_id src,
+ void *buf, size_t len)
+{
+ const char *name = (const char *)buf;
+ DEBUG(10,("smb_stat_cache_delete: delete name %s\n", name));
+ stat_cache_delete(name);
+}
+
/****************************************************************************
Terminate signal.
****************************************************************************/
@@ -412,6 +424,7 @@
message_register(MSG_SHUTDOWN, msg_exit_server);
message_register(MSG_SMB_FILE_RENAME, msg_file_was_renamed);
message_register(MSG_SMB_CONF_UPDATED, smb_conf_updated);
+ message_register(MSG_SMB_STAT_CACHE_DELETE, smb_stat_cache_delete);
#ifdef DEVELOPER
message_register(MSG_SMB_INJECT_FAULT, msg_inject_fault);
Modified: branches/SAMBA_3_0_24/source/smbd/statcache.c
===================================================================
--- branches/SAMBA_3_0_24/source/smbd/statcache.c 2007-01-19 21:29:46 UTC (rev 20915)
+++ branches/SAMBA_3_0_24/source/smbd/statcache.c 2007-01-19 21:46:12 UTC (rev 20916)
@@ -285,6 +285,40 @@
}
}
+/***************************************************************************
+ Tell all smbd's to delete an entry.
+**************************************************************************/
+
+void send_stat_cache_delete_message(const char *name)
+{
+#ifdef DEVELOPER
+ message_send_all(conn_tdb_ctx(),
+ MSG_SMB_STAT_CACHE_DELETE,
+ name,
+ strlen(name)+1,
+ True,
+ NULL);
+#endif
+}
+
+/***************************************************************************
+ Delete an entry.
+**************************************************************************/
+
+void stat_cache_delete(const char *name)
+{
+ char *lname = strdup_upper(name);
+
+ if (!lname) {
+ return;
+ }
+ DEBUG(10,("stat_cache_delete: deleting name [%s] -> %s\n",
+ lname, name ));
+
+ tdb_delete_bystring(tdb_stat_cache, lname);
+ SAFE_FREE(lname);
+}
+
/***************************************************************
Compute a hash value based on a string key value.
The function returns the bucket index number for the hashed key.
More information about the samba-cvs
mailing list