Oren's version of my patch leaks pipe objects due to the way the fget() and fput() operations are structured. The intent was to avoid getting and putting references more than necessary, but the result was a more confusing (IMHO) pattern that resulted in keeping an extra reference in some situations. This patch changes the pattern to something more easily understood and verified, and also allows several of my tests to pass again, as they did before the recent patch. Signed-off-by: Dan Smith <danms@xxxxxxxxxx> --- fs/pipe.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/pipe.c b/fs/pipe.c index 908b8bc..f9ad0f2 100644 --- a/fs/pipe.c +++ b/fs/pipe.c @@ -968,6 +968,7 @@ struct file *pipe_file_restore(struct ckpt_ctx *ctx, struct ckpt_hdr_file *ptr) if (!file) /* this should _never_ happen ! */ return ERR_PTR(-EBADF); ret = restore_pipe(ctx, file); + fput(file); if (ret < 0) goto out; @@ -978,13 +979,12 @@ struct file *pipe_file_restore(struct ckpt_ctx *ctx, struct ckpt_hdr_file *ptr) * other side of the pipe to the hash, to be picked up * when that side is restored. */ - if (which == 1) { /* the 'other' size */ - fput(file); - file = fget(fds[0]); - if (!file) /* this should _never_ happen ! */ - return ERR_PTR(-EBADF); - } + file = fget(fds[1-which]); + if (!file) /* this should _never_ happen ! */ + return ERR_PTR(-EBADF); + ret = ckpt_obj_insert(ctx, file, h->pipe_objref, CKPT_OBJ_FILE); + fput(file); if (ret < 0) goto out; -- 1.7.2.2 _______________________________________________ Containers mailing list Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linux-foundation.org/mailman/listinfo/containers