[PVFS-developers] Mtime going backwards
David S Metheny
david.s.metheny at conwaycorp.net
Fri Mar 26 08:50:42 EST 2004
We discovered another case where the mtime was getting set to an invalid
time. The problem occurs when there are problems in a request that has open
files. The manager will catch the error and execute a goto to
socket_cleanup. Eventually, check_for_implicit_close is called. If it's
determined that the file needs to be closed on the IODs, a local variable,
max_modtime, is used in a comparison. This local variable isn't initialized
and can contain a 64 bit integer value, which will be some garbage value.
Depending on the garbage value, it could be used for the mtime value. Below
is a patch that initializes this variable to zero, as well as the original
mtime patch from Don.
diff -urN pvfs-1.6.0_original_source/mgr/mgr.c
pvfs-1.6.0_mtime_fix/mgr/mgr.c
--- pvfs-1.6.0_original_source/mgr/mgr.c Mon Jun 16 09:52:41 2003
+++ pvfs-1.6.0_mtime_fix/mgr/mgr.c Tue Mar 23 13:46:23 2004
@@ -1221,6 +1221,11 @@
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);
}
@@ -1764,7 +1769,7 @@
mreq req;
ireq iodreq;
int ret, i;
- int64_t max_modtime;
+ int64_t max_modtime = 0;
memset(&iodreq, 0, sizeof(iodreq));
-----Original Message-----
From: pvfs-developers-bounces at beowulf-underground.org
[mailto:pvfs-developers-bounces at beowulf-underground.org] On Behalf Of Porter
Don
Sent: Monday, March 08, 2004 9:09 AM
To: 'pvfs-developers at www.beowulf-underground.org'
Subject: [PVFS-developers] Mtime going backwards
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);
}
_______________________________________________
PVFS-developers mailing list
PVFS-developers at www.beowulf-underground.org
http://www.beowulf-underground.org/mailman/listinfo/pvfs-developers
More information about the PVFS-developers
mailing list