]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Handle some more "stale NFS file handle" cases
authorJoel Rosdahl <joel@rosdahl.net>
Wed, 2 Mar 2016 19:57:08 +0000 (20:57 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Wed, 2 Mar 2016 19:57:08 +0000 (20:57 +0100)
NEWS.txt
ccache.c
cleanup.c
util.c

index 94cf42759f4d8f22a0a607f84ca55080988e12e8..ad6f30e2f6b6408dc2c7615cccbe2115e2db2fc6 100644 (file)
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -10,6 +10,8 @@ New features and improvements
 
 - Only pass clang-specific `-stdlib=` to the preprocessor.
 
+- Improved handling of stale NFS handles.
+
 
 Bug fixes
 ~~~~~~~~~
index 58e60a0c4ae8ab669502fbeca224fc83d857e66d..5ec5299462b5f2bbb3544a77147093519a247a7b 100644 (file)
--- a/ccache.c
+++ b/ccache.c
@@ -843,7 +843,7 @@ get_file_from_cache(const char *source, const char *dest)
        }
 
        if (ret == -1) {
-               if (errno == ENOENT) {
+               if (errno == ENOENT || errno == ESTALE) {
                        /* Someone removed the file just before we began copying? */
                        cc_log("Cache file %s just disappeared from cache", source);
                        stats_update(STATS_MISSING);
index 6eadaa443df0b8f5d14b9ebcd0ab4f0204fa8f5d..dcb1a1570ff72d2de6415d1e921bff3315670142 100644 (file)
--- a/cleanup.c
+++ b/cleanup.c
@@ -108,7 +108,7 @@ delete_file(const char *path, size_t size)
        if (x_unlink(path) == 0) {
                cache_size -= size;
                files_in_cache--;
-       } else if (errno != ENOENT) {
+       } else if (errno != ENOENT && errno != ESTALE) {
                cc_log("Failed to unlink %s (%s)", path, strerror(errno));
        }
 }
@@ -122,7 +122,7 @@ delete_sibling_file(const char *base, const char *extension)
        path = format("%s%s", base, extension);
        if (lstat(path, &st) == 0) {
                delete_file(path, file_size(&st));
-       } else if (errno != ENOENT) {
+       } else if (errno != ENOENT && errno != ESTALE) {
                cc_log("Failed to stat %s: %s", path, strerror(errno));
        }
        free(path);
diff --git a/util.c b/util.c
index 0b78afffc3ce97351e6da1f6b9d002e019b87b06..ce1341c522724449ccf2e4f5e95606fbe98cfd1a 100644 (file)
--- a/util.c
+++ b/util.c
@@ -881,7 +881,7 @@ traverse(const char *dir, void (*fn)(const char *, struct stat *))
 
                fname = format("%s/%s", dir, de->d_name);
                if (lstat(fname, &st)) {
-                       if ((errno != ENOENT) && (errno != ESTALE)) {
+                       if (errno != ENOENT && errno != ESTALE) {
                                fatal("lstat %s failed: %s", fname, strerror(errno));
                        }
                        free(fname);
@@ -1510,7 +1510,7 @@ x_unlink(const char *path)
        }
        if (unlink(tmp_name) == -1) {
                /* If it was released in a race, that's OK. */
-               if (errno != ENOENT) {
+               if (errno != ENOENT && errno != ESTALE) {
                        result = -1;
                        saved_errno = errno;
                }