lkml.org 
[lkml]   [2008]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/9] Introduce context structure needed during checkpointing/restart

> +void context_release(struct cpt_context *ctx)
> +{
> + ctx->ctx_state = CPT_CTX_ERROR;
> +
> + if (ctx->file)
> + fput(ctx->file);
> + kfree(ctx);
> +}
> +
> +static void context_put(struct cpt_context *ctx)
> +{
> + if (!--ctx->refcount)
> + context_release(ctx);
> +}
> +
> static int checkpoint(pid_t pid, int fd, unsigned long flags)
> {
> - return -ENOSYS;
> + struct file *file;
> + struct cpt_context *ctx;
> + int err;
> +
> + err = -EBADF;
> + file = fget(fd);
> + if (!file)
> + goto out;
> +
> + err = -ENOMEM;
> + ctx = context_alloc();
> + if (!ctx)
> + goto out_file;
> +
> + ctx->file = file;
> + ctx->ctx_state = CPT_CTX_DUMPING;
> +
> + /* checkpoint */
> + err = -ENOSYS;
> +
> + context_put(ctx);
> +
> +out_file:
> + fput(file);
> +out:
> + return err;
> }

it looks like fput(file) is done twice in checkpoint() and context_release() ?

C.


\
 
 \ /
  Last update: 2008-09-03 16:15    [W:0.450 / U:0.744 seconds]
©2003-2014 Jasper Spaans. Advertise on this site