svn commit: samba r5731 - in branches/SAMBA_3_0/source: include smbd
jra at samba.org
jra at samba.org
Thu Mar 10 21:43:58 GMT 2005
Author: jra
Date: 2005-03-10 21:43:58 +0000 (Thu, 10 Mar 2005)
New Revision: 5731
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=5731
Log:
Get delayed write semantics closer to W2K3. We need to store 2 times.
This may fix bug #2382.
Jeremy.
Modified:
branches/SAMBA_3_0/source/include/smb.h
branches/SAMBA_3_0/source/smbd/close.c
branches/SAMBA_3_0/source/smbd/fileio.c
branches/SAMBA_3_0/source/smbd/files.c
Changeset:
Modified: branches/SAMBA_3_0/source/include/smb.h
===================================================================
--- branches/SAMBA_3_0/source/include/smb.h 2005-03-10 21:42:20 UTC (rev 5730)
+++ branches/SAMBA_3_0/source/include/smb.h 2005-03-10 21:43:58 UTC (rev 5731)
@@ -404,7 +404,9 @@
struct timeval open_time;
int share_mode;
uint32 desired_access;
+ BOOL pending_modtime_owner;
time_t pending_modtime;
+ time_t last_write_time;
int oplock_type;
int sent_oplock_break;
unsigned long file_id;
Modified: branches/SAMBA_3_0/source/smbd/close.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/close.c 2005-03-10 21:42:20 UTC (rev 5730)
+++ branches/SAMBA_3_0/source/smbd/close.c 2005-03-10 21:43:58 UTC (rev 5731)
@@ -260,8 +260,10 @@
* Ensure pending modtime is set after close.
*/
- if(fsp->pending_modtime) {
+ if(fsp->pending_modtime && fsp->pending_modtime_owner) {
set_filetime(conn, fsp->fsp_name, fsp->pending_modtime);
+ } else if (fsp->last_write_time) {
+ set_filetime(conn, fsp->fsp_name, fsp->last_write_time);
}
DEBUG(2,("%s closed file %s (numopen=%d) %s\n",
Modified: branches/SAMBA_3_0/source/smbd/fileio.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/fileio.c 2005-03-10 21:42:20 UTC (rev 5730)
+++ branches/SAMBA_3_0/source/smbd/fileio.c 2005-03-10 21:43:58 UTC (rev 5731)
@@ -142,6 +142,12 @@
if (fsp->pending_modtime) {
set_filetime(fsp->conn, fsp->fsp_name, fsp->pending_modtime);
+
+ /* If we didn't get the "set modtime" call ourselves, we must
+ store the last write time to restore on close. JRA. */
+ if (!fsp->pending_modtime_owner) {
+ fsp->last_write_time = time(NULL);
+ }
}
/* Yes - this is correct - writes don't update this. JRA. */
Modified: branches/SAMBA_3_0/source/smbd/files.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/files.c 2005-03-10 21:42:20 UTC (rev 5730)
+++ branches/SAMBA_3_0/source/smbd/files.c 2005-03-10 21:43:58 UTC (rev 5731)
@@ -379,6 +379,7 @@
/****************************************************************************
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, time_t pmod)
@@ -394,8 +395,11 @@
fsp->dev == tfsp->dev &&
fsp->inode == tfsp->inode ) {
fsp->pending_modtime = pmod;
+ fsp->pending_modtime_owner = False;
}
}
+
+ tfsp->pending_modtime_owner = True;
}
/****************************************************************************
More information about the samba-cvs
mailing list