diff -NurpP --minimal linux-2.6.19.7-vs2.2.0-rc18/kernel/vserver/context.c linux-2.6.19.7-vs2.2.0-rc18.1/kernel/vserver/context.c --- linux-2.6.19.7-vs2.2.0-rc18/kernel/vserver/context.c 2007-01-31 19:42:25 +0100 +++ linux-2.6.19.7-vs2.2.0-rc18.1/kernel/vserver/context.c 2007-03-18 23:04:30 +0100 @@ -20,6 +20,7 @@ * V0.13 separate per cpu data * V0.14 changed vcmds to vxi arg * V0.15 added context stat + * V0.16 have __create claim() the vxi * */ @@ -400,7 +401,7 @@ out_unlock: /* __create_vx_info() * create the requested context - * get() and hash it */ + * get(), claim() and hash it */ static struct vx_info * __create_vx_info(int id) { @@ -453,6 +454,7 @@ static struct vx_info * __create_vx_info /* new context */ vxdprintk(VXD_CBIT(xid, 0), "create_vx_info(%d) = %p (new)", id, new); + claim_vx_info(new, NULL); __hash_vx_info(get_vx_info(new)); vxi = new, new = NULL; @@ -774,7 +776,7 @@ void vx_set_persistent(struct vx_info *v "vx_set_persistent(%p[#%d])", vxi, vxi->vx_id); get_vx_info(vxi); - claim_vx_info(vxi, current); + claim_vx_info(vxi, NULL); } void vx_clear_persistent(struct vx_info *vxi) @@ -782,7 +784,7 @@ void vx_clear_persistent(struct vx_info vxdprintk(VXD_CBIT(xid, 6), "vx_clear_persistent(%p[#%d])", vxi, vxi->vx_id); - release_vx_info(vxi, current); + release_vx_info(vxi, NULL); put_vx_info(vxi); } @@ -900,27 +902,22 @@ int vc_ctx_create(uint32_t xid, void __u /* initial flags */ new_vxi->vx_flags = vc_data.flagword; - /* get a reference for persistent contexts */ - if ((vc_data.flagword & VXF_PERSISTENT)) - vx_set_persistent(new_vxi); - ret = -ENOEXEC; if (vs_state_change(new_vxi, VSC_STARTUP)) - goto out_err; + goto out; ret = vx_migrate_task(current, new_vxi, (!data)); - if (!ret) { - /* return context id on success */ - ret = new_vxi->vx_id; + if (ret) goto out; - } -out_err: - /* prepare for context disposal */ - new_vxi->vx_state |= VXS_SHUTDOWN; - new_vxi->vx_flags &= ~VXF_PERSISTENT; - if ((vc_data.flagword & VXF_PERSISTENT)) - vx_clear_persistent(new_vxi); + + /* return context id on success */ + ret = new_vxi->vx_id; + + /* get a reference for persistent contexts */ + if ((vc_data.flagword & VXF_PERSISTENT)) + vx_set_persistent(new_vxi); out: + release_vx_info(new_vxi, NULL); put_vx_info(new_vxi); return ret; } diff -NurpP --minimal linux-2.6.19.7-vs2.2.0-rc18/kernel/vserver/legacynet.c linux-2.6.19.7-vs2.2.0-rc18.1/kernel/vserver/legacynet.c --- linux-2.6.19.7-vs2.2.0-rc18/kernel/vserver/legacynet.c 2006-11-08 04:57:49 +0100 +++ linux-2.6.19.7-vs2.2.0-rc18.1/kernel/vserver/legacynet.c 2007-03-18 22:58:16 +0100 @@ -77,6 +77,7 @@ int vc_set_ipv4root(uint32_t nbip, void printk("!!! switching nx_info %p->%p\n", nxi, new_nxi); nx_migrate_task(current, new_nxi); + release_nx_info(new_nxi, NULL); put_nx_info(new_nxi); return 0; } diff -NurpP --minimal linux-2.6.19.7-vs2.2.0-rc18/kernel/vserver/network.c linux-2.6.19.7-vs2.2.0-rc18.1/kernel/vserver/network.c --- linux-2.6.19.7-vs2.2.0-rc18/kernel/vserver/network.c 2007-03-17 22:59:36 +0100 +++ linux-2.6.19.7-vs2.2.0-rc18.1/kernel/vserver/network.c 2007-03-18 22:58:16 +0100 @@ -11,6 +11,7 @@ * V0.04 switch to RCU based hash * V0.05 and back to locking again * V0.06 changed vcmds to nxi arg + * V0.07 have __create claim() the nxi * */ @@ -217,7 +218,7 @@ static inline nid_t __nx_dynamic_id(void /* __create_nx_info() * create the requested context - * get() and hash it */ + * get(), claim() and hash it */ static struct nx_info * __create_nx_info(int id) { @@ -268,6 +269,7 @@ static struct nx_info * __create_nx_info /* new context */ vxdprintk(VXD_CBIT(nid, 0), "create_nx_info(%d) = %p (new)", id, new); + claim_nx_info(new, NULL); __hash_nx_info(get_nx_info(new)); nxi = new, new = NULL; @@ -530,8 +532,11 @@ int nx_addr_conflict(struct nx_info *nxi void nx_set_persistent(struct nx_info *nxi) { + vxdprintk(VXD_CBIT(nid, 6), + "nx_set_persistent(%p[#%d])", nxi, nxi->nx_id); + get_nx_info(nxi); - claim_nx_info(nxi, current); + claim_nx_info(nxi, NULL); } void nx_clear_persistent(struct nx_info *nxi) @@ -539,7 +544,7 @@ void nx_clear_persistent(struct nx_info vxdprintk(VXD_CBIT(nid, 6), "nx_clear_persistent(%p[#%d])", nxi, nxi->nx_id); - release_nx_info(nxi, current); + release_nx_info(nxi, NULL); put_nx_info(nxi); } diff -NurpP --minimal linux-2.6.20.3-vs2.2.0-rc18/kernel/vserver/network.c linux-2.6.20.3-vs2.2.0-rc18.1/kernel/vserver/network.c --- linux-2.6.20.3-vs2.2.0-rc18/kernel/vserver/network.c 2007-03-17 23:16:41 +0100 +++ linux-2.6.20.3-vs2.2.0-rc18.1/kernel/vserver/network.c 2007-03-18 23:24:48 +0100 @@ -614,27 +614,22 @@ int vc_net_create(uint32_t nid, void __u /* initial flags */ new_nxi->nx_flags = vc_data.flagword; - /* get a reference for persistent contexts */ - if ((vc_data.flagword & NXF_PERSISTENT)) - nx_set_persistent(new_nxi); - ret = -ENOEXEC; if (vs_net_change(new_nxi, VSC_NETUP)) - goto out_err; + goto out; ret = nx_migrate_task(current, new_nxi); - if (!ret) { - /* return context id on success */ - ret = new_nxi->nx_id; + if (ret) goto out; - } -out_err: - /* prepare for context disposal */ - new_nxi->nx_state |= NXS_SHUTDOWN; - new_nxi->nx_flags &= NXF_PERSISTENT; + + /* return context id on success */ + ret = new_nxi->nx_id; + + /* get a reference for persistent contexts */ if ((vc_data.flagword & NXF_PERSISTENT)) - nx_clear_persistent(new_nxi); + nx_set_persistent(new_nxi); out: + release_nx_info(new_nxi, NULL); put_nx_info(new_nxi); return ret; }