diff options
author | Stefan Metzmacher <metze@samba.org> | 2008-03-12 15:32:47 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2008-04-07 12:29:25 +0200 |
commit | 2ccf50256e31bd7b9da0f7a7c223bebca5bca062 (patch) | |
tree | cce0d5430e82941b8195e6952fd2704241f4ddfa /source3/smbd/open.c | |
parent | 4f715d110279098bb62cb3f5b0831f1a8868068a (diff) | |
download | samba-2ccf50256e31bd7b9da0f7a7c223bebca5bca062.tar.gz samba-2ccf50256e31bd7b9da0f7a7c223bebca5bca062.tar.bz2 samba-2ccf50256e31bd7b9da0f7a7c223bebca5bca062.zip |
locking: store the write time in the locking.tdb
This is needed to implement the strange write time update
logic later. We need to store 2 time timestamps to
distinguish between the time the file system had before
the first client opened the file and a forced timestamp update.
metze
(This used to be commit 6aaa2ce0eeb46f6735ec984a2e7aadde7a7f456d)
Diffstat (limited to 'source3/smbd/open.c')
-rw-r--r-- | source3/smbd/open.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 0cc48c4f1c..f3ed234c87 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1221,7 +1221,8 @@ NTSTATUS open_file_ntcreate(connection_struct *conn, request_time = pml->request_time; /* Remove the deferred open entry under lock. */ - lck = get_share_mode_lock(talloc_tos(), state->id, NULL, NULL); + lck = get_share_mode_lock(talloc_tos(), state->id, NULL, NULL, + NULL); if (lck == NULL) { DEBUG(0, ("could not get share mode lock\n")); } else { @@ -1450,11 +1451,12 @@ NTSTATUS open_file_ntcreate(connection_struct *conn, } if (file_existed) { + struct timespec old_write_time = get_mtimespec(psbuf); id = vfs_file_id_from_sbuf(conn, psbuf); lck = get_share_mode_lock(talloc_tos(), id, conn->connectpath, - fname); + fname, &old_write_time); if (lck == NULL) { file_free(fsp); @@ -1661,7 +1663,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn, } if (!file_existed) { - + struct timespec old_write_time = get_mtimespec(psbuf); /* * Deal with the race condition where two smbd's detect the * file doesn't exist and do the create at the same time. One @@ -1681,7 +1683,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn, lck = get_share_mode_lock(talloc_tos(), id, conn->connectpath, - fname); + fname, &old_write_time); if (lck == NULL) { DEBUG(0, ("open_file_ntcreate: Could not get share " @@ -2095,6 +2097,7 @@ NTSTATUS open_directory(connection_struct *conn, bool dir_existed = VALID_STAT(*psbuf) ? True : False; struct share_mode_lock *lck = NULL; NTSTATUS status; + struct timespec mtimespec; int info = 0; DEBUG(5,("open_directory: opening directory %s, access_mask = 0x%x, " @@ -2217,9 +2220,11 @@ NTSTATUS open_directory(connection_struct *conn, string_set(&fsp->fsp_name,fname); + mtimespec = get_mtimespec(psbuf); + lck = get_share_mode_lock(talloc_tos(), fsp->file_id, conn->connectpath, - fname); + fname, &mtimespec); if (lck == NULL) { DEBUG(0, ("open_directory: Could not get share mode lock for %s\n", fname)); |