All of lore.kernel.org
 help / color / mirror / Atom feed
* RE: mtime not updated in client cache?
@ 2005-12-09 15:56 Lever, Charles
  2005-12-09 16:10 ` Trond Myklebust
  2005-12-09 16:40 ` Peter Staubach
  0 siblings, 2 replies; 18+ messages in thread
From: Lever, Charles @ 2005-12-09 15:56 UTC (permalink / raw)
  To: Trond Myklebust, Peter Staubach; +Cc: Vince Busam, nfs

> On Fri, 2005-12-09 at 09:24 -0500, Peter Staubach wrote:
>=20
> > >One alternative would be to flush dirty data to the server=20
> on every call
> > >to stat(), but that would slow it down considerably.

only in certain cases.  i can think of one:  'ls -l' in a directory full
of data files for an active Oracle instance.

> > Yes, to this last, but this is how most NFS implementations=20
> that I have seen
> > conform to the requirment that write(2) cause the mtime to=20
> be updated.  The
> > use of UNSTABLE NFSv3/NFSv4 writes can help as well as=20
> limiting the amount
> > of dirty data that the client allows to be cached.
>=20
> My main concern is that it will hit commands like 'ls -l' _hard_. The
> latter will, for instance, be forced to wait until all=20
> pending writes on
> all files in the directory have been flushed out. I'm not sure that
> strict POSIX compatibility is worth that kind of hit.
>=20
> Anyhow, the attached patch implements it. Lets try it out, and see how
> it does. Definitely _not_ a 2.6.15 candidate, though.

i like the idea.

do you need to prevent writes *during* the stat() call?  or do you just
want to make sure that any writes that happened *before* the stat() call
have the intended side-effects on the file size and mtime?  that might
be worth a comment or two.

are you flushing dirty mmap'd data too?  or can this be skipped until
msync() time?

and now that you have added a "flush but don't commit" flag to
nfs_sync_file, maybe we might consider using that (optionally) at file
close() time, like some other NFS client implementations do.  :^)


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 18+ messages in thread
* RE: mtime not updated in client cache?
@ 2005-12-09 19:07 Lever, Charles
  2005-12-09 19:20 ` Peter Staubach
  0 siblings, 1 reply; 18+ messages in thread
From: Lever, Charles @ 2005-12-09 19:07 UTC (permalink / raw)
  To: Peter Staubach; +Cc: nfs

hi peter-

> >and now that you have added a "flush but don't commit" flag to
> >nfs_sync_file, maybe we might consider using that=20
> (optionally) at file
> >close() time, like some other NFS client implementations do.  :^)
>=20
> This seems like a pretty dangerous thing to do.  I've thought about it
> because it would seem to make close-to-open less expensive, but it=20
> introduces
> the possibility of data loss without the application being=20
> aware.  If the
> data is not committed at close(2), then if it can not be=20
> committed when it
> needs to be committed, then there is no way to return an error to the
> application.  A somewat contrived but still possible scenario=20
> is that the
> server crashes, comes back up, and the file system fills up=20
> before the client
> can retransmit all of the data.  In this case, the data will=20
> be lost, but
> the application thought that it was all stored because no system calls
> returned any errors.

risks understood.

however, how is this different from ext3?  a close() on an ext3 file
doesn't even attempt to schedule a flush of the data to disk.  if the
system crashes or the disk dies or the file system fills up, the data is
lost, just like in the NFS case.

in addition, mapped dirty data is never flushed on close() on NFS.  what
happens if a server failure pins dirty mapped pages in the client's
memory?

if an application really wants the guarantee that the data is
permanently stored or have the opportunity to recover if an error
occurs, it will use O_SYNC or msync() or fflush() before closing the
file.

to make a more philosophical argument, UNIX has always compromised data
integrity for performance in the common case.  for example, why aren't
there more file systems around that provide ACID semantics?  because in
99.9% of cases, ACID semantics are simply not required, and just slow
everything else down.

i think this is reasonable behavior to enable with either a mount option
or a sysctl.  we have "nocto," after all.

i'm not trying to start an argument.  just wondering aloud.


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 18+ messages in thread
* mtime not updated in client cache?
@ 2005-11-29  0:09 Vince Busam
  2005-11-29  0:45 ` Trond Myklebust
  0 siblings, 1 reply; 18+ messages in thread
From: Vince Busam @ 2005-11-29  0:09 UTC (permalink / raw)
  To: nfs

The following code snippet run on a 2.6.13.4 (+CITI patch) client shows that mtime doesn't 
get updated unless fclose() is called before stat, or O_DIRECT is used.  In 2.4, the stat 
would return an updated mtime.  Is this a bug, or expected cache behavior?

Thanks,
Vince

#include <stdio.h>
#include <time.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/stat.h>

int main(int argc, char **argv) {
   time_t tm;
   struct stat statinfo;
   FILE *fp = fopen("testfile", "w");
   sleep(2);
   tm = time(NULL);
   fwrite("X", 1, 1, fp);
   fflush(fp);

   stat("testfile", &statinfo);

   if (statinfo.st_mtime < tm) {
     printf("Bug: write time = %u, mtime = %u\n", tm, statinfo.st_mtime);
   }

   fclose(fp);
   return 0;
}


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2005-12-13  1:51 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-09 15:56 mtime not updated in client cache? Lever, Charles
2005-12-09 16:10 ` Trond Myklebust
2005-12-09 16:40 ` Peter Staubach
  -- strict thread matches above, loose matches on Subject: below --
2005-12-09 19:07 Lever, Charles
2005-12-09 19:20 ` Peter Staubach
2005-12-09 19:55   ` Roger Heflin
2005-12-09 21:05     ` Peter Staubach
2005-11-29  0:09 Vince Busam
2005-11-29  0:45 ` Trond Myklebust
2005-12-01  1:06   ` Vince Busam
2005-12-01  1:15     ` Trond Myklebust
2005-12-08  1:22       ` Vince Busam
2005-12-08  3:38         ` Trond Myklebust
2005-12-09 14:06           ` Peter Staubach
2005-12-09 14:16             ` Trond Myklebust
2005-12-09 14:24               ` Peter Staubach
2005-12-09 15:19                 ` Trond Myklebust
2005-12-13  1:51                   ` Vince Busam

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.