[PVFS-developers] 1.6.3 utime bug
Porter Don
PorterDE at mercury.hendrix.edu
Fri May 14 10:11:25 EDT 2004
In testing the 1.6.3 pre-release, we found that the distributed mtime patch
breaks some of the semantics of utime. Particularly, if you have a file
that you explicitly set to a time in the past, mgr.c:do_stat() will favor
the mtime stored on the iods.
This can be easily fixed by two changes, based on the assumption that mtime
shouldn't change while file is closed or not being operated on:
1) Ignore the iod mtimes if the file is not open
2) Upon opening a file, set f_p->utime_event to now, which preserves stored
mtimes that were explicitly set to a time older than last actual access on
iod.
Feel free, as usual, to let me know if anyone has questions/concerns about
this patch.
Thanks,
don
--- pvfs-1.6.3-pre1/mgr/mgr.c Thu May 13 16:57:14 2004
+++ pvfs-1.6.3-pre1-fix/mgr/mgr.c Thu May 13 16:56:42 2004
@@ -994,11 +994,21 @@
/* an explicit utime operation would have
been recorded
* here on the mgr. if that happened after
the last mtime
* on a server, then return the mgr's mtime.
+ *
+ * Further, we are going to ignore
distributed mtime if
+ * the file is closed because the file could
not have been
+ * modified whilst closed. Further, in
close we get the
+ * most current value for mtime, so we can
trust it.
+ * Finally, if we don't ignore it, we can
clobber an
+ * explicit synchronization backwards in
time.
*/
- if (f_p && f_p->utime_event > max_modtime) {
- max_modtime = f_p->utime_modtime;
+
+ if (f_p){
+ if(f_p->utime_event > max_modtime) {
+ max_modtime =
f_p->utime_modtime;
+ }
+ ack_p->ack.stat.meta.u_stat.mtime =
max_modtime;
}
- ack_p->ack.stat.meta.u_stat.mtime =
max_modtime;
#ifdef MGR_USE_CACHED_FILE_SIZE
/* store to metadata if closed */
@@ -1452,7 +1462,7 @@
f_p->f_name = (char *)malloc(strlen(data_p)+1);
/* keep utimes from going backwards */
- f_p->utime_event = ack_p->ack.open.meta.u_stat.mtime;
+ f_p->utime_event = time(NULL);
f_p->utime_modtime = ack_p->ack.open.meta.u_stat.mtime;
strcpy(f_p->f_name, data_p);
More information about the PVFS-developers
mailing list