[SCM] Samba Shared Repository - branch v4-0-test updated - release-4-0-0alpha4-16-g03f43a9

Stefan Metzmacher metze at samba.org
Tue Jun 3 12:09:08 GMT 2008


The branch, v4-0-test has been updated
       via  03f43a9a91bffd60de8f59f8fb717505a428d070 (commit)
       via  c285b540cb1c2b554a85ef08a4280f544d9d20cc (commit)
       via  62030027d1ab735fb9c590fafb0887dc882662d1 (commit)
       via  61bad69e2d7f84e2c6d6fb82917cfa86b17f54b0 (commit)
       via  7f033ce4fb6fc897f8159926d5a6d2e45dd447b6 (commit)
       via  58c118ab4d2b76c4ea68d79b711b81900634f767 (commit)
       via  418e2592b48d558ff1d32031d64263ae21cf1eb0 (commit)
       via  c8e15d4c185f18322a882aa908939fa9d0e341a0 (commit)
       via  c3ba19ca62affced96b927fcbe63cf5d075aed22 (commit)
       via  def52cc0988c26a815e74b3391e5857512408d90 (commit)
       via  3868d8ce630c71e2c70aae442fcdbd68ba1eb708 (commit)
       via  fde9880f9943897549859037b0fc9341d3a032f7 (commit)
       via  9c004df8910c07d75bb3f75d7c3cfba9f9c94f51 (commit)
      from  e9bc72495affb31e5c3d25be7e86d51659333374 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test


- Log -----------------------------------------------------------------
commit 03f43a9a91bffd60de8f59f8fb717505a428d070
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon May 5 13:10:02 2008 +0200

    selftest: don't skip BASE-DELAYWRITE
    
    metze

commit c285b540cb1c2b554a85ef08a4280f544d9d20cc
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon May 5 13:06:54 2008 +0200

    selftest: pass torture:writetimeupdatedelay to smbtorture
    
    metze

commit 62030027d1ab735fb9c590fafb0887dc882662d1
Author: Stefan Metzmacher <metze at sernet.de>
Date:   Tue Jun 3 11:06:33 2008 +0200

    selftest: set posix:writetimeupdatedelay
    
    metze
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 61bad69e2d7f84e2c6d6fb82917cfa86b17f54b0
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Jun 3 13:32:04 2008 +0200

    pvfs: use utimes() instead of utime() to get better timestamp resolution
    
    Note: that libreplace always provides utimes()
    
    metze

commit 7f033ce4fb6fc897f8159926d5a6d2e45dd447b6
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu May 8 22:16:55 2008 +0200

    pvfs_close: correctly handle the write time updates passed by close()
    
    metze

commit 58c118ab4d2b76c4ea68d79b711b81900634f767
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Jun 3 11:54:21 2008 +0200

    pvfs: correctly set the write time in the handle destructor
    
    metze

commit 418e2592b48d558ff1d32031d64263ae21cf1eb0
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Jun 3 11:47:12 2008 +0200

    pvfs_setfileinfo: update the write time in the opendb
    
    metze

commit c8e15d4c185f18322a882aa908939fa9d0e341a0
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Jun 3 11:36:08 2008 +0200

    pvfs: trigger a write time update 2 seconds after the first write
    
    metze

commit c3ba19ca62affced96b927fcbe63cf5d075aed22
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Jun 3 11:34:10 2008 +0200

    pvfs: add posix:writetimeupdatedelay option
    
    metze

commit def52cc0988c26a815e74b3391e5857512408d90
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon May 5 12:18:47 2008 +0200

    pvfs: add PVFS_RESOLVE_NO_OPENDB flag and get the write time from the opendb
    
    By default get the current write time from the opendb,
    but allow callers to pass PVFS_RESOLVE_NO_OPENDB
    for performance reasons, if they don't need to the write time.
    
    metze

commit 3868d8ce630c71e2c70aae442fcdbd68ba1eb708
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Apr 15 16:00:42 2008 +0200

    opendb: add write time handling
    
    metze

