Skip to contentSkip to conversation

Skip down interfaces (v2)

PATCH In review Dan Smith 5 participants 7 messages Mar 31, 2010 – Apr 1, 2010 2 messages not in the archive Networking

lore
Share & tools
lore

Dan Smith

author
#0 lore raw

PATCH 1/1 Skip down interfaces (v2)

This makes the netns checkpoint code skip interfaces that are not up. Later, we want to make it possible to checkpoint down interfaces with a flag, but for now this helps prevent people from getting stuck on stock kernels with various unsupported and persistent virtual interfaces, such as tunnel devices.

Changes in v2:
- Fix logic to only skip down interfaces if they're not supported

---
 net/checkpoint_dev.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
net/checkpoint_dev.c +10 -1
index bc0415d..e8d574c 100644
@@ -268,7 +268,16 @@ int checkpoint_netns(struct ckpt_ctx *ctx, void *ptr)
 		goto out;
 
 	for_each_netdev(net, dev) {
-		ret = checkpoint_obj(ctx, dev, CKPT_OBJ_NETDEV);
+		if (dev->netdev_ops->ndo_checkpoint)
+			ret = checkpoint_obj(ctx, dev, CKPT_OBJ_NETDEV);
+		else if (dev->flags & IFF_UP)
+			ret = -ENOSYS;
+		else
+			/* TODO: There should be a flag to attempt a
+			 * checkpoint of downed interfaces, regardless
+			 * of whether they support checkpoint or not.
+			 */
+			ret = 0;
 		if (ret < 0)
 			break;
 	}
Signature · 1 line
1.6.2.5

A message that is not in the archive (sent off-list or not yet received): 1270052634-8170-1-git-send-email-danms-r/[email protected]

Tested-by
#2 lore raw
Quoted 11 lines · Dan Smith

This makes the netns checkpoint code skip interfaces that are not up. Later, we want to make it possible to checkpoint down interfaces with a flag, but for now this helps prevent people from getting stuck on stock kernels with various unsupported and persistent virtual interfaces, such as tunnel devices.

Changes in v2:
- Fix logic to only skip down interfaces if they're not supported

Looks good, thanks.

-serge

Quoted 33 lines
---
 net/checkpoint_dev.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
net/checkpoint_dev.c +10 -1
index bc0415d..e8d574c 100644
@@ -268,7 +268,16 @@ int checkpoint_netns(struct ckpt_ctx *ctx, void *ptr)
 		goto out;
 
 	for_each_netdev(net, dev) {
-		ret = checkpoint_obj(ctx, dev, CKPT_OBJ_NETDEV);
+		if (dev->netdev_ops->ndo_checkpoint)
+			ret = checkpoint_obj(ctx, dev, CKPT_OBJ_NETDEV);
+		else if (dev->flags & IFF_UP)
+			ret = -ENOSYS;
+		else
+			/* TODO: There should be a flag to attempt a
+			 * checkpoint of downed interfaces, regardless
+			 * of whether they support checkpoint or not.
+			 */
+			ret = 0;
 		if (ret < 0)
 			break;
 	}
Signature · 6 lines
1.6.2.5

_______________________________________________
Containers mailing list
Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
https://lists.linux-foundation.org/mailman/listinfo/containers
#3 lore raw
In reply to a message not in the archive

Acked and pulled for v21-rc2, thanks.

Quoted 37 lines · Dan Smith

This makes the netns checkpoint code skip interfaces that are not up. Later, we want to make it possible to checkpoint down interfaces with a flag, but for now this helps prevent people from getting stuck on stock kernels with various unsupported and persistent virtual interfaces, such as tunnel devices.

Changes in v2:
- Fix logic to only skip down interfaces if they're not supported

---
 net/checkpoint_dev.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
