summaryrefslogtreecommitdiff
path: root/source3/smbd/files.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-03-12 15:39:38 +0100
committerStefan Metzmacher <metze@samba.org>2008-04-07 12:29:26 +0200
commitd03453864ab1bc5fd3b4a3abaf96176a006c102b (patch)
tree13389e06bd05336a1937b98d3e821ad995eef019 /source3/smbd/files.c
parent2ccf50256e31bd7b9da0f7a7c223bebca5bca062 (diff)
downloadsamba-d03453864ab1bc5fd3b4a3abaf96176a006c102b.tar.gz
samba-d03453864ab1bc5fd3b4a3abaf96176a006c102b.tar.bz2
samba-d03453864ab1bc5fd3b4a3abaf96176a006c102b.zip
smbd: implement the strange write time update logic
We now never call file_ntimes() directly, every update is done via smb_set_file_time(). This let samba3 pass the BASE-DELAYWRITE test. The write time is only updated 2 seconds after the first write() on any open handle to the current time (not the time of the first write). Each handle which had write requests updates the write time to the current time on close(). If the write time is set explicit via setfileinfo or setpathinfo the write time is visible directly and a following close on the same handle doesn't update the write time. metze (This used to be commit 2eab212ea2e1bfd8fa716c2c89b2c042f7ba12ea)
Diffstat (limited to 'source3/smbd/files.c')
-rw-r--r--source3/smbd/files.c29
1 files changed, 3 insertions, 26 deletions
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index 95f01b88ce..d6e91c67be 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -375,29 +375,6 @@ files_struct *file_find_print(void)
}
/****************************************************************************
- Set a pending modtime across all files with a given dev/ino pair.
- Record the owner of that modtime.
-****************************************************************************/
-
-void fsp_set_pending_modtime(files_struct *tfsp, const struct timespec mod)
-{
- files_struct *fsp;
-
- if (null_timespec(mod)) {
- return;
- }
-
- for (fsp = Files;fsp;fsp=fsp->next) {
- if ( fsp->fh->fd != -1 && file_id_equal(&fsp->file_id, &tfsp->file_id)) {
- fsp->pending_modtime = mod;
- fsp->pending_modtime_owner = False;
- }
- }
-
- tfsp->pending_modtime_owner = True;
-}
-
-/****************************************************************************
Sync open files on a connection.
****************************************************************************/
@@ -441,6 +418,9 @@ void file_free(files_struct *fsp)
/* Ensure this event will never fire. */
TALLOC_FREE(fsp->oplock_timeout);
+ /* Ensure this event will never fire. */
+ TALLOC_FREE(fsp->update_write_time_event);
+
bitmap_clear(file_bmap, fsp->fnum - FILE_HANDLE_OFFSET);
files_used--;
@@ -548,9 +528,6 @@ NTSTATUS dup_file_fsp(files_struct *fsp,
dup_fsp->open_time = fsp->open_time;
dup_fsp->access_mask = access_mask;
dup_fsp->share_access = share_access;
- dup_fsp->pending_modtime_owner = fsp->pending_modtime_owner;
- dup_fsp->pending_modtime = fsp->pending_modtime;
- dup_fsp->last_write_time = fsp->last_write_time;
dup_fsp->oplock_type = fsp->oplock_type;
dup_fsp->can_lock = fsp->can_lock;
dup_fsp->can_read = (access_mask & (FILE_READ_DATA)) ? True : False;