[Devel] Re: [PATCH] Change the logic in obj_sock_adjust_users()

Oren Laadan orenl at cs.columbia.edu
Wed Sep 15 21:50:20 PDT 2010


Simple enough - queued for v22-dev.

Oren

On 09/09/2010 06:25 PM, Dan Smith wrote:
> The explicit decrement of obj->users isn't correct for all cases of
> SOCK_DEAD, so this patch changes it to the result of ref_users() to
> avoid the false positive in the leak check.  I have confirmed with
> sockets in both SOCK_DEAD situations that we don't leak them with
> this change.
> 
> Signed-off-by: Dan Smith <danms at us.ibm.com>
> ---
>  kernel/checkpoint/objhash.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/checkpoint/objhash.c b/kernel/checkpoint/objhash.c
> index a7b8b7d..62c34ff 100644
> --- a/kernel/checkpoint/objhash.c
> +++ b/kernel/checkpoint/objhash.c
> @@ -546,7 +546,7 @@ static void ckpt_obj_users_inc(struct ckpt_ctx *ctx, void *ptr, int increment)
>   * obj_sock_adjust_users - remove implicit reference on DEAD sockets
>   * @obj: CKPT_OBJ_SOCK object to adjust
>   *
> - * Sockets that have been disconnected from their struct file have
> + * Sockets that have been disconnected from their struct file may have
>   * a reference count one less than normal sockets.  The objhash's
>   * assumption of such a reference is therefore incorrect, so we correct
>   * it here.
> @@ -556,7 +556,7 @@ static inline void obj_sock_adjust_users(struct ckpt_obj *obj)
>  	struct sock *sk = (struct sock *)obj->ptr;
>  
>  	if (sock_flag(sk, SOCK_DEAD)) {
> -		obj->users--;
> +		obj->users = obj->ops->ref_users(obj->ptr);
>  		ckpt_debug("Adjusting SOCK %i count to %i\n",
>  			   obj->objref, obj->users);
>  	}
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list