Since the core socket functions expect to allocate an fd when they allocate the file, we need to be sure to release that file descriptor so that the core checkpoint file code can properly allocate it for us. The core socket function doesn't actually map the file and the fd together, so we just have to release it once we get it. Also, remove the #if 0 around the sock_hold() which was preventing the refcount from being correct (and thus causing a premature socket closure during restart). Signed-off-by: Dan Smith <danms@xxxxxxxxxx> --- net/checkpoint.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-) diff --git a/net/checkpoint.c b/net/checkpoint.c index 69a0a76..c6b6341 100644 --- a/net/checkpoint.c +++ b/net/checkpoint.c @@ -975,17 +975,13 @@ struct file *sock_file_restore(struct ckpt_ctx *ctx, struct ckpt_hdr_file *ptr) fd = sock_alloc_file(sk->sk_socket, &file, O_RDWR); if (fd < 0) return ERR_PTR(fd); + put_unused_fd(fd); /* We'll let the checkpoint code re-allocate this */ -#if 0 /* Since objhash assumes the initial reference for a socket, * we bump it here for this descriptor, unlike other places in * the socket code which assume the descriptor is the owner. */ - sock_hold(sock->sk); -#endif - - get_file(file); - sys_close(fd); + sock_hold(sk); ret = restore_file_common(ctx, file, ptr); if (ret < 0) { -- 1.6.2.5 _______________________________________________ Containers mailing list Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linux-foundation.org/mailman/listinfo/containers