Blame SOURCES/glibc-rh784402.patch

b9ba6d
commit 3e1aa84e7f9f38815f5db9cd7654b1a9497cf6e4
b9ba6d
Author: Ulrich Drepper <drepper@gmail.com>
b9ba6d
Date:   Fri Jan 20 22:39:54 2012 -0500
b9ba6d
b9ba6d
    Do not cache negative results in nscd if these are transient
b9ba6d
b9ba6d
diff -rup a/nscd/aicache.c b/nscd/aicache.c
b9ba6d
--- a/nscd/aicache.c	2012-01-24 20:32:58.906826425 -0700
b9ba6d
+++ b/nscd/aicache.c	2012-01-24 20:42:17.663968882 -0700
b9ba6d
@@ -511,9 +511,17 @@ next_nip:
b9ba6d
       if (fd != -1)
b9ba6d
 	TEMP_FAILURE_RETRY (send (fd, &notfound, total, MSG_NOSIGNAL));
b9ba6d
 
b9ba6d
-      dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len, 1);
b9ba6d
-      /* If we cannot permanently store the result, so be it.  */
b9ba6d
-      if (dataset != NULL)
b9ba6d
+      /* If we have a transient error or cannot permanently store the
b9ba6d
+	 result, so be it.  */
b9ba6d
+      if (rc4 == EAGAIN || __builtin_expect (db->negtimeout == 0, 0))
b9ba6d
+	{
b9ba6d
+	  /* Mark the old entry as obsolete.  */
b9ba6d
+	  if (dh != NULL)
b9ba6d
+	    dh->usable = false;
b9ba6d
+	  dataset = NULL;
b9ba6d
+	}
b9ba6d
+      else if ((dataset = mempool_alloc (db, (sizeof (struct dataset)
b9ba6d
+					      + req->key_len), 1)) != NULL)
b9ba6d
 	{
b9ba6d
 	  dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
b9ba6d
 	  dataset->head.recsize = total;
b9ba6d
diff -rup a/nscd/grpcache.c b/nscd/grpcache.c
b9ba6d
--- a/nscd/grpcache.c	2012-01-24 20:32:58.910826427 -0700
b9ba6d
+++ b/nscd/grpcache.c	2012-01-24 20:42:17.666968883 -0700
b9ba6d
@@ -114,13 +114,21 @@ cache_addgr (struct database_dyn *db, in
b9ba6d
 	     case.  */
b9ba6d
 	  total = sizeof (notfound);
b9ba6d
 
b9ba6d
-	  written = TEMP_FAILURE_RETRY (send (fd, &notfound, total,
b9ba6d
-					      MSG_NOSIGNAL));
b9ba6d
+	  if (fd != -1)
b9ba6d
+	    written = TEMP_FAILURE_RETRY (send (fd, &notfound, total,
b9ba6d
+						MSG_NOSIGNAL));
b9ba6d
+	  else
b9ba6d
+	    written = total;
b9ba6d
 
b9ba6d
-	  dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len,
b9ba6d
-				   1);
b9ba6d
-	  /* If we cannot permanently store the result, so be it.  */
b9ba6d
-	  if (dataset != NULL)
b9ba6d
+	  /* If we have a transient error or cannot permanently store
b9ba6d
+	     the result, so be it.  */
b9ba6d
+	  if (errno == EAGAIN || __builtin_expect (db->negtimeout == 0, 0))
b9ba6d
+	    {
b9ba6d
+	      /* Mark the old entry as obsolete.  */
b9ba6d
+	      if (dh != NULL)
b9ba6d
+		dh->usable = false;
b9ba6d
+	    }
b9ba6d
+	  else if ((dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len, 1)) != NULL)
b9ba6d
 	    {
b9ba6d
 	      dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
b9ba6d
 	      dataset->head.recsize = total;
b9ba6d
diff -rup a/nscd/hstcache.c b/nscd/hstcache.c
b9ba6d
--- a/nscd/hstcache.c	2012-01-24 20:32:58.911826427 -0700
b9ba6d
+++ b/nscd/hstcache.c	2012-01-24 20:42:17.668968883 -0700
b9ba6d
@@ -141,10 +141,16 @@ cache_addhst (struct database_dyn *db, i
b9ba6d
 					MSG_NOSIGNAL)) != total)
b9ba6d
 	    all_written = false;
b9ba6d
 
