[PVFS-developers] Mtime going backwards
Porter Don
PorterDE at mercury.hendrix.edu
Mon Mar 8 09:08:42 EST 2004
If you 'touch' a closed file and then open and close it without modifying
anything, mtime will then go backwards to what it was before the 'touch' was
issued.
This is because mgr:do_close / do_all_implicit_closes check for the latest
modification time on the data files on the iods and if a utime was done
while the file was open. They do not, however, check to see if the most
recent mtime from the iods is less than the mtime stored in the metadata
file.
The most elegant solution, it seems to me, is to initialize f_p->utime_event
and f_p->utime_modtime to the times stored in the metadata file rather than
zero in mgr:do_open. Thus, the close logic doesn't have to be fiddled with,
nor does the metadata file have to be read on close.
So, below is a patch that ought to fix this. It was against a patched
1.6.0, but it applies to cvs.
Thanks!
Don
diff -ur pvfs-1.6.0/mgr/mgr.c pvfs-1.6.0-working/mgr/mgr.c
--- pvfs-1.6.0/mgr/mgr.c Thu Mar 4 13:46:42 2004
+++ pvfs-1.6.0-working/mgr/mgr.c Thu Mar 4 15:06:35 2004
@@ -1291,6 +1291,10 @@
f_p->f_ino = ack_p->ack.open.meta.u_stat.st_ino;
f_p->p_stat = AK_PSTAT;
f_p->f_name = (char *)malloc(strlen(data_p)+1);
+ /*keep time from going backwards when file is opened
read-only*/
+ f_p->utime_event = ack_p->ack.open.meta.u_stat.mtime;
+ f_p->utime_modtime = ack_p->ack.open.meta.u_stat.mtime;
+
strcpy(f_p->f_name, data_p);
dfd_set(sock, &f_p->socks);
}
More information about the PVFS-developers
mailing list