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;
* 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",
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. */
/****************************************************************************
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)
fsp->dev == tfsp->dev &&
fsp->inode == tfsp->inode ) {
fsp->pending_modtime = pmod;
+ fsp->pending_modtime_owner = False;
}
}
+
+ tfsp->pending_modtime_owner = True;
}
/****************************************************************************