commit fde9880f9943897549859037b0fc9341d3a032f7
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Jun 3 14:01:02 2008 +0200

    BASE-DELAYWRITE: fix test on filesystem without high resolution timestamps
    
    metze

commit 9c004df8910c07d75bb3f75d7c3cfba9f9c94f51
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon May 5 15:05:41 2008 +0200

    BASE-DELAYWRITE: add missing time checks to make sure the server has updated the write time
    
    metze

-----------------------------------------------------------------------

Summary of changes:
 source/cluster/ctdb/opendb_ctdb.c     |   51 +++++++++-----------
 source/librpc/idl/opendb.idl          |    2 +
 source/ntvfs/common/opendb.c          |   24 ++++++---
 source/ntvfs/common/opendb.h          |    9 ++-
 source/ntvfs/common/opendb_tdb.c      |   51 +++++++++++++++++--
 source/ntvfs/posix/pvfs_fileinfo.c    |   31 +++++++++++-
 source/ntvfs/posix/pvfs_open.c        |   80 +++++++++++++++++++++++++-----
 source/ntvfs/posix/pvfs_rename.c      |    8 ++-
 source/ntvfs/posix/pvfs_resolve.c     |   32 ++++++++----
 source/ntvfs/posix/pvfs_search.c      |    2 +-
 source/ntvfs/posix/pvfs_seek.c        |    2 +-
 source/ntvfs/posix/pvfs_setfileinfo.c |   87 +++++++++++++++++++++++++++-----
 source/ntvfs/posix/pvfs_unlink.c      |    9 +++-
 source/ntvfs/posix/pvfs_write.c       |   55 +++++++++++++++++++++
 source/ntvfs/posix/vfs_posix.c        |    4 ++
 source/ntvfs/posix/vfs_posix.h        |   14 +++++
 source/samba4-knownfail               |    1 -
 source/samba4-skip                    |    2 -
 source/selftest/samba4_tests.sh       |    6 ++-
 source/selftest/target/Samba4.pm      |    3 +
 source/torture/basic/delaywrite.c     |    4 +-
 21 files changed, 381 insertions(+), 96 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/cluster/ctdb/opendb_ctdb.c b/source/cluster/ctdb/opendb_ctdb.c
