All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] test_and_set_bit returns oldval
@ 2009-10-18 21:19 Serge E. Hallyn
       [not found] ` <20091018211911.GA17271-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Serge E. Hallyn @ 2009-10-18 21:19 UTC (permalink / raw)
  To: Oren Laadan; +Cc: Linux Containers

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-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] test_and_set_bit returns oldval
       [not found] ` <20091018211911.GA17271-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
@ 2009-10-19  3:01   ` Oren Laadan
  0 siblings, 0 replies; 2+ messages in thread
From: Oren Laadan @ 2009-10-19  3:01 UTC (permalink / raw)
  To: Serge E. Hallyn; +Cc: Linux Containers


Serge E. Hallyn wrote:
> 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.

Yeah .. and it explains why you never saw the error as you expected.

Applied, thanks !

> 
> Signed-off-by: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> ---
>  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;
>  }
>  

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-10-19  3:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-18 21:19 [PATCH] test_and_set_bit returns oldval Serge E. Hallyn
     [not found] ` <20091018211911.GA17271-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-10-19  3:01   ` Oren Laadan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.