+static inline int __free_vx_info(struct vx_info *vxi)
+{
+ int usecnt, refcnt;
+
+ BUG_ON(!vxi);
+
+ usecnt = atomic_read(&vxi->vx_usecnt);
+ BUG_ON(usecnt < 0);
+
+ refcnt = atomic_read(&vxi->vx_refcnt);
+ BUG_ON(refcnt < 0);
+
+ if (!usecnt)
+ __dealloc_vx_info(vxi);
+ return usecnt;
+}
+
+#if 0
+
+static void __rcu_free_vx_info(struct rcu_head *head)
+{
+ struct vx_info *vxi = container_of(head, struct vx_info, vx_rcu);
+
+ BUG_ON(!head);
+ vxdprintk(VXD_CBIT(xid, 3),
+ "rcu_free_vx_info(%p): uc=%d", vxi,
+ atomic_read(&vxi->vx_usecnt));
+
+ __free_vx_info(vxi);
+}
+
+#endif
+
+void free_vx_info(struct vx_info *vxi)
+{
+ struct namespace *namespace;
+ struct fs_struct *fs;
+
+ /* context shutdown is mandatory */
+ // BUG_ON(vxi->vx_state != VXS_SHUTDOWN);
+
+ namespace = xchg(&vxi->vx_namespace, NULL);
+ fs = xchg(&vxi->vx_fs, NULL);
+
+ if (namespace)
+ put_namespace(namespace);
+ if (fs)
+ put_fs_struct(fs);
+
+ BUG_ON(__free_vx_info(vxi));
+ // call_rcu(&i->vx_rcu, __rcu_free_vx_info);
+}
+