Skip to contentSkip to conversation

sunrpc/cache.c: races while updating cache entries

DISCUSSION NeilBrown 2 participants 2 messages Jun 13, 2013 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

NeilBrown

author
#1 lore raw
Quoted 18 lines · On 03 Jun 2013 16:27:06 +0200 Bodo Stroesser <[email protected]> wrote:
Quoted 11 lines · Bodo Stroesser

We started the test of the -SP2 (and mainline) series on Tue, 9th, but had no success.
We did _not_ find a problem with the patches, but under -SP2 our test scenario has less than 40% of the throughput we saw under -SP1. With that low performance, we had a 4 day run without any dropped RPC request. But we don't know the error rate without the patches under these conditions. So we can't give an o.k. for the patches yet.

Currently we try to find the reason for the different behavior of SP1 and SP2

Hi,

sorry for the delay. Meanwhile we found the reason for the small throughput with -SP2. The problem resulted from a change in our own software.

Quoted 8 lines

Thus I could fix this and started a test on last Tuesday. I stopped the test today after 6 days without any lost RPC. Without the patches I saw the first dropped RPC after 3 hours. Thus, I think the patches for -SP2 are fine.

@Neil: would patch 0006 of the -SP1 patchset be a good additional change for mainline?

Bodo

Thanks for all the testing.

Bruce: where are you at with these? Are you holding one to some that I sent previously, or should I resend them all?

Bodo: no, I don't think that patch is appropriate for mainline. It causes sunrpc_cache_pipe_upcall to abort if ->expiry_time is zero. There is certainly no point in doing an upcall in that case, but the code in mainline is quite different to the code in -SP1 against which that patch made sense.

For mainline an equivalent optimisation which probably makes the interesting case more obvious would be:

net/sunrpc/cache.c +2 -1
index d01eb07..291cc47 100644
@@ -262,7 +262,8 @@ int cache_check(struct cache_detail *detail,
 	if (rqstp == NULL) {
 		if (rv == -EAGAIN)
 			rv = -ENOENT;
-	} else if (rv == -EAGAIN || age > refresh_age/2) {
+	} else if (rv == -EAGAIN ||
+		   (refresh_age > 0 && age > refresh_age/2)) {
 		dprintk("RPC:       Want update, refage=%ld, age=%ld\n",
 				refresh_age, age);
 		if (!test_and_set_bit(CACHE_PENDING, &h->flags)) {

i.e. trap that case in cache_check.

NeilBrown

#2 lore raw
Quoted 28 lines · NeilBrown
Quoted 25 lines · On 03 Jun 2013 16:27:06 +0200 Bodo Stroesser <[email protected]> wrote:
Quoted 11 lines · Bodo Stroesser

We started the test of the -SP2 (and mainline) series on Tue, 9th, but had no success.
We did _not_ find a problem with the patches, but under -SP2 our test scenario has less than 40% of the throughput we saw under -SP1. With that low performance, we had a 4 day run without any dropped RPC request. But we don't know the error rate without the patches under these conditions. So we can't give an o.k. for the patches yet.

Currently we try to find the reason for the different behavior of SP1 and SP2

Hi,

sorry for the delay. Meanwhile we found the reason for the small throughput with -SP2. The problem resulted from a change in our own software.

Thus I could fix this and started a test on last Tuesday. I stopped the test today after 6 days without any lost RPC. Without the patches I saw the first dropped RPC after 3 hours. Thus, I think the patches for -SP2 are fine.

@Neil: would patch 0006 of the -SP1 patchset be a good additional change for mainline?

Quoted 6 lines
Quoted 1 line

Bodo

Thanks for all the testing.

Bruce: where are you at with these? Are you holding one to some that I sent previously, or should I resend them all?

No, I'm not holding on to any--if you could resend them all that would be great.

--b.

Quoted 29 lines

Bodo: no, I don't think that patch is appropriate for mainline. It causes sunrpc_cache_pipe_upcall to abort if ->expiry_time is zero. There is certainly no point in doing an upcall in that case, but the code in mainline is quite different to the code in -SP1 against which that patch made sense.

For mainline an equivalent optimisation which probably makes the interesting case more obvious would be:

net/sunrpc/cache.c +2 -1
index d01eb07..291cc47 100644
@@ -262,7 +262,8 @@ int cache_check(struct cache_detail *detail,
 	if (rqstp == NULL) {
 		if (rv == -EAGAIN)
 			rv = -ENOENT;
-	} else if (rv == -EAGAIN || age > refresh_age/2) {
+	} else if (rv == -EAGAIN ||
+		   (refresh_age > 0 && age > refresh_age/2)) {
 		dprintk("RPC:       Want update, refage=%ld, age=%ld\n",
 				refresh_age, age);
 		if (!test_and_set_bit(CACHE_PENDING, &h->flags)) {

i.e. trap that case in cache_check.

NeilBrown