[Devel] [PATCH 2/2] Fix restoring unlinked UNIX sockets

Dan Smith danms at us.ibm.com
Fri Jul 30 08:42:43 PDT 2010


We already support the concept, but the logic controlling whether or not we
restore the CWD path didn't follow.  This patch adds a check of the
"unlinked" flag we've already set before saving or restoring the CWD string.

This fixes an issue with a real-world workload that I have which utilizes
AF_UNIX sockets.

Signed-off-by: Dan Smith <danms at us.ibm.com>
---
 net/unix/checkpoint.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/net/unix/checkpoint.c b/net/unix/checkpoint.c
index 47d38e2..9522c3a 100644
--- a/net/unix/checkpoint.c
+++ b/net/unix/checkpoint.c
@@ -165,7 +165,8 @@ int unix_checkpoint(struct ckpt_ctx *ctx, struct socket *sock)
 	if (ret < 0)
 		goto out;
 
-	if (unix_need_cwd(&un->laddr, un->laddr_len))
+	if (unix_need_cwd(&un->laddr, un->laddr_len) &&
+	    (un->flags & CKPT_UNIX_LINKED))
 		ret = unix_write_cwd(ctx, sock->sk, un->laddr.sun_path);
  out:
 	ckpt_hdr_put(ctx, un);
@@ -614,10 +615,12 @@ int unix_restore(struct ckpt_ctx *ctx, struct socket *sock,
 	if (un->peer < 0)
 		goto out;
 
-	if (unix_need_cwd(&un->laddr, un->laddr_len)) {
+	if (unix_need_cwd(&un->laddr, un->laddr_len) &&
+	    (un->flags & CKPT_UNIX_LINKED)) {
 		cwd = ckpt_read_string(ctx, PATH_MAX);
 		if (IS_ERR(cwd)) {
 			ret = PTR_ERR(cwd);
+			cwd = NULL;
 			goto out;
 		}
 	}
-- 
1.7.1.1

_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list