Blame SOURCES/glibc-rh784402.patch

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