]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Do not cache negative results in nscd if these are transient
authorUlrich Drepper <drepper@gmail.com>
Sat, 21 Jan 2012 03:39:54 +0000 (22:39 -0500)
committerUlrich Drepper <drepper@gmail.com>
Sat, 21 Jan 2012 03:39:54 +0000 (22:39 -0500)
ChangeLog
nscd/aicache.c
nscd/grpcache.c
nscd/hstcache.c
nscd/initgrcache.c
nscd/pwdcache.c
nscd/servicescache.c

index 3d847a5f68c60735d59b20309a7fd9f16c157064..1dda738687771650ecb205f5efce27cd7e82c5d8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2012-01-20  Ulrich Drepper  <drepper@gmail.com>
+
+       * nscd/aicache.c (addhstaiX): Do not cache negative results of
+       transient errors.
+       * nscd/grpcache.c (cache_addgr): Likewise.
+       * nscd/hstcache.c (cache_addhst): Likewise.
+       * nscd/initgrcache.c (addinitgroupsX): Likewise.
+       * nscd/pwdcache.c (cache_addpw): Likewise.
+       * nscd/servicescache.c (cache_addserv): Likewise.
+
 2012-01-16  Ulrich Drepper  <drepper@gmail.com>
 
        * malloc/malloc.c: Various cleanups.
index aaaf80df9db41190f7ce24e1249d2a3ee6ef82a3..e1f12445c81740de75984d9e4231dc0b6f8c2285 100644 (file)
@@ -1,5 +1,5 @@
 /* Cache handling for host lookup.
-   Copyright (C) 2004-2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+   Copyright (C) 2004-2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
 
@@ -514,8 +514,9 @@ next_nip:
       if (fd != -1)
        TEMP_FAILURE_RETRY (send (fd, &notfound, total, MSG_NOSIGNAL));
 
-      /* If we cannot permanently store the result, so be it.  */
-      if (__builtin_expect (db->negtimeout == 0, 0))
+      /* If we have a transient error or cannot permanently store the
+        result, so be it.  */
+      if (rc4 == EAGAIN || __builtin_expect (db->negtimeout == 0, 0))
        {
          /* Mark the old entry as obsolete.  */
          if (dh != NULL)
index e9607c6f119e502b6447166990efee6798aa4b42..a698f363c7f97aab936961b08ea54527de0a2b41 100644 (file)
@@ -1,5 +1,5 @@
 /* Cache handling for group lookup.
-   Copyright (C) 1998-2008, 2009, 2011 Free Software Foundation, Inc.
+   Copyright (C) 1998-2008, 2009, 2011, 2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -120,8 +120,9 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req,
          else
            written = total;
 
-         /* If we cannot permanently store the result, so be it.  */
-         if (db->negtimeout == 0)
+         /* If we have a transient error or cannot permanently store
+            the result, so be it.  */
+         if (errno == EAGAIN || __builtin_expect (db->negtimeout == 0, 0))
            {
              /* Mark the old entry as obsolete.  */
              if (dh != NULL)
index 4d68ade98c211372742de6947afc9d723c370d86..c72feaa02e690c0be3d07608dc5c6e2680e8991e 100644 (file)
@@ -1,5 +1,5 @@
 /* Cache handling for host lookup.
-   Copyright (C) 1998-2008, 2009, 2011 Free Software Foundation, Inc.
+   Copyright (C) 1998-2008, 2009, 2011, 2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -141,8 +141,9 @@ cache_addhst (struct database_dyn *db, int fd, request_header *req,
                                        MSG_NOSIGNAL)) != total)
            all_written = false;
 
-         /* If we cannot permanently store the result, so be it.  */
-         if (__builtin_expect (db->negtimeout == 0, 0))
+         /* If we have a transient error or cannot permanently store
+            the result, so be it.  */
+         if (errval == EAGAIN || __builtin_expect (db->negtimeout == 0, 0))
            {
              /* Mark the old entry as obsolete.  */
              if (dh != NULL)
index 4ac9942aebaaaa8e62fc107df9c5da7ff9103eaf..2019991d28f8d9f33d951740911ed6b151ce9665 100644 (file)
@@ -1,5 +1,5 @@
 /* Cache handling for host lookup.
-   Copyright (C) 2004-2006, 2008, 2009, 2011 Free Software Foundation, Inc.
+   Copyright (C) 2004-2006, 2008, 2009, 2011, 2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
 
@@ -202,8 +202,9 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
            written = TEMP_FAILURE_RETRY (send (fd, &notfound, total,
                                                MSG_NOSIGNAL));
 
-         /* If we cannot permanently store the result, so be it.  */
-         if (__builtin_expect (db->negtimeout == 0, 0))
+         /* If we have a transient error or cannot permanently store
+            the result, so be it.  */
+         if (all_tryagain || __builtin_expect (db->negtimeout == 0, 0))
            {
              /* Mark the old entry as obsolete.  */
              if (dh != NULL)
index 49e130c1f0dd147fb0434c3dea7dec0599ecdfa9..e2ba09df4628a29d1329cb3cc379fd4f0a050913 100644 (file)
@@ -1,5 +1,5 @@
 /* Cache handling for passwd lookup.
-   Copyright (C) 1998-2008, 2009, 2011 Free Software Foundation, Inc.
+   Copyright (C) 1998-2008, 2009, 2011, 2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -124,8 +124,9 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req,
            written = TEMP_FAILURE_RETRY (send (fd, &notfound, total,
                                                MSG_NOSIGNAL));
 
-         /* If we cannot permanently store the result, so be it.  */
-         if (__builtin_expect (db->negtimeout == 0, 0))
+         /* If we have a transient error or cannot permanently store
+            the result, so be it.  */
+         if (errno == EAGAIN || __builtin_expect (db->negtimeout == 0, 0))
            {
              /* Mark the old entry as obsolete.  */
              if (dh != NULL)
index d3d5dce44ec878500206c39b31b66d2eda4bfc33..a6337e3b0f3206ba29e8b715ef942d6390f57e39 100644 (file)
@@ -1,5 +1,5 @@
 /* Cache handling for services lookup.
-   Copyright (C) 2007, 2008, 2009, 2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2008, 2009, 2011, 2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@drepper.com>, 2007.
 
@@ -108,8 +108,9 @@ cache_addserv (struct database_dyn *db, int fd, request_header *req,
            written = TEMP_FAILURE_RETRY (send (fd, &notfound, total,
                                                MSG_NOSIGNAL));
 
-         /* If we cannot permanently store the result, so be it.  */
-         if (__builtin_expect (db->negtimeout == 0, 0))
+         /* If we have a transient error or cannot permanently store
+            the result, so be it.  */
+         if (errval == EAGAIN || __builtin_expect (db->negtimeout == 0, 0))
            {
              /* Mark the old entry as obsolete.  */
              if (dh != NULL)