summaryrefslogtreecommitdiff
path: root/source3/include
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-09-05 19:00:48 -0700
committerJeremy Allison <jra@samba.org>2008-09-05 19:00:48 -0700
commit405b072431db3f3f8f16e4e0d2f2b1b2f1c71286 (patch)
tree8a44daaa1bb7912a33ecb1145f48ef4f13e2fe32 /source3/include
parenta90ba70cbf8af0d6081f6bb02cae71b955126c49 (diff)
downloadsamba-405b072431db3f3f8f16e4e0d2f2b1b2f1c71286.tar.gz
samba-405b072431db3f3f8f16e4e0d2f2b1b2f1c71286.tar.bz2
samba-405b072431db3f3f8f16e4e0d2f2b1b2f1c71286.zip
Write times code update.
Ok, here's the fix for the write times breakage with the new tests in S4 smbtorture. The key is keeping in the share mode struct the "old_file_time" as the real write time, set by all the write and allocation calls, and the "changed_write_time" as the "sticky" write time - set by the SET_FILE_TIME calls. We can set them independently (although I kept the optimization of not setting the "old_file_time" is a "changed_write_time" was already set, as we'll never see it. This allows us to update the write time immediately on the SMBwrite truncate case, SET_END_OF_FILE and SET_ALLOCATION_SIZE calls, whilst still have the 2 second delay on the "normal" SMBwrite, SMBwriteX calls. I think in a subsequent patch I'd like to change the name of these from "old_file_time" to "write_time" and "changed_write_time" to "sticky_write_time" to make this clearer. I think I also fixed a bug in Metze's original code in that once a write timestamp had been set from a "normal" SMBwriteX call the fsp->update_write_time_triggered variable was set and then never reset - thus meaning the write timestamp would never get updated again on subsequent SMBwriteX's. The new code checks the update_write_time_event event instead, and doesn't update is there's an event already scheduled. Metze especially, please check this over for your understanding. Jeremy. (This used to be commit 6f20585419046c4aca1f7d6c863cf79eb6ae53b0)
Diffstat (limited to 'source3/include')
-rw-r--r--source3/include/proto.h14
-rw-r--r--source3/include/smb.h1
2 files changed, 7 insertions, 8 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 291afac44d..e94a2178c0 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -5306,8 +5306,8 @@ void set_delete_on_close_token(struct share_mode_lock *lck, UNIX_USER_TOKEN *tok
void set_delete_on_close_lck(struct share_mode_lock *lck, bool delete_on_close, UNIX_USER_TOKEN *tok);
bool set_delete_on_close(files_struct *fsp, bool delete_on_close, UNIX_USER_TOKEN *tok);
bool set_allow_initial_delete_on_close(struct share_mode_lock *lck, files_struct *fsp, bool delete_on_close);
-bool set_write_time(struct file_id fileid, struct timespec write_time,
- bool overwrite);
+bool set_sticky_write_time(struct file_id fileid, struct timespec write_time);
+bool set_write_time(struct file_id fileid, struct timespec write_time);
int share_mode_forall(void (*fn)(const struct share_mode_entry *, const char *,
const char *, void *),
void *private_data);
@@ -9616,11 +9616,10 @@ int file_set_dosmode(connection_struct *conn, const char *fname,
const char *parent_dir,
bool newfile);
int file_ntimes(connection_struct *conn, const char *fname, const struct timespec ts[2]);
-bool set_write_time_path(connection_struct *conn, const char *fname,
- struct file_id fileid, const struct timespec mtime,
- bool overwrite);
-bool set_write_time_fsp(struct files_struct *fsp, const struct timespec mtime,
- bool overwrite);
+bool set_sticky_write_time_path(connection_struct *conn, const char *fname,
+ struct file_id fileid, const struct timespec mtime);
+bool set_sticky_write_time_fsp(struct files_struct *fsp, const struct timespec mtime);
+bool update_write_time(struct files_struct *fsp);
/* The following definitions come from smbd/error.c */
@@ -9665,6 +9664,7 @@ bool directory_has_default_acl(connection_struct *conn, const char *fname);
ssize_t read_file(files_struct *fsp,char *data,SMB_OFF_T pos,size_t n);
void trigger_write_time_update(struct files_struct *fsp);
+void trigger_write_time_update_immediate(struct files_struct *fsp);
ssize_t write_file(struct smb_request *req,
files_struct *fsp,
const char *data,
diff --git a/source3/include/smb.h b/source3/include/smb.h
index c8c4f8c3cc..d450eb51fa 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -456,7 +456,6 @@ typedef struct files_struct {
uint32 access_mask; /* NTCreateX access bits (FILE_READ_DATA etc.) */
uint32 share_access; /* NTCreateX share constants (FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE). */
- bool update_write_time_triggered;
struct timed_event *update_write_time_event;
bool update_write_time_on_close;
struct timespec close_write_time;