net/checkpoint_dev.c +10 -1
index bc0415d..e8d574c 100644
@@ -268,7 +268,16 @@ int checkpoint_netns(struct ckpt_ctx *ctx, void *ptr)
 		goto out;
 
 	for_each_netdev(net, dev) {
-		ret = checkpoint_obj(ctx, dev, CKPT_OBJ_NETDEV);
+		if (dev->netdev_ops->ndo_checkpoint)
+			ret = checkpoint_obj(ctx, dev, CKPT_OBJ_NETDEV);
+		else if (dev->flags & IFF_UP)
+			ret = -ENOSYS;
+		else
+			/* TODO: There should be a flag to attempt a
+			 * checkpoint of downed interfaces, regardless
+			 * of whether they support checkpoint or not.
+			 */
+			ret = 0;
 		if (ret < 0)
 			break;
 	}
#4 lore raw
In reply to a message not in the archive

Acked and pulled for v21-rc2, thanks.

Quoted 37 lines · Dan Smith

This makes the netns checkpoint code skip interfaces that are not up. Later, we want to make it possible to checkpoint down interfaces with a flag, but for now this helps prevent people from getting stuck on stock kernels with various unsupported and persistent virtual interfaces, such as tunnel devices.

Changes in v2:
- Fix logic to only skip down interfaces if they're not supported

---
 net/checkpoint_dev.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
net/checkpoint_dev.c +10 -1
index bc0415d..e8d574c 100644
@@ -268,7 +268,16 @@ int checkpoint_netns(struct ckpt_ctx *ctx, void *ptr)
 		goto out;
 
 	for_each_netdev(net, dev) {
-		ret = checkpoint_obj(ctx, dev, CKPT_OBJ_NETDEV);
+		if (dev->netdev_ops->ndo_checkpoint)
+			ret = checkpoint_obj(ctx, dev, CKPT_OBJ_NETDEV);
+		else if (dev->flags & IFF_UP)
+			ret = -ENOSYS;
+		else
+			/* TODO: There should be a flag to attempt a
+			 * checkpoint of downed interfaces, regardless
+			 * of whether they support checkpoint or not.
+			 */
+			ret = 0;
 		if (ret < 0)
 			break;
 	}
#5 lore raw
In reply to a message not in the archive
Quoted 5 lines · Dan Smith

This makes the netns checkpoint code skip interfaces that are not up. Later, we want to make it possible to checkpoint down interfaces with a flag, but for now this helps prevent people from getting stuck on stock kernels with various unsupported and persistent virtual interfaces, such as tunnel devices.

But devices that are not IFF_UP can still have addresses associated with them, wouldn't this cause those addresses to not be checkpointed?

-Brian

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw
Quoted 10 lines · Brian Haley
Quoted 5 lines · Dan Smith

This makes the netns checkpoint code skip interfaces that are not up. Later, we want to make it possible to checkpoint down interfaces with a flag, but for now this helps prevent people from getting stuck on stock kernels with various unsupported and persistent virtual interfaces, such as tunnel devices.

But devices that are not IFF_UP can still have addresses associated with them, wouldn't this cause those addresses to not be checkpointed?

Only if it's a device that wouldn't have supported checkpoint anyway. So if veth0 is down, it'll be checkpointed. If tunl0 is up, checkpoint will be refused. But if tunl0 is down, then it'll just be ignored. The container didn't want that jerk around anyway, it just couldn't get rid of it.

-serge

author
#8 lore raw
In reply to a message not in the archive

BH> But devices that are not IFF_UP can still have addresses BH> associated with them, wouldn't this cause those addresses to not BH> be checkpointed?

Yes. This was discussed on IRC a bit as being a reasonable compromise. Right now, there are several pernet devices that could show up in a new network namespace that will prevent a checkpoint from completing. Since you can't easily, and at runtime, get rid of these devices without recompiling the kernel, you're kinda stuck. So, we discussed this as something that will let you out of that situation for interfaces that are down.

We could, I suppose, inspect the interfaces a bit to see if they have any addresses configured before we agree to skip them. However, that could falsely trigger a failure because of autoconf addresses, I would think.

The plan is to have a "strict mode" flag that will attempt to checkpoint and fail on down but unsupported interfaces to make sure we don't save an inaccurate representation of the netns that the application is in.

Signature · 3 lines
Dan Smith
IBM Linux Technology Center
email: danms-r/[email protected]