[Devel] [PATCH] test_and_set_bit returns oldval

Serge E. Hallyn serue at us.ibm.com
Sun Oct 18 14:19:11 PDT 2009


ckpt_set_ctx_error() was not setting ctx->errno when it should - it
apparently thought that test_and_set_bit(x,y) would return 1 if the
set_bit succeeded?

Fix ckpt_set_ctx_error() to set ctx->errno the first (and only the
first) time that CKPT_CTX_ERROR gets set in ctx->kflags.

Signed-off-by: Serge E. Hallyn <serue at us.ibm.com>
---
 include/linux/checkpoint.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/checkpoint.h b/include/linux/checkpoint.h
index 4b61378..c550039 100644
--- a/include/linux/checkpoint.h
+++ b/include/linux/checkpoint.h
@@ -111,7 +111,7 @@ extern int ckpt_sock_getnames(struct ckpt_ctx *ctx,
 
 static inline void ckpt_set_ctx_error(struct ckpt_ctx *ctx, int errno)
 {
-	if (ckpt_test_and_set_ctx_kflag(ctx, CKPT_CTX_ERROR))
+	if (!ckpt_test_and_set_ctx_kflag(ctx, CKPT_CTX_ERROR))
 		ctx->errno = errno;
 }
 
-- 
1.6.1

_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list