# HG changeset patch # User Karl Heuer # Date 763353350 0 # Node ID 0aa51282fbfeabecd09de6c35d7604082378d940 # Parent d0a9fa0d0a8df1c80d68655bdca38083b438138d (lock_superlock): Synchronize NFS cache. diff -r d0a9fa0d0a8d -r 0aa51282fbfe src/filelock.c --- a/src/filelock.c Thu Mar 10 23:57:21 1994 +0000 +++ b/src/filelock.c Fri Mar 11 02:35:50 1994 +0000 @@ -37,6 +37,23 @@ #include #include "buffer.h" +#ifdef SYSV_SYSTEM_DIR +#include +#else /* not SYSV_SYSTEM_DIR */ +#ifdef NONSYSTEM_DIR_LIBRARY +#include "ndir.h" +#else /* not NONSYSTEM_DIR_LIBRARY */ +#ifdef MSDOS +#include +#else +#include +#endif +#endif /* not NONSYSTEM_DIR_LIBRARY */ +#ifndef MSDOS +extern DIR *opendir (); +#endif /* not MSDOS */ +#endif /* not SYSV_SYSTEM_DIR */ + extern int errno; extern char *egetenv (); @@ -325,6 +342,7 @@ char *lfname; { register int i, fd; + DIR *lockdir; for (i = -20; i < 0 && (fd = open (superlock_path, O_WRONLY | O_EXCL | O_CREAT, 0666)) < 0; @@ -332,6 +350,13 @@ { if (errno != EEXIST) return; + + /* This seems to be necessary to prevent Emacs from hanging when the + competing process has already deleted the superlock, but it's still + in the NFS cache. So we force NFS to synchronize the cache. */ + if (lockdir = opendir (lock_path)) + closedir (lockdir); + sleep (1); } if (fd >= 0)