smbd: make it possible to change the write time delay for testing
authorStefan Metzmacher <metze@samba.org>
Mon, 7 Apr 2008 07:27:22 +0000 (09:27 +0200)
committerKarolin Seeger <kseeger@samba.org>
Sat, 12 Apr 2008 05:48:25 +0000 (07:48 +0200)
metze
(cherry picked from commit df8c100c2b53575a0d425a2daf52e2d59904746a)

source/include/local.h
source/smbd/fileio.c

index 6d32f4fe6e9a5b404017196ab461b5e018152254..c125ded37130302ec54531e18846b2fbf74f2249 100644 (file)
 /* Number of microseconds to wait before a sharing violation. */
 #define SHARING_VIOLATION_USEC_WAIT 950000
 
+/* Number of microseconds to wait before a updating the write time (2 secs). */
+#define WRITE_TIME_UPDATE_USEC_DELAY 2000000
+
 #define MAX_LDAP_REPLICATION_SLEEP_TIME 5000 /* In milliseconds. */
 
 /* tdb hash size for the open database. */
index 93a303f6c867e232d64508a2c7d8020d9ca1c3d6..64cea7f7ced116b87b4f1ccac2361484429f8643 100644 (file)
@@ -188,6 +188,8 @@ static void update_write_time_handler(struct event_context *ctx,
 
 void trigger_write_time_update(struct files_struct *fsp)
 {
+       int delay;
+
        if (fsp->write_time_forced) {
                return;
        }
@@ -197,11 +199,15 @@ void trigger_write_time_update(struct files_struct *fsp)
        }
        fsp->update_write_time_triggered = true;
 
+       delay = lp_parm_int(SNUM(fsp->conn),
+                           "smbd", "writetimeupdatedelay",
+                           WRITE_TIME_UPDATE_USEC_DELAY);
+
        /* trigger the update 2 seconds later */
        fsp->update_write_time_on_close = true;
        fsp->update_write_time_event =
                event_add_timed(smbd_event_context(), NULL,
-                               timeval_current_ofs(2, 0),
+                               timeval_current_ofs(0, delay),
                                "update_write_time_handler",
                                update_write_time_handler, fsp);
 }