b9ba6d
-	  dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len,
b9ba6d
-				   1);
b9ba6d
-	  /* If we cannot permanently store the result, so be it.  */
b9ba6d
-	  if (dataset != NULL)
b9ba6d
+	  /* If we have a transient error or cannot permanently store
b9ba6d
+	     the result, so be it.  */
b9ba6d
+	  if (errval == EAGAIN || __builtin_expect (db->negtimeout == 0, 0))
b9ba6d
+	    {
b9ba6d
+	      /* Mark the old entry as obsolete.  */
b9ba6d
+	      if (dh != NULL)
b9ba6d
+		dh->usable = false;
b9ba6d
+	    }
b9ba6d
+	  else if ((dataset = mempool_alloc (db, (sizeof (struct dataset)
b9ba6d
+						  + req->key_len), 1)) != NULL)
b9ba6d
 	    {
b9ba6d
 	      dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
b9ba6d
 	      dataset->head.recsize = total;
b9ba6d
diff -rup a/nscd/initgrcache.c b/nscd/initgrcache.c
b9ba6d
--- a/nscd/initgrcache.c	2012-01-24 20:32:58.912826427 -0700
b9ba6d
+++ b/nscd/initgrcache.c	2012-01-24 20:42:17.671968883 -0700
b9ba6d
@@ -202,10 +202,16 @@ addinitgroupsX (struct database_dyn *db,
b9ba6d
 	    written = TEMP_FAILURE_RETRY (send (fd, &notfound, total,
b9ba6d
 						MSG_NOSIGNAL));
b9ba6d
 
b9ba6d
-	  dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len,
b9ba6d
-				   1);
b9ba6d
-	  /* If we cannot permanently store the result, so be it.  */
b9ba6d
-	  if (dataset != NULL)
b9ba6d
+	  /* If we have a transient error or cannot permanently store
b9ba6d
+	     the result, so be it.  */
b9ba6d
+	  if (all_tryagain || __builtin_expect (db->negtimeout == 0, 0))
b9ba6d
+	    {
b9ba6d
+	      /* Mark the old entry as obsolete.  */
b9ba6d
+	      if (dh != NULL)
b9ba6d
+		dh->usable = false;
b9ba6d
+	    }
b9ba6d
+	  else if ((dataset = mempool_alloc (db, (sizeof (struct dataset)
b9ba6d
+						  + req->key_len), 1)) != NULL)
b9ba6d
 	    {
b9ba6d
 	      dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
b9ba6d
 	      dataset->head.recsize = total;
b9ba6d
diff -rup a/nscd/pwdcache.c b/nscd/pwdcache.c
b9ba6d
--- a/nscd/pwdcache.c	2012-01-24 20:32:58.914826427 -0700
b9ba6d
+++ b/nscd/pwdcache.c	2012-01-24 20:42:17.671968883 -0700
b9ba6d
@@ -124,10 +124,16 @@ cache_addpw (struct database_dyn *db, in
b9ba6d
 	    written = TEMP_FAILURE_RETRY (send (fd, &notfound, total,
b9ba6d
 						MSG_NOSIGNAL));
b9ba6d
 
b9ba6d
-	  dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len,
b9ba6d
-				   1);
b9ba6d
-	  /* If we cannot permanently store the result, so be it.  */
b9ba6d
-	  if (dataset != NULL)
b9ba6d
+	  /* If we have a transient error or cannot permanently store
b9ba6d
+	     the result, so be it.  */
b9ba6d
+	  if (errno == EAGAIN || __builtin_expect (db->negtimeout == 0, 0))
b9ba6d
+	    {
b9ba6d
+	      /* Mark the old entry as obsolete.  */
b9ba6d
+	      if (dh != NULL)
b9ba6d
+		dh->usable = false;
b9ba6d
+	    }
b9ba6d
+	  else if ((dataset = mempool_alloc (db, (sizeof (struct dataset)
b9ba6d
+						  + req->key_len), 1)) != NULL)
b9ba6d
 	    {
b9ba6d
 	      dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
b9ba6d
 	      dataset->head.recsize = total;
b9ba6d
diff -rup a/nscd/servicescache.c b/nscd/servicescache.c
b9ba6d
--- a/nscd/servicescache.c	2012-01-24 20:32:58.915826427 -0700
b9ba6d
+++ b/nscd/servicescache.c	2012-01-24 20:42:17.672968884 -0700
b9ba6d
@@ -102,15 +102,22 @@ cache_addserv (struct database_dyn *db,
b9ba6d
 	{
b9ba6d
 	  /* We have no data.  This means we send the standard reply for this
b9ba6d
 	     case.  */
b9ba6d
-	  total = sizeof (notfound);
b9ba6d
+	  written = total = sizeof (notfound);
b9ba6d
 
b9ba6d
-	  written = TEMP_FAILURE_RETRY (send (fd, &notfound, total,
b9ba6d
-					      MSG_NOSIGNAL));
b9ba6d
+	  if (fd != -1)
b9ba6d
+	    written = TEMP_FAILURE_RETRY (send (fd, &notfound, total,
b9ba6d
+						MSG_NOSIGNAL));
b9ba6d
 
b9ba6d
-	  dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len,
b9ba6d
-				   1);
b9ba6d
-	  /* If we cannot permanently store the result, so be it.  */
b9ba6d
-	  if (dataset != NULL)
b9ba6d
+	  /* If we have a transient error or cannot permanently store
b9ba6d
+	     the result, so be it.  */
b9ba6d
+	  if (errval == EAGAIN || __builtin_expect (db->negtimeout == 0, 0))
b9ba6d
+	    {
b9ba6d
+	      /* Mark the old entry as obsolete.  */
b9ba6d
+	      if (dh != NULL)
b9ba6d
+		dh->usable = false;
b9ba6d
+	    }
b9ba6d
+	  else if ((dataset = mempool_alloc (db, (sizeof (struct dataset)
b9ba6d
+						  + req->key_len), 1)) != NULL)
b9ba6d
 	    {
b9ba6d
 	      dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
b9ba6d
 	      dataset->head.recsize = total;