About this list Date view Thread view Subject view Author view Attachment view

From: Alex Lyashkov (shadow_at_psoft.net)
Date: Fri 26 Sep 2003 - 04:25:18 BST


>
> Another problem is that 'vserver XXX enter' can not be used anymore. Or
> does there exist a way to enter the namespace of foreign processes?
> Doing the mounts on every 'enter' seems to be expensive on the first
> glance.
In kernel not have parts for enter to the namaspace of foregin processes but
add very easy. that sample working code.
static inline void switch_namespace(task_t *task, struct s_context
*new_context)
{
   struct fs_struct *fs;
   #define ns new_context->vroot.names
   struct namespace *old_ns;
#ifdef S_CONTEXT_DEBUG_VROOT
   printk("switch_namespace ctx #%u new_root %s\n", new_context->id,
ns.root->mnt_root->d_name.name);
   printk("n_ns %p o_ns %p \n", ns.root, task->namespace);
#endif

   task_lock(task);
   fs = task->fs;
   old_ns = task->namespace;
   get_namespace(&ns);
   task->namespace=&ns;
   put_namespace(old_ns);
   task_unlock(task);

   set_fs_root(fs, ns.root, ns.root->mnt_root);
   set_fs_altroot();
   set_fs_pwd(task->fs, ns.root, ns.root->mnt_root);

   #undef ns
}
it`s not need do mounts every "enter"

-- 
With best regards,
Alex


About this list Date view Thread view Subject view Author view Attachment view
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Fri 26 Sep 2003 - 06:48:12 BST by hypermail 2.1.3