index ed09cf0..b1faf9e 100644
--- a/source/cluster/ctdb/opendb_ctdb.c
+++ b/source/cluster/ctdb/opendb_ctdb.c
@@ -283,7 +283,8 @@ static NTSTATUS odb_oplock_break_send(struct odb_context *odb, struct opendb_ent
 */
 static NTSTATUS odb_ctdb_open_file(struct odb_lock *lck,
 				   void *file_handle, const char *path,
-				   int *fd, bool allow_level_II_oplock,
+				   int *fd, NTTIME open_write_time,
+				   bool allow_level_II_oplock,
 				   uint32_t oplock_level, uint32_t *oplock_granted)
 
 {
@@ -492,37 +493,30 @@ static NTSTATUS odb_ctdb_set_delete_on_close(struct odb_lock *lck, bool del_on_c
 	return odb_push_record(lck, &file);
 }
 
+static NTSTATUS odb_ctdb_set_write_time(struct odb_lock *lck,
+					NTTIME write_time, bool force)
+{
+	/*
+	 * as this file will went away and isn't used yet,
+	 * copy the implementation from the tdb backend
+	 * --metze
+	 */
+	return NT_STATUS_FOOBAR;
+}
+
 /*
   return the current value of the delete_on_close bit, and how many
   people still have the file open
 */
-static NTSTATUS odb_ctdb_get_delete_on_close(struct odb_context *odb, 
-					    DATA_BLOB *key, bool *del_on_close)
+static NTSTATUS odb_ctdb_get_file_infos(struct odb_context *odb, DATA_BLOB *key,
+					bool *del_on_close, NTTIME *write_time)
 {
-	NTSTATUS status;
-	struct opendb_file file;
-	struct odb_lock *lck;
-
-	(*del_on_close) = false;
-
-	lck = odb_lock(odb, odb, key);
-	NT_STATUS_HAVE_NO_MEMORY(lck);
-
-	status = odb_pull_record(lck, &file);
-	if (NT_STATUS_EQUAL(NT_STATUS_OBJECT_NAME_NOT_FOUND, status)) {
-		talloc_free(lck);
-		return NT_STATUS_OK;
-	}
-	if (!NT_STATUS_IS_OK(status)) {
-		talloc_free(lck);
-		return status;
-	}
-
-	(*del_on_close) = file.delete_on_close;
-
-	talloc_free(lck);
-
-	return NT_STATUS_OK;
+	/*
+	 * as this file will went away and isn't used yet,
+	 * copy the implementation from the tdb backend
+	 * --metze
+	 */
+	return NT_STATUS_FOOBAR;
 }
 
 
@@ -589,7 +583,8 @@ static const struct opendb_ops opendb_ctdb_ops = {
 	.odb_rename              = odb_ctdb_rename,
 	.odb_get_path            = odb_ctdb_get_path,
 	.odb_set_delete_on_close = odb_ctdb_set_delete_on_close,
-	.odb_get_delete_on_close = odb_ctdb_get_delete_on_close,
+	.odb_set_write_time      = odb_ctdb_set_write_time,
+	.odb_get_file_infos      = odb_ctdb_get_file_infos,
 	.odb_can_open            = odb_ctdb_can_open,
 	.odb_update_oplock       = odb_ctdb_update_oplock,
 	.odb_break_oplocks       = odb_ctdb_break_oplocks
diff --git a/source/librpc/idl/opendb.idl b/source/librpc/idl/opendb.idl
index 72bf23a..cdbaa6c 100644
--- a/source/librpc/idl/opendb.idl
+++ b/source/librpc/idl/opendb.idl
@@ -35,6 +35,8 @@ interface opendb
 
 	typedef [public] struct {
 		boolean8 delete_on_close;
+		NTTIME open_write_time;
+		NTTIME changed_write_time;
 		utf8string path;
 		uint32 num_entries;
 		opendb_entry entries[num_entries];
diff --git a/source/ntvfs/common/opendb.c b/source/ntvfs/common/opendb.c
index 2913ea8..6917bad 100644
--- a/source/ntvfs/common/opendb.c
+++ b/source/ntvfs/common/opendb.c
@@ -97,11 +97,13 @@ DATA_BLOB odb_get_key(TALLOC_CTX *mem_ctx, struct odb_lock *lck)
 */
 NTSTATUS odb_open_file(struct odb_lock *lck,
 				void *file_handle, const char *path,
-				int *fd, bool allow_level_II_oplock,
+				int *fd, NTTIME open_write_time,
+				bool allow_level_II_oplock,
 				uint32_t oplock_level, uint32_t *oplock_granted)
 {
 	return ops->odb_open_file(lck, file_handle, path,
-				  fd, allow_level_II_oplock,
+				  fd, open_write_time,
+				  allow_level_II_oplock,
 				  oplock_level, oplock_granted);
 }
 
@@ -159,15 +161,23 @@ NTSTATUS odb_set_delete_on_close(struct odb_lock *lck, bool del_on_close)
 }
 
 /*
-  return the current value of the delete_on_close bit, and how many
-  people still have the file open
+  update the write time on an open file
 */
-NTSTATUS odb_get_delete_on_close(struct odb_context *odb, 
-					  DATA_BLOB *key, bool *del_on_close)
+NTSTATUS odb_set_write_time(struct odb_lock *lck,
+			    NTTIME write_time, bool force)
 {
-	return ops->odb_get_delete_on_close(odb, key, del_on_close);
+	return ops->odb_set_write_time(lck, write_time, force);
 }
 
+/*
+  return the current value of the delete_on_close bit,
+  and the current write time.
+*/
+NTSTATUS odb_get_file_infos(struct odb_context *odb, DATA_BLOB *key,
+			    bool *del_on_close, NTTIME *write_time)
+{
+	return ops->odb_get_file_infos(odb, key, del_on_close, write_time);
+}
 
 /*
   determine if a file can be opened with the given share_access,
diff --git a/source/ntvfs/common/opendb.h b/source/ntvfs/common/opendb.h
index 0454763..179db11 100644
--- a/source/ntvfs/common/opendb.h
+++ b/source/ntvfs/common/opendb.h
@@ -27,7 +27,8 @@ struct opendb_ops {
 	DATA_BLOB (*odb_get_key)(TALLOC_CTX *mem_ctx, struct odb_lock *lck);
 	NTSTATUS (*odb_open_file)(struct odb_lock *lck,
 				  void *file_handle, const char *path,
-				  int *fd, bool allow_level_II_oplock,
+				  int *fd, NTTIME open_write_time,
+				  bool allow_level_II_oplock,
 				  uint32_t oplock_level, uint32_t *oplock_granted);
 	NTSTATUS (*odb_open_file_pending)(struct odb_lock *lck, void *private);
 	NTSTATUS (*odb_close_file)(struct odb_lock *lck, void *file_handle,
@@ -36,8 +37,10 @@ struct opendb_ops {
 	NTSTATUS (*odb_rename)(struct odb_lock *lck, const char *path);
 	NTSTATUS (*odb_get_path)(struct odb_lock *lck, const char **path);
 	NTSTATUS (*odb_set_delete_on_close)(struct odb_lock *lck, bool del_on_close);
-	NTSTATUS (*odb_get_delete_on_close)(struct odb_context *odb, 
-					    DATA_BLOB *key, bool *del_on_close);
+	NTSTATUS (*odb_set_write_time)(struct odb_lock *lck,
+				       NTTIME write_time, bool force);
+	NTSTATUS (*odb_get_file_infos)(struct odb_context *odb, DATA_BLOB *key,
+				       bool *del_on_close, NTTIME *write_time);
 	NTSTATUS (*odb_can_open)(struct odb_lock *lck,
 				 uint32_t stream_id, uint32_t share_access,
 				 uint32_t access_mask, bool delete_on_close,
diff --git a/source/ntvfs/common/opendb_tdb.c b/source/ntvfs/common/opendb_tdb.c
index 99c0a95..d753129 100644
--- a/source/ntvfs/common/opendb_tdb.c
+++ b/source/ntvfs/common/opendb_tdb.c
@@ -452,7 +452,8 @@ static NTSTATUS odb_tdb_open_can_internal(struct odb_context *odb,
 */
 static NTSTATUS odb_tdb_open_file(struct odb_lock *lck,
 				  void *file_handle, const char *path,
-				  int *fd, bool allow_level_II_oplock,
+				  int *fd, NTTIME open_write_time,
+				  bool allow_level_II_oplock,
 				  uint32_t oplock_level, uint32_t *oplock_granted)
 {
 	struct odb_context *odb = lck->odb;
@@ -474,6 +475,10 @@ static NTSTATUS odb_tdb_open_file(struct odb_lock *lck,
 		NT_STATUS_HAVE_NO_MEMORY(lck->file.path);
 	}
 
+	if (lck->file.open_write_time == 0) {
+		lck->file.open_write_time = open_write_time;
+	}
+
 	/*
 	  possibly grant an exclusive, batch or level2 oplock
 	*/
@@ -785,20 +790,53 @@ static NTSTATUS odb_tdb_set_delete_on_close(struct odb_lock *lck, bool del_on_cl
 }
 
 /*
+  update the write time on an open file
+*/
+static NTSTATUS odb_tdb_set_write_time(struct odb_lock *lck,
+				       NTTIME write_time, bool force)
+{
+	if (lck->file.path == NULL) {
+		return NT_STATUS_OBJECT_NAME_NOT_FOUND;
+	}
+
+	if (lck->file.changed_write_time != 0 && !force) {
+		return NT_STATUS_OK;
+	}
+
+	lck->file.changed_write_time = write_time;
+
+	return odb_push_record(lck, &lck->file);
+}
+
+/*
   return the current value of the delete_on_close bit, and how many
   people still have the file open
 */
-static NTSTATUS odb_tdb_get_delete_on_close(struct odb_context *odb, 
-					    DATA_BLOB *key, bool *del_on_close)
+static NTSTATUS odb_tdb_get_file_infos(struct odb_context *odb, DATA_BLOB *key,
+				       bool *del_on_close, NTTIME *write_time)
 {
 	struct odb_lock *lck;
 
-	(*del_on_close) = false;
+	if (del_on_close) {
+		*del_on_close = false;
+	}
+	if (write_time) {
+		*write_time = 0;
+	}
 
 	lck = odb_lock(odb, odb, key);
 	NT_STATUS_HAVE_NO_MEMORY(lck);
 
-	(*del_on_close) = lck->file.delete_on_close;
+	if (del_on_close) {
+		*del_on_close = lck->file.delete_on_close;
+	}
+	if (write_time) {
+		if (lck->file.changed_write_time == 0) {
+			*write_time = lck->file.open_write_time;
+		} else {
+			*write_time = lck->file.changed_write_time;
+		}
+	}
 
 	talloc_free(lck);
 
@@ -852,7 +890,8 @@ static const struct opendb_ops opendb_tdb_ops = {
 	.odb_rename              = odb_tdb_rename,
 	.odb_get_path            = odb_tdb_get_path,
 	.odb_set_delete_on_close = odb_tdb_set_delete_on_close,
-	.odb_get_delete_on_close = odb_tdb_get_delete_on_close,
+	.odb_set_write_time      = odb_tdb_set_write_time,
+	.odb_get_file_infos      = odb_tdb_get_file_infos,
 	.odb_can_open            = odb_tdb_can_open,
 	.odb_update_oplock       = odb_tdb_update_oplock,
 	.odb_break_oplocks       = odb_tdb_break_oplocks
diff --git a/source/ntvfs/posix/pvfs_fileinfo.c b/source/ntvfs/posix/pvfs_fileinfo.c
index 04f6ad7..a14c8f6 100644
--- a/source/ntvfs/posix/pvfs_fileinfo.c
+++ b/source/ntvfs/posix/pvfs_fileinfo.c
@@ -52,8 +52,13 @@ static uint32_t dos_mode_from_stat(struct pvfs_state *pvfs, struct stat *st)
 /*
   fill in the dos file attributes for a file
 */
-NTSTATUS pvfs_fill_dos_info(struct pvfs_state *pvfs, struct pvfs_filename *name, int fd)
+NTSTATUS pvfs_fill_dos_info(struct pvfs_state *pvfs, struct pvfs_filename *name,
+			    uint_t flags, int fd)
 {
+	NTSTATUS status;
+	DATA_BLOB lkey;
+	NTTIME write_time;
+
 	/* make directories appear as size 0 with 1 link */
 	if (S_ISDIR(name->st.st_mode)) {
 		name->st.st_size = 0;
@@ -85,7 +90,29 @@ NTSTATUS pvfs_fill_dos_info(struct pvfs_state *pvfs, struct pvfs_filename *name,
 	name->dos.file_id = (((uint64_t)name->st.st_dev)<<32) | name->st.st_ino;
 	name->dos.flags = 0;
 
-	return pvfs_dosattrib_load(pvfs, name, fd);
+	status = pvfs_dosattrib_load(pvfs, name, fd);
+	NT_STATUS_NOT_OK_RETURN(status);
+
+	if (flags & PVFS_RESOLVE_NO_OPENDB) {
+		return NT_STATUS_OK;
+	}
+
+	status = pvfs_locking_key(name, name, &lkey);
+	NT_STATUS_NOT_OK_RETURN(status);
+
+	status = odb_get_file_infos(pvfs->odb_context, &lkey,
+				    NULL, &write_time);
+	data_blob_free(&lkey);
+	if (!NT_STATUS_IS_OK(status)) {
+		DEBUG(1,("WARNING: odb_get_file_infos: %s\n", nt_errstr(status)));
+		return status;
+	}
+
+	if (!null_time(write_time)) {
+		name->dos.write_time = write_time;
+	}
+
+	return NT_STATUS_OK;
 }
 
 
diff --git a/source/ntvfs/posix/pvfs_open.c b/source/ntvfs/posix/pvfs_open.c
index dada9f5..4320308 100644
--- a/source/ntvfs/posix/pvfs_open.c
+++ b/source/ntvfs/posix/pvfs_open.c
@@ -280,6 +280,7 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs,
 	f->handle->position          = 0;
 	f->handle->mode              = 0;
 	f->handle->oplock            = NULL;
+	ZERO_STRUCT(f->handle->write_time);
 	f->handle->open_completed    = false;
 
 	if ((create_options & NTCREATEX_OPTIONS_DELETE_ON_CLOSE) &&
@@ -317,7 +318,8 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs,
 
 		/* now really mark the file as open */
 		status = odb_open_file(lck, f->handle, name->full_name,
-				       NULL, false, OPLOCK_NONE, NULL);
+				       NULL, name->dos.write_time,
+				       false, OPLOCK_NONE, NULL);
 
 		if (!NT_STATUS_IS_OK(status)) {
 			talloc_free(lck);
@@ -377,7 +379,8 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs,
 		}
 
 		status = odb_open_file(lck, f->handle, name->full_name,
-				       NULL, false, OPLOCK_NONE, NULL);
+				       NULL, name->dos.write_time,
+				       false, OPLOCK_NONE, NULL);
 
 		if (!NT_STATUS_IS_OK(status)) {
 			goto cleanup_delete;
@@ -433,6 +436,9 @@ cleanup_delete:
 */
 static int pvfs_handle_destructor(struct pvfs_file_handle *h)
 {
+	talloc_free(h->write_time.update_event);
+	h->write_time.update_event = NULL;
+
 	if ((h->create_options & NTCREATEX_OPTIONS_DELETE_ON_CLOSE) &&
 	    h->name->stream_name) {
 		NTSTATUS status;
@@ -451,6 +457,14 @@ static int pvfs_handle_destructor(struct pvfs_file_handle *h)
 		h->fd = -1;
 	}
 
+	if (!h->write_time.update_forced &&
+	    h->write_time.update_on_close &&
+	    h->write_time.close_time == 0) {
+		struct timeval tv;
+		tv = timeval_current();
+		h->write_time.close_time = timeval_to_nttime(&tv);
+	}
+
 	if (h->have_opendb_entry) {
 		struct odb_lock *lck;
 		NTSTATUS status;
@@ -462,6 +476,26 @@ static int pvfs_handle_destructor(struct pvfs_file_handle *h)
 			return 0;
 		}
 
+		if (h->write_time.update_forced) {
+			status = odb_get_file_infos(h->pvfs->odb_context,
+						    &h->odb_locking_key,
+						    NULL,
+						    &h->write_time.close_time);
+			if (!NT_STATUS_IS_OK(status)) {
+				DEBUG(0,("Unable get write time for '%s' - %s\n",
+					 h->name->full_name, nt_errstr(status)));
+			}
+
+			h->write_time.update_forced = false;
+			h->write_time.update_on_close = true;
+		} else if (h->write_time.update_on_close) {
+			status = odb_set_write_time(lck, h->write_time.close_time, true);
+			if (!NT_STATUS_IS_OK(status)) {
+				DEBUG(0,("Unable set write time for '%s' - %s\n",
+					 h->name->full_name, nt_errstr(status)));
+			}
+		}
+
 		status = odb_close_file(lck, h, &delete_path);
 		if (!NT_STATUS_IS_OK(status)) {
 			DEBUG(0,("Unable to remove opendb entry for '%s' - %s\n", 
@@ -484,11 +518,26 @@ static int pvfs_handle_destructor(struct pvfs_file_handle *h)
 					       FILE_NOTIFY_CHANGE_FILE_NAME,
 					       delete_path);
 			}
+			h->write_time.update_on_close = false;
 		}
 
 		talloc_free(lck);
 	}
 
+	if (h->write_time.update_on_close) {
+		struct timeval tv[2];
+
+		nttime_to_timeval(&tv[0], h->name->dos.access_time);
+		nttime_to_timeval(&tv[1], h->write_time.close_time);
+
+		if (!timeval_is_zero(&tv[0]) || !timeval_is_zero(&tv[1])) {
+			if (utimes(h->name->full_name, tv) == -1) {
+				DEBUG(0,("pvfs_handle_destructor: utimes() failed '%s' - %s\n",
+					 h->name->full_name, strerror(errno)));
+			}
+		}
+	}
+
 	return 0;
 }
 
@@ -594,8 +643,8 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs,
 		DATA_BLOB locking_key;
 		status = pvfs_locking_key(parent, req, &locking_key);
 		NT_STATUS_NOT_OK_RETURN(status);
-		status = odb_get_delete_on_close(pvfs->odb_context, &locking_key, 
-						 &del_on_close);
+		status = odb_get_file_infos(pvfs->odb_context, &locking_key,
+					    &del_on_close, NULL);
 		NT_STATUS_NOT_OK_RETURN(status);
 		if (del_on_close) {
 			return NT_STATUS_DELETE_PENDING;
@@ -638,7 +687,7 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs,
 	}
 
 	/* re-resolve the open fd */
-	status = pvfs_resolve_name_fd(pvfs, fd, name);
+	status = pvfs_resolve_name_fd(pvfs, fd, name, 0);
 	if (!NT_STATUS_IS_OK(status)) {
 		close(fd);
 		return status;
@@ -730,10 +779,12 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs,
 	f->handle->mode              = 0;
 	f->handle->oplock            = NULL;
 	f->handle->have_opendb_entry = true;
+	ZERO_STRUCT(f->handle->write_time);
 	f->handle->open_completed    = false;
 
 	status = odb_open_file(lck, f->handle, name->full_name,
-			       &f->handle->fd, allow_level_II_oplock,
+			       &f->handle->fd, name->dos.write_time,
+			       allow_level_II_oplock,
 			       oplock_level, &oplock_granted);
 	talloc_free(lck);
 	if (!NT_STATUS_IS_OK(status)) {
@@ -1334,6 +1385,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
 	f->handle->mode              = 0;
 	f->handle->oplock            = NULL;
 	f->handle->have_opendb_entry = false;
+	ZERO_STRUCT(f->handle->write_time);
 	f->handle->open_completed    = false;
 
 	/* form the lock context used for byte range locking and
@@ -1437,7 +1489,8 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
 
 	/* now really mark the file as open */
 	status = odb_open_file(lck, f->handle, name->full_name,
-			       &f->handle->fd, allow_level_II_oplock,
+			       &f->handle->fd, name->dos.write_time,
+			       allow_level_II_oplock,
 			       oplock_level, &oplock_granted);
 
 	if (!NT_STATUS_IS_OK(status)) {
@@ -1476,7 +1529,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
 	}
 
 	/* re-resolve the open fd */
-	status = pvfs_resolve_name_fd(f->pvfs, fd, f->handle->name);
+	status = pvfs_resolve_name_fd(f->pvfs, fd, f->handle->name, PVFS_RESOLVE_NO_OPENDB);
 	if (!NT_STATUS_IS_OK(status)) {
 		talloc_free(lck);
 		return status;
@@ -1538,7 +1591,6 @@ NTSTATUS pvfs_close(struct ntvfs_module_context *ntvfs,
 {
 	struct pvfs_state *pvfs = ntvfs->private_data;
 	struct pvfs_file *f;
-	struct utimbuf unix_times;
 
 	if (io->generic.level == RAW_CLOSE_SPLCLOSE) {
 		return NT_STATUS_DOS(ERRSRV, ERRerror);
@@ -1554,9 +1606,9 @@ NTSTATUS pvfs_close(struct ntvfs_module_context *ntvfs,
 	}
 
 	if (!null_time(io->generic.in.write_time)) {
-		unix_times.actime = 0;
-		unix_times.modtime = io->close.in.write_time;
-		utime(f->handle->name->full_name, &unix_times);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list