]> git.pld-linux.org Git - packages/kernel.git/commitdiff
http://vserver.13thfloor.at/Experimental/patch-2.6.27.33-vs2.3.0.36.6.diff
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Thu, 17 Sep 2009 08:31:40 +0000 (08:31 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    kernel-vserver-2.3.patch -> 1.18

kernel-vserver-2.3.patch

index 8d98f35b807dd5ed75a7fee3d670839cfbea03e3..3cd40106c904c03fc2c9e9e5da1fe5f28a6f09a8 100644 (file)
@@ -1,7 +1,7 @@
-diff -NurpP --minimal linux-2.6.31/arch/alpha/Kconfig linux-2.6.31-vs2.3.0.36.14-pre8/arch/alpha/Kconfig
---- linux-2.6.31/arch/alpha/Kconfig    2009-03-24 14:18:07.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/alpha/Kconfig 2009-09-10 16:11:43.000000000 +0200
-@@ -666,6 +666,8 @@ config DUMMY_CONSOLE
+diff -NurpP --minimal linux-2.6.27.33/arch/alpha/Kconfig linux-2.6.27.33-vs2.3.0.36.6/arch/alpha/Kconfig
+--- linux-2.6.27.33/arch/alpha/Kconfig 2008-10-13 14:51:51.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/alpha/Kconfig    2008-10-13 14:54:20.000000000 +0200
+@@ -667,6 +667,8 @@ config DUMMY_CONSOLE
        depends on VGA_HOSE
        default y
  
@@ -10,10 +10,10 @@ diff -NurpP --minimal linux-2.6.31/arch/alpha/Kconfig linux-2.6.31-vs2.3.0.36.14
  source "security/Kconfig"
  
  source "crypto/Kconfig"
-diff -NurpP --minimal linux-2.6.31/arch/alpha/kernel/entry.S linux-2.6.31-vs2.3.0.36.14-pre8/arch/alpha/kernel/entry.S
---- linux-2.6.31/arch/alpha/kernel/entry.S     2009-06-11 17:11:46.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/alpha/kernel/entry.S  2009-09-10 16:11:43.000000000 +0200
-@@ -874,24 +874,15 @@ sys_getxgid:
+diff -NurpP --minimal linux-2.6.27.33/arch/alpha/kernel/entry.S linux-2.6.27.33-vs2.3.0.36.6/arch/alpha/kernel/entry.S
+--- linux-2.6.27.33/arch/alpha/kernel/entry.S  2009-09-13 16:16:49.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/alpha/kernel/entry.S     2009-02-03 17:59:04.000000000 +0100
+@@ -872,24 +872,15 @@ sys_getxgid:
        .globl  sys_getxpid
        .ent    sys_getxpid
  sys_getxpid:
@@ -45,10 +45,10 @@ diff -NurpP --minimal linux-2.6.31/arch/alpha/kernel/entry.S linux-2.6.31-vs2.3.
        ret
  .end sys_getxpid
  
-diff -NurpP --minimal linux-2.6.31/arch/alpha/kernel/osf_sys.c linux-2.6.31-vs2.3.0.36.14-pre8/arch/alpha/kernel/osf_sys.c
---- linux-2.6.31/arch/alpha/kernel/osf_sys.c   2009-09-10 15:25:14.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/alpha/kernel/osf_sys.c        2009-09-10 16:11:43.000000000 +0200
-@@ -872,7 +872,7 @@ SYSCALL_DEFINE2(osf_gettimeofday, struct
+diff -NurpP --minimal linux-2.6.27.33/arch/alpha/kernel/osf_sys.c linux-2.6.27.33-vs2.3.0.36.6/arch/alpha/kernel/osf_sys.c
+--- linux-2.6.27.33/arch/alpha/kernel/osf_sys.c        2008-10-13 14:51:51.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/alpha/kernel/osf_sys.c   2008-10-13 14:54:20.000000000 +0200
+@@ -888,7 +888,7 @@ osf_gettimeofday(struct timeval32 __user
  {
        if (tv) {
                struct timeval ktv;
@@ -57,10 +57,10 @@ diff -NurpP --minimal linux-2.6.31/arch/alpha/kernel/osf_sys.c linux-2.6.31-vs2.
                if (put_tv32(tv, &ktv))
                        return -EFAULT;
        }
-diff -NurpP --minimal linux-2.6.31/arch/alpha/kernel/ptrace.c linux-2.6.31-vs2.3.0.36.14-pre8/arch/alpha/kernel/ptrace.c
---- linux-2.6.31/arch/alpha/kernel/ptrace.c    2009-09-10 15:25:14.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/alpha/kernel/ptrace.c 2009-09-10 16:11:43.000000000 +0200
-@@ -14,6 +14,7 @@
+diff -NurpP --minimal linux-2.6.27.33/arch/alpha/kernel/ptrace.c linux-2.6.27.33-vs2.3.0.36.6/arch/alpha/kernel/ptrace.c
+--- linux-2.6.27.33/arch/alpha/kernel/ptrace.c 2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/alpha/kernel/ptrace.c    2008-10-13 14:54:20.000000000 +0200
+@@ -15,6 +15,7 @@
  #include <linux/slab.h>
  #include <linux/security.h>
  #include <linux/signal.h>
@@ -68,9 +68,9 @@ diff -NurpP --minimal linux-2.6.31/arch/alpha/kernel/ptrace.c linux-2.6.31-vs2.3
  
  #include <asm/uaccess.h>
  #include <asm/pgtable.h>
-diff -NurpP --minimal linux-2.6.31/arch/alpha/kernel/systbls.S linux-2.6.31-vs2.3.0.36.14-pre8/arch/alpha/kernel/systbls.S
---- linux-2.6.31/arch/alpha/kernel/systbls.S   2009-03-24 14:18:08.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/alpha/kernel/systbls.S        2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/arch/alpha/kernel/systbls.S linux-2.6.27.33-vs2.3.0.36.6/arch/alpha/kernel/systbls.S
+--- linux-2.6.27.33/arch/alpha/kernel/systbls.S        2009-09-13 16:16:49.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/alpha/kernel/systbls.S   2009-02-03 17:59:04.000000000 +0100
 @@ -446,7 +446,7 @@ sys_call_table:
        .quad sys_stat64                        /* 425 */
        .quad sys_lstat64
@@ -80,9 +80,9 @@ diff -NurpP --minimal linux-2.6.31/arch/alpha/kernel/systbls.S linux-2.6.31-vs2.
        .quad sys_ni_syscall                    /* sys_mbind */
        .quad sys_ni_syscall                    /* sys_get_mempolicy */
        .quad sys_ni_syscall                    /* sys_set_mempolicy */
-diff -NurpP --minimal linux-2.6.31/arch/alpha/kernel/traps.c linux-2.6.31-vs2.3.0.36.14-pre8/arch/alpha/kernel/traps.c
---- linux-2.6.31/arch/alpha/kernel/traps.c     2009-06-11 17:11:46.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/alpha/kernel/traps.c  2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/arch/alpha/kernel/traps.c linux-2.6.27.33-vs2.3.0.36.6/arch/alpha/kernel/traps.c
+--- linux-2.6.27.33/arch/alpha/kernel/traps.c  2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/alpha/kernel/traps.c     2008-10-13 14:54:20.000000000 +0200
 @@ -183,7 +183,8 @@ die_if_kernel(char * str, struct pt_regs
  #ifdef CONFIG_SMP
        printk("CPU %d ", hard_smp_processor_id());
@@ -93,9 +93,9 @@ diff -NurpP --minimal linux-2.6.31/arch/alpha/kernel/traps.c linux-2.6.31-vs2.3.
        dik_show_regs(regs, r9_15);
        add_taint(TAINT_DIE);
        dik_show_trace((unsigned long *)(regs+1));
-diff -NurpP --minimal linux-2.6.31/arch/alpha/mm/fault.c linux-2.6.31-vs2.3.0.36.14-pre8/arch/alpha/mm/fault.c
---- linux-2.6.31/arch/alpha/mm/fault.c 2009-09-10 15:25:14.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/alpha/mm/fault.c      2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/arch/alpha/mm/fault.c linux-2.6.27.33-vs2.3.0.36.6/arch/alpha/mm/fault.c
+--- linux-2.6.27.33/arch/alpha/mm/fault.c      2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/alpha/mm/fault.c 2008-10-13 14:54:20.000000000 +0200
 @@ -193,8 +193,8 @@ do_page_fault(unsigned long address, uns
                down_read(&mm->mmap_sem);
                goto survive;
@@ -107,10 +107,10 @@ diff -NurpP --minimal linux-2.6.31/arch/alpha/mm/fault.c linux-2.6.31-vs2.3.0.36
        if (!user_mode(regs))
                goto no_context;
        do_group_exit(SIGKILL);
-diff -NurpP --minimal linux-2.6.31/arch/arm/Kconfig linux-2.6.31-vs2.3.0.36.14-pre8/arch/arm/Kconfig
---- linux-2.6.31/arch/arm/Kconfig      2009-09-10 15:25:14.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/arm/Kconfig   2009-09-10 16:11:43.000000000 +0200
-@@ -1483,6 +1483,8 @@ source "fs/Kconfig"
+diff -NurpP --minimal linux-2.6.27.33/arch/arm/Kconfig linux-2.6.27.33-vs2.3.0.36.6/arch/arm/Kconfig
+--- linux-2.6.27.33/arch/arm/Kconfig   2008-10-13 14:51:51.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/arm/Kconfig      2008-10-13 14:54:20.000000000 +0200
+@@ -1240,6 +1240,8 @@ source "fs/Kconfig"
  
  source "arch/arm/Kconfig.debug"
  
@@ -119,9 +119,9 @@ diff -NurpP --minimal linux-2.6.31/arch/arm/Kconfig linux-2.6.31-vs2.3.0.36.14-p
  source "security/Kconfig"
  
  source "crypto/Kconfig"
-diff -NurpP --minimal linux-2.6.31/arch/arm/kernel/calls.S linux-2.6.31-vs2.3.0.36.14-pre8/arch/arm/kernel/calls.S
---- linux-2.6.31/arch/arm/kernel/calls.S       2009-09-10 15:25:15.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/arm/kernel/calls.S    2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/arch/arm/kernel/calls.S linux-2.6.27.33-vs2.3.0.36.6/arch/arm/kernel/calls.S
+--- linux-2.6.27.33/arch/arm/kernel/calls.S    2009-09-13 16:16:49.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/arm/kernel/calls.S       2009-02-03 17:59:04.000000000 +0100
 @@ -322,7 +322,7 @@
  /* 310 */     CALL(sys_request_key)
                CALL(sys_keyctl)
@@ -131,10 +131,10 @@ diff -NurpP --minimal linux-2.6.31/arch/arm/kernel/calls.S linux-2.6.31-vs2.3.0.
                CALL(sys_ioprio_set)
  /* 315 */     CALL(sys_ioprio_get)
                CALL(sys_inotify_init)
-diff -NurpP --minimal linux-2.6.31/arch/arm/kernel/process.c linux-2.6.31-vs2.3.0.36.14-pre8/arch/arm/kernel/process.c
---- linux-2.6.31/arch/arm/kernel/process.c     2009-09-10 15:25:15.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/arm/kernel/process.c  2009-09-10 16:11:43.000000000 +0200
-@@ -269,7 +269,8 @@ void __show_regs(struct pt_regs *regs)
+diff -NurpP --minimal linux-2.6.27.33/arch/arm/kernel/process.c linux-2.6.27.33-vs2.3.0.36.6/arch/arm/kernel/process.c
+--- linux-2.6.27.33/arch/arm/kernel/process.c  2008-10-13 14:51:52.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/arm/kernel/process.c     2008-10-13 14:54:20.000000000 +0200
+@@ -262,7 +262,8 @@ void __show_regs(struct pt_regs *regs)
  void show_regs(struct pt_regs * regs)
  {
        printk("\n");
@@ -144,10 +144,10 @@ diff -NurpP --minimal linux-2.6.31/arch/arm/kernel/process.c linux-2.6.31-vs2.3.
        __show_regs(regs);
        __backtrace();
  }
-diff -NurpP --minimal linux-2.6.31/arch/arm/kernel/traps.c linux-2.6.31-vs2.3.0.36.14-pre8/arch/arm/kernel/traps.c
---- linux-2.6.31/arch/arm/kernel/traps.c       2009-06-11 17:11:49.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/arm/kernel/traps.c    2009-09-10 16:11:43.000000000 +0200
-@@ -228,8 +228,8 @@ static void __die(const char *str, int e
+diff -NurpP --minimal linux-2.6.27.33/arch/arm/kernel/traps.c linux-2.6.27.33-vs2.3.0.36.6/arch/arm/kernel/traps.c
+--- linux-2.6.27.33/arch/arm/kernel/traps.c    2008-10-13 14:51:52.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/arm/kernel/traps.c       2008-10-13 14:54:20.000000000 +0200
+@@ -214,8 +214,8 @@ static void __die(const char *str, int e
               str, err, ++die_counter);
        print_modules();
        __show_regs(regs);
@@ -158,10 +158,10 @@ diff -NurpP --minimal linux-2.6.31/arch/arm/kernel/traps.c linux-2.6.31-vs2.3.0.
  
        if (!user_mode(regs) || in_interrupt()) {
                dump_mem("Stack: ", regs->ARM_sp,
-diff -NurpP --minimal linux-2.6.31/arch/arm/mm/fault.c linux-2.6.31-vs2.3.0.36.14-pre8/arch/arm/mm/fault.c
---- linux-2.6.31/arch/arm/mm/fault.c   2009-09-10 15:25:18.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/arm/mm/fault.c        2009-09-10 16:11:43.000000000 +0200
-@@ -294,7 +294,8 @@ do_page_fault(unsigned long addr, unsign
+diff -NurpP --minimal linux-2.6.27.33/arch/arm/mm/fault.c linux-2.6.27.33-vs2.3.0.36.6/arch/arm/mm/fault.c
+--- linux-2.6.27.33/arch/arm/mm/fault.c        2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/arm/mm/fault.c   2008-10-13 14:54:20.000000000 +0200
+@@ -292,7 +292,8 @@ do_page_fault(unsigned long addr, unsign
                 * happened to us that made us unable to handle
                 * the page fault gracefully.
                 */
@@ -171,10 +171,10 @@ diff -NurpP --minimal linux-2.6.31/arch/arm/mm/fault.c linux-2.6.31-vs2.3.0.36.1
                do_group_exit(SIGKILL);
                return 0;
        }
-diff -NurpP --minimal linux-2.6.31/arch/cris/Kconfig linux-2.6.31-vs2.3.0.36.14-pre8/arch/cris/Kconfig
---- linux-2.6.31/arch/cris/Kconfig     2009-06-11 17:11:56.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/cris/Kconfig  2009-09-10 16:11:43.000000000 +0200
-@@ -685,6 +685,8 @@ source "drivers/staging/Kconfig"
+diff -NurpP --minimal linux-2.6.27.33/arch/cris/Kconfig linux-2.6.27.33-vs2.3.0.36.6/arch/cris/Kconfig
+--- linux-2.6.27.33/arch/cris/Kconfig  2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/cris/Kconfig     2008-10-13 14:54:20.000000000 +0200
+@@ -679,6 +679,8 @@ source "drivers/usb/Kconfig"
  
  source "arch/cris/Kconfig.debug"
  
@@ -183,9 +183,9 @@ diff -NurpP --minimal linux-2.6.31/arch/cris/Kconfig linux-2.6.31-vs2.3.0.36.14-
  source "security/Kconfig"
  
  source "crypto/Kconfig"
-diff -NurpP --minimal linux-2.6.31/arch/frv/kernel/kernel_thread.S linux-2.6.31-vs2.3.0.36.14-pre8/arch/frv/kernel/kernel_thread.S
---- linux-2.6.31/arch/frv/kernel/kernel_thread.S       2008-12-25 00:26:37.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/frv/kernel/kernel_thread.S    2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/arch/frv/kernel/kernel_thread.S linux-2.6.27.33-vs2.3.0.36.6/arch/frv/kernel/kernel_thread.S
+--- linux-2.6.27.33/arch/frv/kernel/kernel_thread.S    2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/frv/kernel/kernel_thread.S       2008-10-13 14:54:20.000000000 +0200
 @@ -37,7 +37,7 @@ kernel_thread:
  
        # start by forking the current process, but with shared VM
@@ -195,10 +195,10 @@ diff -NurpP --minimal linux-2.6.31/arch/frv/kernel/kernel_thread.S linux-2.6.31-
        sethi.p         #0xe4e4,gr9             ; second syscall arg    [newsp]
        setlo           #0xe4e4,gr9
        setlos.p        #0,gr10                 ; third syscall arg     [parent_tidptr]
-diff -NurpP --minimal linux-2.6.31/arch/h8300/Kconfig linux-2.6.31-vs2.3.0.36.14-pre8/arch/h8300/Kconfig
---- linux-2.6.31/arch/h8300/Kconfig    2009-03-24 14:18:24.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/h8300/Kconfig 2009-09-10 16:11:43.000000000 +0200
-@@ -226,6 +226,8 @@ source "fs/Kconfig"
+diff -NurpP --minimal linux-2.6.27.33/arch/h8300/Kconfig linux-2.6.27.33-vs2.3.0.36.6/arch/h8300/Kconfig
+--- linux-2.6.27.33/arch/h8300/Kconfig 2008-10-13 14:51:55.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/h8300/Kconfig    2008-10-13 14:54:20.000000000 +0200
+@@ -219,6 +219,8 @@ source "fs/Kconfig"
  
  source "arch/h8300/Kconfig.debug"
  
@@ -207,10 +207,10 @@ diff -NurpP --minimal linux-2.6.31/arch/h8300/Kconfig linux-2.6.31-vs2.3.0.36.14
  source "security/Kconfig"
  
  source "crypto/Kconfig"
-diff -NurpP --minimal linux-2.6.31/arch/ia64/ia32/ia32_entry.S linux-2.6.31-vs2.3.0.36.14-pre8/arch/ia64/ia32/ia32_entry.S
---- linux-2.6.31/arch/ia64/ia32/ia32_entry.S   2009-06-11 17:11:57.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/ia64/ia32/ia32_entry.S        2009-09-10 16:11:43.000000000 +0200
-@@ -451,7 +451,7 @@ ia32_syscall_table:
+diff -NurpP --minimal linux-2.6.27.33/arch/ia64/ia32/ia32_entry.S linux-2.6.27.33-vs2.3.0.36.6/arch/ia64/ia32/ia32_entry.S
+--- linux-2.6.27.33/arch/ia64/ia32/ia32_entry.S        2009-09-13 16:16:49.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/ia64/ia32/ia32_entry.S   2009-02-03 17:59:04.000000000 +0100
+@@ -446,7 +446,7 @@ ia32_syscall_table:
        data8 sys_tgkill        /* 270 */
        data8 compat_sys_utimes
        data8 sys32_fadvise64_64
@@ -219,10 +219,22 @@ diff -NurpP --minimal linux-2.6.31/arch/ia64/ia32/ia32_entry.S linux-2.6.31-vs2.
        data8 sys_ni_syscall
        data8 sys_ni_syscall    /* 275 */
        data8 sys_ni_syscall
-diff -NurpP --minimal linux-2.6.31/arch/ia64/Kconfig linux-2.6.31-vs2.3.0.36.14-pre8/arch/ia64/Kconfig
---- linux-2.6.31/arch/ia64/Kconfig     2009-09-10 15:25:22.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/ia64/Kconfig  2009-09-10 16:11:43.000000000 +0200
-@@ -676,6 +676,8 @@ source "fs/Kconfig"
+diff -NurpP --minimal linux-2.6.27.33/arch/ia64/ia32/sys_ia32.c linux-2.6.27.33-vs2.3.0.36.6/arch/ia64/ia32/sys_ia32.c
+--- linux-2.6.27.33/arch/ia64/ia32/sys_ia32.c  2008-10-13 14:51:55.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/ia64/ia32/sys_ia32.c     2008-10-13 14:54:20.000000000 +0200
+@@ -1178,7 +1178,7 @@ sys32_gettimeofday (struct compat_timeva
+ {
+       if (tv) {
+               struct timeval ktv;
+-              do_gettimeofday(&ktv);
++              vx_gettimeofday(&ktv);
+               if (put_tv32(tv, &ktv))
+                       return -EFAULT;
+       }
+diff -NurpP --minimal linux-2.6.27.33/arch/ia64/Kconfig linux-2.6.27.33-vs2.3.0.36.6/arch/ia64/Kconfig
+--- linux-2.6.27.33/arch/ia64/Kconfig  2009-09-13 16:16:49.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/ia64/Kconfig     2009-03-25 14:32:29.000000000 +0100
+@@ -639,6 +639,8 @@ source "arch/ia64/hp/sim/Kconfig"
  
  source "arch/ia64/Kconfig.debug"
  
@@ -231,10 +243,10 @@ diff -NurpP --minimal linux-2.6.31/arch/ia64/Kconfig linux-2.6.31-vs2.3.0.36.14-
  source "security/Kconfig"
  
  source "crypto/Kconfig"
-diff -NurpP --minimal linux-2.6.31/arch/ia64/kernel/entry.S linux-2.6.31-vs2.3.0.36.14-pre8/arch/ia64/kernel/entry.S
---- linux-2.6.31/arch/ia64/kernel/entry.S      2009-09-10 15:25:22.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/ia64/kernel/entry.S   2009-09-10 16:11:43.000000000 +0200
-@@ -1753,7 +1753,7 @@ sys_call_table:
+diff -NurpP --minimal linux-2.6.27.33/arch/ia64/kernel/entry.S linux-2.6.27.33-vs2.3.0.36.6/arch/ia64/kernel/entry.S
+--- linux-2.6.27.33/arch/ia64/kernel/entry.S   2009-09-13 16:16:49.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/ia64/kernel/entry.S      2009-02-03 17:59:04.000000000 +0100
+@@ -1647,7 +1647,7 @@ sys_call_table:
        data8 sys_mq_notify
        data8 sys_mq_getsetattr
        data8 sys_kexec_load
@@ -243,18 +255,18 @@ diff -NurpP --minimal linux-2.6.31/arch/ia64/kernel/entry.S linux-2.6.31-vs2.3.0
        data8 sys_waitid                        // 1270
        data8 sys_add_key
        data8 sys_request_key
-diff -NurpP --minimal linux-2.6.31/arch/ia64/kernel/perfmon.c linux-2.6.31-vs2.3.0.36.14-pre8/arch/ia64/kernel/perfmon.c
---- linux-2.6.31/arch/ia64/kernel/perfmon.c    2009-09-10 15:25:22.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/ia64/kernel/perfmon.c 2009-09-10 16:11:43.000000000 +0200
-@@ -41,6 +41,7 @@
+diff -NurpP --minimal linux-2.6.27.33/arch/ia64/kernel/perfmon.c linux-2.6.27.33-vs2.3.0.36.6/arch/ia64/kernel/perfmon.c
+--- linux-2.6.27.33/arch/ia64/kernel/perfmon.c 2008-10-13 14:51:55.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/ia64/kernel/perfmon.c    2008-10-13 14:54:20.000000000 +0200
+@@ -40,6 +40,7 @@
+ #include <linux/capability.h>
  #include <linux/rcupdate.h>
  #include <linux/completion.h>
- #include <linux/tracehook.h>
 +#include <linux/vs_memory.h>
  
  #include <asm/errno.h>
  #include <asm/intrinsics.h>
-@@ -2372,7 +2373,7 @@ pfm_smpl_buffer_alloc(struct task_struct
+@@ -2376,7 +2377,7 @@ pfm_smpl_buffer_alloc(struct task_struct
         */
        insert_vm_struct(mm, vma);
  
@@ -263,10 +275,10 @@ diff -NurpP --minimal linux-2.6.31/arch/ia64/kernel/perfmon.c linux-2.6.31-vs2.3
        vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file,
                                                        vma_pages(vma));
        up_write(&task->mm->mmap_sem);
-diff -NurpP --minimal linux-2.6.31/arch/ia64/kernel/process.c linux-2.6.31-vs2.3.0.36.14-pre8/arch/ia64/kernel/process.c
---- linux-2.6.31/arch/ia64/kernel/process.c    2009-06-11 17:11:57.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/ia64/kernel/process.c 2009-09-10 16:11:43.000000000 +0200
-@@ -110,8 +110,8 @@ show_regs (struct pt_regs *regs)
+diff -NurpP --minimal linux-2.6.27.33/arch/ia64/kernel/process.c linux-2.6.27.33-vs2.3.0.36.6/arch/ia64/kernel/process.c
+--- linux-2.6.27.33/arch/ia64/kernel/process.c 2008-10-13 14:51:55.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/ia64/kernel/process.c    2008-10-13 14:54:20.000000000 +0200
+@@ -109,8 +109,8 @@ show_regs (struct pt_regs *regs)
        unsigned long ip = regs->cr_iip + ia64_psr(regs)->ri;
  
        print_modules();
@@ -277,20 +289,20 @@ diff -NurpP --minimal linux-2.6.31/arch/ia64/kernel/process.c linux-2.6.31-vs2.3
        printk("psr : %016lx ifs : %016lx ip  : [<%016lx>]    %s (%s)\n",
               regs->cr_ipsr, regs->cr_ifs, ip, print_tainted(),
               init_utsname()->release);
-diff -NurpP --minimal linux-2.6.31/arch/ia64/kernel/ptrace.c linux-2.6.31-vs2.3.0.36.14-pre8/arch/ia64/kernel/ptrace.c
---- linux-2.6.31/arch/ia64/kernel/ptrace.c     2009-09-10 15:25:22.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/ia64/kernel/ptrace.c  2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/arch/ia64/kernel/ptrace.c linux-2.6.27.33-vs2.3.0.36.6/arch/ia64/kernel/ptrace.c
+--- linux-2.6.27.33/arch/ia64/kernel/ptrace.c  2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/ia64/kernel/ptrace.c     2008-10-13 14:54:20.000000000 +0200
 @@ -22,6 +22,7 @@
+ #include <linux/signal.h>
  #include <linux/regset.h>
  #include <linux/elf.h>
- #include <linux/tracehook.h>
 +#include <linux/vs_base.h>
  
  #include <asm/pgtable.h>
  #include <asm/processor.h>
-diff -NurpP --minimal linux-2.6.31/arch/ia64/kernel/traps.c linux-2.6.31-vs2.3.0.36.14-pre8/arch/ia64/kernel/traps.c
---- linux-2.6.31/arch/ia64/kernel/traps.c      2008-12-25 00:26:37.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/ia64/kernel/traps.c   2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/arch/ia64/kernel/traps.c linux-2.6.27.33-vs2.3.0.36.6/arch/ia64/kernel/traps.c
+--- linux-2.6.27.33/arch/ia64/kernel/traps.c   2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/ia64/kernel/traps.c      2008-10-13 14:54:20.000000000 +0200
 @@ -60,8 +60,9 @@ die (const char *str, struct pt_regs *re
        put_cpu();
  
@@ -315,9 +327,9 @@ diff -NurpP --minimal linux-2.6.31/arch/ia64/kernel/traps.c linux-2.6.31-vs2.3.0
                        }
                }
        }
-diff -NurpP --minimal linux-2.6.31/arch/ia64/mm/fault.c linux-2.6.31-vs2.3.0.36.14-pre8/arch/ia64/mm/fault.c
---- linux-2.6.31/arch/ia64/mm/fault.c  2009-09-10 15:25:23.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/ia64/mm/fault.c       2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/arch/ia64/mm/fault.c linux-2.6.27.33-vs2.3.0.36.6/arch/ia64/mm/fault.c
+--- linux-2.6.27.33/arch/ia64/mm/fault.c       2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/ia64/mm/fault.c  2008-10-13 14:54:20.000000000 +0200
 @@ -10,6 +10,7 @@
  #include <linux/interrupt.h>
  #include <linux/kprobes.h>
@@ -326,9 +338,9 @@ diff -NurpP --minimal linux-2.6.31/arch/ia64/mm/fault.c linux-2.6.31-vs2.3.0.36.
  
  #include <asm/pgtable.h>
  #include <asm/processor.h>
-diff -NurpP --minimal linux-2.6.31/arch/m32r/kernel/traps.c linux-2.6.31-vs2.3.0.36.14-pre8/arch/m32r/kernel/traps.c
---- linux-2.6.31/arch/m32r/kernel/traps.c      2008-12-25 00:26:37.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/m32r/kernel/traps.c   2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/arch/m32r/kernel/traps.c linux-2.6.27.33-vs2.3.0.36.6/arch/m32r/kernel/traps.c
+--- linux-2.6.27.33/arch/m32r/kernel/traps.c   2008-10-13 14:51:55.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/m32r/kernel/traps.c      2008-10-13 14:54:20.000000000 +0200
 @@ -196,8 +196,9 @@ static void show_registers(struct pt_reg
        } else {
                printk("SPI: %08lx\n", sp);
@@ -341,10 +353,10 @@ diff -NurpP --minimal linux-2.6.31/arch/m32r/kernel/traps.c linux-2.6.31-vs2.3.0
  
        /*
         * When in-kernel, we also print out the stack and code at the
-diff -NurpP --minimal linux-2.6.31/arch/m68k/Kconfig linux-2.6.31-vs2.3.0.36.14-pre8/arch/m68k/Kconfig
---- linux-2.6.31/arch/m68k/Kconfig     2009-03-24 14:18:26.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/m68k/Kconfig  2009-09-10 16:11:43.000000000 +0200
-@@ -616,6 +616,8 @@ source "fs/Kconfig"
+diff -NurpP --minimal linux-2.6.27.33/arch/m68k/Kconfig linux-2.6.27.33-vs2.3.0.36.6/arch/m68k/Kconfig
+--- linux-2.6.27.33/arch/m68k/Kconfig  2008-10-13 14:51:55.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/m68k/Kconfig     2008-10-13 14:54:20.000000000 +0200
+@@ -633,6 +633,8 @@ source "fs/Kconfig"
  
  source "arch/m68k/Kconfig.debug"
  
@@ -353,9 +365,9 @@ diff -NurpP --minimal linux-2.6.31/arch/m68k/Kconfig linux-2.6.31-vs2.3.0.36.14-
  source "security/Kconfig"
  
  source "crypto/Kconfig"
-diff -NurpP --minimal linux-2.6.31/arch/m68k/kernel/ptrace.c linux-2.6.31-vs2.3.0.36.14-pre8/arch/m68k/kernel/ptrace.c
---- linux-2.6.31/arch/m68k/kernel/ptrace.c     2008-12-25 00:26:37.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/m68k/kernel/ptrace.c  2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/arch/m68k/kernel/ptrace.c linux-2.6.27.33-vs2.3.0.36.6/arch/m68k/kernel/ptrace.c
+--- linux-2.6.27.33/arch/m68k/kernel/ptrace.c  2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/m68k/kernel/ptrace.c     2008-10-13 14:54:20.000000000 +0200
 @@ -18,6 +18,7 @@
  #include <linux/ptrace.h>
  #include <linux/user.h>
@@ -373,10 +385,10 @@ diff -NurpP --minimal linux-2.6.31/arch/m68k/kernel/ptrace.c linux-2.6.31-vs2.3.
  
        return ret;
  out_eio:
-diff -NurpP --minimal linux-2.6.31/arch/m68k/kernel/traps.c linux-2.6.31-vs2.3.0.36.14-pre8/arch/m68k/kernel/traps.c
---- linux-2.6.31/arch/m68k/kernel/traps.c      2009-09-10 15:25:23.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/m68k/kernel/traps.c   2009-09-10 16:11:43.000000000 +0200
-@@ -906,8 +906,8 @@ void show_registers(struct pt_regs *regs
+diff -NurpP --minimal linux-2.6.27.33/arch/m68k/kernel/traps.c linux-2.6.27.33-vs2.3.0.36.6/arch/m68k/kernel/traps.c
+--- linux-2.6.27.33/arch/m68k/kernel/traps.c   2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/m68k/kernel/traps.c      2008-10-13 14:54:20.000000000 +0200
+@@ -909,8 +909,8 @@ void show_registers(struct pt_regs *regs
        printk("d4: %08lx    d5: %08lx    a0: %08lx    a1: %08lx\n",
               regs->d4, regs->d5, regs->a0, regs->a1);
  
@@ -387,10 +399,10 @@ diff -NurpP --minimal linux-2.6.31/arch/m68k/kernel/traps.c linux-2.6.31-vs2.3.0
        addr = (unsigned long)&fp->un;
        printk("Frame format=%X ", regs->format);
        switch (regs->format) {
-diff -NurpP --minimal linux-2.6.31/arch/m68knommu/Kconfig linux-2.6.31-vs2.3.0.36.14-pre8/arch/m68knommu/Kconfig
---- linux-2.6.31/arch/m68knommu/Kconfig        2009-06-11 17:11:59.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/m68knommu/Kconfig     2009-09-10 16:11:43.000000000 +0200
-@@ -721,6 +721,8 @@ source "fs/Kconfig"
+diff -NurpP --minimal linux-2.6.27.33/arch/m68knommu/Kconfig linux-2.6.27.33-vs2.3.0.36.6/arch/m68knommu/Kconfig
+--- linux-2.6.27.33/arch/m68knommu/Kconfig     2009-09-13 16:16:50.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/m68knommu/Kconfig        2009-02-22 22:58:32.000000000 +0100
+@@ -744,6 +744,8 @@ source "fs/Kconfig"
  
  source "arch/m68knommu/Kconfig.debug"
  
@@ -399,10 +411,10 @@ diff -NurpP --minimal linux-2.6.31/arch/m68knommu/Kconfig linux-2.6.31-vs2.3.0.3
  source "security/Kconfig"
  
  source "crypto/Kconfig"
-diff -NurpP --minimal linux-2.6.31/arch/m68knommu/kernel/traps.c linux-2.6.31-vs2.3.0.36.14-pre8/arch/m68knommu/kernel/traps.c
---- linux-2.6.31/arch/m68knommu/kernel/traps.c 2009-09-10 15:25:23.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/m68knommu/kernel/traps.c      2009-09-10 16:11:43.000000000 +0200
-@@ -78,8 +78,9 @@ void die_if_kernel(char *str, struct pt_
+diff -NurpP --minimal linux-2.6.27.33/arch/m68knommu/kernel/traps.c linux-2.6.27.33-vs2.3.0.36.6/arch/m68knommu/kernel/traps.c
+--- linux-2.6.27.33/arch/m68knommu/kernel/traps.c      2008-10-13 14:51:55.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/m68knommu/kernel/traps.c 2008-10-13 14:54:20.000000000 +0200
+@@ -79,8 +79,9 @@ void die_if_kernel(char *str, struct pt_
        printk(KERN_EMERG "d4: %08lx    d5: %08lx    a0: %08lx    a1: %08lx\n",
               fp->d4, fp->d5, fp->a0, fp->a1);
  
@@ -414,10 +426,10 @@ diff -NurpP --minimal linux-2.6.31/arch/m68knommu/kernel/traps.c linux-2.6.31-vs
        show_stack(NULL, (unsigned long *)(fp + 1));
        add_taint(TAINT_DIE);
        do_exit(SIGSEGV);
-diff -NurpP --minimal linux-2.6.31/arch/mips/Kconfig linux-2.6.31-vs2.3.0.36.14-pre8/arch/mips/Kconfig
---- linux-2.6.31/arch/mips/Kconfig     2009-09-10 15:25:24.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/mips/Kconfig  2009-09-10 16:11:43.000000000 +0200
-@@ -2186,6 +2186,8 @@ source "fs/Kconfig"
+diff -NurpP --minimal linux-2.6.27.33/arch/mips/Kconfig linux-2.6.27.33-vs2.3.0.36.6/arch/mips/Kconfig
+--- linux-2.6.27.33/arch/mips/Kconfig  2009-09-13 16:16:50.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/mips/Kconfig     2009-05-15 22:57:04.000000000 +0200
+@@ -2032,6 +2032,8 @@ source "fs/Kconfig"
  
  source "arch/mips/Kconfig.debug"
  
@@ -426,9 +438,21 @@ diff -NurpP --minimal linux-2.6.31/arch/mips/Kconfig linux-2.6.31-vs2.3.0.36.14-
  source "security/Kconfig"
  
  source "crypto/Kconfig"
-diff -NurpP --minimal linux-2.6.31/arch/mips/kernel/ptrace.c linux-2.6.31-vs2.3.0.36.14-pre8/arch/mips/kernel/ptrace.c
---- linux-2.6.31/arch/mips/kernel/ptrace.c     2008-12-25 00:26:37.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/mips/kernel/ptrace.c  2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/arch/mips/kernel/linux32.c linux-2.6.27.33-vs2.3.0.36.6/arch/mips/kernel/linux32.c
+--- linux-2.6.27.33/arch/mips/kernel/linux32.c 2009-09-13 16:16:50.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/mips/kernel/linux32.c    2009-05-15 22:57:04.000000000 +0200
+@@ -192,7 +192,7 @@ sys32_gettimeofday(struct compat_timeval
+ {
+       if (tv) {
+               struct timeval ktv;
+-              do_gettimeofday(&ktv);
++              vx_gettimeofday(&ktv);
+               if (put_tv32(tv, &ktv))
+                       return -EFAULT;
+       }
+diff -NurpP --minimal linux-2.6.27.33/arch/mips/kernel/ptrace.c linux-2.6.27.33-vs2.3.0.36.6/arch/mips/kernel/ptrace.c
+--- linux-2.6.27.33/arch/mips/kernel/ptrace.c  2008-10-13 14:51:56.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/mips/kernel/ptrace.c     2008-10-13 14:54:20.000000000 +0200
 @@ -25,6 +25,7 @@
  #include <linux/security.h>
  #include <linux/audit.h>
@@ -437,7 +461,7 @@ diff -NurpP --minimal linux-2.6.31/arch/mips/kernel/ptrace.c linux-2.6.31-vs2.3.
  
  #include <asm/byteorder.h>
  #include <asm/cpu.h>
-@@ -259,6 +260,9 @@ long arch_ptrace(struct task_struct *chi
+@@ -171,6 +172,9 @@ long arch_ptrace(struct task_struct *chi
  {
        int ret;
  
@@ -447,10 +471,10 @@ diff -NurpP --minimal linux-2.6.31/arch/mips/kernel/ptrace.c linux-2.6.31-vs2.3.
        switch (request) {
        /* when I and D space are separate, these will need to be fixed. */
        case PTRACE_PEEKTEXT: /* read word at location addr. */
-diff -NurpP --minimal linux-2.6.31/arch/mips/kernel/scall32-o32.S linux-2.6.31-vs2.3.0.36.14-pre8/arch/mips/kernel/scall32-o32.S
---- linux-2.6.31/arch/mips/kernel/scall32-o32.S        2009-09-10 15:25:38.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/mips/kernel/scall32-o32.S     2009-09-10 16:11:43.000000000 +0200
-@@ -597,7 +597,7 @@ einval:    li      v0, -ENOSYS
+diff -NurpP --minimal linux-2.6.27.33/arch/mips/kernel/scall32-o32.S linux-2.6.27.33-vs2.3.0.36.6/arch/mips/kernel/scall32-o32.S
+--- linux-2.6.27.33/arch/mips/kernel/scall32-o32.S     2009-09-13 16:16:50.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/mips/kernel/scall32-o32.S        2009-05-15 22:57:04.000000000 +0200
+@@ -600,7 +600,7 @@ einval:    li      v0, -EINVAL
        sys     sys_mq_timedreceive     5
        sys     sys_mq_notify           2       /* 4275 */
        sys     sys_mq_getsetattr       3
@@ -459,9 +483,9 @@ diff -NurpP --minimal linux-2.6.31/arch/mips/kernel/scall32-o32.S linux-2.6.31-v
        sys     sys_waitid              5
        sys     sys_ni_syscall          0       /* available, was setaltroot */
        sys     sys_add_key             5       /* 4280 */
-diff -NurpP --minimal linux-2.6.31/arch/mips/kernel/scall64-64.S linux-2.6.31-vs2.3.0.36.14-pre8/arch/mips/kernel/scall64-64.S
---- linux-2.6.31/arch/mips/kernel/scall64-64.S 2009-09-10 15:25:38.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/mips/kernel/scall64-64.S      2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/arch/mips/kernel/scall64-64.S linux-2.6.27.33-vs2.3.0.36.6/arch/mips/kernel/scall64-64.S
+--- linux-2.6.27.33/arch/mips/kernel/scall64-64.S      2009-09-13 16:16:50.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/mips/kernel/scall64-64.S 2009-05-15 22:57:04.000000000 +0200
 @@ -434,7 +434,7 @@ sys_call_table:
        PTR     sys_mq_timedreceive
        PTR     sys_mq_notify
@@ -471,9 +495,9 @@ diff -NurpP --minimal linux-2.6.31/arch/mips/kernel/scall64-64.S linux-2.6.31-vs
        PTR     sys_waitid
        PTR     sys_ni_syscall                  /* available, was setaltroot */
        PTR     sys_add_key
-diff -NurpP --minimal linux-2.6.31/arch/mips/kernel/scall64-n32.S linux-2.6.31-vs2.3.0.36.14-pre8/arch/mips/kernel/scall64-n32.S
---- linux-2.6.31/arch/mips/kernel/scall64-n32.S        2009-09-10 15:25:38.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/mips/kernel/scall64-n32.S     2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/arch/mips/kernel/scall64-n32.S linux-2.6.27.33-vs2.3.0.36.6/arch/mips/kernel/scall64-n32.S
+--- linux-2.6.27.33/arch/mips/kernel/scall64-n32.S     2009-09-13 16:16:50.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/mips/kernel/scall64-n32.S        2009-05-15 22:57:04.000000000 +0200
 @@ -360,7 +360,7 @@ EXPORT(sysn32_call_table)
        PTR     compat_sys_mq_timedreceive
        PTR     compat_sys_mq_notify
@@ -483,10 +507,10 @@ diff -NurpP --minimal linux-2.6.31/arch/mips/kernel/scall64-n32.S linux-2.6.31-v
        PTR     compat_sys_waitid
        PTR     sys_ni_syscall                  /* available, was setaltroot */
        PTR     sys_add_key
-diff -NurpP --minimal linux-2.6.31/arch/mips/kernel/scall64-o32.S linux-2.6.31-vs2.3.0.36.14-pre8/arch/mips/kernel/scall64-o32.S
---- linux-2.6.31/arch/mips/kernel/scall64-o32.S        2009-09-10 15:25:38.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/mips/kernel/scall64-o32.S     2009-09-10 16:11:43.000000000 +0200
-@@ -480,7 +480,7 @@ sys_call_table:
+diff -NurpP --minimal linux-2.6.27.33/arch/mips/kernel/scall64-o32.S linux-2.6.27.33-vs2.3.0.36.6/arch/mips/kernel/scall64-o32.S
+--- linux-2.6.27.33/arch/mips/kernel/scall64-o32.S     2009-09-13 16:16:50.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/mips/kernel/scall64-o32.S        2009-05-15 22:57:46.000000000 +0200
+@@ -482,7 +482,7 @@ sys_call_table:
        PTR     compat_sys_mq_timedreceive
        PTR     compat_sys_mq_notify            /* 4275 */
        PTR     compat_sys_mq_getsetattr
@@ -495,10 +519,10 @@ diff -NurpP --minimal linux-2.6.31/arch/mips/kernel/scall64-o32.S linux-2.6.31-v
        PTR     sys_32_waitid
        PTR     sys_ni_syscall                  /* available, was setaltroot */
        PTR     sys_add_key                     /* 4280 */
-diff -NurpP --minimal linux-2.6.31/arch/mips/kernel/traps.c linux-2.6.31-vs2.3.0.36.14-pre8/arch/mips/kernel/traps.c
---- linux-2.6.31/arch/mips/kernel/traps.c      2009-09-10 15:25:38.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/mips/kernel/traps.c   2009-09-10 16:11:43.000000000 +0200
-@@ -335,9 +335,10 @@ void show_registers(const struct pt_regs
+diff -NurpP --minimal linux-2.6.27.33/arch/mips/kernel/traps.c linux-2.6.27.33-vs2.3.0.36.6/arch/mips/kernel/traps.c
+--- linux-2.6.27.33/arch/mips/kernel/traps.c   2008-10-13 14:51:56.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/mips/kernel/traps.c      2008-10-13 14:54:20.000000000 +0200
+@@ -328,9 +328,10 @@ void show_registers(const struct pt_regs
  
        __show_regs(regs);
        print_modules();
@@ -512,10 +536,23 @@ diff -NurpP --minimal linux-2.6.31/arch/mips/kernel/traps.c linux-2.6.31-vs2.3.0
        if (cpu_has_userlocal) {
                unsigned long tls;
  
-diff -NurpP --minimal linux-2.6.31/arch/parisc/Kconfig linux-2.6.31-vs2.3.0.36.14-pre8/arch/parisc/Kconfig
---- linux-2.6.31/arch/parisc/Kconfig   2009-09-10 15:25:39.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/parisc/Kconfig        2009-09-10 16:11:43.000000000 +0200
-@@ -293,6 +293,8 @@ source "fs/Kconfig"
+diff -NurpP --minimal linux-2.6.27.33/arch/mips/mm/fault.c linux-2.6.27.33-vs2.3.0.36.6/arch/mips/mm/fault.c
+--- linux-2.6.27.33/arch/mips/mm/fault.c       2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/mips/mm/fault.c  2008-10-13 14:54:20.000000000 +0200
+@@ -178,7 +178,8 @@ out_of_memory:
+               down_read(&mm->mmap_sem);
+               goto survive;
+       }
+-      printk("VM: killing process %s\n", tsk->comm);
++      printk("VM: killing process %s(%d:#%u)\n",
++              tsk->comm, tsk->pid, tsk->xid);
+       if (user_mode(regs))
+               do_group_exit(SIGKILL);
+       goto no_context;
+diff -NurpP --minimal linux-2.6.27.33/arch/parisc/Kconfig linux-2.6.27.33-vs2.3.0.36.6/arch/parisc/Kconfig
+--- linux-2.6.27.33/arch/parisc/Kconfig        2008-10-13 14:51:56.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/parisc/Kconfig   2008-10-13 14:54:20.000000000 +0200
+@@ -279,6 +279,8 @@ source "fs/Kconfig"
  
  source "arch/parisc/Kconfig.debug"
  
@@ -524,9 +561,9 @@ diff -NurpP --minimal linux-2.6.31/arch/parisc/Kconfig linux-2.6.31-vs2.3.0.36.1
  source "security/Kconfig"
  
  source "crypto/Kconfig"
-diff -NurpP --minimal linux-2.6.31/arch/parisc/kernel/syscall_table.S linux-2.6.31-vs2.3.0.36.14-pre8/arch/parisc/kernel/syscall_table.S
---- linux-2.6.31/arch/parisc/kernel/syscall_table.S    2009-09-10 15:25:40.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/parisc/kernel/syscall_table.S 2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/arch/parisc/kernel/syscall_table.S linux-2.6.27.33-vs2.3.0.36.6/arch/parisc/kernel/syscall_table.S
+--- linux-2.6.27.33/arch/parisc/kernel/syscall_table.S 2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/parisc/kernel/syscall_table.S    2008-10-13 14:54:20.000000000 +0200
 @@ -361,7 +361,7 @@
        ENTRY_COMP(mbind)               /* 260 */
        ENTRY_COMP(get_mempolicy)
@@ -536,9 +573,26 @@ diff -NurpP --minimal linux-2.6.31/arch/parisc/kernel/syscall_table.S linux-2.6.
        ENTRY_SAME(add_key)
        ENTRY_SAME(request_key)         /* 265 */
        ENTRY_SAME(keyctl)
-diff -NurpP --minimal linux-2.6.31/arch/parisc/kernel/traps.c linux-2.6.31-vs2.3.0.36.14-pre8/arch/parisc/kernel/traps.c
---- linux-2.6.31/arch/parisc/kernel/traps.c    2009-09-10 15:25:40.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/parisc/kernel/traps.c 2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/arch/parisc/kernel/sys_parisc32.c linux-2.6.27.33-vs2.3.0.36.6/arch/parisc/kernel/sys_parisc32.c
+--- linux-2.6.27.33/arch/parisc/kernel/sys_parisc32.c  2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/parisc/kernel/sys_parisc32.c     2008-10-13 14:54:20.000000000 +0200
+@@ -203,11 +203,11 @@ static inline long get_ts32(struct times
+ asmlinkage int
+ sys32_gettimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
+ {
+-    extern void do_gettimeofday(struct timeval *tv);
++    extern void vx_gettimeofday(struct timeval *tv);
+     if (tv) {
+           struct timeval ktv;
+-          do_gettimeofday(&ktv);
++          vx_gettimeofday(&ktv);
+           if (put_compat_timeval(tv, &ktv))
+                   return -EFAULT;
+     }
+diff -NurpP --minimal linux-2.6.27.33/arch/parisc/kernel/traps.c linux-2.6.27.33-vs2.3.0.36.6/arch/parisc/kernel/traps.c
+--- linux-2.6.27.33/arch/parisc/kernel/traps.c 2009-09-13 16:16:50.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/parisc/kernel/traps.c    2009-02-03 17:59:04.000000000 +0100
 @@ -236,8 +236,9 @@ void die_if_kernel(char *str, struct pt_
                if (err == 0)
                        return; /* STFU */
@@ -551,7 +605,7 @@ diff -NurpP --minimal linux-2.6.31/arch/parisc/kernel/traps.c linux-2.6.31-vs2.3
  #ifdef PRINT_USER_FAULTS
                /* XXX for debugging only */
                show_regs(regs);
-@@ -270,8 +271,8 @@ void die_if_kernel(char *str, struct pt_
+@@ -269,8 +270,8 @@ KERN_CRIT "                     ||     |
                pdc_console_restart();
        
        if (err)
@@ -562,10 +616,10 @@ diff -NurpP --minimal linux-2.6.31/arch/parisc/kernel/traps.c linux-2.6.31-vs2.3
  
        /* Wot's wrong wif bein' racy? */
        if (current->thread.flags & PARISC_KERNEL_DEATH) {
-diff -NurpP --minimal linux-2.6.31/arch/parisc/mm/fault.c linux-2.6.31-vs2.3.0.36.14-pre8/arch/parisc/mm/fault.c
---- linux-2.6.31/arch/parisc/mm/fault.c        2009-09-10 15:25:40.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/parisc/mm/fault.c     2009-09-10 16:11:43.000000000 +0200
-@@ -237,8 +237,9 @@ bad_area:
+diff -NurpP --minimal linux-2.6.27.33/arch/parisc/mm/fault.c linux-2.6.27.33-vs2.3.0.36.6/arch/parisc/mm/fault.c
+--- linux-2.6.27.33/arch/parisc/mm/fault.c     2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/parisc/mm/fault.c        2008-10-13 14:54:20.000000000 +0200
+@@ -210,8 +210,9 @@ bad_area:
  
  #ifdef PRINT_USER_FAULTS
                printk(KERN_DEBUG "\n");
@@ -577,7 +631,7 @@ diff -NurpP --minimal linux-2.6.31/arch/parisc/mm/fault.c linux-2.6.31-vs2.3.0.3
                if (vma) {
                        printk(KERN_DEBUG "vm_start = 0x%08lx, vm_end = 0x%08lx\n",
                                        vma->vm_start, vma->vm_end);
-@@ -264,7 +265,8 @@ no_context:
+@@ -261,7 +262,8 @@ no_context:
  
    out_of_memory:
        up_read(&mm->mmap_sem);
@@ -587,10 +641,10 @@ diff -NurpP --minimal linux-2.6.31/arch/parisc/mm/fault.c linux-2.6.31-vs2.3.0.3
        if (user_mode(regs))
                do_group_exit(SIGKILL);
        goto no_context;
-diff -NurpP --minimal linux-2.6.31/arch/powerpc/Kconfig linux-2.6.31-vs2.3.0.36.14-pre8/arch/powerpc/Kconfig
---- linux-2.6.31/arch/powerpc/Kconfig  2009-09-10 15:25:40.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/powerpc/Kconfig       2009-09-10 16:11:43.000000000 +0200
-@@ -933,6 +933,8 @@ source "lib/Kconfig"
+diff -NurpP --minimal linux-2.6.27.33/arch/powerpc/Kconfig linux-2.6.27.33-vs2.3.0.36.6/arch/powerpc/Kconfig
+--- linux-2.6.27.33/arch/powerpc/Kconfig       2009-09-13 16:16:50.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/powerpc/Kconfig  2009-02-03 17:59:04.000000000 +0100
+@@ -836,6 +836,8 @@ source "lib/Kconfig"
  
  source "arch/powerpc/Kconfig.debug"
  
@@ -599,21 +653,21 @@ diff -NurpP --minimal linux-2.6.31/arch/powerpc/Kconfig linux-2.6.31-vs2.3.0.36.
  source "security/Kconfig"
  
  config KEYS_COMPAT
-diff -NurpP --minimal linux-2.6.31/arch/powerpc/kernel/irq.c linux-2.6.31-vs2.3.0.36.14-pre8/arch/powerpc/kernel/irq.c
---- linux-2.6.31/arch/powerpc/kernel/irq.c     2009-09-10 15:25:41.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/powerpc/kernel/irq.c  2009-09-10 16:15:56.000000000 +0200
-@@ -54,6 +54,7 @@
+diff -NurpP --minimal linux-2.6.27.33/arch/powerpc/kernel/irq.c linux-2.6.27.33-vs2.3.0.36.6/arch/powerpc/kernel/irq.c
+--- linux-2.6.27.33/arch/powerpc/kernel/irq.c  2008-10-13 14:51:56.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/powerpc/kernel/irq.c     2008-10-13 14:54:20.000000000 +0200
+@@ -53,6 +53,7 @@
+ #include <linux/bootmem.h>
  #include <linux/pci.h>
  #include <linux/debugfs.h>
- #include <linux/perf_counter.h>
 +#include <linux/vs_context.h>
  
  #include <asm/uaccess.h>
  #include <asm/system.h>
-diff -NurpP --minimal linux-2.6.31/arch/powerpc/kernel/process.c linux-2.6.31-vs2.3.0.36.14-pre8/arch/powerpc/kernel/process.c
---- linux-2.6.31/arch/powerpc/kernel/process.c 2009-09-10 15:25:41.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/powerpc/kernel/process.c      2009-09-10 16:11:43.000000000 +0200
-@@ -519,8 +519,9 @@ void show_regs(struct pt_regs * regs)
+diff -NurpP --minimal linux-2.6.27.33/arch/powerpc/kernel/process.c linux-2.6.27.33-vs2.3.0.36.6/arch/powerpc/kernel/process.c
+--- linux-2.6.27.33/arch/powerpc/kernel/process.c      2008-10-13 14:51:56.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/powerpc/kernel/process.c 2008-10-13 14:54:20.000000000 +0200
+@@ -513,8 +513,9 @@ void show_regs(struct pt_regs * regs)
  #else
                printk("DAR: "REG", DSISR: "REG"\n", regs->dar, regs->dsisr);
  #endif
@@ -625,10 +679,22 @@ diff -NurpP --minimal linux-2.6.31/arch/powerpc/kernel/process.c linux-2.6.31-vs
  
  #ifdef CONFIG_SMP
        printk(" CPU: %d", raw_smp_processor_id());
-diff -NurpP --minimal linux-2.6.31/arch/powerpc/kernel/traps.c linux-2.6.31-vs2.3.0.36.14-pre8/arch/powerpc/kernel/traps.c
---- linux-2.6.31/arch/powerpc/kernel/traps.c   2009-09-10 15:25:41.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/powerpc/kernel/traps.c        2009-09-10 16:11:43.000000000 +0200
-@@ -931,8 +931,9 @@ void nonrecoverable_exception(struct pt_
+diff -NurpP --minimal linux-2.6.27.33/arch/powerpc/kernel/sys_ppc32.c linux-2.6.27.33-vs2.3.0.36.6/arch/powerpc/kernel/sys_ppc32.c
+--- linux-2.6.27.33/arch/powerpc/kernel/sys_ppc32.c    2008-10-13 14:51:56.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/powerpc/kernel/sys_ppc32.c       2008-10-13 14:54:20.000000000 +0200
+@@ -147,7 +147,7 @@ asmlinkage long compat_sys_gettimeofday(
+ {
+       if (tv) {
+               struct timeval ktv;
+-              do_gettimeofday(&ktv);
++              vx_gettimeofday(&ktv);
+               if (put_tv32(tv, &ktv))
+                       return -EFAULT;
+       }
+diff -NurpP --minimal linux-2.6.27.33/arch/powerpc/kernel/traps.c linux-2.6.27.33-vs2.3.0.36.6/arch/powerpc/kernel/traps.c
+--- linux-2.6.27.33/arch/powerpc/kernel/traps.c        2008-10-13 14:51:56.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/powerpc/kernel/traps.c   2008-10-13 14:54:20.000000000 +0200
+@@ -941,8 +941,9 @@ void nonrecoverable_exception(struct pt_
  
  void trace_syscall(struct pt_regs *regs)
  {
@@ -640,9 +706,9 @@ diff -NurpP --minimal linux-2.6.31/arch/powerpc/kernel/traps.c linux-2.6.31-vs2.
               regs->ccr&0x10000000?"Error=":"", regs->gpr[3], print_tainted());
  }
  
-diff -NurpP --minimal linux-2.6.31/arch/powerpc/kernel/vdso.c linux-2.6.31-vs2.3.0.36.14-pre8/arch/powerpc/kernel/vdso.c
---- linux-2.6.31/arch/powerpc/kernel/vdso.c    2009-03-24 14:18:35.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/powerpc/kernel/vdso.c 2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/arch/powerpc/kernel/vdso.c linux-2.6.27.33-vs2.3.0.36.6/arch/powerpc/kernel/vdso.c
+--- linux-2.6.27.33/arch/powerpc/kernel/vdso.c 2008-10-13 14:51:56.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/powerpc/kernel/vdso.c    2008-10-13 14:54:20.000000000 +0200
 @@ -22,6 +22,7 @@
  #include <linux/security.h>
  #include <linux/bootmem.h>
@@ -651,10 +717,10 @@ diff -NurpP --minimal linux-2.6.31/arch/powerpc/kernel/vdso.c linux-2.6.31-vs2.3
  
  #include <asm/pgtable.h>
  #include <asm/system.h>
-diff -NurpP --minimal linux-2.6.31/arch/powerpc/mm/fault.c linux-2.6.31-vs2.3.0.36.14-pre8/arch/powerpc/mm/fault.c
---- linux-2.6.31/arch/powerpc/mm/fault.c       2009-09-10 15:25:41.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/powerpc/mm/fault.c    2009-09-10 16:11:43.000000000 +0200
-@@ -358,7 +358,8 @@ out_of_memory:
+diff -NurpP --minimal linux-2.6.27.33/arch/powerpc/mm/fault.c linux-2.6.27.33-vs2.3.0.36.6/arch/powerpc/mm/fault.c
+--- linux-2.6.27.33/arch/powerpc/mm/fault.c    2008-10-13 14:51:56.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/powerpc/mm/fault.c       2008-10-13 14:54:20.000000000 +0200
+@@ -354,7 +354,8 @@ out_of_memory:
                down_read(&mm->mmap_sem);
                goto survive;
        }
@@ -664,10 +730,10 @@ diff -NurpP --minimal linux-2.6.31/arch/powerpc/mm/fault.c linux-2.6.31-vs2.3.0.
        if (user_mode(regs))
                do_group_exit(SIGKILL);
        return SIGKILL;
-diff -NurpP --minimal linux-2.6.31/arch/s390/Kconfig linux-2.6.31-vs2.3.0.36.14-pre8/arch/s390/Kconfig
---- linux-2.6.31/arch/s390/Kconfig     2009-09-10 15:25:42.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/s390/Kconfig  2009-09-10 16:11:43.000000000 +0200
-@@ -624,6 +624,8 @@ source "fs/Kconfig"
+diff -NurpP --minimal linux-2.6.27.33/arch/s390/Kconfig linux-2.6.27.33-vs2.3.0.36.6/arch/s390/Kconfig
+--- linux-2.6.27.33/arch/s390/Kconfig  2009-09-13 16:16:50.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/s390/Kconfig     2009-02-03 17:59:04.000000000 +0100
+@@ -588,6 +588,8 @@ source "fs/Kconfig"
  
  source "arch/s390/Kconfig.debug"
  
@@ -676,20 +742,32 @@ diff -NurpP --minimal linux-2.6.31/arch/s390/Kconfig linux-2.6.31-vs2.3.0.36.14-
  source "security/Kconfig"
  
  source "crypto/Kconfig"
-diff -NurpP --minimal linux-2.6.31/arch/s390/kernel/ptrace.c linux-2.6.31-vs2.3.0.36.14-pre8/arch/s390/kernel/ptrace.c
---- linux-2.6.31/arch/s390/kernel/ptrace.c     2009-09-10 15:25:43.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/s390/kernel/ptrace.c  2009-09-10 16:17:22.000000000 +0200
-@@ -36,6 +36,7 @@
+diff -NurpP --minimal linux-2.6.27.33/arch/s390/kernel/compat_linux.c linux-2.6.27.33-vs2.3.0.36.6/arch/s390/kernel/compat_linux.c
+--- linux-2.6.27.33/arch/s390/kernel/compat_linux.c    2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/s390/kernel/compat_linux.c       2008-10-13 14:54:20.000000000 +0200
+@@ -566,7 +566,7 @@ asmlinkage long sys32_gettimeofday(struc
+ {
+       if (tv) {
+               struct timeval ktv;
+-              do_gettimeofday(&ktv);
++              vx_gettimeofday(&ktv);
+               if (put_tv32(tv, &ktv))
+                       return -EFAULT;
+       }
+diff -NurpP --minimal linux-2.6.27.33/arch/s390/kernel/ptrace.c linux-2.6.27.33-vs2.3.0.36.6/arch/s390/kernel/ptrace.c
+--- linux-2.6.27.33/arch/s390/kernel/ptrace.c  2008-10-13 14:51:57.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/s390/kernel/ptrace.c     2008-10-13 14:54:20.000000000 +0200
+@@ -35,6 +35,7 @@
+ #include <linux/signal.h>
+ #include <linux/elf.h>
  #include <linux/regset.h>
- #include <linux/tracehook.h>
- #include <linux/seccomp.h>
 +#include <linux/vs_base.h>
- #include <trace/syscall.h>
- #include <asm/compat.h>
  #include <asm/segment.h>
-diff -NurpP --minimal linux-2.6.31/arch/s390/kernel/syscalls.S linux-2.6.31-vs2.3.0.36.14-pre8/arch/s390/kernel/syscalls.S
---- linux-2.6.31/arch/s390/kernel/syscalls.S   2009-09-10 15:25:43.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/s390/kernel/syscalls.S        2009-09-10 16:11:43.000000000 +0200
+ #include <asm/page.h>
+diff -NurpP --minimal linux-2.6.27.33/arch/s390/kernel/syscalls.S linux-2.6.27.33-vs2.3.0.36.6/arch/s390/kernel/syscalls.S
+--- linux-2.6.27.33/arch/s390/kernel/syscalls.S        2009-09-13 16:16:50.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/s390/kernel/syscalls.S   2009-02-03 17:59:04.000000000 +0100
 @@ -271,7 +271,7 @@ SYSCALL(sys_clock_settime,sys_clock_sett
  SYSCALL(sys_clock_gettime,sys_clock_gettime,sys32_clock_gettime_wrapper)      /* 260 */
  SYSCALL(sys_clock_getres,sys_clock_getres,sys32_clock_getres_wrapper)
@@ -699,10 +777,23 @@ diff -NurpP --minimal linux-2.6.31/arch/s390/kernel/syscalls.S linux-2.6.31-vs2.
  SYSCALL(sys_s390_fadvise64_64,sys_ni_syscall,sys32_fadvise64_64_wrapper)
  SYSCALL(sys_statfs64,sys_statfs64,compat_sys_statfs64_wrapper)
  SYSCALL(sys_fstatfs64,sys_fstatfs64,compat_sys_fstatfs64_wrapper)
-diff -NurpP --minimal linux-2.6.31/arch/sh/Kconfig linux-2.6.31-vs2.3.0.36.14-pre8/arch/sh/Kconfig
---- linux-2.6.31/arch/sh/Kconfig       2009-09-10 15:25:43.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/sh/Kconfig    2009-09-10 16:11:43.000000000 +0200
-@@ -813,6 +813,8 @@ source "fs/Kconfig"
+diff -NurpP --minimal linux-2.6.27.33/arch/s390/mm/fault.c linux-2.6.27.33-vs2.3.0.36.6/arch/s390/mm/fault.c
+--- linux-2.6.27.33/arch/s390/mm/fault.c       2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/s390/mm/fault.c  2008-10-13 14:54:20.000000000 +0200
+@@ -216,7 +216,8 @@ static int do_out_of_memory(struct pt_re
+               down_read(&mm->mmap_sem);
+               return 1;
+       }
+-      printk("VM: killing process %s\n", tsk->comm);
++      printk("VM: killing process %s(%d:#%u)\n",
++              tsk->comm, tsk->pid, tsk->xid);
+       if (regs->psw.mask & PSW_MASK_PSTATE)
+               do_group_exit(SIGKILL);
+       do_no_context(regs, error_code, address);
+diff -NurpP --minimal linux-2.6.27.33/arch/sh/Kconfig linux-2.6.27.33-vs2.3.0.36.6/arch/sh/Kconfig
+--- linux-2.6.27.33/arch/sh/Kconfig    2008-10-13 14:51:57.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/sh/Kconfig       2008-10-13 14:54:20.000000000 +0200
+@@ -747,6 +747,8 @@ source "fs/Kconfig"
  
  source "arch/sh/Kconfig.debug"
  
@@ -711,9 +802,9 @@ diff -NurpP --minimal linux-2.6.31/arch/sh/Kconfig linux-2.6.31-vs2.3.0.36.14-pr
  source "security/Kconfig"
  
  source "crypto/Kconfig"
-diff -NurpP --minimal linux-2.6.31/arch/sh/kernel/irq.c linux-2.6.31-vs2.3.0.36.14-pre8/arch/sh/kernel/irq.c
---- linux-2.6.31/arch/sh/kernel/irq.c  2009-09-10 15:25:45.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/sh/kernel/irq.c       2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/arch/sh/kernel/irq.c linux-2.6.27.33-vs2.3.0.36.6/arch/sh/kernel/irq.c
+--- linux-2.6.27.33/arch/sh/kernel/irq.c       2008-10-13 14:51:57.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/sh/kernel/irq.c  2008-10-13 14:54:20.000000000 +0200
 @@ -11,6 +11,7 @@
  #include <linux/module.h>
  #include <linux/kernel_stat.h>
@@ -722,9 +813,9 @@ diff -NurpP --minimal linux-2.6.31/arch/sh/kernel/irq.c linux-2.6.31-vs2.3.0.36.
  #include <asm/processor.h>
  #include <asm/machvec.h>
  #include <asm/uaccess.h>
-diff -NurpP --minimal linux-2.6.31/arch/sh/kernel/vsyscall/vsyscall.c linux-2.6.31-vs2.3.0.36.14-pre8/arch/sh/kernel/vsyscall/vsyscall.c
---- linux-2.6.31/arch/sh/kernel/vsyscall/vsyscall.c    2009-03-24 14:18:42.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/sh/kernel/vsyscall/vsyscall.c 2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/arch/sh/kernel/vsyscall/vsyscall.c linux-2.6.27.33-vs2.3.0.36.6/arch/sh/kernel/vsyscall/vsyscall.c
+--- linux-2.6.27.33/arch/sh/kernel/vsyscall/vsyscall.c 2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/sh/kernel/vsyscall/vsyscall.c    2008-10-13 14:54:20.000000000 +0200
 @@ -19,6 +19,7 @@
  #include <linux/elf.h>
  #include <linux/sched.h>
@@ -733,33 +824,10 @@ diff -NurpP --minimal linux-2.6.31/arch/sh/kernel/vsyscall/vsyscall.c linux-2.6.
  
  /*
   * Should the kernel map a VDSO page into processes and pass its
-diff -NurpP --minimal linux-2.6.31/arch/sparc/include/asm/tlb_64.h linux-2.6.31-vs2.3.0.36.14-pre8/arch/sparc/include/asm/tlb_64.h
---- linux-2.6.31/arch/sparc/include/asm/tlb_64.h       2009-09-10 15:25:45.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/sparc/include/asm/tlb_64.h    2009-09-10 16:11:43.000000000 +0200
-@@ -3,6 +3,7 @@
- #include <linux/swap.h>
- #include <linux/pagemap.h>
-+#include <linux/vs_memory.h>
- #include <asm/pgalloc.h>
- #include <asm/tlbflush.h>
- #include <asm/mmu_context.h>
-diff -NurpP --minimal linux-2.6.31/arch/sparc/include/asm/unistd.h linux-2.6.31-vs2.3.0.36.14-pre8/arch/sparc/include/asm/unistd.h
---- linux-2.6.31/arch/sparc/include/asm/unistd.h       2009-09-10 15:25:45.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/sparc/include/asm/unistd.h    2009-09-10 16:11:43.000000000 +0200
-@@ -335,7 +335,7 @@
- #define __NR_timer_getoverrun 264
- #define __NR_timer_delete     265
- #define __NR_timer_create     266
--/* #define __NR_vserver               267 Reserved for VSERVER */
-+#define __NR_vserver          267
- #define __NR_io_setup         268
- #define __NR_io_destroy               269
- #define __NR_io_submit                270
-diff -NurpP --minimal linux-2.6.31/arch/sparc/Kconfig linux-2.6.31-vs2.3.0.36.14-pre8/arch/sparc/Kconfig
---- linux-2.6.31/arch/sparc/Kconfig    2009-09-10 15:25:45.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/sparc/Kconfig 2009-09-10 16:11:43.000000000 +0200
-@@ -530,6 +530,8 @@ source "fs/Kconfig"
+diff -NurpP --minimal linux-2.6.27.33/arch/sparc/Kconfig linux-2.6.27.33-vs2.3.0.36.6/arch/sparc/Kconfig
+--- linux-2.6.27.33/arch/sparc/Kconfig 2008-10-13 14:51:58.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/sparc/Kconfig    2008-10-13 14:54:20.000000000 +0200
+@@ -305,6 +305,8 @@ source "fs/Kconfig"
  
  source "arch/sparc/Kconfig.debug"
  
@@ -768,9 +836,20 @@ diff -NurpP --minimal linux-2.6.31/arch/sparc/Kconfig linux-2.6.31-vs2.3.0.36.14
  source "security/Kconfig"
  
  source "crypto/Kconfig"
-diff -NurpP --minimal linux-2.6.31/arch/sparc/kernel/systbls_32.S linux-2.6.31-vs2.3.0.36.14-pre8/arch/sparc/kernel/systbls_32.S
---- linux-2.6.31/arch/sparc/kernel/systbls_32.S        2009-09-10 15:25:45.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/sparc/kernel/systbls_32.S     2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/arch/sparc/kernel/ptrace.c linux-2.6.27.33-vs2.3.0.36.6/arch/sparc/kernel/ptrace.c
+--- linux-2.6.27.33/arch/sparc/kernel/ptrace.c 2008-10-13 14:51:58.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/sparc/kernel/ptrace.c    2008-10-13 14:54:20.000000000 +0200
+@@ -22,6 +22,7 @@
+ #include <linux/regset.h>
+ #include <linux/elf.h>
+ #include <linux/tracehook.h>
++#include <linux/vs_base.h>
+ #include <asm/pgtable.h>
+ #include <asm/system.h>
+diff -NurpP --minimal linux-2.6.27.33/arch/sparc/kernel/systbls.S linux-2.6.27.33-vs2.3.0.36.6/arch/sparc/kernel/systbls.S
+--- linux-2.6.27.33/arch/sparc/kernel/systbls.S        2009-09-13 16:16:51.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/sparc/kernel/systbls.S   2009-02-03 17:59:04.000000000 +0100
 @@ -70,7 +70,7 @@ sys_call_table:
  /*250*/       .long sparc_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl
  /*255*/       .long sys_sync_file_range, sys_clock_settime, sys_clock_gettime, sys_clock_getres, sys_clock_nanosleep
@@ -780,9 +859,70 @@ diff -NurpP --minimal linux-2.6.31/arch/sparc/kernel/systbls_32.S linux-2.6.31-v
  /*270*/       .long sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink
  /*275*/       .long sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid
  /*280*/       .long sys_tee, sys_add_key, sys_request_key, sys_keyctl, sys_openat
-diff -NurpP --minimal linux-2.6.31/arch/sparc/kernel/systbls_64.S linux-2.6.31-vs2.3.0.36.14-pre8/arch/sparc/kernel/systbls_64.S
---- linux-2.6.31/arch/sparc/kernel/systbls_64.S        2009-09-10 15:25:45.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/sparc/kernel/systbls_64.S     2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/arch/sparc/kernel/traps.c linux-2.6.27.33-vs2.3.0.36.6/arch/sparc/kernel/traps.c
+--- linux-2.6.27.33/arch/sparc/kernel/traps.c  2008-10-13 14:51:58.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/sparc/kernel/traps.c     2008-10-13 14:54:20.000000000 +0200
+@@ -95,7 +95,8 @@ void die_if_kernel(char *str, struct pt_
+ "              /_| \\__/ |_\\\n"
+ "                 \\__U_/\n");
+-      printk("%s(%d): %s [#%d]\n", current->comm, task_pid_nr(current), str, ++die_counter);
++      printk("%s(%d[#%u]): %s [#%d]\n", current->comm,
++              task_pid_nr(current), current->xid, str, ++die_counter);
+       show_regs(regs);
+       add_taint(TAINT_DIE);
+diff -NurpP --minimal linux-2.6.27.33/arch/sparc/mm/fault.c linux-2.6.27.33-vs2.3.0.36.6/arch/sparc/mm/fault.c
+--- linux-2.6.27.33/arch/sparc/mm/fault.c      2008-10-13 14:51:58.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/sparc/mm/fault.c 2008-10-13 14:54:20.000000000 +0200
+@@ -318,7 +318,8 @@ no_context:
+  */
+ out_of_memory:
+       up_read(&mm->mmap_sem);
+-      printk("VM: killing process %s\n", tsk->comm);
++      printk("VM: killing process %s(%d:#%u)\n",
++              tsk->comm, tsk->pid, tsk->xid);
+       if (from_user)
+               do_group_exit(SIGKILL);
+       goto no_context;
+diff -NurpP --minimal linux-2.6.27.33/arch/sparc64/Kconfig linux-2.6.27.33-vs2.3.0.36.6/arch/sparc64/Kconfig
+--- linux-2.6.27.33/arch/sparc64/Kconfig       2009-09-13 16:16:51.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/sparc64/Kconfig  2009-02-22 22:58:32.000000000 +0100
+@@ -404,6 +404,8 @@ source "fs/Kconfig"
+ source "arch/sparc64/Kconfig.debug"
++source "kernel/vserver/Kconfig"
++
+ source "security/Kconfig"
+ source "crypto/Kconfig"
+diff -NurpP --minimal linux-2.6.27.33/arch/sparc64/kernel/ptrace.c linux-2.6.27.33-vs2.3.0.36.6/arch/sparc64/kernel/ptrace.c
+--- linux-2.6.27.33/arch/sparc64/kernel/ptrace.c       2009-09-13 16:16:51.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/sparc64/kernel/ptrace.c  2009-02-03 17:59:04.000000000 +0100
+@@ -26,6 +26,7 @@
+ #include <linux/tracehook.h>
+ #include <linux/compat.h>
+ #include <linux/elf.h>
++#include <linux/vs_base.h>
+ #include <asm/asi.h>
+ #include <asm/pgtable.h>
+diff -NurpP --minimal linux-2.6.27.33/arch/sparc64/kernel/sys_sparc32.c linux-2.6.27.33-vs2.3.0.36.6/arch/sparc64/kernel/sys_sparc32.c
+--- linux-2.6.27.33/arch/sparc64/kernel/sys_sparc32.c  2008-10-13 14:51:58.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/sparc64/kernel/sys_sparc32.c     2008-10-13 14:54:20.000000000 +0200
+@@ -532,7 +532,7 @@ asmlinkage long sys32_gettimeofday(struc
+ {
+       if (tv) {
+               struct timeval ktv;
+-              do_gettimeofday(&ktv);
++              vx_gettimeofday(&ktv);
+               if (put_tv32(tv, &ktv))
+                       return -EFAULT;
+       }
+diff -NurpP --minimal linux-2.6.27.33/arch/sparc64/kernel/systbls.S linux-2.6.27.33-vs2.3.0.36.6/arch/sparc64/kernel/systbls.S
+--- linux-2.6.27.33/arch/sparc64/kernel/systbls.S      2009-09-13 16:16:51.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/sparc64/kernel/systbls.S 2009-02-22 22:58:32.000000000 +0100
 @@ -71,7 +71,7 @@ sys_call_table32:
  /*250*/       .word sys32_mremap, sys32_sysctl, sys32_getsid, sys_fdatasync, sys32_nfsservctl
        .word sys32_sync_file_range, compat_sys_clock_settime, compat_sys_clock_gettime, compat_sys_clock_getres, sys32_clock_nanosleep
@@ -792,7 +932,7 @@ diff -NurpP --minimal linux-2.6.31/arch/sparc/kernel/systbls_64.S linux-2.6.31-v
  /*270*/       .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink
        .word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid
  /*280*/       .word sys32_tee, sys_add_key, sys_request_key, sys_keyctl, compat_sys_openat
-@@ -146,7 +146,7 @@ sys_call_table:
+@@ -145,7 +145,7 @@ sys_call_table:
  /*250*/       .word sys_64_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl
        .word sys_sync_file_range, sys_clock_settime, sys_clock_gettime, sys_clock_getres, sys_clock_nanosleep
  /*260*/       .word sys_sched_getaffinity, sys_sched_setaffinity, sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun
@@ -801,10 +941,61 @@ diff -NurpP --minimal linux-2.6.31/arch/sparc/kernel/systbls_64.S linux-2.6.31-v
  /*270*/       .word sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink
        .word sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid
  /*280*/       .word sys_tee, sys_add_key, sys_request_key, sys_keyctl, sys_openat
-diff -NurpP --minimal linux-2.6.31/arch/x86/ia32/ia32entry.S linux-2.6.31-vs2.3.0.36.14-pre8/arch/x86/ia32/ia32entry.S
---- linux-2.6.31/arch/x86/ia32/ia32entry.S     2009-09-10 15:25:46.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/x86/ia32/ia32entry.S  2009-09-10 16:11:43.000000000 +0200
-@@ -768,7 +768,7 @@ ia32_sys_call_table:
+diff -NurpP --minimal linux-2.6.27.33/arch/sparc64/kernel/traps.c linux-2.6.27.33-vs2.3.0.36.6/arch/sparc64/kernel/traps.c
+--- linux-2.6.27.33/arch/sparc64/kernel/traps.c        2009-09-13 16:16:51.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/sparc64/kernel/traps.c   2009-03-25 14:32:29.000000000 +0100
+@@ -2201,7 +2201,8 @@ void die_if_kernel(char *str, struct pt_
+ "              /_| \\__/ |_\\\n"
+ "                 \\__U_/\n");
+-      printk("%s(%d): %s [#%d]\n", current->comm, task_pid_nr(current), str, ++die_counter);
++      printk("%s(%d[#%u]): %s [#%d]\n", current->comm,
++              task_pid_nr(current), current->xid, str, ++die_counter);
+       notify_die(DIE_OOPS, str, regs, 0, 255, SIGSEGV);
+       __asm__ __volatile__("flushw");
+       show_regs(regs);
+diff -NurpP --minimal linux-2.6.27.33/arch/sparc64/mm/fault.c linux-2.6.27.33-vs2.3.0.36.6/arch/sparc64/mm/fault.c
+--- linux-2.6.27.33/arch/sparc64/mm/fault.c    2008-10-13 14:51:58.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/sparc64/mm/fault.c       2008-10-13 14:54:20.000000000 +0200
+@@ -452,7 +452,8 @@ handle_kernel_fault:
+ out_of_memory:
+       insn = get_fault_insn(regs, insn);
+       up_read(&mm->mmap_sem);
+-      printk("VM: killing process %s\n", current->comm);
++      printk("VM: killing process %s(%d:#%u)\n",
++              current->comm, current->pid, current->xid);
+       if (!(regs->tstate & TSTATE_PRIV))
+               do_group_exit(SIGKILL);
+       goto handle_kernel_fault;
+diff -NurpP --minimal linux-2.6.27.33/arch/um/Kconfig linux-2.6.27.33-vs2.3.0.36.6/arch/um/Kconfig
+--- linux-2.6.27.33/arch/um/Kconfig    2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/um/Kconfig       2008-10-13 14:54:20.000000000 +0200
+@@ -245,6 +245,8 @@ source "drivers/connector/Kconfig"
+ source "fs/Kconfig"
++source "kernel/vserver/Kconfig"
++
+ source "security/Kconfig"
+ source "crypto/Kconfig"
+diff -NurpP --minimal linux-2.6.27.33/arch/um/kernel/trap.c linux-2.6.27.33-vs2.3.0.36.6/arch/um/kernel/trap.c
+--- linux-2.6.27.33/arch/um/kernel/trap.c      2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/um/kernel/trap.c 2008-10-13 14:54:20.000000000 +0200
+@@ -215,7 +215,8 @@ unsigned long segv(struct faultinfo fi, 
+               current->thread.arch.faultinfo = fi;
+               force_sig_info(SIGBUS, &si, current);
+       } else if (err == -ENOMEM) {
+-              printk(KERN_INFO "VM: killing process %s\n", current->comm);
++              printk(KERN_INFO "VM: killing process %s(%d:#%u)\n",
++                      current->comm, task_pid_nr(current), current->xid);
+               do_exit(SIGKILL);
+       } else {
+               BUG_ON(err != -EFAULT);
+diff -NurpP --minimal linux-2.6.27.33/arch/x86/ia32/ia32entry.S linux-2.6.27.33-vs2.3.0.36.6/arch/x86/ia32/ia32entry.S
+--- linux-2.6.27.33/arch/x86/ia32/ia32entry.S  2009-09-13 16:16:51.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/x86/ia32/ia32entry.S     2009-03-25 14:32:29.000000000 +0100
+@@ -774,7 +774,7 @@ ia32_sys_call_table:
        .quad sys_tgkill                /* 270 */
        .quad compat_sys_utimes
        .quad sys32_fadvise64_64
@@ -813,22 +1004,10 @@ diff -NurpP --minimal linux-2.6.31/arch/x86/ia32/ia32entry.S linux-2.6.31-vs2.3.
        .quad sys_mbind
        .quad compat_sys_get_mempolicy  /* 275 */
        .quad sys_set_mempolicy
-diff -NurpP --minimal linux-2.6.31/arch/x86/include/asm/unistd_64.h linux-2.6.31-vs2.3.0.36.14-pre8/arch/x86/include/asm/unistd_64.h
---- linux-2.6.31/arch/x86/include/asm/unistd_64.h      2009-09-10 15:25:47.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/x86/include/asm/unistd_64.h   2009-09-10 16:11:43.000000000 +0200
-@@ -535,7 +535,7 @@ __SYSCALL(__NR_tgkill, sys_tgkill)
- #define __NR_utimes                           235
- __SYSCALL(__NR_utimes, sys_utimes)
- #define __NR_vserver                          236
--__SYSCALL(__NR_vserver, sys_ni_syscall)
-+__SYSCALL(__NR_vserver, sys_vserver)
- #define __NR_mbind                            237
- __SYSCALL(__NR_mbind, sys_mbind)
- #define __NR_set_mempolicy                    238
-diff -NurpP --minimal linux-2.6.31/arch/x86/Kconfig linux-2.6.31-vs2.3.0.36.14-pre8/arch/x86/Kconfig
---- linux-2.6.31/arch/x86/Kconfig      2009-09-10 15:25:46.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/x86/Kconfig   2009-09-10 16:11:43.000000000 +0200
-@@ -2088,6 +2088,8 @@ source "fs/Kconfig"
+diff -NurpP --minimal linux-2.6.27.33/arch/x86/Kconfig linux-2.6.27.33-vs2.3.0.36.6/arch/x86/Kconfig
+--- linux-2.6.27.33/arch/x86/Kconfig   2009-09-13 16:16:51.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/x86/Kconfig      2009-02-22 22:58:32.000000000 +0100
+@@ -1811,6 +1811,8 @@ source "fs/Kconfig"
  
  source "arch/x86/Kconfig.debug"
  
@@ -837,9 +1016,9 @@ diff -NurpP --minimal linux-2.6.31/arch/x86/Kconfig linux-2.6.31-vs2.3.0.36.14-p
  source "security/Kconfig"
  
  source "crypto/Kconfig"
-diff -NurpP --minimal linux-2.6.31/arch/x86/kernel/syscall_table_32.S linux-2.6.31-vs2.3.0.36.14-pre8/arch/x86/kernel/syscall_table_32.S
---- linux-2.6.31/arch/x86/kernel/syscall_table_32.S    2009-09-10 15:25:47.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/arch/x86/kernel/syscall_table_32.S 2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/arch/x86/kernel/syscall_table_32.S linux-2.6.27.33-vs2.3.0.36.6/arch/x86/kernel/syscall_table_32.S
+--- linux-2.6.27.33/arch/x86/kernel/syscall_table_32.S 2009-09-13 16:16:51.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/arch/x86/kernel/syscall_table_32.S    2009-02-03 17:59:04.000000000 +0100
 @@ -272,7 +272,7 @@ ENTRY(sys_call_table)
        .long sys_tgkill        /* 270 */
        .long sys_utimes
@@ -849,9 +1028,9 @@ diff -NurpP --minimal linux-2.6.31/arch/x86/kernel/syscall_table_32.S linux-2.6.
        .long sys_mbind
        .long sys_get_mempolicy
        .long sys_set_mempolicy
-diff -NurpP --minimal linux-2.6.31/Documentation/vserver/debug.txt linux-2.6.31-vs2.3.0.36.14-pre8/Documentation/vserver/debug.txt
---- linux-2.6.31/Documentation/vserver/debug.txt       1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/Documentation/vserver/debug.txt    2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/Documentation/vserver/debug.txt linux-2.6.27.33-vs2.3.0.36.6/Documentation/vserver/debug.txt
+--- linux-2.6.27.33/Documentation/vserver/debug.txt    1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/Documentation/vserver/debug.txt       2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,154 @@
 +
 +debug_cvirt:
@@ -1007,10 +1186,10 @@ diff -NurpP --minimal linux-2.6.31/Documentation/vserver/debug.txt linux-2.6.31-
 + m 2^m        "vx_acc_page[%5d,%s,%2d]: %5d%s"
 +      "vx_acc_pages[%5d,%s,%2d]: %5d += %5d"
 +      "vx_pages_avail[%5d,%s,%2d]: %5ld > %5d + %5d"
-diff -NurpP --minimal linux-2.6.31/drivers/block/Kconfig linux-2.6.31-vs2.3.0.36.14-pre8/drivers/block/Kconfig
---- linux-2.6.31/drivers/block/Kconfig 2009-09-10 15:25:49.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/drivers/block/Kconfig      2009-09-10 16:11:43.000000000 +0200
-@@ -271,6 +271,13 @@ config BLK_DEV_CRYPTOLOOP
+diff -NurpP --minimal linux-2.6.27.33/drivers/block/Kconfig linux-2.6.27.33-vs2.3.0.36.6/drivers/block/Kconfig
+--- linux-2.6.27.33/drivers/block/Kconfig      2008-10-13 14:51:59.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/drivers/block/Kconfig 2008-10-13 14:54:20.000000000 +0200
+@@ -263,6 +263,13 @@ config BLK_DEV_CRYPTOLOOP
          instead, which can be configured to be on-disk compatible with the
          cryptoloop device.
  
@@ -1024,10 +1203,10 @@ diff -NurpP --minimal linux-2.6.31/drivers/block/Kconfig linux-2.6.31-vs2.3.0.36
  config BLK_DEV_NBD
        tristate "Network block device support"
        depends on NET
-diff -NurpP --minimal linux-2.6.31/drivers/block/loop.c linux-2.6.31-vs2.3.0.36.14-pre8/drivers/block/loop.c
---- linux-2.6.31/drivers/block/loop.c  2009-09-10 15:25:49.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/drivers/block/loop.c       2009-09-10 16:11:43.000000000 +0200
-@@ -74,6 +74,7 @@
+diff -NurpP --minimal linux-2.6.27.33/drivers/block/loop.c linux-2.6.27.33-vs2.3.0.36.6/drivers/block/loop.c
+--- linux-2.6.27.33/drivers/block/loop.c       2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/drivers/block/loop.c  2008-10-13 14:54:20.000000000 +0200
+@@ -76,6 +76,7 @@
  #include <linux/gfp.h>
  #include <linux/kthread.h>
  #include <linux/splice.h>
@@ -1035,7 +1214,7 @@ diff -NurpP --minimal linux-2.6.31/drivers/block/loop.c linux-2.6.31-vs2.3.0.36.
  
  #include <asm/uaccess.h>
  
-@@ -812,6 +813,7 @@ static int loop_set_fd(struct loop_devic
+@@ -794,6 +795,7 @@ static int loop_set_fd(struct loop_devic
        lo->lo_blocksize = lo_blocksize;
        lo->lo_device = bdev;
        lo->lo_flags = lo_flags;
@@ -1043,7 +1222,7 @@ diff -NurpP --minimal linux-2.6.31/drivers/block/loop.c linux-2.6.31-vs2.3.0.36.
        lo->lo_backing_file = file;
        lo->transfer = transfer_none;
        lo->ioctl = NULL;
-@@ -937,6 +939,7 @@ static int loop_clr_fd(struct loop_devic
+@@ -915,6 +917,7 @@ static int loop_clr_fd(struct loop_devic
        lo->lo_encrypt_key_size = 0;
        lo->lo_flags = 0;
        lo->lo_thread = NULL;
@@ -1051,16 +1230,16 @@ diff -NurpP --minimal linux-2.6.31/drivers/block/loop.c linux-2.6.31-vs2.3.0.36.
        memset(lo->lo_encrypt_key, 0, LO_KEY_SIZE);
        memset(lo->lo_crypt_name, 0, LO_NAME_SIZE);
        memset(lo->lo_file_name, 0, LO_NAME_SIZE);
-@@ -971,7 +974,7 @@ loop_set_status(struct loop_device *lo, 
+@@ -938,7 +941,7 @@ loop_set_status(struct loop_device *lo, 
+       struct loop_func_table *xfer;
  
-       if (lo->lo_encrypt_key_size &&
-           lo->lo_key_owner != uid &&
+       if (lo->lo_encrypt_key_size && lo->lo_key_owner != current->uid &&
 -          !capable(CAP_SYS_ADMIN))
 +          !vx_capable(CAP_SYS_ADMIN, VXC_ADMIN_CLOOP))
                return -EPERM;
        if (lo->lo_state != Lo_bound)
                return -ENXIO;
-@@ -1055,7 +1058,8 @@ loop_get_status(struct loop_device *lo, 
+@@ -1022,7 +1025,8 @@ loop_get_status(struct loop_device *lo, 
        memcpy(info->lo_crypt_name, lo->lo_crypt_name, LO_NAME_SIZE);
        info->lo_encrypt_type =
                lo->lo_encryption ? lo->lo_encryption->number : 0;
@@ -1070,9 +1249,9 @@ diff -NurpP --minimal linux-2.6.31/drivers/block/loop.c linux-2.6.31-vs2.3.0.36.
                info->lo_encrypt_key_size = lo->lo_encrypt_key_size;
                memcpy(info->lo_encrypt_key, lo->lo_encrypt_key,
                       lo->lo_encrypt_key_size);
-@@ -1399,6 +1403,9 @@ static int lo_open(struct block_device *
+@@ -1331,6 +1335,9 @@ static int lo_open(struct inode *inode, 
  {
-       struct loop_device *lo = bdev->bd_disk->private_data;
+       struct loop_device *lo = inode->i_bdev->bd_disk->private_data;
  
 +      if (!vx_check(lo->lo_xid, VS_IDENT|VS_HOSTID|VS_ADMIN_P))
 +              return -EACCES;
@@ -1080,21 +1259,20 @@ diff -NurpP --minimal linux-2.6.31/drivers/block/loop.c linux-2.6.31-vs2.3.0.36.
        mutex_lock(&lo->lo_ctl_mutex);
        lo->lo_refcnt++;
        mutex_unlock(&lo->lo_ctl_mutex);
-diff -NurpP --minimal linux-2.6.31/drivers/block/Makefile linux-2.6.31-vs2.3.0.36.14-pre8/drivers/block/Makefile
---- linux-2.6.31/drivers/block/Makefile        2009-09-10 15:25:49.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/drivers/block/Makefile     2009-09-10 16:11:43.000000000 +0200
-@@ -34,6 +34,7 @@ obj-$(CONFIG_VIODASD)                += viodasd.o
+diff -NurpP --minimal linux-2.6.27.33/drivers/block/Makefile linux-2.6.27.33-vs2.3.0.36.6/drivers/block/Makefile
+--- linux-2.6.27.33/drivers/block/Makefile     2008-10-13 14:51:59.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/drivers/block/Makefile        2008-10-13 14:54:20.000000000 +0200
+@@ -30,5 +30,6 @@ obj-$(CONFIG_VIODASD)                += viodasd.o
  obj-$(CONFIG_BLK_DEV_SX8)     += sx8.o
  obj-$(CONFIG_BLK_DEV_UB)      += ub.o
  obj-$(CONFIG_BLK_DEV_HD)      += hd.o
 +obj-$(CONFIG_BLK_DEV_VROOT)   += vroot.o
  
  obj-$(CONFIG_XEN_BLKDEV_FRONTEND)     += xen-blkfront.o
-diff -NurpP --minimal linux-2.6.31/drivers/block/vroot.c linux-2.6.31-vs2.3.0.36.14-pre8/drivers/block/vroot.c
---- linux-2.6.31/drivers/block/vroot.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/drivers/block/vroot.c      2009-09-10 16:11:43.000000000 +0200
-@@ -0,0 +1,281 @@
+diff -NurpP --minimal linux-2.6.27.33/drivers/block/vroot.c linux-2.6.27.33-vs2.3.0.36.6/drivers/block/vroot.c
+--- linux-2.6.27.33/drivers/block/vroot.c      1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/drivers/block/vroot.c 2008-10-13 14:54:20.000000000 +0200
+@@ -0,0 +1,283 @@
 +/*
 + *  linux/drivers/block/vroot.c
 + *
@@ -1127,6 +1305,7 @@ diff -NurpP --minimal linux-2.6.31/drivers/block/vroot.c linux-2.6.31-vs2.3.0.36
 +
 +static int vroot_set_dev(
 +      struct vroot_device *vr,
++      struct file *vr_file,
 +      struct block_device *bdev,
 +      unsigned int arg)
 +{
@@ -1170,6 +1349,7 @@ diff -NurpP --minimal linux-2.6.31/drivers/block/vroot.c linux-2.6.31-vs2.3.0.36
 +
 +static int vroot_clr_dev(
 +      struct vroot_device *vr,
++      struct file *vr_file,
 +      struct block_device *bdev)
 +{
 +      struct block_device *real_bdev;
@@ -1192,19 +1372,19 @@ diff -NurpP --minimal linux-2.6.31/drivers/block/vroot.c linux-2.6.31-vs2.3.0.36
 +}
 +
 +
-+static int vr_ioctl(struct block_device *bdev, fmode_t mode,
++static int vr_ioctl(struct inode *inode, struct file *file,
 +      unsigned int cmd, unsigned long arg)
 +{
-+      struct vroot_device *vr = bdev->bd_disk->private_data;
++      struct vroot_device *vr = inode->i_bdev->bd_disk->private_data;
 +      int err;
 +
 +      down(&vr->vr_ctl_mutex);
 +      switch (cmd) {
 +      case VROOT_SET_DEV:
-+              err = vroot_set_dev(vr, bdev, arg);
++              err = vroot_set_dev(vr, file, inode->i_bdev, arg);
 +              break;
 +      case VROOT_CLR_DEV:
-+              err = vroot_clr_dev(vr, bdev);
++              err = vroot_clr_dev(vr, file, inode->i_bdev);
 +              break;
 +      default:
 +              err = -EINVAL;
@@ -1214,9 +1394,9 @@ diff -NurpP --minimal linux-2.6.31/drivers/block/vroot.c linux-2.6.31-vs2.3.0.36
 +      return err;
 +}
 +
-+static int vr_open(struct block_device *bdev, fmode_t mode)
++static int vr_open(struct inode *inode, struct file *file)
 +{
-+      struct vroot_device *vr = bdev->bd_disk->private_data;
++      struct vroot_device *vr = inode->i_bdev->bd_disk->private_data;
 +
 +      down(&vr->vr_ctl_mutex);
 +      vr->vr_refcnt++;
@@ -1224,9 +1404,9 @@ diff -NurpP --minimal linux-2.6.31/drivers/block/vroot.c linux-2.6.31-vs2.3.0.36
 +      return 0;
 +}
 +
-+static int vr_release(struct gendisk *disk, fmode_t mode)
++static int vr_release(struct inode *inode, struct file *file)
 +{
-+      struct vroot_device *vr = disk->private_data;
++      struct vroot_device *vr = inode->i_bdev->bd_disk->private_data;
 +
 +      down(&vr->vr_ctl_mutex);
 +      --vr->vr_refcnt;
@@ -1376,18 +1556,18 @@ diff -NurpP --minimal linux-2.6.31/drivers/block/vroot.c linux-2.6.31-vs2.3.0.36
 +
 +#endif
 +
-diff -NurpP --minimal linux-2.6.31/drivers/char/sysrq.c linux-2.6.31-vs2.3.0.36.14-pre8/drivers/char/sysrq.c
---- linux-2.6.31/drivers/char/sysrq.c  2009-09-10 15:25:50.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/drivers/char/sysrq.c       2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/drivers/char/sysrq.c linux-2.6.27.33-vs2.3.0.36.6/drivers/char/sysrq.c
+--- linux-2.6.27.33/drivers/char/sysrq.c       2008-10-13 14:51:59.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/drivers/char/sysrq.c  2008-10-13 14:54:20.000000000 +0200
 @@ -37,6 +37,7 @@
- #include <linux/workqueue.h>
+ #include <linux/irq.h>
  #include <linux/hrtimer.h>
  #include <linux/oom.h>
 +#include <linux/vserver/debug.h>
  
  #include <asm/ptrace.h>
  #include <asm/irq_regs.h>
-@@ -382,6 +383,21 @@ static struct sysrq_key_op sysrq_unrt_op
+@@ -351,6 +352,21 @@ static struct sysrq_key_op sysrq_unrt_op
        .enable_mask    = SYSRQ_ENABLE_RTNICE,
  };
  
@@ -1409,19 +1589,20 @@ diff -NurpP --minimal linux-2.6.31/drivers/char/sysrq.c linux-2.6.31-vs2.3.0.36.
  /* Key Operations table and lock */
  static DEFINE_SPINLOCK(sysrq_key_table_lock);
  
-@@ -436,7 +452,11 @@ static struct sysrq_key_op *sysrq_key_ta
-       NULL,                           /* v */
-       &sysrq_showstate_blocked_op,    /* w */
-       /* x: May be registered on ppc/powerpc for xmon */
-+#ifdef CONFIG_VSERVER_DEBUG
-+      &sysrq_showvxinfo_op,           /* x */
-+#else
+@@ -404,7 +420,11 @@ static struct sysrq_key_op *sysrq_key_ta
        NULL,                           /* x */
-+#endif
        /* y: May be registered on sparc64 for global register dump */
        NULL,                           /* y */
-       &sysrq_ftrace_dump_op,          /* z */
-@@ -451,6 +471,8 @@ static int sysrq_key_table_key2index(int
+-      NULL                            /* z */
++#ifdef CONFIG_VSERVER_DEBUG
++      &sysrq_showvxinfo_op,           /* z */
++#else
++      NULL,                           /* z */
++#endif
+ };
+ /* key2index calculation, -1 on invalid index */
+@@ -416,6 +436,8 @@ static int sysrq_key_table_key2index(int
                retval = key - '0';
        else if ((key >= 'a') && (key <= 'z'))
                retval = key + 10 - 'a';
@@ -1430,9 +1611,9 @@ diff -NurpP --minimal linux-2.6.31/drivers/char/sysrq.c linux-2.6.31-vs2.3.0.36.
        else
                retval = -1;
        return retval;
-diff -NurpP --minimal linux-2.6.31/drivers/char/tty_io.c linux-2.6.31-vs2.3.0.36.14-pre8/drivers/char/tty_io.c
---- linux-2.6.31/drivers/char/tty_io.c 2009-09-10 15:25:50.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/drivers/char/tty_io.c      2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/drivers/char/tty_io.c linux-2.6.27.33-vs2.3.0.36.6/drivers/char/tty_io.c
+--- linux-2.6.27.33/drivers/char/tty_io.c      2009-09-13 16:16:53.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/drivers/char/tty_io.c 2009-02-03 17:59:04.000000000 +0100
 @@ -106,6 +106,7 @@
  
  #include <linux/kmod.h>
@@ -1441,7 +1622,7 @@ diff -NurpP --minimal linux-2.6.31/drivers/char/tty_io.c linux-2.6.31-vs2.3.0.36
  
  #undef TTY_DEBUG_HANGUP
  
-@@ -2235,6 +2236,7 @@ static int tiocspgrp(struct tty_struct *
+@@ -2770,6 +2771,7 @@ static int tiocspgrp(struct tty_struct *
                return -ENOTTY;
        if (get_user(pgrp_nr, p))
                return -EFAULT;
@@ -1449,9 +1630,9 @@ diff -NurpP --minimal linux-2.6.31/drivers/char/tty_io.c linux-2.6.31-vs2.3.0.36
        if (pgrp_nr < 0)
                return -EINVAL;
        rcu_read_lock();
-diff -NurpP --minimal linux-2.6.31/drivers/infiniband/hw/ipath/ipath_user_pages.c linux-2.6.31-vs2.3.0.36.14-pre8/drivers/infiniband/hw/ipath/ipath_user_pages.c
---- linux-2.6.31/drivers/infiniband/hw/ipath/ipath_user_pages.c        2009-06-11 17:12:30.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/drivers/infiniband/hw/ipath/ipath_user_pages.c     2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/drivers/infiniband/hw/ipath/ipath_user_pages.c linux-2.6.27.33-vs2.3.0.36.6/drivers/infiniband/hw/ipath/ipath_user_pages.c
+--- linux-2.6.27.33/drivers/infiniband/hw/ipath/ipath_user_pages.c     2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/drivers/infiniband/hw/ipath/ipath_user_pages.c        2008-10-13 14:54:20.000000000 +0200
 @@ -33,6 +33,7 @@
  
  #include <linux/mm.h>
@@ -1497,18 +1678,18 @@ diff -NurpP --minimal linux-2.6.31/drivers/infiniband/hw/ipath/ipath_user_pages.
        up_write(&work->mm->mmap_sem);
        mmput(work->mm);
        kfree(work);
-diff -NurpP --minimal linux-2.6.31/drivers/md/dm.c linux-2.6.31-vs2.3.0.36.14-pre8/drivers/md/dm.c
---- linux-2.6.31/drivers/md/dm.c       2009-09-10 15:25:55.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/drivers/md/dm.c    2009-09-10 16:15:37.000000000 +0200
-@@ -19,6 +19,7 @@
- #include <linux/slab.h>
- #include <linux/idr.h>
+diff -NurpP --minimal linux-2.6.27.33/drivers/md/dm.c linux-2.6.27.33-vs2.3.0.36.6/drivers/md/dm.c
+--- linux-2.6.27.33/drivers/md/dm.c    2008-10-13 14:52:01.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/drivers/md/dm.c       2009-07-21 15:54:27.000000000 +0200
+@@ -22,6 +22,7 @@
  #include <linux/hdreg.h>
+ #include <linux/blktrace_api.h>
+ #include <linux/smp_lock.h>
 +#include <linux/vs_base.h>
  
- #include <trace/events/block.h>
+ #define DM_MSG_PREFIX "core"
  
-@@ -118,6 +119,7 @@ struct mapped_device {
+@@ -91,6 +92,7 @@ struct mapped_device {
        rwlock_t map_lock;
        atomic_t holders;
        atomic_t open_count;
@@ -1516,15 +1697,15 @@ diff -NurpP --minimal linux-2.6.31/drivers/md/dm.c linux-2.6.31-vs2.3.0.36.14-pr
  
        unsigned long flags;
  
-@@ -322,6 +324,7 @@ static void __exit dm_exit(void)
- static int dm_blk_open(struct block_device *bdev, fmode_t mode)
+@@ -252,6 +254,7 @@ static void __exit dm_exit(void)
+ static int dm_blk_open(struct inode *inode, struct file *file)
  {
        struct mapped_device *md;
 +      int ret = -ENXIO;
  
        spin_lock(&_minor_lock);
  
-@@ -330,18 +333,19 @@ static int dm_blk_open(struct block_devi
+@@ -260,18 +263,19 @@ static int dm_blk_open(struct inode *ino
                goto out;
  
        if (test_bit(DMF_FREEING, &md->flags) ||
@@ -1549,8 +1730,8 @@ diff -NurpP --minimal linux-2.6.31/drivers/md/dm.c linux-2.6.31-vs2.3.0.36.14-pr
 +      return ret;
  }
  
- static int dm_blk_close(struct gendisk *disk, fmode_t mode)
-@@ -550,6 +554,14 @@ int dm_set_geometry(struct mapped_device
+ static int dm_blk_close(struct inode *inode, struct file *file)
+@@ -467,6 +471,14 @@ int dm_set_geometry(struct mapped_device
        return 0;
  }
  
@@ -1565,29 +1746,29 @@ diff -NurpP --minimal linux-2.6.31/drivers/md/dm.c linux-2.6.31-vs2.3.0.36.14-pr
  /*-----------------------------------------------------------------
   * CRUD START:
   *   A more elegant soln is in the works that uses the queue
-@@ -1754,6 +1766,7 @@ static struct mapped_device *alloc_dev(i
+@@ -1069,6 +1081,7 @@ static struct mapped_device *alloc_dev(i
        INIT_LIST_HEAD(&md->uevent_list);
        spin_lock_init(&md->uevent_lock);
  
 +      md->xid = vx_current_xid();
-       md->queue = blk_init_queue(dm_request_fn, NULL);
+       md->queue = blk_alloc_queue(GFP_KERNEL);
        if (!md->queue)
                goto bad_queue;
-diff -NurpP --minimal linux-2.6.31/drivers/md/dm.h linux-2.6.31-vs2.3.0.36.14-pre8/drivers/md/dm.h
---- linux-2.6.31/drivers/md/dm.h       2009-09-10 15:25:55.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/drivers/md/dm.h    2009-09-10 16:11:43.000000000 +0200
-@@ -41,6 +41,8 @@ struct dm_dev_internal {
- struct dm_table;
struct dm_md_mempools;
+diff -NurpP --minimal linux-2.6.27.33/drivers/md/dm.h linux-2.6.27.33-vs2.3.0.36.6/drivers/md/dm.h
+--- linux-2.6.27.33/drivers/md/dm.h    2008-10-13 14:52:01.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/drivers/md/dm.h       2008-10-13 14:54:20.000000000 +0200
+@@ -66,6 +66,8 @@ void dm_put_target_type(struct target_ty
+ int dm_target_iterate(void (*iter_func)(struct target_type *tt,
                                      void *param), void *param);
  
 +xid_t dm_get_xid(struct mapped_device *md);
 +
  /*-----------------------------------------------------------------
-  * Internal table functions.
+  * Useful inlines.
   *---------------------------------------------------------------*/
-diff -NurpP --minimal linux-2.6.31/drivers/md/dm-ioctl.c linux-2.6.31-vs2.3.0.36.14-pre8/drivers/md/dm-ioctl.c
---- linux-2.6.31/drivers/md/dm-ioctl.c 2009-09-10 15:25:55.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/drivers/md/dm-ioctl.c      2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/drivers/md/dm-ioctl.c linux-2.6.27.33-vs2.3.0.36.6/drivers/md/dm-ioctl.c
+--- linux-2.6.27.33/drivers/md/dm-ioctl.c      2009-09-13 16:16:54.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/drivers/md/dm-ioctl.c 2009-03-25 14:32:29.000000000 +0100
 @@ -16,6 +16,7 @@
  #include <linux/dm-ioctl.h>
  #include <linux/hdreg.h>
@@ -1658,7 +1839,7 @@ diff -NurpP --minimal linux-2.6.31/drivers/md/dm-ioctl.c linux-2.6.31-vs2.3.0.36
  out:
        return mdptr;
  }
-@@ -1445,8 +1456,8 @@ static int ctl_ioctl(uint command, struc
+@@ -1407,8 +1418,8 @@ static int ctl_ioctl(uint command, struc
        ioctl_fn fn = NULL;
        size_t param_size;
  
@@ -1669,9 +1850,9 @@ diff -NurpP --minimal linux-2.6.31/drivers/md/dm-ioctl.c linux-2.6.31-vs2.3.0.36
                return -EACCES;
  
        if (_IOC_TYPE(command) != DM_IOCTL)
-diff -NurpP --minimal linux-2.6.31/drivers/net/tun.c linux-2.6.31-vs2.3.0.36.14-pre8/drivers/net/tun.c
---- linux-2.6.31/drivers/net/tun.c     2009-09-10 15:26:03.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/drivers/net/tun.c  2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/drivers/net/tun.c linux-2.6.27.33-vs2.3.0.36.6/drivers/net/tun.c
+--- linux-2.6.27.33/drivers/net/tun.c  2009-09-13 16:16:55.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/drivers/net/tun.c     2009-02-22 22:58:32.000000000 +0100
 @@ -61,6 +61,7 @@
  #include <linux/crc32.h>
  #include <linux/nsproxy.h>
@@ -1679,43 +1860,43 @@ diff -NurpP --minimal linux-2.6.31/drivers/net/tun.c linux-2.6.31-vs2.3.0.36.14-
 +#include <linux/vs_network.h>
  #include <net/net_namespace.h>
  #include <net/netns/generic.h>
- #include <net/rtnetlink.h>
-@@ -102,6 +103,7 @@ struct tun_struct {
-       unsigned int            flags;
+@@ -93,6 +94,7 @@ struct tun_struct {
+       int                     attached;
        uid_t                   owner;
        gid_t                   group;
 +      nid_t                   nid;
  
+       wait_queue_head_t       read_wait;
        struct sk_buff_head     readq;
-@@ -138,7 +140,7 @@ static int tun_attach(struct tun_struct 
-       /* Check permissions */
-       if (((tun->owner != -1 && cred->euid != tun->owner) ||
-            (tun->group != -1 && !in_egroup_p(tun->group))) &&
--              !capable(CAP_NET_ADMIN))
-+              !cap_raised(current_cap(), CAP_NET_ADMIN))
-               return -EPERM;
-       netif_tx_lock_bh(tun->dev);
-@@ -823,6 +825,7 @@ static void tun_setup(struct net_device 
+@@ -681,6 +683,7 @@ static void tun_setup(struct net_device 
  
        tun->owner = -1;
        tun->group = -1;
 +      tun->nid = current->nid;
  
-       dev->ethtool_ops = &tun_ethtool_ops;
-       dev->destructor = tun_free_netdev;
-@@ -935,6 +938,9 @@ static int tun_set_iff(struct net *net, 
-               else
-                       return -EINVAL;
+       dev->open = tun_net_open;
+       dev->hard_start_xmit = tun_net_xmit;
+@@ -713,6 +716,9 @@ static int tun_set_iff(struct net *net, 
+       tn = net_generic(net, tun_net_id);
+       tun = tun_get_by_name(tn, ifr->ifr_name);
+       if (tun) {
 +              if (!nx_check(tun->nid, VS_IDENT | VS_HOSTID | VS_ADMIN_P))
 +                      return -EPERM;
 +
-               err = tun_attach(tun, file);
-               if (err < 0)
-                       return err;
-@@ -945,7 +951,7 @@ static int tun_set_iff(struct net *net, 
+               if (tun->attached)
+                       return -EBUSY;
+@@ -721,7 +727,7 @@ static int tun_set_iff(struct net *net, 
+                     current->euid != tun->owner) ||
+                    (tun->group != -1 &&
+                     current->egid != tun->group)) &&
+-                   !capable(CAP_NET_ADMIN))
++                   !cap_raised(current->cap_effective, CAP_NET_ADMIN))
+                       return -EPERM;
+       }
+       else if (__dev_get_by_name(net, ifr->ifr_name))
+@@ -732,7 +738,7 @@ static int tun_set_iff(struct net *net, 
  
                err = -EINVAL;
  
@@ -1724,7 +1905,7 @@ diff -NurpP --minimal linux-2.6.31/drivers/net/tun.c linux-2.6.31-vs2.3.0.36.14-
                        return -EPERM;
  
                /* Set dev type */
-@@ -1192,6 +1198,16 @@ static long tun_chr_ioctl(struct file *f
+@@ -972,6 +978,16 @@ static int tun_chr_ioctl(struct inode *i
                DBG(KERN_INFO "%s: group set to %d\n", tun->dev->name, tun->group);
                break;
  
@@ -1740,10 +1921,10 @@ diff -NurpP --minimal linux-2.6.31/drivers/net/tun.c linux-2.6.31-vs2.3.0.36.14-
 +
        case TUNSETLINK:
                /* Only allow setting the type when the interface is down */
-               if (tun->dev->flags & IFF_UP) {
-diff -NurpP --minimal linux-2.6.31/fs/attr.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/attr.c
---- linux-2.6.31/fs/attr.c     2009-06-11 17:13:01.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/attr.c  2009-09-10 16:11:43.000000000 +0200
+               rtnl_lock();
+diff -NurpP --minimal linux-2.6.27.33/fs/attr.c linux-2.6.27.33-vs2.3.0.36.6/fs/attr.c
+--- linux-2.6.27.33/fs/attr.c  2008-10-13 14:52:05.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/attr.c     2008-10-24 03:34:52.000000000 +0200
 @@ -14,6 +14,9 @@
  #include <linux/fcntl.h>
  #include <linux/quotaops.h>
@@ -1775,18 +1956,18 @@ diff -NurpP --minimal linux-2.6.31/fs/attr.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/
                inode->i_atime = timespec_trunc(attr->ia_atime,
                                                inode->i_sb->s_time_gran);
 @@ -172,7 +181,8 @@ int notify_change(struct dentry * dentry
-               error = inode_change_ok(inode, attr);
+                       error = security_inode_setattr(dentry, attr);
                if (!error) {
                        if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
 -                          (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid))
 +                          (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid) ||
 +                          (ia_valid & ATTR_TAG && attr->ia_tag != inode->i_tag))
-                               error = vfs_dq_transfer(inode, attr) ?
-                                       -EDQUOT : 0;
+                               error = DQUOT_TRANSFER(inode, attr) ? -EDQUOT : 0;
                        if (!error)
-diff -NurpP --minimal linux-2.6.31/fs/binfmt_aout.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/binfmt_aout.c
---- linux-2.6.31/fs/binfmt_aout.c      2009-03-24 14:22:24.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/binfmt_aout.c   2009-09-10 16:11:43.000000000 +0200
+                               error = inode_setattr(inode, attr);
+diff -NurpP --minimal linux-2.6.27.33/fs/binfmt_aout.c linux-2.6.27.33-vs2.3.0.36.6/fs/binfmt_aout.c
+--- linux-2.6.27.33/fs/binfmt_aout.c   2008-10-13 14:52:05.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/binfmt_aout.c      2008-10-13 14:54:20.000000000 +0200
 @@ -24,6 +24,7 @@
  #include <linux/binfmts.h>
  #include <linux/personality.h>
@@ -1795,10 +1976,10 @@ diff -NurpP --minimal linux-2.6.31/fs/binfmt_aout.c linux-2.6.31-vs2.3.0.36.14-p
  
  #include <asm/system.h>
  #include <asm/uaccess.h>
-diff -NurpP --minimal linux-2.6.31/fs/binfmt_elf.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/binfmt_elf.c
---- linux-2.6.31/fs/binfmt_elf.c       2009-09-10 15:26:20.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/binfmt_elf.c    2009-09-10 16:11:43.000000000 +0200
-@@ -31,6 +31,7 @@
+diff -NurpP --minimal linux-2.6.27.33/fs/binfmt_elf.c linux-2.6.27.33-vs2.3.0.36.6/fs/binfmt_elf.c
+--- linux-2.6.27.33/fs/binfmt_elf.c    2009-09-13 16:16:57.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/binfmt_elf.c       2009-08-01 01:45:51.000000000 +0200
+@@ -38,6 +38,7 @@
  #include <linux/random.h>
  #include <linux/elf.h>
  #include <linux/utsname.h>
@@ -1806,9 +1987,9 @@ diff -NurpP --minimal linux-2.6.31/fs/binfmt_elf.c linux-2.6.31-vs2.3.0.36.14-pr
  #include <asm/uaccess.h>
  #include <asm/param.h>
  #include <asm/page.h>
-diff -NurpP --minimal linux-2.6.31/fs/binfmt_flat.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/binfmt_flat.c
---- linux-2.6.31/fs/binfmt_flat.c      2009-09-10 15:26:20.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/binfmt_flat.c   2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/binfmt_flat.c linux-2.6.27.33-vs2.3.0.36.6/fs/binfmt_flat.c
+--- linux-2.6.27.33/fs/binfmt_flat.c   2009-09-13 16:16:57.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/binfmt_flat.c      2009-08-17 19:07:36.000000000 +0200
 @@ -35,6 +35,7 @@
  #include <linux/init.h>
  #include <linux/flat.h>
@@ -1817,9 +1998,9 @@ diff -NurpP --minimal linux-2.6.31/fs/binfmt_flat.c linux-2.6.31-vs2.3.0.36.14-p
  
  #include <asm/byteorder.h>
  #include <asm/system.h>
-diff -NurpP --minimal linux-2.6.31/fs/binfmt_som.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/binfmt_som.c
---- linux-2.6.31/fs/binfmt_som.c       2009-06-11 17:13:02.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/binfmt_som.c    2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/binfmt_som.c linux-2.6.27.33-vs2.3.0.36.6/fs/binfmt_som.c
+--- linux-2.6.27.33/fs/binfmt_som.c    2008-10-13 14:52:05.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/binfmt_som.c       2008-10-13 14:54:20.000000000 +0200
 @@ -28,6 +28,7 @@
  #include <linux/shm.h>
  #include <linux/personality.h>
@@ -1828,18 +2009,18 @@ diff -NurpP --minimal linux-2.6.31/fs/binfmt_som.c linux-2.6.31-vs2.3.0.36.14-pr
  
  #include <asm/uaccess.h>
  #include <asm/pgtable.h>
-diff -NurpP --minimal linux-2.6.31/fs/block_dev.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/block_dev.c
---- linux-2.6.31/fs/block_dev.c        2009-09-10 15:26:20.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/block_dev.c     2009-09-10 17:01:13.000000000 +0200
-@@ -26,6 +26,7 @@
+diff -NurpP --minimal linux-2.6.27.33/fs/block_dev.c linux-2.6.27.33-vs2.3.0.36.6/fs/block_dev.c
+--- linux-2.6.27.33/fs/block_dev.c     2008-10-13 14:52:05.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/block_dev.c        2008-10-13 14:54:20.000000000 +0200
+@@ -24,6 +24,7 @@
+ #include <linux/uio.h>
  #include <linux/namei.h>
  #include <linux/log2.h>
- #include <linux/kmemleak.h>
 +#include <linux/vs_device.h>
  #include <asm/uaccess.h>
  #include "internal.h"
  
-@@ -550,6 +551,7 @@ struct block_device *bdget(dev_t dev)
+@@ -389,6 +390,7 @@ struct block_device *bdget(dev_t dev)
                bdev->bd_invalidated = 0;
                inode->i_mode = S_IFBLK;
                inode->i_rdev = dev;
@@ -1847,7 +2028,7 @@ diff -NurpP --minimal linux-2.6.31/fs/block_dev.c linux-2.6.31-vs2.3.0.36.14-pre
                inode->i_bdev = bdev;
                inode->i_data.a_ops = &def_blk_aops;
                mapping_set_gfp_mask(&inode->i_data, GFP_USER);
-@@ -596,6 +598,11 @@ EXPORT_SYMBOL(bdput);
+@@ -425,6 +427,11 @@ EXPORT_SYMBOL(bdput);
  static struct block_device *bd_acquire(struct inode *inode)
  {
        struct block_device *bdev;
@@ -1859,7 +2040,7 @@ diff -NurpP --minimal linux-2.6.31/fs/block_dev.c linux-2.6.31-vs2.3.0.36.14-pre
  
        spin_lock(&bdev_lock);
        bdev = inode->i_bdev;
-@@ -606,7 +613,7 @@ static struct block_device *bd_acquire(s
+@@ -435,7 +442,7 @@ static struct block_device *bd_acquire(s
        }
        spin_unlock(&bdev_lock);
  
@@ -1868,19 +2049,19 @@ diff -NurpP --minimal linux-2.6.31/fs/block_dev.c linux-2.6.31-vs2.3.0.36.14-pre
        if (bdev) {
                spin_lock(&bdev_lock);
                if (!inode->i_bdev) {
-diff -NurpP --minimal linux-2.6.31/fs/char_dev.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/char_dev.c
---- linux-2.6.31/fs/char_dev.c 2009-09-10 15:26:21.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/char_dev.c      2009-09-10 16:11:43.000000000 +0200
-@@ -20,6 +20,8 @@
+diff -NurpP --minimal linux-2.6.27.33/fs/char_dev.c linux-2.6.27.33-vs2.3.0.36.6/fs/char_dev.c
+--- linux-2.6.27.33/fs/char_dev.c      2008-10-13 14:52:05.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/char_dev.c 2008-10-13 14:54:20.000000000 +0200
+@@ -21,6 +21,8 @@
  #include <linux/cdev.h>
  #include <linux/mutex.h>
  #include <linux/backing-dev.h>
 +#include <linux/vs_context.h>
 +#include <linux/vs_device.h>
  
- #include "internal.h"
-@@ -357,14 +359,21 @@ static int chrdev_open(struct inode *ino
+ #ifdef CONFIG_KMOD
+ #include <linux/kmod.h>
+@@ -361,14 +363,21 @@ static int chrdev_open(struct inode *ino
        struct cdev *p;
        struct cdev *new = NULL;
        int ret = 0;
@@ -1903,18 +2084,18 @@ diff -NurpP --minimal linux-2.6.31/fs/char_dev.c linux-2.6.31-vs2.3.0.36.14-pre8
                if (!kobj)
                        return -ENXIO;
                new = container_of(kobj, struct cdev, kobj);
-diff -NurpP --minimal linux-2.6.31/fs/dcache.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/dcache.c
---- linux-2.6.31/fs/dcache.c   2009-09-10 15:26:21.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/dcache.c        2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/dcache.c linux-2.6.27.33-vs2.3.0.36.6/fs/dcache.c
+--- linux-2.6.27.33/fs/dcache.c        2009-09-13 16:16:58.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/dcache.c   2009-02-03 17:59:04.000000000 +0100
 @@ -32,6 +32,7 @@
+ #include <linux/seqlock.h>
  #include <linux/swap.h>
  #include <linux/bootmem.h>
- #include <linux/fs_struct.h>
 +#include <linux/vs_limit.h>
  #include "internal.h"
  
- int sysctl_vfs_cache_pressure __read_mostly = 100;
-@@ -229,6 +230,8 @@ repeat:
+@@ -226,6 +227,8 @@ repeat:
                return;
        }
  
@@ -1923,7 +2104,7 @@ diff -NurpP --minimal linux-2.6.31/fs/dcache.c linux-2.6.31-vs2.3.0.36.14-pre8/f
        /*
         * AV: ->d_delete() is _NOT_ allowed to block now.
         */
-@@ -320,6 +323,7 @@ static inline struct dentry * __dget_loc
+@@ -317,6 +320,7 @@ static inline struct dentry * __dget_loc
  {
        atomic_inc(&dentry->d_count);
        dentry_lru_del_init(dentry);
@@ -1931,7 +2112,7 @@ diff -NurpP --minimal linux-2.6.31/fs/dcache.c linux-2.6.31-vs2.3.0.36.14-pre8/f
        return dentry;
  }
  
-@@ -918,6 +922,9 @@ struct dentry *d_alloc(struct dentry * p
+@@ -914,6 +918,9 @@ struct dentry *d_alloc(struct dentry * p
        struct dentry *dentry;
        char *dname;
  
@@ -1941,7 +2122,7 @@ diff -NurpP --minimal linux-2.6.31/fs/dcache.c linux-2.6.31-vs2.3.0.36.14-pre8/f
        dentry = kmem_cache_alloc(dentry_cache, GFP_KERNEL);
        if (!dentry)
                return NULL;
-@@ -963,6 +970,7 @@ struct dentry *d_alloc(struct dentry * p
+@@ -962,6 +969,7 @@ struct dentry *d_alloc(struct dentry * p
        if (parent)
                list_add(&dentry->d_u.d_child, &parent->d_subdirs);
        dentry_stat.nr_dentry++;
@@ -1949,7 +2130,7 @@ diff -NurpP --minimal linux-2.6.31/fs/dcache.c linux-2.6.31-vs2.3.0.36.14-pre8/f
        spin_unlock(&dcache_lock);
  
        return dentry;
-@@ -1406,6 +1414,7 @@ struct dentry * __d_lookup(struct dentry
+@@ -1415,6 +1423,7 @@ struct dentry * __d_lookup(struct dentry
                }
  
                atomic_inc(&dentry->d_count);
@@ -1957,10 +2138,10 @@ diff -NurpP --minimal linux-2.6.31/fs/dcache.c linux-2.6.31-vs2.3.0.36.14-pre8/f
                found = dentry;
                spin_unlock(&dentry->d_lock);
                break;
-diff -NurpP --minimal linux-2.6.31/fs/devpts/inode.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/devpts/inode.c
---- linux-2.6.31/fs/devpts/inode.c     2009-09-10 15:26:21.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/devpts/inode.c  2009-09-10 16:11:43.000000000 +0200
-@@ -19,12 +19,12 @@
+diff -NurpP --minimal linux-2.6.27.33/fs/devpts/inode.c linux-2.6.27.33-vs2.3.0.36.6/fs/devpts/inode.c
+--- linux-2.6.27.33/fs/devpts/inode.c  2008-10-13 14:52:05.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/devpts/inode.c     2008-10-13 14:54:20.000000000 +0200
+@@ -19,15 +19,29 @@
  #include <linux/tty.h>
  #include <linux/mutex.h>
  #include <linux/idr.h>
@@ -1974,10 +2155,6 @@ diff -NurpP --minimal linux-2.6.31/fs/devpts/inode.c linux-2.6.31-vs2.3.0.36.14-
 +#include <linux/vs_base.h>
  
  #define DEVPTS_DEFAULT_MODE 0600
- /*
-@@ -36,6 +36,20 @@
- #define DEVPTS_DEFAULT_PTMX_MODE 0000
- #define PTMX_MINOR    2
  
 +static int devpts_permission(struct inode *inode, int mask)
 +{
@@ -1994,9 +2171,9 @@ diff -NurpP --minimal linux-2.6.31/fs/devpts/inode.c linux-2.6.31-vs2.3.0.36.14-
 +};
 +
  extern int pty_limit;                 /* Config limit on Unix98 ptys */
+ static DEFINE_IDA(allocated_ptys);
  static DEFINE_MUTEX(allocated_ptys_lock);
-@@ -263,6 +277,25 @@ static int devpts_show_options(struct se
+@@ -112,6 +126,25 @@ static int devpts_show_options(struct se
        return 0;
  }
  
@@ -2022,13 +2199,8 @@ diff -NurpP --minimal linux-2.6.31/fs/devpts/inode.c linux-2.6.31-vs2.3.0.36.14-
  static const struct super_operations devpts_sops = {
        .statfs         = simple_statfs,
        .remount_fs     = devpts_remount,
-@@ -302,12 +335,15 @@ devpts_fill_super(struct super_block *s,
-       inode = new_inode(s);
-       if (!inode)
-               goto free_fsi;
-+
-       inode->i_ino = 1;
-       inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
+@@ -138,8 +171,10 @@ devpts_fill_super(struct super_block *s,
+       inode->i_uid = inode->i_gid = 0;
        inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR;
        inode->i_op = &simple_dir_inode_operations;
 -      inode->i_fop = &simple_dir_operations;
@@ -2037,33 +2209,33 @@ diff -NurpP --minimal linux-2.6.31/fs/devpts/inode.c linux-2.6.31-vs2.3.0.36.14-
 +      /* devpts is xid tagged */
 +      inode->i_tag = (tag_t)vx_current_xid();
  
-       s->s_root = d_alloc_root(inode);
+       devpts_root = s->s_root = d_alloc_root(inode);
        if (s->s_root)
-@@ -498,6 +534,9 @@ int devpts_pty_new(struct inode *ptmx_in
-       inode->i_gid = opts->setgid ? opts->gid : current_fsgid();
+@@ -232,6 +267,9 @@ int devpts_pty_new(struct tty_struct *tt
+       inode->i_gid = config.setgid ? config.gid : current->fsgid;
        inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
-       init_special_inode(inode, S_IFCHR|opts->mode, device);
+       init_special_inode(inode, S_IFCHR|config.mode, device);
 +      /* devpts is xid tagged */
 +      inode->i_tag = (tag_t)vx_current_xid();
 +      inode->i_op = &devpts_file_inode_operations;
        inode->i_private = tty;
-       tty->driver_data = inode;
  
-diff -NurpP --minimal linux-2.6.31/fs/exec.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/exec.c
---- linux-2.6.31/fs/exec.c     2009-09-10 15:26:21.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/exec.c  2009-09-10 16:11:43.000000000 +0200
-@@ -249,7 +249,9 @@ static int __bprm_mm_init(struct linux_b
-       if (err)
+       dentry = get_node(number);
+diff -NurpP --minimal linux-2.6.27.33/fs/exec.c linux-2.6.27.33-vs2.3.0.36.6/fs/exec.c
+--- linux-2.6.27.33/fs/exec.c  2009-09-13 16:16:58.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/exec.c     2009-05-15 22:57:04.000000000 +0200
+@@ -263,7 +263,9 @@ static int __bprm_mm_init(struct linux_b
                goto err;
+       }
  
 -      mm->stack_vm = mm->total_vm = 1;
 +      mm->total_vm = 0;
 +      vx_vmpages_inc(mm);
 +      mm->stack_vm = 1;
        up_write(&mm->mmap_sem);
        bprm->p = vma->vm_end - sizeof(void *);
-       return 0;
-@@ -1471,7 +1473,7 @@ static int format_corename(char *corenam
+@@ -1459,7 +1461,7 @@ static int format_corename(char *corenam
                        /* UNIX time of coredump */
                        case 't': {
                                struct timeval tv;
@@ -2072,10 +2244,27 @@ diff -NurpP --minimal linux-2.6.31/fs/exec.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/
                                rc = snprintf(out_ptr, out_end - out_ptr,
                                              "%lu", tv.tv_sec);
                                if (rc > out_end - out_ptr)
-diff -NurpP --minimal linux-2.6.31/fs/ext2/balloc.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext2/balloc.c
---- linux-2.6.31/fs/ext2/balloc.c      2009-06-11 17:13:03.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext2/balloc.c   2009-09-10 16:11:43.000000000 +0200
-@@ -701,7 +701,6 @@ ext2_try_to_allocate(struct super_block 
+diff -NurpP --minimal linux-2.6.27.33/fs/ext2/balloc.c linux-2.6.27.33-vs2.3.0.36.6/fs/ext2/balloc.c
+--- linux-2.6.27.33/fs/ext2/balloc.c   2009-09-13 16:16:58.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ext2/balloc.c      2009-02-03 17:59:04.000000000 +0100
+@@ -16,6 +16,8 @@
+ #include <linux/sched.h>
+ #include <linux/buffer_head.h>
+ #include <linux/capability.h>
++#include <linux/vs_dlimit.h>
++#include <linux/vs_tag.h>
+ /*
+  * balloc.c contains the blocks allocation and deallocation routines
+@@ -569,6 +571,7 @@ do_more:
+       }
+ error_return:
+       brelse(bitmap_bh);
++      DLIMIT_FREE_BLOCK(inode, freed);
+       release_blocks(sb, freed);
+       DQUOT_FREE_BLOCK(inode, freed);
+ }
+@@ -701,7 +704,6 @@ ext2_try_to_allocate(struct super_block 
                        start = 0;
                end = EXT2_BLOCKS_PER_GROUP(sb);
        }
@@ -2083,10 +2272,42 @@ diff -NurpP --minimal linux-2.6.31/fs/ext2/balloc.c linux-2.6.31-vs2.3.0.36.14-p
        BUG_ON(start > EXT2_BLOCKS_PER_GROUP(sb));
  
  repeat:
-diff -NurpP --minimal linux-2.6.31/fs/ext2/ext2.h linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext2/ext2.h
---- linux-2.6.31/fs/ext2/ext2.h        2009-09-10 15:26:21.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext2/ext2.h     2009-09-10 16:11:43.000000000 +0200
-@@ -163,6 +163,7 @@ extern const struct file_operations ext2
+@@ -1251,6 +1253,11 @@ ext2_fsblk_t ext2_new_blocks(struct inod
+               *errp = -EDQUOT;
+               return 0;
+       }
++      if (DLIMIT_ALLOC_BLOCK(inode, num)) {
++              *errp = -ENOSPC;
++              DQUOT_FREE_BLOCK(inode, num);
++              return 0;
++      }
+       sbi = EXT2_SB(sb);
+       es = EXT2_SB(sb)->s_es;
+@@ -1409,6 +1416,7 @@ allocated:
+       *errp = 0;
+       brelse(bitmap_bh);
++      DLIMIT_FREE_BLOCK(inode, *count-num);
+       DQUOT_FREE_BLOCK(inode, *count-num);
+       *count = num;
+       return ret_block;
+@@ -1419,8 +1427,10 @@ out:
+       /*
+        * Undo the block allocation
+        */
+-      if (!performed_allocation)
++      if (!performed_allocation) {
++              DLIMIT_FREE_BLOCK(inode, *count);
+               DQUOT_FREE_BLOCK(inode, *count);
++      }
+       brelse(bitmap_bh);
+       return 0;
+ }
+diff -NurpP --minimal linux-2.6.27.33/fs/ext2/ext2.h linux-2.6.27.33-vs2.3.0.36.6/fs/ext2/ext2.h
+--- linux-2.6.27.33/fs/ext2/ext2.h     2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ext2/ext2.h        2008-10-13 14:54:20.000000000 +0200
+@@ -168,6 +168,7 @@ extern const struct file_operations ext2
  extern const struct address_space_operations ext2_aops;
  extern const struct address_space_operations ext2_aops_xip;
  extern const struct address_space_operations ext2_nobh_aops;
@@ -2094,27 +2315,85 @@ diff -NurpP --minimal linux-2.6.31/fs/ext2/ext2.h linux-2.6.31-vs2.3.0.36.14-pre
  
  /* namei.c */
  extern const struct inode_operations ext2_dir_inode_operations;
-diff -NurpP --minimal linux-2.6.31/fs/ext2/file.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext2/file.c
---- linux-2.6.31/fs/ext2/file.c        2009-09-10 15:26:21.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext2/file.c     2009-09-10 16:11:43.000000000 +0200
-@@ -87,4 +87,5 @@ const struct inode_operations ext2_file_
+diff -NurpP --minimal linux-2.6.27.33/fs/ext2/file.c linux-2.6.27.33-vs2.3.0.36.6/fs/ext2/file.c
+--- linux-2.6.27.33/fs/ext2/file.c     2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ext2/file.c        2008-10-13 14:54:20.000000000 +0200
+@@ -86,4 +86,5 @@ const struct inode_operations ext2_file_
+ #endif
        .setattr        = ext2_setattr,
        .permission     = ext2_permission,
-       .fiemap         = ext2_fiemap,
 +      .sync_flags     = ext2_sync_flags,
  };
-diff -NurpP --minimal linux-2.6.31/fs/ext2/inode.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext2/inode.c
---- linux-2.6.31/fs/ext2/inode.c       2009-09-10 15:26:21.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext2/inode.c    2009-09-10 16:11:43.000000000 +0200
-@@ -33,6 +33,7 @@
+diff -NurpP --minimal linux-2.6.27.33/fs/ext2/ialloc.c linux-2.6.27.33-vs2.3.0.36.6/fs/ext2/ialloc.c
+--- linux-2.6.27.33/fs/ext2/ialloc.c   2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ext2/ialloc.c      2008-10-13 14:54:20.000000000 +0200
+@@ -17,6 +17,8 @@
+ #include <linux/backing-dev.h>
+ #include <linux/buffer_head.h>
+ #include <linux/random.h>
++#include <linux/vs_dlimit.h>
++#include <linux/vs_tag.h>
+ #include "ext2.h"
+ #include "xattr.h"
+ #include "acl.h"
+@@ -123,6 +125,7 @@ void ext2_free_inode (struct inode * ino
+               ext2_xattr_delete_inode(inode);
+               DQUOT_FREE_INODE(inode);
+               DQUOT_DROP(inode);
++              DLIMIT_FREE_INODE(inode);
+       }
+       es = EXT2_SB(sb)->s_es;
+@@ -454,6 +457,11 @@ struct inode *ext2_new_inode(struct inod
+       if (!inode)
+               return ERR_PTR(-ENOMEM);
++      inode->i_tag = dx_current_fstag(sb);
++      if (DLIMIT_ALLOC_INODE(inode)) {
++              err = -ENOSPC;
++              goto fail_dlim;
++      }
+       ei = EXT2_I(inode);
+       sbi = EXT2_SB(sb);
+       es = sbi->s_es;
+@@ -565,7 +573,8 @@ got:
+       inode->i_blocks = 0;
+       inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
+       memset(ei->i_data, 0, sizeof(ei->i_data));
+-      ei->i_flags = EXT2_I(dir)->i_flags & ~EXT2_BTREE_FL;
++      ei->i_flags = EXT2_I(dir)->i_flags &
++              ~(EXT2_BTREE_FL|EXT2_IXUNLINK_FL|EXT2_BARRIER_FL);
+       if (S_ISLNK(mode))
+               ei->i_flags &= ~(EXT2_IMMUTABLE_FL|EXT2_APPEND_FL);
+       /* dirsync is only applied to directories */
+@@ -610,12 +619,15 @@ fail_free_drop:
+ fail_drop:
+       DQUOT_DROP(inode);
++      DLIMIT_FREE_INODE(inode);
+       inode->i_flags |= S_NOQUOTA;
+       inode->i_nlink = 0;
+       iput(inode);
+       return ERR_PTR(err);
+ fail:
++      DLIMIT_FREE_INODE(inode);
++fail_dlim:
+       make_bad_inode(inode);
+       iput(inode);
+       return ERR_PTR(err);
+diff -NurpP --minimal linux-2.6.27.33/fs/ext2/inode.c linux-2.6.27.33-vs2.3.0.36.6/fs/ext2/inode.c
+--- linux-2.6.27.33/fs/ext2/inode.c    2008-10-13 14:52:05.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ext2/inode.c       2008-10-13 14:54:20.000000000 +0200
+@@ -31,6 +31,7 @@
+ #include <linux/writeback.h>
+ #include <linux/buffer_head.h>
  #include <linux/mpage.h>
- #include <linux/fiemap.h>
- #include <linux/namei.h>
 +#include <linux/vs_tag.h>
  #include "ext2.h"
  #include "acl.h"
  #include "xip.h"
-@@ -1038,7 +1039,7 @@ void ext2_truncate(struct inode *inode)
+@@ -1011,7 +1012,7 @@ void ext2_truncate(struct inode *inode)
                return;
        if (ext2_inode_is_fast_symlink(inode))
                return;
@@ -2123,7 +2402,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ext2/inode.c linux-2.6.31-vs2.3.0.36.14-pr
                return;
  
        blocksize = inode->i_sb->s_blocksize;
-@@ -1176,38 +1177,72 @@ void ext2_set_inode_flags(struct inode *
+@@ -1149,38 +1150,72 @@ void ext2_set_inode_flags(struct inode *
  {
        unsigned int flags = EXT2_I(inode)->i_flags;
  
@@ -2203,7 +2482,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ext2/inode.c linux-2.6.31-vs2.3.0.36.14-pr
  struct inode *ext2_iget (struct super_block *sb, unsigned long ino)
  {
        struct ext2_inode_info *ei;
-@@ -1215,6 +1250,8 @@ struct inode *ext2_iget (struct super_bl
+@@ -1188,6 +1223,8 @@ struct inode *ext2_iget (struct super_bl
        struct ext2_inode *raw_inode;
        struct inode *inode;
        long ret = -EIO;
@@ -2212,7 +2491,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ext2/inode.c linux-2.6.31-vs2.3.0.36.14-pr
        int n;
  
        inode = iget_locked(sb, ino);
-@@ -1233,12 +1270,17 @@ struct inode *ext2_iget (struct super_bl
+@@ -1210,12 +1247,17 @@ struct inode *ext2_iget (struct super_bl
        }
  
        inode->i_mode = le16_to_cpu(raw_inode->i_mode);
@@ -2234,7 +2513,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ext2/inode.c linux-2.6.31-vs2.3.0.36.14-pr
        inode->i_nlink = le16_to_cpu(raw_inode->i_links_count);
        inode->i_size = le32_to_cpu(raw_inode->i_size);
        inode->i_atime.tv_sec = (signed)le32_to_cpu(raw_inode->i_atime);
-@@ -1336,8 +1378,8 @@ int ext2_write_inode(struct inode *inode
+@@ -1311,8 +1353,8 @@ static int ext2_update_inode(struct inod
        struct ext2_inode_info *ei = EXT2_I(inode);
        struct super_block *sb = inode->i_sb;
        ino_t ino = inode->i_ino;
@@ -2245,7 +2524,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ext2/inode.c linux-2.6.31-vs2.3.0.36.14-pr
        struct buffer_head * bh;
        struct ext2_inode * raw_inode = ext2_get_inode(sb, ino, &bh);
        int n;
-@@ -1373,6 +1415,9 @@ int ext2_write_inode(struct inode *inode
+@@ -1348,6 +1390,9 @@ static int ext2_update_inode(struct inod
                raw_inode->i_uid_high = 0;
                raw_inode->i_gid_high = 0;
        }
@@ -2255,22 +2534,30 @@ diff -NurpP --minimal linux-2.6.31/fs/ext2/inode.c linux-2.6.31-vs2.3.0.36.14-pr
        raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
        raw_inode->i_size = cpu_to_le32(inode->i_size);
        raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec);
-@@ -1454,7 +1499,8 @@ int ext2_setattr(struct dentry *dentry, 
+@@ -1434,7 +1479,8 @@ int ext2_setattr(struct dentry *dentry, 
        if (error)
                return error;
        if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
 -          (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
 +          (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid) ||
 +          (iattr->ia_valid & ATTR_TAG && iattr->ia_tag != inode->i_tag)) {
-               error = vfs_dq_transfer(inode, iattr) ? -EDQUOT : 0;
+               error = DQUOT_TRANSFER(inode, iattr) ? -EDQUOT : 0;
                if (error)
                        return error;
-diff -NurpP --minimal linux-2.6.31/fs/ext2/ioctl.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext2/ioctl.c
---- linux-2.6.31/fs/ext2/ioctl.c       2009-09-10 15:26:21.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext2/ioctl.c    2009-09-10 16:11:43.000000000 +0200
-@@ -51,6 +51,11 @@ long ext2_ioctl(struct file *filp, unsig
+diff -NurpP --minimal linux-2.6.27.33/fs/ext2/ioctl.c linux-2.6.27.33-vs2.3.0.36.6/fs/ext2/ioctl.c
+--- linux-2.6.27.33/fs/ext2/ioctl.c    2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ext2/ioctl.c       2008-10-13 14:54:20.000000000 +0200
+@@ -14,6 +14,7 @@
+ #include <linux/compat.h>
+ #include <linux/mount.h>
+ #include <linux/smp_lock.h>
++#include <linux/mount.h>
+ #include <asm/current.h>
+ #include <asm/uaccess.h>
  
-               flags = ext2_mask_flags(inode->i_mode, flags);
+@@ -53,6 +54,11 @@ long ext2_ioctl(struct file *filp, unsig
+               if (!S_ISDIR(inode->i_mode))
+                       flags &= ~EXT2_DIRSYNC_FL;
  
 +              if (IS_BARRIER(inode)) {
 +                      vxwprintk_task(1, "messing with the barrier.");
@@ -2280,7 +2567,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ext2/ioctl.c linux-2.6.31-vs2.3.0.36.14-pr
                mutex_lock(&inode->i_mutex);
                /* Is it quota file? Do not allow user to mess with it */
                if (IS_NOQUOTA(inode)) {
-@@ -66,7 +71,9 @@ long ext2_ioctl(struct file *filp, unsig
+@@ -68,7 +74,9 @@ long ext2_ioctl(struct file *filp, unsig
                 *
                 * This test looks nicer. Thanks to Pauline Middelink
                 */
@@ -2291,9 +2578,9 @@ diff -NurpP --minimal linux-2.6.31/fs/ext2/ioctl.c linux-2.6.31-vs2.3.0.36.14-pr
                        if (!capable(CAP_LINUX_IMMUTABLE)) {
                                mutex_unlock(&inode->i_mutex);
                                ret = -EPERM;
-diff -NurpP --minimal linux-2.6.31/fs/ext2/namei.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext2/namei.c
---- linux-2.6.31/fs/ext2/namei.c       2009-09-10 15:26:21.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext2/namei.c    2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/ext2/namei.c linux-2.6.27.33-vs2.3.0.36.6/fs/ext2/namei.c
+--- linux-2.6.27.33/fs/ext2/namei.c    2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ext2/namei.c       2008-10-13 14:54:20.000000000 +0200
 @@ -31,6 +31,7 @@
   */
  
@@ -2302,15 +2589,15 @@ diff -NurpP --minimal linux-2.6.31/fs/ext2/namei.c linux-2.6.31-vs2.3.0.36.14-pr
  #include "ext2.h"
  #include "xattr.h"
  #include "acl.h"
-@@ -74,6 +75,7 @@ static struct dentry *ext2_lookup(struct
-                               return ERR_PTR(-EIO);
-                       } else {
-                               return ERR_CAST(inode);
+@@ -66,6 +67,7 @@ static struct dentry *ext2_lookup(struct
+               inode = ext2_iget(dir->i_sb, ino);
+               if (IS_ERR(inode))
+                       return ERR_CAST(inode);
 +              dx_propagate_tag(nd, inode);
-                       }
-               }
        }
-@@ -401,6 +403,7 @@ const struct inode_operations ext2_dir_i
+       return d_splice_alias(inode, dentry);
+ }
+@@ -391,6 +393,7 @@ const struct inode_operations ext2_dir_i
  #endif
        .setattr        = ext2_setattr,
        .permission     = ext2_permission,
@@ -2318,16 +2605,16 @@ diff -NurpP --minimal linux-2.6.31/fs/ext2/namei.c linux-2.6.31-vs2.3.0.36.14-pr
  };
  
  const struct inode_operations ext2_special_inode_operations = {
-@@ -412,4 +415,5 @@ const struct inode_operations ext2_speci
+@@ -402,4 +405,5 @@ const struct inode_operations ext2_speci
  #endif
        .setattr        = ext2_setattr,
        .permission     = ext2_permission,
 +      .sync_flags     = ext2_sync_flags,
  };
-diff -NurpP --minimal linux-2.6.31/fs/ext2/super.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext2/super.c
---- linux-2.6.31/fs/ext2/super.c       2009-09-10 15:26:21.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext2/super.c    2009-09-10 16:11:43.000000000 +0200
-@@ -382,7 +382,8 @@ enum {
+diff -NurpP --minimal linux-2.6.27.33/fs/ext2/super.c linux-2.6.27.33-vs2.3.0.36.6/fs/ext2/super.c
+--- linux-2.6.27.33/fs/ext2/super.c    2009-09-13 16:16:58.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ext2/super.c       2009-02-22 22:58:32.000000000 +0100
+@@ -390,7 +390,8 @@ enum {
        Opt_err_ro, Opt_nouid32, Opt_nocheck, Opt_debug,
        Opt_oldalloc, Opt_orlov, Opt_nobh, Opt_user_xattr, Opt_nouser_xattr,
        Opt_acl, Opt_noacl, Opt_xip, Opt_ignore, Opt_err, Opt_quota,
@@ -2336,8 +2623,8 @@ diff -NurpP --minimal linux-2.6.31/fs/ext2/super.c linux-2.6.31-vs2.3.0.36.14-pr
 +      Opt_tag, Opt_notag, Opt_tagid
  };
  
- static const match_table_t tokens = {
-@@ -410,6 +411,9 @@ static const match_table_t tokens = {
+ static match_table_t tokens = {
+@@ -418,6 +419,9 @@ static match_table_t tokens = {
        {Opt_acl, "acl"},
        {Opt_noacl, "noacl"},
        {Opt_xip, "xip"},
@@ -2347,7 +2634,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ext2/super.c linux-2.6.31-vs2.3.0.36.14-pr
        {Opt_grpquota, "grpquota"},
        {Opt_ignore, "noquota"},
        {Opt_quota, "quota"},
-@@ -480,6 +484,20 @@ static int parse_options (char * options
+@@ -488,6 +492,20 @@ static int parse_options (char * options
                case Opt_nouid32:
                        set_opt (sbi->s_mount_opt, NO_UID32);
                        break;
@@ -2368,7 +2655,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ext2/super.c linux-2.6.31-vs2.3.0.36.14-pr
                case Opt_nocheck:
                        clear_opt (sbi->s_mount_opt, CHECK);
                        break;
-@@ -829,6 +847,8 @@ static int ext2_fill_super(struct super_
+@@ -830,6 +848,8 @@ static int ext2_fill_super(struct super_
        if (!parse_options ((char *) data, sbi))
                goto failed_mount;
  
@@ -2377,7 +2664,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ext2/super.c linux-2.6.31-vs2.3.0.36.14-pr
        sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
                ((EXT2_SB(sb)->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ?
                 MS_POSIXACL : 0);
-@@ -1175,6 +1195,13 @@ static int ext2_remount (struct super_bl
+@@ -1162,6 +1182,13 @@ static int ext2_remount (struct super_bl
                goto restore_opts;
        }
  
@@ -2391,9 +2678,9 @@ diff -NurpP --minimal linux-2.6.31/fs/ext2/super.c linux-2.6.31-vs2.3.0.36.14-pr
        sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
                ((sbi->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0);
  
-diff -NurpP --minimal linux-2.6.31/fs/ext2/symlink.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext2/symlink.c
---- linux-2.6.31/fs/ext2/symlink.c     2008-12-25 00:26:37.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext2/symlink.c  2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/ext2/symlink.c linux-2.6.27.33-vs2.3.0.36.6/fs/ext2/symlink.c
+--- linux-2.6.27.33/fs/ext2/symlink.c  2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ext2/symlink.c     2008-10-13 14:54:20.000000000 +0200
 @@ -38,6 +38,7 @@ const struct inode_operations ext2_symli
        .listxattr      = ext2_listxattr,
        .removexattr    = generic_removexattr,
@@ -2408,37 +2695,246 @@ diff -NurpP --minimal linux-2.6.31/fs/ext2/symlink.c linux-2.6.31-vs2.3.0.36.14-
  #endif
 +      .sync_flags     = ext2_sync_flags,
  };
-diff -NurpP --minimal linux-2.6.31/fs/ext3/file.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext3/file.c
---- linux-2.6.31/fs/ext3/file.c        2009-06-11 17:13:03.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext3/file.c     2009-09-10 16:11:43.000000000 +0200
-@@ -139,5 +139,6 @@ const struct inode_operations ext3_file_
- #endif
-       .permission     = ext3_permission,
-       .fiemap         = ext3_fiemap,
-+      .sync_flags     = ext3_sync_flags,
- };
-diff -NurpP --minimal linux-2.6.31/fs/ext3/inode.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext3/inode.c
---- linux-2.6.31/fs/ext3/inode.c       2009-09-10 15:26:21.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext3/inode.c    2009-09-10 16:11:43.000000000 +0200
-@@ -38,6 +38,7 @@
- #include <linux/bio.h>
- #include <linux/fiemap.h>
- #include <linux/namei.h>
-+#include <linux/vs_tag.h>
+diff -NurpP --minimal linux-2.6.27.33/fs/ext2/xattr.c linux-2.6.27.33-vs2.3.0.36.6/fs/ext2/xattr.c
+--- linux-2.6.27.33/fs/ext2/xattr.c    2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ext2/xattr.c       2008-10-13 14:54:20.000000000 +0200
+@@ -60,6 +60,7 @@
+ #include <linux/mbcache.h>
+ #include <linux/quotaops.h>
+ #include <linux/rwsem.h>
++#include <linux/vs_dlimit.h>
+ #include "ext2.h"
  #include "xattr.h"
  #include "acl.h"
+@@ -641,8 +642,12 @@ ext2_xattr_set2(struct inode *inode, str
+                                  the inode.  */
+                               ea_bdebug(new_bh, "reusing block");
++                              error = -ENOSPC;
++                              if (DLIMIT_ALLOC_BLOCK(inode, 1))
++                                      goto cleanup;
+                               error = -EDQUOT;
+                               if (DQUOT_ALLOC_BLOCK(inode, 1)) {
++                                      DLIMIT_FREE_BLOCK(inode, 1);
+                                       unlock_buffer(new_bh);
+                                       goto cleanup;
+                               }
+@@ -731,6 +736,7 @@ ext2_xattr_set2(struct inode *inode, str
+                       le32_add_cpu(&HDR(old_bh)->h_refcount, -1);
+                       if (ce)
+                               mb_cache_entry_release(ce);
++                      DLIMIT_FREE_BLOCK(inode, 1);
+                       DQUOT_FREE_BLOCK(inode, 1);
+                       mark_buffer_dirty(old_bh);
+                       ea_bdebug(old_bh, "refcount now=%d",
+@@ -794,6 +800,7 @@ ext2_xattr_delete_inode(struct inode *in
+               mark_buffer_dirty(bh);
+               if (IS_SYNC(inode))
+                       sync_dirty_buffer(bh);
++              DLIMIT_FREE_BLOCK(inode, 1);
+               DQUOT_FREE_BLOCK(inode, 1);
+       }
+       EXT2_I(inode)->i_file_acl = 0;
+diff -NurpP --minimal linux-2.6.27.33/fs/ext3/balloc.c linux-2.6.27.33-vs2.3.0.36.6/fs/ext3/balloc.c
+--- linux-2.6.27.33/fs/ext3/balloc.c   2009-09-13 16:16:58.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ext3/balloc.c      2009-07-21 16:41:09.000000000 +0200
+@@ -19,6 +19,8 @@
+ #include <linux/ext3_jbd.h>
+ #include <linux/quotaops.h>
+ #include <linux/buffer_head.h>
++#include <linux/vs_dlimit.h>
++#include <linux/vs_tag.h>
  
-@@ -2312,7 +2313,7 @@ static void ext3_free_branches(handle_t 
+ /*
+  * balloc.c contains the blocks allocation and deallocation routines
+@@ -675,8 +677,10 @@ void ext3_free_blocks(handle_t *handle, 
+               return;
+       }
+       ext3_free_blocks_sb(handle, sb, block, count, &dquot_freed_blocks);
+-      if (dquot_freed_blocks)
++      if (dquot_freed_blocks) {
++              DLIMIT_FREE_BLOCK(inode, dquot_freed_blocks);
+               DQUOT_FREE_BLOCK(inode, dquot_freed_blocks);
++      }
+       return;
+ }
  
- int ext3_can_truncate(struct inode *inode)
- {
+@@ -1415,18 +1419,33 @@ out:
+  *
+  * Check if filesystem has at least 1 free block available for allocation.
+  */
+-static int ext3_has_free_blocks(struct ext3_sb_info *sbi)
++static int ext3_has_free_blocks(struct super_block *sb)
+ {
+-      ext3_fsblk_t free_blocks, root_blocks;
++      struct ext3_sb_info *sbi = EXT3_SB(sb);
++      unsigned long long free_blocks, root_blocks;
++      int cond;
+       free_blocks = percpu_counter_read_positive(&sbi->s_freeblocks_counter);
+       root_blocks = le32_to_cpu(sbi->s_es->s_r_blocks_count);
+-      if (free_blocks < root_blocks + 1 && !capable(CAP_SYS_RESOURCE) &&
++
++      vxdprintk(VXD_CBIT(dlim, 3),
++              "ext3_has_free_blocks(%p): free=%llu, root=%llu",
++              sb, free_blocks, root_blocks);
++
++      DLIMIT_ADJUST_BLOCK(sb, dx_current_tag(), &free_blocks, &root_blocks);
++
++      cond = (free_blocks < root_blocks + 1 &&
++              !capable(CAP_SYS_RESOURCE) &&
+               sbi->s_resuid != current->fsuid &&
+-              (sbi->s_resgid == 0 || !in_group_p (sbi->s_resgid))) {
+-              return 0;
+-      }
+-      return 1;
++              (sbi->s_resgid == 0 || !in_group_p (sbi->s_resgid)));
++
++      vxdprintk(VXD_CBIT(dlim, 3),
++              "ext3_has_free_blocks(%p): %llu<%llu+1, %c, %u!=%u r=%d",
++              sb, free_blocks, root_blocks,
++              !capable(CAP_SYS_RESOURCE)?'1':'0',
++              sbi->s_resuid, current->fsuid, cond?0:1);
++
++      return (cond ? 0 : 1);
+ }
+ /**
+@@ -1443,7 +1462,7 @@ static int ext3_has_free_blocks(struct e
+  */
+ int ext3_should_retry_alloc(struct super_block *sb, int *retries)
+ {
+-      if (!ext3_has_free_blocks(EXT3_SB(sb)) || (*retries)++ > 3)
++      if (!ext3_has_free_blocks(sb) || (*retries)++ > 3)
+               return 0;
+       jbd_debug(1, "%s: retrying operation after ENOSPC\n", sb->s_id);
+@@ -1506,6 +1525,8 @@ ext3_fsblk_t ext3_new_blocks(handle_t *h
+               *errp = -EDQUOT;
+               return 0;
+       }
++      if (DLIMIT_ALLOC_BLOCK(inode, num))
++          goto out_dlimit;
+       sbi = EXT3_SB(sb);
+       es = EXT3_SB(sb)->s_es;
+@@ -1522,7 +1543,7 @@ ext3_fsblk_t ext3_new_blocks(handle_t *h
+       if (block_i && ((windowsz = block_i->rsv_window_node.rsv_goal_size) > 0))
+               my_rsv = &block_i->rsv_window_node;
+-      if (!ext3_has_free_blocks(sbi)) {
++      if (!ext3_has_free_blocks(sb)) {
+               *errp = -ENOSPC;
+               goto out;
+       }
+@@ -1715,12 +1736,16 @@ allocated:
+       *errp = 0;
+       brelse(bitmap_bh);
+       DQUOT_FREE_BLOCK(inode, *count-num);
++      DLIMIT_FREE_BLOCK(inode, *count-num);
+       *count = num;
+       return ret_block;
+ io_error:
+       *errp = -EIO;
+ out:
++      if (!performed_allocation)
++              DLIMIT_FREE_BLOCK(inode, *count);
++out_dlimit:
+       if (fatal) {
+               *errp = fatal;
+               ext3_std_error(sb, fatal);
+diff -NurpP --minimal linux-2.6.27.33/fs/ext3/file.c linux-2.6.27.33-vs2.3.0.36.6/fs/ext3/file.c
+--- linux-2.6.27.33/fs/ext3/file.c     2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ext3/file.c        2008-10-13 14:54:20.000000000 +0200
+@@ -134,5 +134,6 @@ const struct inode_operations ext3_file_
+       .removexattr    = generic_removexattr,
+ #endif
+       .permission     = ext3_permission,
++      .sync_flags     = ext3_sync_flags,
+ };
+diff -NurpP --minimal linux-2.6.27.33/fs/ext3/ialloc.c linux-2.6.27.33-vs2.3.0.36.6/fs/ext3/ialloc.c
+--- linux-2.6.27.33/fs/ext3/ialloc.c   2008-10-13 14:52:05.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ext3/ialloc.c      2008-10-13 14:54:20.000000000 +0200
+@@ -23,6 +23,8 @@
+ #include <linux/buffer_head.h>
+ #include <linux/random.h>
+ #include <linux/bitops.h>
++#include <linux/vs_dlimit.h>
++#include <linux/vs_tag.h>
+ #include <asm/byteorder.h>
+@@ -127,6 +129,7 @@ void ext3_free_inode (handle_t *handle, 
+       ext3_xattr_delete_inode(handle, inode);
+       DQUOT_FREE_INODE(inode);
+       DQUOT_DROP(inode);
++      DLIMIT_FREE_INODE(inode);
+       is_directory = S_ISDIR(inode->i_mode);
+@@ -440,6 +443,12 @@ struct inode *ext3_new_inode(handle_t *h
+       inode = new_inode(sb);
+       if (!inode)
+               return ERR_PTR(-ENOMEM);
++
++      inode->i_tag = dx_current_fstag(sb);
++      if (DLIMIT_ALLOC_INODE(inode)) {
++              err = -ENOSPC;
++              goto out_dlimit;
++      }
+       ei = EXT3_I(inode);
+       sbi = EXT3_SB(sb);
+@@ -559,7 +568,8 @@ got:
+       ei->i_dir_start_lookup = 0;
+       ei->i_disksize = 0;
+-      ei->i_flags = EXT3_I(dir)->i_flags & ~EXT3_INDEX_FL;
++      ei->i_flags = EXT3_I(dir)->i_flags &
++              ~(EXT3_INDEX_FL|EXT3_IXUNLINK_FL|EXT3_BARRIER_FL);
+       if (S_ISLNK(mode))
+               ei->i_flags &= ~(EXT3_IMMUTABLE_FL|EXT3_APPEND_FL);
+       /* dirsync only applies to directories */
+@@ -614,6 +624,8 @@ got:
+ fail:
+       ext3_std_error(sb, err);
+ out:
++      DLIMIT_FREE_INODE(inode);
++out_dlimit:
+       iput(inode);
+       ret = ERR_PTR(err);
+ really_out:
+@@ -625,6 +637,7 @@ fail_free_drop:
+ fail_drop:
+       DQUOT_DROP(inode);
++      DLIMIT_FREE_INODE(inode);
+       inode->i_flags |= S_NOQUOTA;
+       inode->i_nlink = 0;
+       iput(inode);
+diff -NurpP --minimal linux-2.6.27.33/fs/ext3/inode.c linux-2.6.27.33-vs2.3.0.36.6/fs/ext3/inode.c
+--- linux-2.6.27.33/fs/ext3/inode.c    2009-09-13 16:16:58.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ext3/inode.c       2009-02-03 17:59:04.000000000 +0100
+@@ -36,6 +36,7 @@
+ #include <linux/mpage.h>
+ #include <linux/uio.h>
+ #include <linux/bio.h>
++#include <linux/vs_tag.h>
+ #include "xattr.h"
+ #include "acl.h"
+@@ -2272,7 +2273,7 @@ static void ext3_free_branches(handle_t 
+ int ext3_can_truncate(struct inode *inode)
+ {
 -      if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
 +      if (IS_APPEND(inode) || IS_IXORUNLINK(inode))
                return 0;
        if (S_ISREG(inode->i_mode))
                return 1;
-@@ -2697,36 +2698,84 @@ void ext3_set_inode_flags(struct inode *
+@@ -2646,36 +2647,84 @@ void ext3_set_inode_flags(struct inode *
  {
        unsigned int flags = EXT3_I(inode)->i_flags;
  
@@ -2530,7 +3026,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ext3/inode.c linux-2.6.31-vs2.3.0.36.14-pr
  }
  
  struct inode *ext3_iget(struct super_block *sb, unsigned long ino)
-@@ -2738,6 +2787,8 @@ struct inode *ext3_iget(struct super_blo
+@@ -2687,6 +2736,8 @@ struct inode *ext3_iget(struct super_blo
        struct inode *inode;
        long ret;
        int block;
@@ -2539,7 +3035,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ext3/inode.c linux-2.6.31-vs2.3.0.36.14-pr
  
        inode = iget_locked(sb, ino);
        if (!inode)
-@@ -2754,12 +2805,17 @@ struct inode *ext3_iget(struct super_blo
+@@ -2707,12 +2758,17 @@ struct inode *ext3_iget(struct super_blo
        bh = iloc.bh;
        raw_inode = ext3_raw_inode(&iloc);
        inode->i_mode = le16_to_cpu(raw_inode->i_mode);
@@ -2561,7 +3057,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ext3/inode.c linux-2.6.31-vs2.3.0.36.14-pr
        inode->i_nlink = le16_to_cpu(raw_inode->i_links_count);
        inode->i_size = le32_to_cpu(raw_inode->i_size);
        inode->i_atime.tv_sec = (signed)le32_to_cpu(raw_inode->i_atime);
-@@ -2890,6 +2946,8 @@ static int ext3_do_update_inode(handle_t
+@@ -2841,6 +2897,8 @@ static int ext3_do_update_inode(handle_t
        struct ext3_inode *raw_inode = ext3_raw_inode(iloc);
        struct ext3_inode_info *ei = EXT3_I(inode);
        struct buffer_head *bh = iloc->bh;
@@ -2570,7 +3066,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ext3/inode.c linux-2.6.31-vs2.3.0.36.14-pr
        int err = 0, rc, block;
  
        /* For fields not not tracking in the in-memory inode,
-@@ -2900,29 +2958,32 @@ static int ext3_do_update_inode(handle_t
+@@ -2851,29 +2909,32 @@ static int ext3_do_update_inode(handle_t
        ext3_get_inode_flags(ei);
        raw_inode->i_mode = cpu_to_le16(inode->i_mode);
        if(!(test_opt(inode->i_sb, NO_UID32))) {
@@ -2609,7 +3105,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ext3/inode.c linux-2.6.31-vs2.3.0.36.14-pr
        raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
        raw_inode->i_size = cpu_to_le32(ei->i_disksize);
        raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec);
-@@ -3074,7 +3135,8 @@ int ext3_setattr(struct dentry *dentry, 
+@@ -3026,7 +3087,8 @@ int ext3_setattr(struct dentry *dentry, 
                return error;
  
        if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
@@ -2619,7 +3115,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ext3/inode.c linux-2.6.31-vs2.3.0.36.14-pr
                handle_t *handle;
  
                /* (user+group)*(old+new) structure, inode write (sb,
-@@ -3096,6 +3158,8 @@ int ext3_setattr(struct dentry *dentry, 
+@@ -3048,6 +3110,8 @@ int ext3_setattr(struct dentry *dentry, 
                        inode->i_uid = attr->ia_uid;
                if (attr->ia_valid & ATTR_GID)
                        inode->i_gid = attr->ia_gid;
@@ -2628,9 +3124,9 @@ diff -NurpP --minimal linux-2.6.31/fs/ext3/inode.c linux-2.6.31-vs2.3.0.36.14-pr
                error = ext3_mark_inode_dirty(handle, inode);
                ext3_journal_stop(handle);
        }
-diff -NurpP --minimal linux-2.6.31/fs/ext3/ioctl.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext3/ioctl.c
---- linux-2.6.31/fs/ext3/ioctl.c       2009-06-11 17:13:03.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext3/ioctl.c    2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/ext3/ioctl.c linux-2.6.27.33-vs2.3.0.36.6/fs/ext3/ioctl.c
+--- linux-2.6.27.33/fs/ext3/ioctl.c    2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ext3/ioctl.c       2008-10-13 14:54:20.000000000 +0200
 @@ -8,6 +8,7 @@
   */
  
@@ -2639,17 +3135,17 @@ diff -NurpP --minimal linux-2.6.31/fs/ext3/ioctl.c linux-2.6.31-vs2.3.0.36.14-pr
  #include <linux/jbd.h>
  #include <linux/capability.h>
  #include <linux/ext3_fs.h>
-@@ -15,6 +16,7 @@
- #include <linux/mount.h>
+@@ -16,6 +17,7 @@
  #include <linux/time.h>
  #include <linux/compat.h>
+ #include <linux/smp_lock.h>
 +#include <linux/vs_tag.h>
  #include <asm/uaccess.h>
  
- long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
-@@ -50,6 +52,11 @@ long ext3_ioctl(struct file *filp, unsig
-               flags = ext3_mask_flags(inode->i_mode, flags);
+ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
+@@ -56,6 +58,11 @@ int ext3_ioctl (struct inode * inode, st
+               if (!S_ISDIR(inode->i_mode))
+                       flags &= ~EXT3_DIRSYNC_FL;
  
 +              if (IS_BARRIER(inode)) {
 +                      vxwprintk_task(1, "messing with the barrier.");
@@ -2657,9 +3153,9 @@ diff -NurpP --minimal linux-2.6.31/fs/ext3/ioctl.c linux-2.6.31-vs2.3.0.36.14-pr
 +              }
 +
                mutex_lock(&inode->i_mutex);
                /* Is it quota file? Do not allow user to mess with it */
-@@ -68,7 +75,9 @@ long ext3_ioctl(struct file *filp, unsig
+               if (IS_NOQUOTA(inode)) {
+@@ -74,7 +81,9 @@ int ext3_ioctl (struct inode * inode, st
                 *
                 * This test looks nicer. Thanks to Pauline Middelink
                 */
@@ -2667,12 +3163,12 @@ diff -NurpP --minimal linux-2.6.31/fs/ext3/ioctl.c linux-2.6.31-vs2.3.0.36.14-pr
 +              if ((oldflags & EXT3_IMMUTABLE_FL) ||
 +                      ((flags ^ oldflags) & (EXT3_APPEND_FL |
 +                      EXT3_IMMUTABLE_FL | EXT3_IXUNLINK_FL))) {
-                       if (!capable(CAP_LINUX_IMMUTABLE))
-                               goto flags_out;
-               }
-diff -NurpP --minimal linux-2.6.31/fs/ext3/namei.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext3/namei.c
---- linux-2.6.31/fs/ext3/namei.c       2009-06-11 17:13:03.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext3/namei.c    2009-09-10 16:11:43.000000000 +0200
+                       if (!capable(CAP_LINUX_IMMUTABLE)) {
+                               mutex_unlock(&inode->i_mutex);
+                               err = -EPERM;
+diff -NurpP --minimal linux-2.6.27.33/fs/ext3/namei.c linux-2.6.27.33-vs2.3.0.36.6/fs/ext3/namei.c
+--- linux-2.6.27.33/fs/ext3/namei.c    2009-09-13 16:16:58.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ext3/namei.c       2009-02-03 18:03:38.000000000 +0100
 @@ -36,6 +36,7 @@
  #include <linux/quotaops.h>
  #include <linux/buffer_head.h>
@@ -2689,7 +3185,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ext3/namei.c linux-2.6.31-vs2.3.0.36.14-pr
                }
                if ((bh = bh_use[ra_ptr++]) == NULL)
                        goto next;
-@@ -2446,6 +2448,7 @@ const struct inode_operations ext3_dir_i
+@@ -2433,6 +2435,7 @@ const struct inode_operations ext3_dir_i
        .removexattr    = generic_removexattr,
  #endif
        .permission     = ext3_permission,
@@ -2697,16 +3193,16 @@ diff -NurpP --minimal linux-2.6.31/fs/ext3/namei.c linux-2.6.31-vs2.3.0.36.14-pr
  };
  
  const struct inode_operations ext3_special_inode_operations = {
-@@ -2457,4 +2460,5 @@ const struct inode_operations ext3_speci
+@@ -2444,4 +2447,5 @@ const struct inode_operations ext3_speci
        .removexattr    = generic_removexattr,
  #endif
        .permission     = ext3_permission,
 +      .sync_flags     = ext3_sync_flags,
  };
-diff -NurpP --minimal linux-2.6.31/fs/ext3/super.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext3/super.c
---- linux-2.6.31/fs/ext3/super.c       2009-09-10 15:26:21.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext3/super.c    2009-09-10 16:11:43.000000000 +0200
-@@ -787,7 +787,7 @@ enum {
+diff -NurpP --minimal linux-2.6.27.33/fs/ext3/super.c linux-2.6.27.33-vs2.3.0.36.6/fs/ext3/super.c
+--- linux-2.6.27.33/fs/ext3/super.c    2009-09-13 16:16:58.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ext3/super.c       2009-02-03 17:59:04.000000000 +0100
+@@ -757,7 +757,7 @@ enum {
        Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
        Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_quota, Opt_noquota,
        Opt_ignore, Opt_barrier, Opt_err, Opt_resize, Opt_usrquota,
@@ -2714,8 +3210,8 @@ diff -NurpP --minimal linux-2.6.31/fs/ext3/super.c linux-2.6.31-vs2.3.0.36.14-pr
 +      Opt_grpquota, Opt_tag, Opt_notag, Opt_tagid
  };
  
- static const match_table_t tokens = {
-@@ -840,6 +840,9 @@ static const match_table_t tokens = {
+ static match_table_t tokens = {
+@@ -808,6 +808,9 @@ static match_table_t tokens = {
        {Opt_usrquota, "usrquota"},
        {Opt_barrier, "barrier=%u"},
        {Opt_resize, "resize"},
@@ -2725,7 +3221,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ext3/super.c linux-2.6.31-vs2.3.0.36.14-pr
        {Opt_err, NULL},
  };
  
-@@ -932,6 +935,20 @@ static int parse_options (char *options,
+@@ -900,6 +903,20 @@ static int parse_options (char *options,
                case Opt_nouid32:
                        set_opt (sbi->s_mount_opt, NO_UID32);
                        break;
@@ -2746,7 +3242,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ext3/super.c linux-2.6.31-vs2.3.0.36.14-pr
                case Opt_nocheck:
                        clear_opt (sbi->s_mount_opt, CHECK);
                        break;
-@@ -1656,6 +1673,9 @@ static int ext3_fill_super (struct super
+@@ -1609,6 +1626,9 @@ static int ext3_fill_super (struct super
                            NULL, 0))
                goto failed_mount;
  
@@ -2756,7 +3252,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ext3/super.c linux-2.6.31-vs2.3.0.36.14-pr
        sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
                ((sbi->s_mount_opt & EXT3_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0);
  
-@@ -2514,6 +2534,13 @@ static int ext3_remount (struct super_bl
+@@ -2446,6 +2466,13 @@ static int ext3_remount (struct super_bl
        if (sbi->s_mount_opt & EXT3_MOUNT_ABORT)
                ext3_abort(sb, __func__, "Abort forced by user");
  
@@ -2770,9 +3266,9 @@ diff -NurpP --minimal linux-2.6.31/fs/ext3/super.c linux-2.6.31-vs2.3.0.36.14-pr
        sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
                ((sbi->s_mount_opt & EXT3_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0);
  
-diff -NurpP --minimal linux-2.6.31/fs/ext3/symlink.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext3/symlink.c
---- linux-2.6.31/fs/ext3/symlink.c     2008-12-25 00:26:37.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext3/symlink.c  2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/ext3/symlink.c linux-2.6.27.33-vs2.3.0.36.6/fs/ext3/symlink.c
+--- linux-2.6.27.33/fs/ext3/symlink.c  2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ext3/symlink.c     2008-10-13 14:54:20.000000000 +0200
 @@ -40,6 +40,7 @@ const struct inode_operations ext3_symli
        .listxattr      = ext3_listxattr,
        .removexattr    = generic_removexattr,
@@ -2787,10 +3283,104 @@ diff -NurpP --minimal linux-2.6.31/fs/ext3/symlink.c linux-2.6.31-vs2.3.0.36.14-
  #endif
 +      .sync_flags     = ext3_sync_flags,
  };
-diff -NurpP --minimal linux-2.6.31/fs/ext4/ext4.h linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext4/ext4.h
---- linux-2.6.31/fs/ext4/ext4.h        2009-09-10 15:26:21.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext4/ext4.h     2009-09-10 17:05:31.000000000 +0200
-@@ -252,8 +252,12 @@ struct flex_groups {
+diff -NurpP --minimal linux-2.6.27.33/fs/ext3/xattr.c linux-2.6.27.33-vs2.3.0.36.6/fs/ext3/xattr.c
+--- linux-2.6.27.33/fs/ext3/xattr.c    2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ext3/xattr.c       2008-10-13 14:54:20.000000000 +0200
+@@ -58,6 +58,7 @@
+ #include <linux/mbcache.h>
+ #include <linux/quotaops.h>
+ #include <linux/rwsem.h>
++#include <linux/vs_dlimit.h>
+ #include "xattr.h"
+ #include "acl.h"
+@@ -498,6 +499,7 @@ ext3_xattr_release_block(handle_t *handl
+               error = ext3_journal_dirty_metadata(handle, bh);
+               if (IS_SYNC(inode))
+                       handle->h_sync = 1;
++                      DLIMIT_FREE_BLOCK(inode, 1);
+               DQUOT_FREE_BLOCK(inode, 1);
+               ea_bdebug(bh, "refcount now=%d; releasing",
+                         le32_to_cpu(BHDR(bh)->h_refcount));
+@@ -771,11 +773,14 @@ inserted:
+                       if (new_bh == bs->bh)
+                               ea_bdebug(new_bh, "keeping");
+                       else {
++                              error = -ENOSPC;
++                              if (DLIMIT_ALLOC_BLOCK(inode, 1))
++                                      goto cleanup;
+                               /* The old block is released after updating
+                                  the inode. */
+                               error = -EDQUOT;
+                               if (DQUOT_ALLOC_BLOCK(inode, 1))
+-                                      goto cleanup;
++                                      goto cleanup_dlimit;
+                               error = ext3_journal_get_write_access(handle,
+                                                                     new_bh);
+                               if (error)
+@@ -849,6 +854,8 @@ cleanup:
+ cleanup_dquot:
+       DQUOT_FREE_BLOCK(inode, 1);
++cleanup_dlimit:
++      DLIMIT_FREE_BLOCK(inode, 1);
+       goto cleanup;
+ bad_block:
+diff -NurpP --minimal linux-2.6.27.33/fs/ext4/balloc.c linux-2.6.27.33-vs2.3.0.36.6/fs/ext4/balloc.c
+--- linux-2.6.27.33/fs/ext4/balloc.c   2009-09-13 16:16:58.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ext4/balloc.c      2009-02-22 22:58:32.000000000 +0100
+@@ -17,6 +17,8 @@
+ #include <linux/jbd2.h>
+ #include <linux/quotaops.h>
+ #include <linux/buffer_head.h>
++#include <linux/vs_dlimit.h>
++#include <linux/vs_tag.h>
+ #include "ext4.h"
+ #include "ext4_jbd2.h"
+ #include "group.h"
+@@ -1019,8 +1021,10 @@ void ext4_free_blocks(handle_t *handle, 
+       else
+               ext4_mb_free_blocks(handle, inode, block, count,
+                                               metadata, &dquot_freed_blocks);
+-      if (dquot_freed_blocks)
++      if (dquot_freed_blocks) {
++              DLIMIT_FREE_BLOCK(inode, dquot_freed_blocks);
+               DQUOT_FREE_BLOCK(inode, dquot_freed_blocks);
++      }
+       return;
+ }
+@@ -1880,6 +1884,8 @@ ext4_fsblk_t ext4_old_new_blocks(handle_
+               *errp = -EDQUOT;
+               return 0;
+       }
++      if (DLIMIT_ALLOC_BLOCK(inode, num))
++          goto out_dlimit;
+       sbi = EXT4_SB(sb);
+       es = EXT4_SB(sb)->s_es;
+@@ -2089,12 +2095,16 @@ allocated:
+       *errp = 0;
+       brelse(bitmap_bh);
+       DQUOT_FREE_BLOCK(inode, *count-num);
++      DLIMIT_FREE_BLOCK(inode, *count-num);
+       *count = num;
+       return ret_block;
+ io_error:
+       *errp = -EIO;
+ out:
++      if (!performed_allocation)
++              DLIMIT_FREE_BLOCK(inode, *count);
++out_dlimit:
+       if (fatal) {
+               *errp = fatal;
+               ext4_std_error(sb, fatal);
+diff -NurpP --minimal linux-2.6.27.33/fs/ext4/ext4.h linux-2.6.27.33-vs2.3.0.36.6/fs/ext4/ext4.h
+--- linux-2.6.27.33/fs/ext4/ext4.h     2009-09-13 16:16:58.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ext4/ext4.h        2009-06-15 17:22:10.000000000 +0200
+@@ -243,8 +243,12 @@ struct flex_groups {
  #define EXT4_HUGE_FILE_FL               0x00040000 /* Set to each huge file */
  #define EXT4_EXTENTS_FL                       0x00080000 /* Inode uses extents */
  #define EXT4_EXT_MIGRATE              0x00100000 /* Inode is migrating */
@@ -2801,64 +3391,119 @@ diff -NurpP --minimal linux-2.6.31/fs/ext4/ext4.h linux-2.6.31-vs2.3.0.36.14-pre
 +#define EXT4_COW_FL                   0x20000000 /* Copy on Write marker */
 +
  #define EXT4_FL_USER_VISIBLE          0x000BDFFF /* User visible flags */
- #define EXT4_FL_USER_MODIFIABLE               0x000B80FF /* User modifiable flags */
-@@ -423,7 +427,8 @@ struct ext4_inode {
-                       __le16  l_i_file_acl_high;
-                       __le16  l_i_uid_high;   /* these 2 fields */
-                       __le16  l_i_gid_high;   /* were reserved2[0] */
--                      __u32   l_i_reserved2;
-+                      __le16  l_i_tag;        /* Context Tag */
-+                      __u16   l_i_reserved2;
-               } linux2;
-               struct {
-                       __le16  h_i_reserved1;  /* Obsoleted fragment number/size which are removed in ext4 */
-@@ -538,6 +543,7 @@ do {                                                                              \
- #define i_gid_low     i_gid
- #define i_uid_high    osd2.linux2.l_i_uid_high
- #define i_gid_high    osd2.linux2.l_i_gid_high
-+#define i_raw_tag     osd2.linux2.l_i_tag
- #define i_reserved2   osd2.linux2.l_i_reserved2
+ #define EXT4_FL_USER_MODIFIABLE               0x000380FF /* User modifiable flags */
  
- #elif defined(__GNU__)
-@@ -694,6 +700,7 @@ struct ext4_inode_info {
- #define EXT4_MOUNT_QUOTA              0x80000 /* Some quota option set */
- #define EXT4_MOUNT_USRQUOTA           0x100000 /* "old" user quota */
- #define EXT4_MOUNT_GRPQUOTA           0x200000 /* "old" group quota */
-+#define EXT4_MOUNT_TAGGED             0x400000 /* Enable Context Tags */
- #define EXT4_MOUNT_JOURNAL_CHECKSUM   0x800000 /* Journal checksums */
- #define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT       0x1000000 /* Journal Async Commit */
+@@ -569,6 +573,7 @@ do {                                                                              \
  #define EXT4_MOUNT_I_VERSION            0x2000000 /* i_version support */
-@@ -1354,6 +1361,7 @@ struct buffer_head *ext4_bread(handle_t 
-                                               ext4_lblk_t, int, int *);
- int ext4_get_block(struct inode *inode, sector_t iblock,
-                               struct buffer_head *bh_result, int create);
+ #define EXT4_MOUNT_MBALLOC            0x4000000 /* Buddy allocation support */
+ #define EXT4_MOUNT_DELALLOC           0x8000000 /* Delalloc support */
++#define EXT4_MOUNT_TAGGED             (1<<24) /* Enable Context Tags */
+ /* Compatibility, for having both ext2_fs.h and ext4_fs.h included at once */
+ #ifndef _LINUX_EXT2_FS_H
+ #define clear_opt(o, opt)             o &= ~EXT4_MOUNT_##opt
+@@ -1089,6 +1094,7 @@ int ext4_get_blocks_handle(handle_t *han
+                               ext4_lblk_t iblock, unsigned long maxblocks,
+                               struct buffer_head *bh_result,
+                               int create, int extend_disksize);
 +extern int ext4_sync_flags(struct inode *inode);
  
  extern struct inode *ext4_iget(struct super_block *, unsigned long);
- extern int  ext4_write_inode(struct inode *, int);
-diff -NurpP --minimal linux-2.6.31/fs/ext4/file.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext4/file.c
---- linux-2.6.31/fs/ext4/file.c        2009-09-10 15:26:21.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext4/file.c     2009-09-10 16:11:43.000000000 +0200
-@@ -210,5 +210,6 @@ const struct inode_operations ext4_file_
+ extern int  ext4_write_inode (struct inode *, int);
+diff -NurpP --minimal linux-2.6.27.33/fs/ext4/file.c linux-2.6.27.33-vs2.3.0.36.6/fs/ext4/file.c
+--- linux-2.6.27.33/fs/ext4/file.c     2009-09-13 16:16:58.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ext4/file.c        2009-06-15 17:22:10.000000000 +0200
+@@ -175,5 +175,6 @@ const struct inode_operations ext4_file_
+ #endif
        .permission     = ext4_permission,
        .fallocate      = ext4_fallocate,
-       .fiemap         = ext4_fiemap,
 +      .sync_flags     = ext4_sync_flags,
  };
  
-diff -NurpP --minimal linux-2.6.31/fs/ext4/inode.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext4/inode.c
---- linux-2.6.31/fs/ext4/inode.c       2009-09-10 15:26:21.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext4/inode.c    2009-09-10 17:09:15.000000000 +0200
-@@ -37,6 +37,7 @@
- #include <linux/namei.h>
+diff -NurpP --minimal linux-2.6.27.33/fs/ext4/ialloc.c linux-2.6.27.33-vs2.3.0.36.6/fs/ext4/ialloc.c
+--- linux-2.6.27.33/fs/ext4/ialloc.c   2009-09-13 16:16:58.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ext4/ialloc.c      2009-06-15 17:22:10.000000000 +0200
+@@ -22,6 +22,8 @@
+ #include <linux/random.h>
+ #include <linux/bitops.h>
+ #include <linux/blkdev.h>
++#include <linux/vs_dlimit.h>
++#include <linux/vs_tag.h>
+ #include <asm/byteorder.h>
+ #include "ext4.h"
+ #include "ext4_jbd2.h"
+@@ -218,6 +220,7 @@ void ext4_free_inode (handle_t *handle, 
+       ext4_xattr_delete_inode(handle, inode);
+       DQUOT_FREE_INODE(inode);
+       DQUOT_DROP(inode);
++      DLIMIT_FREE_INODE(inode);
+       is_directory = S_ISDIR(inode->i_mode);
+@@ -698,6 +701,12 @@ struct inode *ext4_new_inode(handle_t *h
+       inode = new_inode(sb);
+       if (!inode)
+               return ERR_PTR(-ENOMEM);
++
++      inode->i_tag = dx_current_fstag(sb);
++      if (DLIMIT_ALLOC_INODE(inode)) {
++              err = -ENOSPC;
++              goto out_dlimit;
++      }
+       ei = EXT4_I(inode);
+       sbi = EXT4_SB(sb);
+@@ -866,12 +875,17 @@ got:
+       ei->i_disksize = 0;
+       /*
+-       * Don't inherit extent flag from directory, amongst others. We set
+-       * extent flag on newly created directory and file only if -o extent
+-       * mount option is specified
++       * Don't inherit extent flag from directory. We set extent flag on
++       * newly created directory and file only if -o extent mount option is
++       * specified
+        */
+-      ei->i_flags =
+-              ext4_mask_flags(mode, EXT4_I(dir)->i_flags & EXT4_FL_INHERITED);
++      ei->i_flags = EXT4_I(dir)->i_flags &
++              ~(EXT4_INDEX_FL|EXT4_EXTENTS_FL|EXT4_IXUNLINK_FL|EXT4_BARRIER_FL);
++      if (S_ISLNK(mode))
++              ei->i_flags &= ~(EXT4_IMMUTABLE_FL|EXT4_APPEND_FL);
++      /* dirsync only applies to directories */
++      if (!S_ISDIR(mode))
++              ei->i_flags &= ~EXT4_DIRSYNC_FL;
+       ei->i_file_acl = 0;
+       ei->i_dtime = 0;
+       ei->i_block_alloc_info = NULL;
+@@ -922,6 +936,8 @@ got:
+ fail:
+       ext4_std_error(sb, err);
+ out:
++      DLIMIT_FREE_INODE(inode);
++out_dlimit:
+       iput(inode);
+       ret = ERR_PTR(err);
+ really_out:
+@@ -933,6 +949,7 @@ fail_free_drop:
+ fail_drop:
+       DQUOT_DROP(inode);
++      DLIMIT_FREE_INODE(inode);
+       inode->i_flags |= S_NOQUOTA;
+       inode->i_nlink = 0;
+       iput(inode);
+diff -NurpP --minimal linux-2.6.27.33/fs/ext4/inode.c linux-2.6.27.33-vs2.3.0.36.6/fs/ext4/inode.c
+--- linux-2.6.27.33/fs/ext4/inode.c    2009-09-13 16:16:58.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ext4/inode.c       2009-06-15 17:22:10.000000000 +0200
+@@ -36,6 +36,7 @@
+ #include <linux/mpage.h>
  #include <linux/uio.h>
  #include <linux/bio.h>
 +#include <linux/vs_tag.h>
  #include "ext4_jbd2.h"
  #include "xattr.h"
-@@ -3901,7 +3902,7 @@ static void ext4_free_branches(handle_t 
+ #include "acl.h"
+@@ -3611,7 +3612,7 @@ static void ext4_free_branches(handle_t 
  
  int ext4_can_truncate(struct inode *inode)
  {
@@ -2867,7 +3512,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ext4/inode.c linux-2.6.31-vs2.3.0.36.14-pr
                return 0;
        if (S_ISREG(inode->i_mode))
                return 1;
-@@ -4253,36 +4254,84 @@ void ext4_set_inode_flags(struct inode *
+@@ -3973,37 +3974,86 @@ void ext4_set_inode_flags(struct inode *
  {
        unsigned int flags = EXT4_I(inode)->i_flags;
  
@@ -2932,7 +3577,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ext4/inode.c linux-2.6.31-vs2.3.0.36.14-pr
 +              ei->i_flags |= EXT4_BARRIER_FL;
 +      if (vflags & V_COW)
 +              ei->i_flags |= EXT4_COW_FL;
-+}
+ }
 +
 +int ext4_sync_flags(struct inode *inode)
 +{
@@ -2956,10 +3601,12 @@ diff -NurpP --minimal linux-2.6.31/fs/ext4/inode.c linux-2.6.31-vs2.3.0.36.14-pr
 +flags_err:
 +      ext4_journal_stop(handle);
 +      return err;
- }
++}
++
  static blkcnt_t ext4_inode_blocks(struct ext4_inode *raw_inode,
-@@ -4317,6 +4366,8 @@ struct inode *ext4_iget(struct super_blo
+                                       struct ext4_inode_info *ei)
+ {
+@@ -4036,6 +4086,8 @@ struct inode *ext4_iget(struct super_blo
        struct inode *inode;
        long ret;
        int block;
@@ -2968,7 +3615,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ext4/inode.c linux-2.6.31-vs2.3.0.36.14-pr
  
        inode = iget_locked(sb, ino);
        if (!inode)
-@@ -4332,12 +4383,16 @@ struct inode *ext4_iget(struct super_blo
+@@ -4056,12 +4108,17 @@ struct inode *ext4_iget(struct super_blo
        bh = iloc.bh;
        raw_inode = ext4_raw_inode(&iloc);
        inode->i_mode = le16_to_cpu(raw_inode->i_mode);
@@ -2976,7 +3623,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ext4/inode.c linux-2.6.31-vs2.3.0.36.14-pr
 -      inode->i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
 +      uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
 +      gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
-       if (!(test_opt(inode->i_sb, NO_UID32))) {
+       if(!(test_opt (inode->i_sb, NO_UID32))) {
 -              inode->i_uid |= le16_to_cpu(raw_inode->i_uid_high) << 16;
 -              inode->i_gid |= le16_to_cpu(raw_inode->i_gid_high) << 16;
 +              uid |= le16_to_cpu(raw_inode->i_uid_high) << 16;
@@ -2986,10 +3633,11 @@ diff -NurpP --minimal linux-2.6.31/fs/ext4/inode.c linux-2.6.31-vs2.3.0.36.14-pr
 +      inode->i_gid = INOTAG_GID(DX_TAG(inode), uid, gid);
 +      inode->i_tag = INOTAG_TAG(DX_TAG(inode), uid, gid,
 +              le16_to_cpu(raw_inode->i_raw_tag));
++
        inode->i_nlink = le16_to_cpu(raw_inode->i_links_count);
  
        ei->i_state = 0;
-@@ -4538,6 +4593,8 @@ static int ext4_do_update_inode(handle_t
+@@ -4253,6 +4310,8 @@ static int ext4_do_update_inode(handle_t
        struct ext4_inode *raw_inode = ext4_raw_inode(iloc);
        struct ext4_inode_info *ei = EXT4_I(inode);
        struct buffer_head *bh = iloc->bh;
@@ -2998,10 +3646,10 @@ diff -NurpP --minimal linux-2.6.31/fs/ext4/inode.c linux-2.6.31-vs2.3.0.36.14-pr
        int err = 0, rc, block;
  
        /* For fields not not tracking in the in-memory inode,
-@@ -4548,29 +4605,32 @@ static int ext4_do_update_inode(handle_t
+@@ -4263,29 +4322,32 @@ static int ext4_do_update_inode(handle_t
        ext4_get_inode_flags(ei);
        raw_inode->i_mode = cpu_to_le16(inode->i_mode);
-       if (!(test_opt(inode->i_sb, NO_UID32))) {
+       if(!(test_opt(inode->i_sb, NO_UID32))) {
 -              raw_inode->i_uid_low = cpu_to_le16(low_16_bits(inode->i_uid));
 -              raw_inode->i_gid_low = cpu_to_le16(low_16_bits(inode->i_gid));
 +              raw_inode->i_uid_low = cpu_to_le16(low_16_bits(uid));
@@ -3010,7 +3658,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ext4/inode.c linux-2.6.31-vs2.3.0.36.14-pr
   * Fix up interoperability with old kernels. Otherwise, old inodes get
   * re-used with the upper 16 bits of the uid/gid intact
   */
-               if (!ei->i_dtime) {
+               if(!ei->i_dtime) {
                        raw_inode->i_uid_high =
 -                              cpu_to_le16(high_16_bits(inode->i_uid));
 +                              cpu_to_le16(high_16_bits(uid));
@@ -3037,7 +3685,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ext4/inode.c linux-2.6.31-vs2.3.0.36.14-pr
        raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
  
        EXT4_INODE_SET_XTIME(i_ctime, inode, raw_inode);
-@@ -4734,7 +4794,8 @@ int ext4_setattr(struct dentry *dentry, 
+@@ -4449,7 +4511,8 @@ int ext4_setattr(struct dentry *dentry, 
                return error;
  
        if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
@@ -3047,7 +3695,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ext4/inode.c linux-2.6.31-vs2.3.0.36.14-pr
                handle_t *handle;
  
                /* (user+group)*(old+new) structure, inode write (sb,
-@@ -4756,6 +4817,8 @@ int ext4_setattr(struct dentry *dentry, 
+@@ -4471,6 +4534,8 @@ int ext4_setattr(struct dentry *dentry, 
                        inode->i_uid = attr->ia_uid;
                if (attr->ia_valid & ATTR_GID)
                        inode->i_gid = attr->ia_gid;
@@ -3056,30 +3704,37 @@ diff -NurpP --minimal linux-2.6.31/fs/ext4/inode.c linux-2.6.31-vs2.3.0.36.14-pr
                error = ext4_mark_inode_dirty(handle, inode);
                ext4_journal_stop(handle);
        }
-diff -NurpP --minimal linux-2.6.31/fs/ext4/ioctl.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext4/ioctl.c
---- linux-2.6.31/fs/ext4/ioctl.c       2009-09-10 15:26:21.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext4/ioctl.c    2009-09-10 17:10:01.000000000 +0200
-@@ -14,6 +14,7 @@
+diff -NurpP --minimal linux-2.6.27.33/fs/ext4/ioctl.c linux-2.6.27.33-vs2.3.0.36.6/fs/ext4/ioctl.c
+--- linux-2.6.27.33/fs/ext4/ioctl.c    2009-09-13 16:16:58.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ext4/ioctl.c       2009-06-15 17:24:03.000000000 +0200
+@@ -8,12 +8,14 @@
+  */
+ #include <linux/fs.h>
++#include <linux/mount.h>
+ #include <linux/jbd2.h>
+ #include <linux/capability.h>
+ #include <linux/time.h>
  #include <linux/compat.h>
+ #include <linux/smp_lock.h>
  #include <linux/mount.h>
- #include <linux/file.h>
 +#include <linux/vs_tag.h>
  #include <asm/uaccess.h>
  #include "ext4_jbd2.h"
  #include "ext4.h"
-@@ -50,6 +51,11 @@ long ext4_ioctl(struct file *filp, unsig
-               flags = ext4_mask_flags(inode->i_mode, flags);
+@@ -49,6 +51,11 @@ long ext4_ioctl(struct file *filp, unsig
+               if (err)
+                       return err;
  
 +              if (IS_BARRIER(inode)) {
 +                      vxwprintk_task(1, "messing with the barrier.");
 +                      return -EACCES;
 +              }
 +
+               flags = ext4_mask_flags(inode->i_mode, flags);
                err = -EPERM;
-               mutex_lock(&inode->i_mutex);
-               /* Is it quota file? Do not allow user to mess with it */
-@@ -67,7 +73,9 @@ long ext4_ioctl(struct file *filp, unsig
+@@ -68,7 +75,9 @@ long ext4_ioctl(struct file *filp, unsig
                 *
                 * This test looks nicer. Thanks to Pauline Middelink
                 */
@@ -3090,9 +3745,9 @@ diff -NurpP --minimal linux-2.6.31/fs/ext4/ioctl.c linux-2.6.31-vs2.3.0.36.14-pr
                        if (!capable(CAP_LINUX_IMMUTABLE))
                                goto flags_out;
                }
-diff -NurpP --minimal linux-2.6.31/fs/ext4/namei.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext4/namei.c
---- linux-2.6.31/fs/ext4/namei.c       2009-09-10 15:26:21.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext4/namei.c    2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/ext4/namei.c linux-2.6.27.33-vs2.3.0.36.6/fs/ext4/namei.c
+--- linux-2.6.27.33/fs/ext4/namei.c    2009-09-13 16:16:58.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ext4/namei.c       2009-06-15 17:22:10.000000000 +0200
 @@ -34,6 +34,7 @@
  #include <linux/quotaops.h>
  #include <linux/buffer_head.h>
@@ -3101,7 +3756,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ext4/namei.c linux-2.6.31-vs2.3.0.36.14-pr
  #include "ext4.h"
  #include "ext4_jbd2.h"
  
-@@ -941,6 +942,7 @@ restart:
+@@ -919,6 +920,7 @@ restart:
                                if (bh)
                                        ll_rw_block(READ_META, 1, &bh);
                        }
@@ -3109,37 +3764,42 @@ diff -NurpP --minimal linux-2.6.31/fs/ext4/namei.c linux-2.6.31-vs2.3.0.36.14-pr
                }
                if ((bh = bh_use[ra_ptr++]) == NULL)
                        goto next;
-@@ -2549,4 +2551,6 @@ const struct inode_operations ext4_speci
+@@ -2487,6 +2489,7 @@ const struct inode_operations ext4_dir_i
        .removexattr    = generic_removexattr,
  #endif
        .permission     = ext4_permission,
 +      .sync_flags     = ext4_sync_flags,
+ };
+ const struct inode_operations ext4_special_inode_operations = {
+@@ -2498,4 +2501,5 @@ const struct inode_operations ext4_speci
+       .removexattr    = generic_removexattr,
+ #endif
+       .permission     = ext4_permission,
 +      .sync_flags     = ext4_sync_flags,
  };
-diff -NurpP --minimal linux-2.6.31/fs/ext4/super.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext4/super.c
---- linux-2.6.31/fs/ext4/super.c       2009-09-10 15:26:21.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext4/super.c    2009-09-10 17:06:37.000000000 +0200
-@@ -1057,7 +1057,8 @@ enum {
-       Opt_usrquota, Opt_grpquota, Opt_i_version,
-       Opt_stripe, Opt_delalloc, Opt_nodelalloc,
-       Opt_block_validity, Opt_noblock_validity,
--      Opt_inode_readahead_blks, Opt_journal_ioprio
-+      Opt_inode_readahead_blks, Opt_journal_ioprio,
+diff -NurpP --minimal linux-2.6.27.33/fs/ext4/super.c linux-2.6.27.33-vs2.3.0.36.6/fs/ext4/super.c
+--- linux-2.6.27.33/fs/ext4/super.c    2009-09-13 16:16:58.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ext4/super.c       2009-03-25 14:32:29.000000000 +0100
+@@ -907,6 +907,7 @@ enum {
+       Opt_ignore, Opt_barrier, Opt_err, Opt_resize, Opt_usrquota,
+       Opt_grpquota, Opt_extents, Opt_noextents, Opt_i_version,
+       Opt_mballoc, Opt_nomballoc, Opt_stripe, Opt_delalloc, Opt_nodelalloc,
 +      Opt_tag, Opt_notag, Opt_tagid
  };
  
- static const match_table_t tokens = {
-@@ -1123,6 +1124,9 @@ static const match_table_t tokens = {
-       {Opt_auto_da_alloc, "auto_da_alloc=%u"},
-       {Opt_auto_da_alloc, "auto_da_alloc"},
-       {Opt_noauto_da_alloc, "noauto_da_alloc"},
+ static match_table_t tokens = {
+@@ -967,6 +968,9 @@ static match_table_t tokens = {
+       {Opt_resize, "resize"},
+       {Opt_delalloc, "delalloc"},
+       {Opt_nodelalloc, "nodelalloc"},
 +      {Opt_tag, "tag"},
 +      {Opt_notag, "notag"},
 +      {Opt_tagid, "tagid=%u"},
        {Opt_err, NULL},
  };
  
-@@ -1220,6 +1224,20 @@ static int parse_options(char *options, 
+@@ -1060,6 +1064,20 @@ static int parse_options(char *options, 
                case Opt_nouid32:
                        set_opt(sbi->s_mount_opt, NO_UID32);
                        break;
@@ -3157,11 +3817,11 @@ diff -NurpP --minimal linux-2.6.31/fs/ext4/super.c linux-2.6.31-vs2.3.0.36.14-pr
 +                      set_opt (sbi->s_mount_opt, TAGGED);
 +                      break;
 +#endif
-               case Opt_debug:
-                       set_opt(sbi->s_mount_opt, DEBUG);
+               case Opt_nocheck:
+                       clear_opt(sbi->s_mount_opt, CHECK);
                        break;
-@@ -2385,6 +2403,9 @@ static int ext4_fill_super(struct super_
-                          &journal_ioprio, NULL, 0))
+@@ -2029,6 +2047,9 @@ static int ext4_fill_super(struct super_
+                          NULL, 0))
                goto failed_mount;
  
 +      if (EXT4_SB(sb)->s_mount_opt & EXT4_MOUNT_TAGGED)
@@ -3170,8 +3830,8 @@ diff -NurpP --minimal linux-2.6.31/fs/ext4/super.c linux-2.6.31-vs2.3.0.36.14-pr
        sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
                ((sbi->s_mount_opt & EXT4_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0);
  
-@@ -3441,6 +3462,13 @@ static int ext4_remount(struct super_blo
-       if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED)
+@@ -3033,6 +3054,13 @@ static int ext4_remount(struct super_blo
+       if (sbi->s_mount_opt & EXT4_MOUNT_ABORT)
                ext4_abort(sb, __func__, "Abort forced by user");
  
 +      if ((sbi->s_mount_opt & EXT4_MOUNT_TAGGED) &&
@@ -3184,9 +3844,9 @@ diff -NurpP --minimal linux-2.6.31/fs/ext4/super.c linux-2.6.31-vs2.3.0.36.14-pr
        sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
                ((sbi->s_mount_opt & EXT4_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0);
  
-diff -NurpP --minimal linux-2.6.31/fs/ext4/symlink.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext4/symlink.c
---- linux-2.6.31/fs/ext4/symlink.c     2008-12-25 00:26:37.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ext4/symlink.c  2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/ext4/symlink.c linux-2.6.27.33-vs2.3.0.36.6/fs/ext4/symlink.c
+--- linux-2.6.27.33/fs/ext4/symlink.c  2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ext4/symlink.c     2008-10-13 14:54:20.000000000 +0200
 @@ -40,6 +40,7 @@ const struct inode_operations ext4_symli
        .listxattr      = ext4_listxattr,
        .removexattr    = generic_removexattr,
@@ -3201,18 +3861,62 @@ diff -NurpP --minimal linux-2.6.31/fs/ext4/symlink.c linux-2.6.31-vs2.3.0.36.14-
  #endif
 +      .sync_flags     = ext4_sync_flags,
  };
-diff -NurpP --minimal linux-2.6.31/fs/fcntl.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/fcntl.c
---- linux-2.6.31/fs/fcntl.c    2009-09-10 15:26:22.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/fcntl.c 2009-09-10 17:00:41.000000000 +0200
-@@ -19,6 +19,7 @@
- #include <linux/signal.h>
+diff -NurpP --minimal linux-2.6.27.33/fs/ext4/xattr.c linux-2.6.27.33-vs2.3.0.36.6/fs/ext4/xattr.c
+--- linux-2.6.27.33/fs/ext4/xattr.c    2009-09-13 16:16:58.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ext4/xattr.c       2009-02-03 17:59:04.000000000 +0100
+@@ -56,6 +56,7 @@
+ #include <linux/mbcache.h>
+ #include <linux/quotaops.h>
+ #include <linux/rwsem.h>
++#include <linux/vs_dlimit.h>
+ #include "ext4_jbd2.h"
+ #include "ext4.h"
+ #include "xattr.h"
+@@ -490,6 +491,7 @@ ext4_xattr_release_block(handle_t *handl
+               error = ext4_journal_dirty_metadata(handle, bh);
+               if (IS_SYNC(inode))
+                       handle->h_sync = 1;
++                      DLIMIT_FREE_BLOCK(inode, 1);
+               DQUOT_FREE_BLOCK(inode, 1);
+               ea_bdebug(bh, "refcount now=%d; releasing",
+                         le32_to_cpu(BHDR(bh)->h_refcount));
+@@ -780,11 +782,14 @@ inserted:
+                       if (new_bh == bs->bh)
+                               ea_bdebug(new_bh, "keeping");
+                       else {
++                              error = -ENOSPC;
++                              if (DLIMIT_ALLOC_BLOCK(inode, 1))
++                                      goto cleanup;
+                               /* The old block is released after updating
+                                  the inode. */
+                               error = -EDQUOT;
+                               if (DQUOT_ALLOC_BLOCK(inode, 1))
+-                                      goto cleanup;
++                                      goto cleanup_dlimit;
+                               error = ext4_journal_get_write_access(handle,
+                                                                     new_bh);
+                               if (error)
+@@ -858,6 +863,8 @@ cleanup:
+ cleanup_dquot:
+       DQUOT_FREE_BLOCK(inode, 1);
++cleanup_dlimit:
++      DLIMIT_FREE_BLOCK(inode, 1);
+       goto cleanup;
+ bad_block:
+diff -NurpP --minimal linux-2.6.27.33/fs/fcntl.c linux-2.6.27.33-vs2.3.0.36.6/fs/fcntl.c
+--- linux-2.6.27.33/fs/fcntl.c 2009-09-13 16:16:58.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/fcntl.c    2009-05-22 00:47:30.000000000 +0200
+@@ -20,6 +20,7 @@
  #include <linux/rcupdate.h>
  #include <linux/pid_namespace.h>
+ #include <linux/smp_lock.h>
 +#include <linux/vs_limit.h>
  
  #include <asm/poll.h>
  #include <asm/siginfo.h>
-@@ -102,6 +103,8 @@ SYSCALL_DEFINE3(dup3, unsigned int, oldf
+@@ -103,6 +104,8 @@ SYSCALL_DEFINE3(dup3, unsigned int, oldf
  
        if (tofree)
                filp_close(tofree, files);
@@ -3221,7 +3925,7 @@ diff -NurpP --minimal linux-2.6.31/fs/fcntl.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
  
        return newfd;
  
-@@ -347,6 +350,8 @@ SYSCALL_DEFINE3(fcntl, unsigned int, fd,
+@@ -344,6 +347,8 @@ SYSCALL_DEFINE3(fcntl, unsigned int, fd,
        filp = fget(fd);
        if (!filp)
                goto out;
@@ -3230,9 +3934,9 @@ diff -NurpP --minimal linux-2.6.31/fs/fcntl.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
  
        err = security_file_fcntl(filp, cmd, arg);
        if (err) {
-diff -NurpP --minimal linux-2.6.31/fs/file.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/file.c
---- linux-2.6.31/fs/file.c     2008-12-25 00:26:37.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/file.c  2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/file.c linux-2.6.27.33-vs2.3.0.36.6/fs/file.c
+--- linux-2.6.27.33/fs/file.c  2008-10-13 14:52:05.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/file.c     2008-10-24 04:44:48.000000000 +0200
 @@ -19,6 +19,7 @@
  #include <linux/spinlock.h>
  #include <linux/rcupdate.h>
@@ -3258,10 +3962,10 @@ diff -NurpP --minimal linux-2.6.31/fs/file.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/
  #if 1
        /* Sanity check */
        if (rcu_dereference(fdt->fd[fd]) != NULL) {
-diff -NurpP --minimal linux-2.6.31/fs/file_table.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/file_table.c
---- linux-2.6.31/fs/file_table.c       2009-09-10 15:26:22.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/file_table.c    2009-09-10 16:11:43.000000000 +0200
-@@ -22,6 +22,8 @@
+diff -NurpP --minimal linux-2.6.27.33/fs/file_table.c linux-2.6.27.33-vs2.3.0.36.6/fs/file_table.c
+--- linux-2.6.27.33/fs/file_table.c    2008-10-13 14:52:05.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/file_table.c       2008-10-13 14:54:20.000000000 +0200
+@@ -21,6 +21,8 @@
  #include <linux/fsnotify.h>
  #include <linux/sysctl.h>
  #include <linux/percpu_counter.h>
@@ -3270,8 +3974,8 @@ diff -NurpP --minimal linux-2.6.31/fs/file_table.c linux-2.6.31-vs2.3.0.36.14-pr
  
  #include <asm/atomic.h>
  
-@@ -131,6 +133,8 @@ struct file *get_empty_filp(void)
-       spin_lock_init(&f->f_lock);
+@@ -126,6 +128,8 @@ struct file *get_empty_filp(void)
+       f->f_gid = tsk->fsgid;
        eventpoll_init_file(f);
        /* f->f_version: 0 */
 +      f->f_xid = vx_current_xid();
@@ -3279,7 +3983,7 @@ diff -NurpP --minimal linux-2.6.31/fs/file_table.c linux-2.6.31-vs2.3.0.36.14-pr
        return f;
  
  over:
-@@ -285,6 +289,8 @@ void __fput(struct file *file)
+@@ -276,6 +280,8 @@ void __fput(struct file *file)
                cdev_put(inode->i_cdev);
        fops_put(file->f_op);
        put_pid(file->f_owner.pid);
@@ -3288,7 +3992,7 @@ diff -NurpP --minimal linux-2.6.31/fs/file_table.c linux-2.6.31-vs2.3.0.36.14-pr
        file_kill(file);
        if (file->f_mode & FMODE_WRITE)
                drop_file_write_access(file);
-@@ -352,6 +358,8 @@ void put_filp(struct file *file)
+@@ -343,6 +349,8 @@ void put_filp(struct file *file)
  {
        if (atomic_long_dec_and_test(&file->f_count)) {
                security_file_free(file);
@@ -3297,36 +4001,9 @@ diff -NurpP --minimal linux-2.6.31/fs/file_table.c linux-2.6.31-vs2.3.0.36.14-pr
                file_kill(file);
                file_free(file);
        }
-diff -NurpP --minimal linux-2.6.31/fs/fs_struct.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/fs_struct.c
---- linux-2.6.31/fs/fs_struct.c        2009-06-11 17:13:04.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/fs_struct.c     2009-09-10 16:11:43.000000000 +0200
-@@ -4,6 +4,7 @@
- #include <linux/path.h>
- #include <linux/slab.h>
- #include <linux/fs_struct.h>
-+#include <linux/vserver/global.h>
- /*
-  * Replace the fs->{rootmnt,root} with {mnt,dentry}. Put the old values.
-@@ -77,6 +78,7 @@ void free_fs_struct(struct fs_struct *fs
- {
-       path_put(&fs->root);
-       path_put(&fs->pwd);
-+      atomic_dec(&vs_global_fs);
-       kmem_cache_free(fs_cachep, fs);
- }
-@@ -112,6 +114,7 @@ struct fs_struct *copy_fs_struct(struct 
-               fs->pwd = old->pwd;
-               path_get(&old->pwd);
-               read_unlock(&old->lock);
-+              atomic_inc(&vs_global_fs);
-       }
-       return fs;
- }
-diff -NurpP --minimal linux-2.6.31/fs/hfsplus/ioctl.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/hfsplus/ioctl.c
---- linux-2.6.31/fs/hfsplus/ioctl.c    2008-12-25 00:26:37.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/hfsplus/ioctl.c 2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/hfsplus/ioctl.c linux-2.6.27.33-vs2.3.0.36.6/fs/hfsplus/ioctl.c
+--- linux-2.6.27.33/fs/hfsplus/ioctl.c 2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/hfsplus/ioctl.c    2008-10-13 14:54:20.000000000 +0200
 @@ -17,6 +17,7 @@
  #include <linux/mount.h>
  #include <linux/sched.h>
@@ -3335,28 +4012,28 @@ diff -NurpP --minimal linux-2.6.31/fs/hfsplus/ioctl.c linux-2.6.31-vs2.3.0.36.14
  #include <asm/uaccess.h>
  #include "hfsplus_fs.h"
  
-diff -NurpP --minimal linux-2.6.31/fs/inode.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/inode.c
---- linux-2.6.31/fs/inode.c    2009-09-10 15:26:22.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/inode.c 2009-09-10 16:11:43.000000000 +0200
-@@ -128,6 +128,9 @@ int inode_init_always(struct super_block
-       struct address_space *const mapping = &inode->i_data;
-       inode->i_sb = sb;
-+
-+      /* essential because of inode slab reuse */
-+      inode->i_tag = 0;
-       inode->i_blkbits = sb->s_blocksize_bits;
-       inode->i_flags = 0;
-       atomic_set(&inode->i_count, 1);
-@@ -148,6 +151,7 @@ int inode_init_always(struct super_block
-       inode->i_bdev = NULL;
-       inode->i_cdev = NULL;
-       inode->i_rdev = 0;
-+      inode->i_mdev = 0;
-       inode->dirtied_when = 0;
-       if (security_inode_alloc(inode))
-@@ -304,6 +308,8 @@ void __iget(struct inode *inode)
+diff -NurpP --minimal linux-2.6.27.33/fs/inode.c linux-2.6.27.33-vs2.3.0.36.6/fs/inode.c
+--- linux-2.6.27.33/fs/inode.c 2009-09-13 16:16:58.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/inode.c    2009-03-25 14:32:29.000000000 +0100
+@@ -124,6 +124,9 @@ static struct inode *alloc_inode(struct 
+               struct address_space * const mapping = &inode->i_data;
+               inode->i_sb = sb;
++
++              /* essential because of inode slab reuse */
++              inode->i_tag = 0;
+               inode->i_blkbits = sb->s_blocksize_bits;
+               inode->i_flags = 0;
+               atomic_set(&inode->i_count, 1);
+@@ -142,6 +145,7 @@ static struct inode *alloc_inode(struct 
+               inode->i_bdev = NULL;
+               inode->i_cdev = NULL;
+               inode->i_rdev = 0;
++              inode->i_mdev = 0;
+               inode->dirtied_when = 0;
+               if (security_inode_alloc(inode)) {
+                       if (inode->i_sb->s_op->destroy_inode)
+@@ -247,6 +251,8 @@ void __iget(struct inode * inode)
        inodes_stat.nr_unused--;
  }
  
@@ -3365,7 +4042,7 @@ diff -NurpP --minimal linux-2.6.31/fs/inode.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
  /**
   * clear_inode - clear an inode
   * @inode: inode to clear
-@@ -1586,9 +1592,11 @@ void init_special_inode(struct inode *in
+@@ -1434,9 +1440,11 @@ void init_special_inode(struct inode *in
        if (S_ISCHR(mode)) {
                inode->i_fop = &def_chr_fops;
                inode->i_rdev = rdev;
@@ -3377,31 +4054,31 @@ diff -NurpP --minimal linux-2.6.31/fs/inode.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
        } else if (S_ISFIFO(mode))
                inode->i_fop = &def_fifo_fops;
        else if (S_ISSOCK(mode))
-diff -NurpP --minimal linux-2.6.31/fs/ioctl.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/ioctl.c
---- linux-2.6.31/fs/ioctl.c    2009-09-10 15:26:22.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ioctl.c 2009-09-10 17:13:08.000000000 +0200
-@@ -16,6 +16,9 @@
- #include <linux/writeback.h>
- #include <linux/buffer_head.h>
- #include <linux/falloc.h>
+diff -NurpP --minimal linux-2.6.27.33/fs/ioctl.c linux-2.6.27.33-vs2.3.0.36.6/fs/ioctl.c
+--- linux-2.6.27.33/fs/ioctl.c 2009-09-13 16:16:58.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ioctl.c    2009-02-03 17:59:04.000000000 +0100
+@@ -13,6 +13,9 @@
+ #include <linux/security.h>
+ #include <linux/module.h>
+ #include <linux/uaccess.h>
 +#include <linux/proc_fs.h>
 +#include <linux/vserver/inode.h>
 +#include <linux/vs_tag.h>
  
  #include <asm/ioctls.h>
  
-diff -NurpP --minimal linux-2.6.31/fs/ioprio.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/ioprio.c
---- linux-2.6.31/fs/ioprio.c   2009-03-24 14:22:26.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ioprio.c        2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/ioprio.c linux-2.6.27.33-vs2.3.0.36.6/fs/ioprio.c
+--- linux-2.6.27.33/fs/ioprio.c        2009-09-13 16:16:58.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ioprio.c   2009-02-03 17:59:04.000000000 +0100
 @@ -26,6 +26,7 @@
  #include <linux/syscalls.h>
  #include <linux/security.h>
  #include <linux/pid_namespace.h>
 +#include <linux/vs_base.h>
  
- int set_task_ioprio(struct task_struct *task, int ioprio)
static int set_task_ioprio(struct task_struct *task, int ioprio)
  {
-@@ -123,6 +124,8 @@ SYSCALL_DEFINE3(ioprio_set, int, which, 
+@@ -116,6 +117,8 @@ SYSCALL_DEFINE3(ioprio_set, int, which, 
                        else
                                pgrp = find_vpid(who);
                        do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
@@ -3410,7 +4087,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ioprio.c linux-2.6.31-vs2.3.0.36.14-pre8/f
                                ret = set_task_ioprio(p, ioprio);
                                if (ret)
                                        break;
-@@ -212,6 +215,8 @@ SYSCALL_DEFINE2(ioprio_get, int, which, 
+@@ -205,6 +208,8 @@ SYSCALL_DEFINE2(ioprio_get, int, which, 
                        else
                                pgrp = find_vpid(who);
                        do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
@@ -3419,22 +4096,22 @@ diff -NurpP --minimal linux-2.6.31/fs/ioprio.c linux-2.6.31-vs2.3.0.36.14-pre8/f
                                tmpio = get_task_ioprio(p);
                                if (tmpio < 0)
                                        continue;
-diff -NurpP --minimal linux-2.6.31/fs/jfs/acl.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/jfs/acl.c
---- linux-2.6.31/fs/jfs/acl.c  2009-09-10 15:26:22.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/jfs/acl.c       2009-09-10 16:11:43.000000000 +0200
-@@ -221,7 +221,8 @@ int jfs_setattr(struct dentry *dentry, s
+diff -NurpP --minimal linux-2.6.27.33/fs/jfs/acl.c linux-2.6.27.33-vs2.3.0.36.6/fs/jfs/acl.c
+--- linux-2.6.27.33/fs/jfs/acl.c       2008-10-13 14:52:05.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/jfs/acl.c  2008-10-13 14:54:20.000000000 +0200
+@@ -232,7 +232,8 @@ int jfs_setattr(struct dentry *dentry, s
                return rc;
  
        if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
 -          (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
 +          (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid) ||
 +          (iattr->ia_valid & ATTR_TAG && iattr->ia_tag != inode->i_tag)) {
-               if (vfs_dq_transfer(inode, iattr))
+               if (DQUOT_TRANSFER(inode, iattr))
                        return -EDQUOT;
        }
-diff -NurpP --minimal linux-2.6.31/fs/jfs/file.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/jfs/file.c
---- linux-2.6.31/fs/jfs/file.c 2008-12-25 00:26:37.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/jfs/file.c      2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/jfs/file.c linux-2.6.27.33-vs2.3.0.36.6/fs/jfs/file.c
+--- linux-2.6.27.33/fs/jfs/file.c      2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/jfs/file.c 2008-10-13 14:54:20.000000000 +0200
 @@ -98,6 +98,7 @@ const struct inode_operations jfs_file_i
        .setattr        = jfs_setattr,
        .permission     = jfs_permission,
@@ -3443,9 +4120,28 @@ diff -NurpP --minimal linux-2.6.31/fs/jfs/file.c linux-2.6.31-vs2.3.0.36.14-pre8
  };
  
  const struct file_operations jfs_file_operations = {
-diff -NurpP --minimal linux-2.6.31/fs/jfs/ioctl.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/jfs/ioctl.c
---- linux-2.6.31/fs/jfs/ioctl.c        2008-12-25 00:26:37.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/jfs/ioctl.c     2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/jfs/inode.c linux-2.6.27.33-vs2.3.0.36.6/fs/jfs/inode.c
+--- linux-2.6.27.33/fs/jfs/inode.c     2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/jfs/inode.c        2008-10-13 14:54:20.000000000 +0200
+@@ -22,6 +22,7 @@
+ #include <linux/buffer_head.h>
+ #include <linux/pagemap.h>
+ #include <linux/quotaops.h>
++#include <linux/vs_dlimit.h>
+ #include "jfs_incore.h"
+ #include "jfs_inode.h"
+ #include "jfs_filsys.h"
+@@ -155,6 +156,7 @@ void jfs_delete_inode(struct inode *inod
+               DQUOT_INIT(inode);
+               DQUOT_FREE_INODE(inode);
+               DQUOT_DROP(inode);
++              DLIMIT_FREE_INODE(inode);
+       }
+       clear_inode(inode);
+diff -NurpP --minimal linux-2.6.27.33/fs/jfs/ioctl.c linux-2.6.27.33-vs2.3.0.36.6/fs/jfs/ioctl.c
+--- linux-2.6.27.33/fs/jfs/ioctl.c     2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/jfs/ioctl.c        2008-10-13 14:54:20.000000000 +0200
 @@ -11,6 +11,7 @@
  #include <linux/mount.h>
  #include <linux/time.h>
@@ -3477,9 +4173,9 @@ diff -NurpP --minimal linux-2.6.31/fs/jfs/ioctl.c linux-2.6.31-vs2.3.0.36.14-pre
                        if (!capable(CAP_LINUX_IMMUTABLE)) {
                                mutex_unlock(&inode->i_mutex);
                                err = -EPERM;
-diff -NurpP --minimal linux-2.6.31/fs/jfs/jfs_dinode.h linux-2.6.31-vs2.3.0.36.14-pre8/fs/jfs/jfs_dinode.h
---- linux-2.6.31/fs/jfs/jfs_dinode.h   2008-12-25 00:26:37.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/jfs/jfs_dinode.h        2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/jfs/jfs_dinode.h linux-2.6.27.33-vs2.3.0.36.6/fs/jfs/jfs_dinode.h
+--- linux-2.6.27.33/fs/jfs/jfs_dinode.h        2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/jfs/jfs_dinode.h   2008-10-31 18:15:18.000000000 +0100
 @@ -161,9 +161,13 @@ struct dinode {
  
  #define JFS_APPEND_FL         0x01000000 /* writes to file may only append */
@@ -3496,59 +4192,237 @@ diff -NurpP --minimal linux-2.6.31/fs/jfs/jfs_dinode.h linux-2.6.31-vs2.3.0.36.1
  #define JFS_FL_INHERIT                0x03C80000
  
  /* These are identical to EXT[23]_IOC_GETFLAGS/SETFLAGS */
-diff -NurpP --minimal linux-2.6.31/fs/jfs/jfs_filsys.h linux-2.6.31-vs2.3.0.36.14-pre8/fs/jfs/jfs_filsys.h
---- linux-2.6.31/fs/jfs/jfs_filsys.h   2008-12-25 00:26:37.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/jfs/jfs_filsys.h        2009-09-10 16:11:43.000000000 +0200
-@@ -263,6 +263,7 @@
- #define JFS_NAME_MAX  255
- #define JFS_PATH_MAX  BPSIZE
-+#define JFS_TAGGED            0x00800000      /* Context Tagging */
+diff -NurpP --minimal linux-2.6.27.33/fs/jfs/jfs_dtree.c linux-2.6.27.33-vs2.3.0.36.6/fs/jfs/jfs_dtree.c
+--- linux-2.6.27.33/fs/jfs/jfs_dtree.c 2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/jfs/jfs_dtree.c    2008-10-13 14:54:20.000000000 +0200
+@@ -102,6 +102,7 @@
  
- /*
-  *    file system state (superblock state)
-diff -NurpP --minimal linux-2.6.31/fs/jfs/jfs_imap.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/jfs/jfs_imap.c
---- linux-2.6.31/fs/jfs/jfs_imap.c     2009-09-10 15:26:22.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/jfs/jfs_imap.c  2009-09-10 16:11:43.000000000 +0200
-@@ -45,6 +45,7 @@
- #include <linux/buffer_head.h>
- #include <linux/pagemap.h>
+ #include <linux/fs.h>
  #include <linux/quotaops.h>
-+#include <linux/vs_tag.h>
++#include <linux/vs_dlimit.h>
  #include "jfs_incore.h"
- #include "jfs_inode.h"
-@@ -3059,6 +3060,8 @@ static int copy_from_dinode(struct dinod
- {
-       struct jfs_inode_info *jfs_ip = JFS_IP(ip);
-       struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb);
-+      uid_t uid;
-+      gid_t gid;
+ #include "jfs_superblock.h"
+ #include "jfs_filsys.h"
+@@ -383,10 +384,10 @@ static u32 add_index(tid_t tid, struct i
+                */
+               if (DQUOT_ALLOC_BLOCK(ip, sbi->nbperpage))
+                       goto clean_up;
+-              if (dbAlloc(ip, 0, sbi->nbperpage, &xaddr)) {
+-                      DQUOT_FREE_BLOCK(ip, sbi->nbperpage);
+-                      goto clean_up;
+-              }
++              if (DLIMIT_ALLOC_BLOCK(ip, sbi->nbperpage))
++                      goto clean_up_dquot;
++              if (dbAlloc(ip, 0, sbi->nbperpage, &xaddr))
++                      goto clean_up_dlimit;
  
-       jfs_ip->fileset = le32_to_cpu(dip->di_fileset);
-       jfs_ip->mode2 = le32_to_cpu(dip->di_mode);
-@@ -3079,14 +3082,18 @@ static int copy_from_dinode(struct dinod
-       }
-       ip->i_nlink = le32_to_cpu(dip->di_nlink);
+               /*
+                * Save the table, we're going to overwrite it with the
+@@ -480,6 +481,12 @@ static u32 add_index(tid_t tid, struct i
  
--      jfs_ip->saved_uid = le32_to_cpu(dip->di_uid);
-+      uid = le32_to_cpu(dip->di_uid);
-+      gid = le32_to_cpu(dip->di_gid);
-+      ip->i_tag = INOTAG_TAG(DX_TAG(ip), uid, gid, 0);
+       return index;
++      clean_up_dlimit:
++      DLIMIT_FREE_BLOCK(ip, sbi->nbperpage);
 +
-+      jfs_ip->saved_uid = INOTAG_UID(DX_TAG(ip), uid, gid);
-       if (sbi->uid == -1)
-               ip->i_uid = jfs_ip->saved_uid;
-       else {
-               ip->i_uid = sbi->uid;
++      clean_up_dquot:
++      DQUOT_FREE_BLOCK(ip, sbi->nbperpage);
++
+       clean_up:
+       jfs_ip->next_index--;
+@@ -951,6 +958,7 @@ static int dtSplitUp(tid_t tid,
+       struct tlock *tlck;
+       struct lv *lv;
+       int quota_allocation = 0;
++      int dlimit_allocation = 0;
+       /* get split page */
+       smp = split->mp;
+@@ -1033,6 +1041,12 @@ static int dtSplitUp(tid_t tid,
+               }
+               quota_allocation += n;
++              if (DLIMIT_ALLOC_BLOCK(ip, n)) {
++                      rc = -ENOSPC;
++                      goto extendOut;
++              }
++              dlimit_allocation += n;
++
+               if ((rc = dbReAlloc(sbi->ipbmap, xaddr, (s64) xlen,
+                                   (s64) n, &nxaddr)))
+                       goto extendOut;
+@@ -1306,6 +1320,9 @@ static int dtSplitUp(tid_t tid,
+       freeKeyName:
+       kfree(key.name);
++      /* Rollback dlimit allocation */
++      if (rc && dlimit_allocation)
++              DLIMIT_FREE_BLOCK(ip, dlimit_allocation);
+       /* Rollback quota allocation */
+       if (rc && quota_allocation)
+               DQUOT_FREE_BLOCK(ip, quota_allocation);
+@@ -1373,6 +1390,12 @@ static int dtSplitPage(tid_t tid, struct
+               release_metapage(rmp);
+               return -EDQUOT;
        }
++      /* Allocate blocks to dlimit. */
++      if (DLIMIT_ALLOC_BLOCK(ip, lengthPXD(pxd))) {
++              DQUOT_FREE_BLOCK(ip, lengthPXD(pxd));
++              release_metapage(rmp);
++              return -ENOSPC;
++      }
  
--      jfs_ip->saved_gid = le32_to_cpu(dip->di_gid);
-+      jfs_ip->saved_gid = INOTAG_GID(DX_TAG(ip), uid, gid);
+       jfs_info("dtSplitPage: ip:0x%p smp:0x%p rmp:0x%p", ip, smp, rmp);
+@@ -1920,6 +1943,12 @@ static int dtSplitRoot(tid_t tid,
+               release_metapage(rmp);
+               return -EDQUOT;
+       }
++      /* Allocate blocks to dlimit. */
++      if (DLIMIT_ALLOC_BLOCK(ip, lengthPXD(pxd))) {
++              DQUOT_FREE_BLOCK(ip, lengthPXD(pxd));
++              release_metapage(rmp);
++              return -ENOSPC;
++      }
+       BT_MARK_DIRTY(rmp, ip);
+       /*
+@@ -2286,6 +2315,8 @@ static int dtDeleteUp(tid_t tid, struct 
+       xlen = lengthPXD(&fp->header.self);
++      /* Free dlimit allocation. */
++      DLIMIT_FREE_BLOCK(ip, xlen);
+       /* Free quota allocation. */
+       DQUOT_FREE_BLOCK(ip, xlen);
+@@ -2362,6 +2393,8 @@ static int dtDeleteUp(tid_t tid, struct 
+                               xlen = lengthPXD(&p->header.self);
++                              /* Free dlimit allocation */
++                              DLIMIT_FREE_BLOCK(ip, xlen);
+                               /* Free quota allocation */
+                               DQUOT_FREE_BLOCK(ip, xlen);
+diff -NurpP --minimal linux-2.6.27.33/fs/jfs/jfs_extent.c linux-2.6.27.33-vs2.3.0.36.6/fs/jfs/jfs_extent.c
+--- linux-2.6.27.33/fs/jfs/jfs_extent.c        2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/jfs/jfs_extent.c   2008-10-13 14:54:20.000000000 +0200
+@@ -18,6 +18,7 @@
+ #include <linux/fs.h>
+ #include <linux/quotaops.h>
++#include <linux/vs_dlimit.h>
+ #include "jfs_incore.h"
+ #include "jfs_inode.h"
+ #include "jfs_superblock.h"
+@@ -147,6 +148,14 @@ extAlloc(struct inode *ip, s64 xlen, s64
+               return -EDQUOT;
+       }
++      /* Allocate blocks to dlimit. */
++      if (DLIMIT_ALLOC_BLOCK(ip, nxlen)) {
++              DQUOT_FREE_BLOCK(ip, nxlen);
++              dbFree(ip, nxaddr, (s64) nxlen);
++              mutex_unlock(&JFS_IP(ip)->commit_mutex);
++              return -ENOSPC;
++      }
++
+       /* determine the value of the extent flag */
+       xflag = abnr ? XAD_NOTRECORDED : 0;
+@@ -164,6 +173,7 @@ extAlloc(struct inode *ip, s64 xlen, s64
+        */
+       if (rc) {
+               dbFree(ip, nxaddr, nxlen);
++              DLIMIT_FREE_BLOCK(ip, nxlen);
+               DQUOT_FREE_BLOCK(ip, nxlen);
+               mutex_unlock(&JFS_IP(ip)->commit_mutex);
+               return (rc);
+@@ -261,6 +271,13 @@ int extRealloc(struct inode *ip, s64 nxl
+               mutex_unlock(&JFS_IP(ip)->commit_mutex);
+               return -EDQUOT;
+       }
++      /* Allocate blocks to dlimit. */
++      if (DLIMIT_ALLOC_BLOCK(ip, nxlen)) {
++              DQUOT_FREE_BLOCK(ip, nxlen);
++              dbFree(ip, nxaddr, (s64) nxlen);
++              up(&JFS_IP(ip)->commit_sem);
++              return -ENOSPC;
++      }
+       delta = nxlen - xlen;
+@@ -297,6 +314,7 @@ int extRealloc(struct inode *ip, s64 nxl
+               /* extend the extent */
+               if ((rc = xtExtend(0, ip, xoff + xlen, (int) nextend, 0))) {
+                       dbFree(ip, xaddr + xlen, delta);
++                      DLIMIT_FREE_BLOCK(ip, nxlen);
+                       DQUOT_FREE_BLOCK(ip, nxlen);
+                       goto exit;
+               }
+@@ -308,6 +326,7 @@ int extRealloc(struct inode *ip, s64 nxl
+                */
+               if ((rc = xtTailgate(0, ip, xoff, (int) ntail, nxaddr, 0))) {
+                       dbFree(ip, nxaddr, nxlen);
++                      DLIMIT_FREE_BLOCK(ip, nxlen);
+                       DQUOT_FREE_BLOCK(ip, nxlen);
+                       goto exit;
+               }
+diff -NurpP --minimal linux-2.6.27.33/fs/jfs/jfs_filsys.h linux-2.6.27.33-vs2.3.0.36.6/fs/jfs/jfs_filsys.h
+--- linux-2.6.27.33/fs/jfs/jfs_filsys.h        2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/jfs/jfs_filsys.h   2008-10-13 14:54:20.000000000 +0200
+@@ -263,6 +263,7 @@
+ #define JFS_NAME_MAX  255
+ #define JFS_PATH_MAX  BPSIZE
++#define JFS_TAGGED            0x00800000      /* Context Tagging */
+ /*
+  *    file system state (superblock state)
+diff -NurpP --minimal linux-2.6.27.33/fs/jfs/jfs_imap.c linux-2.6.27.33-vs2.3.0.36.6/fs/jfs/jfs_imap.c
+--- linux-2.6.27.33/fs/jfs/jfs_imap.c  2008-10-13 14:52:05.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/jfs/jfs_imap.c     2008-10-13 14:54:20.000000000 +0200
+@@ -45,6 +45,7 @@
+ #include <linux/buffer_head.h>
+ #include <linux/pagemap.h>
+ #include <linux/quotaops.h>
++#include <linux/vs_tag.h>
+ #include "jfs_incore.h"
+ #include "jfs_inode.h"
+@@ -3058,6 +3059,8 @@ static int copy_from_dinode(struct dinod
+ {
+       struct jfs_inode_info *jfs_ip = JFS_IP(ip);
+       struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb);
++      uid_t uid;
++      gid_t gid;
+       jfs_ip->fileset = le32_to_cpu(dip->di_fileset);
+       jfs_ip->mode2 = le32_to_cpu(dip->di_mode);
+@@ -3078,14 +3081,18 @@ static int copy_from_dinode(struct dinod
+       }
+       ip->i_nlink = le32_to_cpu(dip->di_nlink);
+-      jfs_ip->saved_uid = le32_to_cpu(dip->di_uid);
++      uid = le32_to_cpu(dip->di_uid);
++      gid = le32_to_cpu(dip->di_gid);
++      ip->i_tag = INOTAG_TAG(DX_TAG(ip), uid, gid, 0);
++
++      jfs_ip->saved_uid = INOTAG_UID(DX_TAG(ip), uid, gid);
+       if (sbi->uid == -1)
+               ip->i_uid = jfs_ip->saved_uid;
+       else {
+               ip->i_uid = sbi->uid;
+       }
+-      jfs_ip->saved_gid = le32_to_cpu(dip->di_gid);
++      jfs_ip->saved_gid = INOTAG_GID(DX_TAG(ip), uid, gid);
        if (sbi->gid == -1)
                ip->i_gid = jfs_ip->saved_gid;
        else {
-@@ -3151,14 +3158,12 @@ static void copy_to_dinode(struct dinode
+@@ -3150,14 +3157,12 @@ static void copy_to_dinode(struct dinode
        dip->di_size = cpu_to_le64(ip->i_size);
        dip->di_nblocks = cpu_to_le64(PBLK2LBLK(ip->i_sb, ip->i_blocks));
        dip->di_nlink = cpu_to_le32(ip->i_nlink);
@@ -3569,10 +4443,19 @@ diff -NurpP --minimal linux-2.6.31/fs/jfs/jfs_imap.c linux-2.6.31-vs2.3.0.36.14-
        jfs_get_inode_flags(jfs_ip);
        /*
         * mode2 is only needed for storing the higher order bits.
-diff -NurpP --minimal linux-2.6.31/fs/jfs/jfs_inode.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/jfs/jfs_inode.c
---- linux-2.6.31/fs/jfs/jfs_inode.c    2009-06-11 17:13:05.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/jfs/jfs_inode.c 2009-09-10 16:11:43.000000000 +0200
-@@ -30,29 +30,46 @@ void jfs_set_inode_flags(struct inode *i
+diff -NurpP --minimal linux-2.6.27.33/fs/jfs/jfs_inode.c linux-2.6.27.33-vs2.3.0.36.6/fs/jfs/jfs_inode.c
+--- linux-2.6.27.33/fs/jfs/jfs_inode.c 2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/jfs/jfs_inode.c    2008-10-13 14:54:20.000000000 +0200
+@@ -18,6 +18,8 @@
+ #include <linux/fs.h>
+ #include <linux/quotaops.h>
++#include <linux/vs_dlimit.h>
++#include <linux/vs_tag.h>
+ #include "jfs_incore.h"
+ #include "jfs_inode.h"
+ #include "jfs_filsys.h"
+@@ -30,29 +32,46 @@ void jfs_set_inode_flags(struct inode *i
  {
        unsigned int flags = JFS_IP(inode)->mode2;
  
@@ -3625,7 +4508,7 @@ diff -NurpP --minimal linux-2.6.31/fs/jfs/jfs_inode.c linux-2.6.31-vs2.3.0.36.14
        if (flags & S_APPEND)
                jfs_ip->mode2 |= JFS_APPEND_FL;
        if (flags & S_NOATIME)
-@@ -61,6 +78,19 @@ void jfs_get_inode_flags(struct jfs_inod
+@@ -61,6 +80,19 @@ void jfs_get_inode_flags(struct jfs_inod
                jfs_ip->mode2 |= JFS_DIRSYNC_FL;
        if (flags & S_SYNC)
                jfs_ip->mode2 |= JFS_SYNC_FL;
@@ -3645,9 +4528,27 @@ diff -NurpP --minimal linux-2.6.31/fs/jfs/jfs_inode.c linux-2.6.31-vs2.3.0.36.14
  }
  
  /*
-diff -NurpP --minimal linux-2.6.31/fs/jfs/jfs_inode.h linux-2.6.31-vs2.3.0.36.14-pre8/fs/jfs/jfs_inode.h
---- linux-2.6.31/fs/jfs/jfs_inode.h    2009-06-11 17:13:05.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/jfs/jfs_inode.h 2009-09-10 16:11:43.000000000 +0200
+@@ -108,10 +140,17 @@ struct inode *ialloc(struct inode *paren
+       jfs_inode->saved_uid = inode->i_uid;
+       jfs_inode->saved_gid = inode->i_gid;
++      inode->i_tag = dx_current_fstag(sb);
++      if (DLIMIT_ALLOC_INODE(inode)) {
++              iput(inode);
++              return ERR_PTR(-ENOSPC);
++      }
++
+       /*
+        * Allocate inode to quota.
+        */
+       if (DQUOT_ALLOC_INODE(inode)) {
++              DLIMIT_FREE_INODE(inode);
+               DQUOT_DROP(inode);
+               inode->i_flags |= S_NOQUOTA;
+               inode->i_nlink = 0;
+diff -NurpP --minimal linux-2.6.27.33/fs/jfs/jfs_inode.h linux-2.6.27.33-vs2.3.0.36.6/fs/jfs/jfs_inode.h
+--- linux-2.6.27.33/fs/jfs/jfs_inode.h 2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/jfs/jfs_inode.h    2008-10-13 14:54:20.000000000 +0200
 @@ -39,6 +39,7 @@ extern struct dentry *jfs_fh_to_dentry(s
  extern struct dentry *jfs_fh_to_parent(struct super_block *sb, struct fid *fid,
        int fh_len, int fh_type);
@@ -3656,9 +4557,95 @@ diff -NurpP --minimal linux-2.6.31/fs/jfs/jfs_inode.h linux-2.6.31-vs2.3.0.36.14
  extern int jfs_get_block(struct inode *, sector_t, struct buffer_head *, int);
  
  extern const struct address_space_operations jfs_aops;
-diff -NurpP --minimal linux-2.6.31/fs/jfs/namei.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/jfs/namei.c
---- linux-2.6.31/fs/jfs/namei.c        2009-06-11 17:13:05.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/jfs/namei.c     2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/jfs/jfs_xtree.c linux-2.6.27.33-vs2.3.0.36.6/fs/jfs/jfs_xtree.c
+--- linux-2.6.27.33/fs/jfs/jfs_xtree.c 2008-10-13 14:52:05.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/jfs/jfs_xtree.c    2008-10-13 14:54:20.000000000 +0200
+@@ -23,6 +23,7 @@
+ #include <linux/module.h>
+ #include <linux/quotaops.h>
+ #include <linux/seq_file.h>
++#include <linux/vs_dlimit.h>
+ #include "jfs_incore.h"
+ #include "jfs_filsys.h"
+ #include "jfs_metapage.h"
+@@ -848,7 +849,12 @@ int xtInsert(tid_t tid,           /* transaction 
+                       hint = 0;
+               if ((rc = DQUOT_ALLOC_BLOCK(ip, xlen)))
+                       goto out;
++              if ((rc = DLIMIT_ALLOC_BLOCK(ip, xlen))) {
++                      DQUOT_FREE_BLOCK(ip, xlen);
++                      goto out;
++              }
+               if ((rc = dbAlloc(ip, hint, (s64) xlen, &xaddr))) {
++                      DLIMIT_FREE_BLOCK(ip, xlen);
+                       DQUOT_FREE_BLOCK(ip, xlen);
+                       goto out;
+               }
+@@ -878,6 +884,7 @@ int xtInsert(tid_t tid,            /* transaction 
+                       /* undo data extent allocation */
+                       if (*xaddrp == 0) {
+                               dbFree(ip, xaddr, (s64) xlen);
++                              DLIMIT_FREE_BLOCK(ip, xlen);
+                               DQUOT_FREE_BLOCK(ip, xlen);
+                       }
+                       return rc;
+@@ -1234,6 +1241,7 @@ xtSplitPage(tid_t tid, struct inode *ip,
+       struct tlock *tlck;
+       struct xtlock *sxtlck = NULL, *rxtlck = NULL;
+       int quota_allocation = 0;
++      int dlimit_allocation = 0;
+       smp = split->mp;
+       sp = XT_PAGE(ip, smp);
+@@ -1253,6 +1261,13 @@ xtSplitPage(tid_t tid, struct inode *ip,
+       quota_allocation += lengthPXD(pxd);
++      /* Allocate blocks to dlimit. */
++      if (DLIMIT_ALLOC_BLOCK(ip, lengthPXD(pxd))) {
++             rc = -ENOSPC;
++             goto clean_up;
++      }
++      dlimit_allocation += lengthPXD(pxd);
++
+       /*
+        * allocate the new right page for the split
+        */
+@@ -1454,6 +1469,9 @@ xtSplitPage(tid_t tid, struct inode *ip,
+       clean_up:
++      /* Rollback dlimit allocation. */
++      if (dlimit_allocation)
++              DLIMIT_FREE_BLOCK(ip, dlimit_allocation);
+       /* Rollback quota allocation. */
+       if (quota_allocation)
+               DQUOT_FREE_BLOCK(ip, quota_allocation);
+@@ -1517,6 +1535,12 @@ xtSplitRoot(tid_t tid,
+               release_metapage(rmp);
+               return -EDQUOT;
+       }
++      /* Allocate blocks to dlimit. */
++      if (DLIMIT_ALLOC_BLOCK(ip, lengthPXD(pxd))) {
++              DQUOT_FREE_BLOCK(ip, lengthPXD(pxd));
++              release_metapage(rmp);
++              return -ENOSPC;
++      }
+       jfs_info("xtSplitRoot: ip:0x%p rmp:0x%p", ip, rmp);
+@@ -3940,6 +3964,8 @@ s64 xtTruncate(tid_t tid, struct inode *
+       else
+               ip->i_size = newsize;
++      /* update dlimit allocation to reflect freed blocks */
++      DLIMIT_FREE_BLOCK(ip, nfreed);
+       /* update quota allocation to reflect freed blocks */
+       DQUOT_FREE_BLOCK(ip, nfreed);
+diff -NurpP --minimal linux-2.6.27.33/fs/jfs/namei.c linux-2.6.27.33-vs2.3.0.36.6/fs/jfs/namei.c
+--- linux-2.6.27.33/fs/jfs/namei.c     2008-10-13 14:52:05.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/jfs/namei.c        2008-10-13 14:54:20.000000000 +0200
 @@ -21,6 +21,7 @@
  #include <linux/ctype.h>
  #include <linux/quotaops.h>
@@ -3667,7 +4654,7 @@ diff -NurpP --minimal linux-2.6.31/fs/jfs/namei.c linux-2.6.31-vs2.3.0.36.14-pre
  #include "jfs_incore.h"
  #include "jfs_superblock.h"
  #include "jfs_inode.h"
-@@ -1476,6 +1477,7 @@ static struct dentry *jfs_lookup(struct 
+@@ -1468,6 +1469,7 @@ static struct dentry *jfs_lookup(struct 
                return ERR_CAST(ip);
        }
  
@@ -3675,7 +4662,7 @@ diff -NurpP --minimal linux-2.6.31/fs/jfs/namei.c linux-2.6.31-vs2.3.0.36.14-pre
        dentry = d_splice_alias(ip, dentry);
  
        if (dentry && (JFS_SBI(dip->i_sb)->mntflag & JFS_OS2))
-@@ -1545,6 +1547,7 @@ const struct inode_operations jfs_dir_in
+@@ -1550,6 +1552,7 @@ const struct inode_operations jfs_dir_in
        .setattr        = jfs_setattr,
        .permission     = jfs_permission,
  #endif
@@ -3683,10 +4670,10 @@ diff -NurpP --minimal linux-2.6.31/fs/jfs/namei.c linux-2.6.31-vs2.3.0.36.14-pre
  };
  
  const struct file_operations jfs_dir_operations = {
-diff -NurpP --minimal linux-2.6.31/fs/jfs/super.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/jfs/super.c
---- linux-2.6.31/fs/jfs/super.c        2009-09-10 15:26:22.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/jfs/super.c     2009-09-10 17:10:55.000000000 +0200
-@@ -194,7 +194,8 @@ static void jfs_put_super(struct super_b
+diff -NurpP --minimal linux-2.6.27.33/fs/jfs/super.c linux-2.6.27.33-vs2.3.0.36.6/fs/jfs/super.c
+--- linux-2.6.27.33/fs/jfs/super.c     2008-10-13 14:52:05.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/jfs/super.c        2008-10-13 14:54:20.000000000 +0200
+@@ -196,7 +196,8 @@ static void jfs_put_super(struct super_b
  enum {
        Opt_integrity, Opt_nointegrity, Opt_iocharset, Opt_resize,
        Opt_resize_nosize, Opt_errors, Opt_ignore, Opt_err, Opt_quota,
@@ -3695,8 +4682,8 @@ diff -NurpP --minimal linux-2.6.31/fs/jfs/super.c linux-2.6.31-vs2.3.0.36.14-pre
 +      Opt_tag, Opt_notag, Opt_tagid
  };
  
- static const match_table_t tokens = {
-@@ -204,6 +205,10 @@ static const match_table_t tokens = {
+ static match_table_t tokens = {
+@@ -206,6 +207,10 @@ static match_table_t tokens = {
        {Opt_resize, "resize=%u"},
        {Opt_resize_nosize, "resize"},
        {Opt_errors, "errors=%s"},
@@ -3707,7 +4694,7 @@ diff -NurpP --minimal linux-2.6.31/fs/jfs/super.c linux-2.6.31-vs2.3.0.36.14-pre
        {Opt_ignore, "noquota"},
        {Opt_ignore, "quota"},
        {Opt_usrquota, "usrquota"},
-@@ -338,6 +343,20 @@ static int parse_options(char *options, 
+@@ -340,6 +345,20 @@ static int parse_options(char *options, 
                        }
                        break;
                }
@@ -3728,20 +4715,21 @@ diff -NurpP --minimal linux-2.6.31/fs/jfs/super.c linux-2.6.31-vs2.3.0.36.14-pre
                default:
                        printk("jfs: Unrecognized mount option \"%s\" "
                                        " or missing value\n", p);
-@@ -369,6 +388,12 @@ static int jfs_remount(struct super_bloc
+@@ -370,6 +389,13 @@ static int jfs_remount(struct super_bloc
        if (!parse_options(data, sb, &newLVSize, &flag)) {
                return -EINVAL;
        }
++
 +      if ((flag & JFS_TAGGED) && !(sb->s_flags & MS_TAGGED)) {
 +              printk(KERN_ERR "JFS: %s: tagging not permitted on remount.\n",
 +                      sb->s_id);
 +              return -EINVAL;
 +      }
 +
-       lock_kernel();
        if (newLVSize) {
                if (sb->s_flags & MS_RDONLY) {
-@@ -452,6 +477,9 @@ static int jfs_fill_super(struct super_b
+                       printk(KERN_ERR
+@@ -441,6 +467,9 @@ static int jfs_fill_super(struct super_b
  #ifdef CONFIG_JFS_POSIX_ACL
        sb->s_flags |= MS_POSIXACL;
  #endif
@@ -3751,10 +4739,90 @@ diff -NurpP --minimal linux-2.6.31/fs/jfs/super.c linux-2.6.31-vs2.3.0.36.14-pre
  
        if (newLVSize) {
                printk(KERN_ERR "resize option for remount only\n");
-diff -NurpP --minimal linux-2.6.31/fs/libfs.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/libfs.c
---- linux-2.6.31/fs/libfs.c    2009-09-10 15:26:22.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/libfs.c 2009-09-10 16:11:43.000000000 +0200
-@@ -127,7 +127,8 @@ static inline unsigned char dt_type(stru
+diff -NurpP --minimal linux-2.6.27.33/fs/jfs/xattr.c linux-2.6.27.33-vs2.3.0.36.6/fs/jfs/xattr.c
+--- linux-2.6.27.33/fs/jfs/xattr.c     2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/jfs/xattr.c        2008-10-13 14:54:20.000000000 +0200
+@@ -23,6 +23,7 @@
+ #include <linux/posix_acl_xattr.h>
+ #include <linux/quotaops.h>
+ #include <linux/security.h>
++#include <linux/vs_dlimit.h>
+ #include "jfs_incore.h"
+ #include "jfs_superblock.h"
+ #include "jfs_dmap.h"
+@@ -263,9 +264,16 @@ static int ea_write(struct inode *ip, st
+       if (DQUOT_ALLOC_BLOCK(ip, nblocks)) {
+               return -EDQUOT;
+       }
++      /* Allocate new blocks to dlimit. */
++      if (DLIMIT_ALLOC_BLOCK(ip, nblocks)) {
++              DQUOT_FREE_BLOCK(ip, nblocks);
++              return -ENOSPC;
++      }
+       rc = dbAlloc(ip, INOHINT(ip), nblocks, &blkno);
+       if (rc) {
++              /*Rollback dlimit allocation. */
++              DLIMIT_FREE_BLOCK(ip, nblocks);
+               /*Rollback quota allocation. */
+               DQUOT_FREE_BLOCK(ip, nblocks);
+               return rc;
+@@ -332,6 +340,8 @@ static int ea_write(struct inode *ip, st
+       failed:
+       /* Rollback quota allocation. */
++      DLIMIT_FREE_BLOCK(ip, nblocks);
++      /* Rollback quota allocation. */
+       DQUOT_FREE_BLOCK(ip, nblocks);
+       dbFree(ip, blkno, nblocks);
+@@ -468,6 +478,7 @@ static int ea_get(struct inode *inode, s
+       s64 blkno;
+       int rc;
+       int quota_allocation = 0;
++      int dlimit_allocation = 0;
+       /* When fsck.jfs clears a bad ea, it doesn't clear the size */
+       if (ji->ea.flag == 0)
+@@ -543,6 +554,12 @@ static int ea_get(struct inode *inode, s
+               quota_allocation = blocks_needed;
++              /* Allocate new blocks to dlimit. */
++              rc = -ENOSPC;
++              if (DLIMIT_ALLOC_BLOCK(inode, blocks_needed))
++                      goto clean_up;
++              dlimit_allocation = blocks_needed;
++
+               rc = dbAlloc(inode, INOHINT(inode), (s64) blocks_needed,
+                            &blkno);
+               if (rc)
+@@ -600,6 +617,9 @@ static int ea_get(struct inode *inode, s
+       return ea_size;
+       clean_up:
++      /* Rollback dlimit allocation */
++      if (dlimit_allocation)
++              DLIMIT_FREE_BLOCK(inode, dlimit_allocation);
+       /* Rollback quota allocation */
+       if (quota_allocation)
+               DQUOT_FREE_BLOCK(inode, quota_allocation);
+@@ -676,8 +696,10 @@ static int ea_put(tid_t tid, struct inod
+       }
+       /* If old blocks exist, they must be removed from quota allocation. */
+-      if (old_blocks)
++      if (old_blocks) {
++              DLIMIT_FREE_BLOCK(inode, old_blocks);
+               DQUOT_FREE_BLOCK(inode, old_blocks);
++      }
+       inode->i_ctime = CURRENT_TIME;
+diff -NurpP --minimal linux-2.6.27.33/fs/libfs.c linux-2.6.27.33-vs2.3.0.36.6/fs/libfs.c
+--- linux-2.6.27.33/fs/libfs.c 2009-09-13 16:16:59.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/libfs.c    2009-02-03 17:59:04.000000000 +0100
+@@ -125,7 +125,8 @@ static inline unsigned char dt_type(stru
   * both impossible due to the lock on directory.
   */
  
@@ -3764,7 +4832,7 @@ diff -NurpP --minimal linux-2.6.31/fs/libfs.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
  {
        struct dentry *dentry = filp->f_path.dentry;
        struct dentry *cursor = filp->private_data;
-@@ -160,6 +161,8 @@ int dcache_readdir(struct file * filp, v
+@@ -158,6 +159,8 @@ int dcache_readdir(struct file * filp, v
                                next = list_entry(p, struct dentry, d_u.d_child);
                                if (d_unhashed(next) || !next->d_inode)
                                        continue;
@@ -3773,7 +4841,7 @@ diff -NurpP --minimal linux-2.6.31/fs/libfs.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
  
                                spin_unlock(&dcache_lock);
                                if (filldir(dirent, next->d_name.name, 
-@@ -178,6 +181,18 @@ int dcache_readdir(struct file * filp, v
+@@ -176,6 +179,18 @@ int dcache_readdir(struct file * filp, v
        return 0;
  }
  
@@ -3792,7 +4860,7 @@ diff -NurpP --minimal linux-2.6.31/fs/libfs.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
  ssize_t generic_read_dir(struct file *filp, char __user *buf, size_t siz, loff_t *ppos)
  {
        return -EISDIR;
-@@ -836,6 +851,7 @@ EXPORT_SYMBOL(dcache_dir_close);
+@@ -823,6 +838,7 @@ EXPORT_SYMBOL(dcache_dir_close);
  EXPORT_SYMBOL(dcache_dir_lseek);
  EXPORT_SYMBOL(dcache_dir_open);
  EXPORT_SYMBOL(dcache_readdir);
@@ -3800,9 +4868,9 @@ diff -NurpP --minimal linux-2.6.31/fs/libfs.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
  EXPORT_SYMBOL(generic_read_dir);
  EXPORT_SYMBOL(get_sb_pseudo);
  EXPORT_SYMBOL(simple_write_begin);
-diff -NurpP --minimal linux-2.6.31/fs/locks.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/locks.c
---- linux-2.6.31/fs/locks.c    2009-09-10 15:26:22.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/locks.c 2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/locks.c linux-2.6.27.33-vs2.3.0.36.6/fs/locks.c
+--- linux-2.6.27.33/fs/locks.c 2009-09-13 16:16:59.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/locks.c    2009-02-03 17:59:04.000000000 +0100
 @@ -127,6 +127,8 @@
  #include <linux/time.h>
  #include <linux/rcupdate.h>
@@ -3821,7 +4889,7 @@ diff -NurpP --minimal linux-2.6.31/fs/locks.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
        return kmem_cache_alloc(filelock_cache, GFP_KERNEL);
  }
  
-@@ -174,6 +178,7 @@ static void locks_free_lock(struct file_
+@@ -173,6 +177,7 @@ static void locks_free_lock(struct file_
        BUG_ON(!list_empty(&fl->fl_block));
        BUG_ON(!list_empty(&fl->fl_link));
  
@@ -3829,7 +4897,7 @@ diff -NurpP --minimal linux-2.6.31/fs/locks.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
        locks_release_private(fl);
        kmem_cache_free(filelock_cache, fl);
  }
-@@ -194,6 +199,7 @@ void locks_init_lock(struct file_lock *f
+@@ -193,6 +198,7 @@ void locks_init_lock(struct file_lock *f
        fl->fl_start = fl->fl_end = 0;
        fl->fl_ops = NULL;
        fl->fl_lmops = NULL;
@@ -3837,7 +4905,7 @@ diff -NurpP --minimal linux-2.6.31/fs/locks.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
  }
  
  EXPORT_SYMBOL(locks_init_lock);
-@@ -248,6 +254,7 @@ void locks_copy_lock(struct file_lock *n
+@@ -247,6 +253,7 @@ void locks_copy_lock(struct file_lock *n
        new->fl_file = fl->fl_file;
        new->fl_ops = fl->fl_ops;
        new->fl_lmops = fl->fl_lmops;
@@ -3845,7 +4913,7 @@ diff -NurpP --minimal linux-2.6.31/fs/locks.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
  
        locks_copy_private(new, fl);
  }
-@@ -286,6 +293,11 @@ static int flock_make_lock(struct file *
+@@ -285,6 +292,11 @@ static int flock_make_lock(struct file *
        fl->fl_flags = FL_FLOCK;
        fl->fl_type = type;
        fl->fl_end = OFFSET_MAX;
@@ -3857,7 +4925,7 @@ diff -NurpP --minimal linux-2.6.31/fs/locks.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
        
        *lock = fl;
        return 0;
-@@ -451,6 +463,7 @@ static int lease_init(struct file *filp,
+@@ -450,6 +462,7 @@ static int lease_init(struct file *filp,
  
        fl->fl_owner = current->files;
        fl->fl_pid = current->tgid;
@@ -3865,7 +4933,7 @@ diff -NurpP --minimal linux-2.6.31/fs/locks.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
  
        fl->fl_file = filp;
        fl->fl_flags = FL_LEASE;
-@@ -470,6 +483,11 @@ static struct file_lock *lease_alloc(str
+@@ -469,6 +482,11 @@ static struct file_lock *lease_alloc(str
        if (fl == NULL)
                return ERR_PTR(error);
  
@@ -3877,7 +4945,7 @@ diff -NurpP --minimal linux-2.6.31/fs/locks.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
        error = lease_init(filp, type, fl);
        if (error) {
                locks_free_lock(fl);
-@@ -770,6 +788,7 @@ static int flock_lock_file(struct file *
+@@ -769,6 +787,7 @@ static int flock_lock_file(struct file *
        if (found)
                cond_resched_bkl();
  
@@ -3885,7 +4953,7 @@ diff -NurpP --minimal linux-2.6.31/fs/locks.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
  find_conflict:
        for_each_lock(inode, before) {
                struct file_lock *fl = *before;
-@@ -790,6 +809,7 @@ find_conflict:
+@@ -789,6 +808,7 @@ find_conflict:
                goto out;
        locks_copy_lock(new_fl, request);
        locks_insert_lock(before, new_fl);
@@ -3893,7 +4961,7 @@ diff -NurpP --minimal linux-2.6.31/fs/locks.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
        new_fl = NULL;
        error = 0;
  
-@@ -800,7 +820,8 @@ out:
+@@ -799,7 +819,8 @@ out:
        return error;
  }
  
@@ -3903,7 +4971,7 @@ diff -NurpP --minimal linux-2.6.31/fs/locks.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
  {
        struct file_lock *fl;
        struct file_lock *new_fl = NULL;
-@@ -810,6 +831,8 @@ static int __posix_lock_file(struct inod
+@@ -809,6 +830,8 @@ static int __posix_lock_file(struct inod
        struct file_lock **before;
        int error, added = 0;
  
@@ -3912,7 +4980,7 @@ diff -NurpP --minimal linux-2.6.31/fs/locks.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
        /*
         * We may need two file_lock structures for this operation,
         * so we get them in advance to avoid races.
-@@ -820,7 +843,11 @@ static int __posix_lock_file(struct inod
+@@ -819,7 +842,11 @@ static int __posix_lock_file(struct inod
            (request->fl_type != F_UNLCK ||
             request->fl_start != 0 || request->fl_end != OFFSET_MAX)) {
                new_fl = locks_alloc_lock();
@@ -3924,7 +4992,7 @@ diff -NurpP --minimal linux-2.6.31/fs/locks.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
        }
  
        lock_kernel();
-@@ -1019,7 +1046,8 @@ static int __posix_lock_file(struct inod
+@@ -1018,7 +1045,8 @@ static int __posix_lock_file(struct inod
  int posix_lock_file(struct file *filp, struct file_lock *fl,
                        struct file_lock *conflock)
  {
@@ -3934,7 +5002,7 @@ diff -NurpP --minimal linux-2.6.31/fs/locks.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
  }
  EXPORT_SYMBOL(posix_lock_file);
  
-@@ -1109,7 +1137,7 @@ int locks_mandatory_area(int read_write,
+@@ -1108,7 +1136,7 @@ int locks_mandatory_area(int read_write,
        fl.fl_end = offset + count - 1;
  
        for (;;) {
@@ -3943,7 +5011,7 @@ diff -NurpP --minimal linux-2.6.31/fs/locks.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
                if (error != FILE_LOCK_DEFERRED)
                        break;
                error = wait_event_interruptible(fl.fl_wait, !fl.fl_next);
-@@ -1424,6 +1452,7 @@ int generic_setlease(struct file *filp, 
+@@ -1423,6 +1451,7 @@ int generic_setlease(struct file *filp, 
  
        locks_copy_lock(new_fl, lease);
        locks_insert_lock(before, new_fl);
@@ -3951,7 +5019,7 @@ diff -NurpP --minimal linux-2.6.31/fs/locks.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
  
        *flp = new_fl;
        return 0;
-@@ -1779,6 +1808,11 @@ int fcntl_setlk(unsigned int fd, struct 
+@@ -1777,6 +1806,11 @@ int fcntl_setlk(unsigned int fd, struct 
        if (file_lock == NULL)
                return -ENOLCK;
  
@@ -3963,7 +5031,7 @@ diff -NurpP --minimal linux-2.6.31/fs/locks.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
        /*
         * This might block, so we do it before checking the inode.
         */
-@@ -1897,6 +1931,11 @@ int fcntl_setlk64(unsigned int fd, struc
+@@ -1895,6 +1929,11 @@ int fcntl_setlk64(unsigned int fd, struc
        if (file_lock == NULL)
                return -ENOLCK;
  
@@ -3975,7 +5043,7 @@ diff -NurpP --minimal linux-2.6.31/fs/locks.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
        /*
         * This might block, so we do it before checking the inode.
         */
-@@ -2162,8 +2201,11 @@ static int locks_show(struct seq_file *f
+@@ -2159,8 +2198,11 @@ static int locks_show(struct seq_file *f
  
        lock_get_status(f, fl, (long)f->private, "");
  
@@ -3988,13 +5056,13 @@ diff -NurpP --minimal linux-2.6.31/fs/locks.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
  
        f->private++;
        return 0;
-diff -NurpP --minimal linux-2.6.31/fs/namei.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/namei.c
---- linux-2.6.31/fs/namei.c    2009-09-10 15:26:22.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/namei.c 2009-09-10 17:12:38.000000000 +0200
-@@ -33,6 +33,14 @@
+diff -NurpP --minimal linux-2.6.27.33/fs/namei.c linux-2.6.27.33-vs2.3.0.36.6/fs/namei.c
+--- linux-2.6.27.33/fs/namei.c 2009-09-13 16:16:59.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/namei.c    2009-02-03 17:59:04.000000000 +0100
+@@ -31,6 +31,14 @@
+ #include <linux/file.h>
  #include <linux/fcntl.h>
  #include <linux/device_cgroup.h>
- #include <linux/fs_struct.h>
 +#include <linux/proc_fs.h>
 +#include <linux/vserver/inode.h>
 +#include <linux/vs_base.h>
@@ -4006,7 +5074,7 @@ diff -NurpP --minimal linux-2.6.31/fs/namei.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
  #include <asm/uaccess.h>
  
  #define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE])
-@@ -169,6 +177,77 @@ void putname(const char *name)
+@@ -167,6 +175,77 @@ void putname(const char *name)
  EXPORT_SYMBOL(putname);
  #endif
  
@@ -4084,7 +5152,7 @@ diff -NurpP --minimal linux-2.6.31/fs/namei.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
  
  /**
   * generic_permission  -  check for access rights on a Posix-like filesystem
-@@ -255,10 +334,14 @@ int inode_permission(struct inode *inode
+@@ -244,10 +323,14 @@ int inode_permission(struct inode *inode
                /*
                 * Nobody gets write access to an immutable file.
                 */
@@ -4097,29 +5165,29 @@ diff -NurpP --minimal linux-2.6.31/fs/namei.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
 +      if (retval)
 +              return retval;
 +
-       if (inode->i_op->permission)
+       /* Ordinary permission routines do not understand MAY_APPEND. */
+       if (inode->i_op && inode->i_op->permission) {
                retval = inode->i_op->permission(inode, mask);
-       else
-@@ -434,6 +517,8 @@ static int exec_permission_lite(struct i
+@@ -451,6 +534,8 @@ static int exec_permission_lite(struct i
  {
        umode_t mode = inode->i_mode;
  
 +      if (dx_barrier(inode))
 +              return -EACCES;
-       if (inode->i_op->permission)
+       if (inode->i_op && inode->i_op->permission)
                return -EAGAIN;
  
-@@ -756,7 +841,8 @@ static __always_inline void follow_dotdo
-               if (nd->path.dentry == nd->root.dentry &&
-                   nd->path.mnt == nd->root.mnt) {
+@@ -773,7 +858,8 @@ static __always_inline void follow_dotdo
+               if (nd->path.dentry == fs->root.dentry &&
+                   nd->path.mnt == fs->root.mnt) {
+                         read_unlock(&fs->lock);
 -                      break;
 +                      /* for sane '/' avoid follow_mount() */
 +                      return;
                }
+                 read_unlock(&fs->lock);
                spin_lock(&dcache_lock);
-               if (nd->path.dentry != nd->path.mnt->mnt_root) {
-@@ -792,16 +878,30 @@ static int do_lookup(struct nameidata *n
+@@ -810,16 +896,30 @@ static int do_lookup(struct nameidata *n
  {
        struct vfsmount *mnt = nd->path.mnt;
        struct dentry *dentry = __d_lookup(nd->path.dentry, name);
@@ -4142,25 +5210,25 @@ diff -NurpP --minimal linux-2.6.31/fs/namei.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
        __follow_mount(path);
        return 0;
 +hidden:
-+      vxwprintk_task(1, "did lookup hidden %s:%p[#%d,%lu] »%s/%.*s«.",
++      vxwprintk_task(1, "did lookup hidden %s:%p[#%d,%lu] »%s«.",
 +              inode->i_sb->s_id, inode, inode->i_tag, inode->i_ino,
-+              vxd_path(&nd->path), name->len, name->name);
++              vxd_path(&nd->path));
 +      dput(dentry);
 +      return -ENOENT;
  
  need_lookup:
        dentry = real_lookup(nd->path.dentry, name, nd);
-@@ -1389,7 +1489,7 @@ static int may_delete(struct inode *dir,
+@@ -1407,7 +1507,7 @@ static int may_delete(struct inode *dir,
        if (IS_APPEND(dir))
                return -EPERM;
        if (check_sticky(dir, victim->d_inode)||IS_APPEND(victim->d_inode)||
--          IS_IMMUTABLE(victim->d_inode) || IS_SWAPFILE(victim->d_inode))
-+              IS_IXORUNLINK(victim->d_inode) || IS_SWAPFILE(victim->d_inode))
+-          IS_IMMUTABLE(victim->d_inode))
++              IS_IXORUNLINK(victim->d_inode))
                return -EPERM;
        if (isdir) {
                if (!S_ISDIR(victim->d_inode->i_mode))
-@@ -1529,6 +1629,14 @@ int may_open(struct path *path, int acc_
-               break;
+@@ -1551,6 +1651,14 @@ int may_open(struct nameidata *nd, int a
+               flag &= ~O_TRUNC;
        }
  
 +#ifdef        CONFIG_VSERVER_COWBL
@@ -4171,26 +5239,25 @@ diff -NurpP --minimal linux-2.6.31/fs/namei.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
 +              mark_inode_dirty(inode);
 +      }
 +#endif
-       error = inode_permission(inode, acc_mode);
+       error = vfs_permission(nd, acc_mode);
        if (error)
                return error;
-@@ -1675,7 +1783,11 @@ struct file *do_filp_open(int dfd, const
-       int count = 0;
+@@ -1677,6 +1785,11 @@ struct file *do_filp_open(int dfd, const
        int will_write;
        int flag = open_to_namei_flags(open_flag);
--
 +#ifdef        CONFIG_VSERVER_COWBL
 +      int rflag = flag;
 +      int rmode = mode;
 +restart:
 +#endif
-       if (!acc_mode)
-               acc_mode = MAY_OPEN | ACC_MODE(flag);
+       acc_mode = MAY_OPEN | ACC_MODE(flag);
  
-@@ -1823,6 +1935,25 @@ ok:
+       /* O_TRUNC implies we need access checks for write permissions */
+@@ -1800,6 +1913,25 @@ ok:
                        goto exit;
        }
-       error = may_open(&nd.path, acc_mode, flag);
+       error = may_open(&nd, acc_mode, flag);
 +#ifdef        CONFIG_VSERVER_COWBL
 +      if (error == -EMLINK) {
 +              struct dentry *dentry;
@@ -4213,7 +5280,7 @@ diff -NurpP --minimal linux-2.6.31/fs/namei.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
        if (error) {
                if (will_write)
                        mnt_drop_write(nd.path.mnt);
-@@ -1985,9 +2116,17 @@ int vfs_mknod(struct inode *dir, struct 
+@@ -1952,9 +2084,17 @@ int vfs_mknod(struct inode *dir, struct 
        if (error)
                return error;
  
@@ -4229,19 +5296,19 @@ diff -NurpP --minimal linux-2.6.31/fs/namei.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
 +      if (S_ISBLK(mode) && !vs_blkdev_perm(dev, DATTR_CREATE))
 +              return -EPERM;
 +okay:
-       if (!dir->i_op->mknod)
+       if (!dir->i_op || !dir->i_op->mknod)
                return -EPERM;
  
-@@ -2454,7 +2593,7 @@ int vfs_link(struct dentry *old_dentry, 
+@@ -2395,7 +2535,7 @@ int vfs_link(struct dentry *old_dentry, 
        /*
         * A link to an append-only or immutable file cannot be created.
         */
 -      if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
 +      if (IS_APPEND(inode) || IS_IXORUNLINK(inode))
                return -EPERM;
-       if (!dir->i_op->link)
+       if (!dir->i_op || !dir->i_op->link)
                return -EPERM;
-@@ -2827,6 +2966,219 @@ int vfs_follow_link(struct nameidata *nd
+@@ -2755,6 +2895,217 @@ int vfs_follow_link(struct nameidata *nd
        return __vfs_follow_link(nd, link);
  }
  
@@ -4342,8 +5409,7 @@ diff -NurpP --minimal linux-2.6.31/fs/namei.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
 +      dget(old_path.dentry);
 +      mntget(old_path.mnt);
 +      /* this one cleans up the dentry/mnt in case of failure */
-+      old_file = dentry_open(old_path.dentry, old_path.mnt,
-+              O_RDONLY, current_cred());
++      old_file = dentry_open(old_path.dentry, old_path.mnt, O_RDONLY);
 +      vxdprintk(VXD_CBIT(misc, 2),
 +              "dentry_open(old): %p", old_file);
 +      if (!old_file || IS_ERR(old_file)) {
@@ -4354,8 +5420,7 @@ diff -NurpP --minimal linux-2.6.31/fs/namei.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
 +      dget(new_path.dentry);
 +      mntget(new_path.mnt);
 +      /* this one cleans up the dentry/mnt in case of failure */
-+      new_file = dentry_open(new_path.dentry, new_path.mnt,
-+              O_WRONLY, current_cred());
++      new_file = dentry_open(new_path.dentry, new_path.mnt, O_WRONLY);
 +      vxdprintk(VXD_CBIT(misc, 2),
 +              "dentry_open(new): %p", new_file);
 +
@@ -4461,13 +5526,13 @@ diff -NurpP --minimal linux-2.6.31/fs/namei.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
  /* get the link contents into pagecache */
  static char *page_getlink(struct dentry * dentry, struct page **ppage)
  {
-diff -NurpP --minimal linux-2.6.31/fs/namespace.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/namespace.c
---- linux-2.6.31/fs/namespace.c        2009-09-10 15:26:22.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/namespace.c     2009-09-10 16:11:43.000000000 +0200
-@@ -29,6 +29,11 @@
+diff -NurpP --minimal linux-2.6.27.33/fs/namespace.c linux-2.6.27.33-vs2.3.0.36.6/fs/namespace.c
+--- linux-2.6.27.33/fs/namespace.c     2009-09-13 16:16:59.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/namespace.c        2009-05-15 22:59:20.000000000 +0200
+@@ -27,6 +27,11 @@
+ #include <linux/ramfs.h>
  #include <linux/log2.h>
  #include <linux/idr.h>
- #include <linux/fs_struct.h>
 +#include <linux/vs_base.h>
 +#include <linux/vs_context.h>
 +#include <linux/vs_tag.h>
@@ -4476,7 +5541,7 @@ diff -NurpP --minimal linux-2.6.31/fs/namespace.c linux-2.6.31-vs2.3.0.36.14-pre
  #include <asm/uaccess.h>
  #include <asm/unistd.h>
  #include "pnode.h"
-@@ -567,6 +572,7 @@ static struct vfsmount *clone_mnt(struct
+@@ -573,6 +578,7 @@ static struct vfsmount *clone_mnt(struct
                mnt->mnt_root = dget(root);
                mnt->mnt_mountpoint = mnt->mnt_root;
                mnt->mnt_parent = mnt;
@@ -4484,7 +5549,7 @@ diff -NurpP --minimal linux-2.6.31/fs/namespace.c linux-2.6.31-vs2.3.0.36.14-pre
  
                if (flag & CL_SLAVE) {
                        list_add(&mnt->mnt_slave, &old->mnt_slave_list);
-@@ -661,6 +667,31 @@ static inline void mangle(struct seq_fil
+@@ -685,6 +691,31 @@ static inline void mangle(struct seq_fil
        seq_escape(m, s, " \t\n\\");
  }
  
@@ -4516,7 +5581,7 @@ diff -NurpP --minimal linux-2.6.31/fs/namespace.c linux-2.6.31-vs2.3.0.36.14-pre
  /*
   * Simple .show_options callback for filesystems which don't want to
   * implement more complex mount option showing.
-@@ -748,6 +779,8 @@ static int show_sb_opts(struct seq_file 
+@@ -757,6 +788,8 @@ static int show_sb_opts(struct seq_file 
                { MS_SYNCHRONOUS, ",sync" },
                { MS_DIRSYNC, ",dirsync" },
                { MS_MANDLOCK, ",mand" },
@@ -4525,7 +5590,7 @@ diff -NurpP --minimal linux-2.6.31/fs/namespace.c linux-2.6.31-vs2.3.0.36.14-pre
                { 0, NULL }
        };
        const struct proc_fs_info *fs_infop;
-@@ -795,10 +828,20 @@ static int show_vfsmnt(struct seq_file *
+@@ -803,10 +836,20 @@ static int show_vfsmnt(struct seq_file *
        int err = 0;
        struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
  
@@ -4550,7 +5615,7 @@ diff -NurpP --minimal linux-2.6.31/fs/namespace.c linux-2.6.31-vs2.3.0.36.14-pre
        show_type(m, mnt->mnt_sb);
        seq_puts(m, __mnt_is_readonly(mnt) ? " ro" : " rw");
        err = show_sb_opts(m, mnt->mnt_sb);
-@@ -828,6 +871,11 @@ static int show_mountinfo(struct seq_fil
+@@ -836,6 +879,11 @@ static int show_mountinfo(struct seq_fil
        struct path root = p->root;
        int err = 0;
  
@@ -4562,7 +5627,7 @@ diff -NurpP --minimal linux-2.6.31/fs/namespace.c linux-2.6.31-vs2.3.0.36.14-pre
        seq_printf(m, "%i %i %u:%u ", mnt->mnt_id, mnt->mnt_parent->mnt_id,
                   MAJOR(sb->s_dev), MINOR(sb->s_dev));
        seq_dentry(m, mnt->mnt_root, " \t\n\\");
-@@ -886,17 +934,27 @@ static int show_vfsstat(struct seq_file 
+@@ -894,17 +942,27 @@ static int show_vfsstat(struct seq_file 
        struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
        int err = 0;
  
@@ -4600,7 +5665,7 @@ diff -NurpP --minimal linux-2.6.31/fs/namespace.c linux-2.6.31-vs2.3.0.36.14-pre
  
        /* file system type */
        seq_puts(m, "with fstype ");
-@@ -1130,7 +1188,7 @@ SYSCALL_DEFINE2(umount, char __user *, n
+@@ -1143,7 +1201,7 @@ SYSCALL_DEFINE2(umount, char __user *, n
                goto dput_and_out;
  
        retval = -EPERM;
@@ -4609,40 +5674,31 @@ diff -NurpP --minimal linux-2.6.31/fs/namespace.c linux-2.6.31-vs2.3.0.36.14-pre
                goto dput_and_out;
  
        retval = do_umount(path.mnt, flags);
-@@ -1156,7 +1214,7 @@ SYSCALL_DEFINE1(oldumount, char __user *
+@@ -1169,7 +1227,7 @@ SYSCALL_DEFINE1(oldumount, char __user *
  
- static int mount_is_safe(struct path *path)
+ static int mount_is_safe(struct nameidata *nd)
  {
 -      if (capable(CAP_SYS_ADMIN))
 +      if (vx_capable(CAP_SYS_ADMIN, VXC_SECURE_MOUNT))
                return 0;
        return -EPERM;
  #ifdef notyet
-@@ -1420,7 +1478,7 @@ static int do_change_type(struct path *p
-       int type = flag & ~MS_REC;
-       int err = 0;
--      if (!capable(CAP_SYS_ADMIN))
-+      if (!vx_capable(CAP_SYS_ADMIN, VXC_NAMESPACE))
-               return -EPERM;
-       if (path->dentry != path->mnt->mnt_root)
-@@ -1447,11 +1505,13 @@ static int do_change_type(struct path *p
-  * do loopback mount.
+@@ -1462,11 +1520,13 @@ static noinline int do_change_type(struc
+  * noinline this do_mount helper to save do_mount stack space.
   */
- static int do_loopback(struct path *path, char *old_name,
+ static noinline int do_loopback(struct nameidata *nd, char *old_name,
 -                              int recurse)
 +      tag_t tag, unsigned long flags, int mnt_flags)
  {
-       struct path old_path;
+       struct nameidata old_nd;
        struct vfsmount *mnt = NULL;
-       int err = mount_is_safe(path);
+       int err = mount_is_safe(nd);
 +      int recurse = flags & MS_REC;
 +
        if (err)
                return err;
        if (!old_name || !*old_name)
-@@ -1485,6 +1545,7 @@ static int do_loopback(struct path *path
+@@ -1500,6 +1560,7 @@ static noinline int do_loopback(struct n
                spin_unlock(&vfsmount_lock);
                release_mounts(&umount_list);
        }
@@ -4650,23 +5706,23 @@ diff -NurpP --minimal linux-2.6.31/fs/namespace.c linux-2.6.31-vs2.3.0.36.14-pre
  
  out:
        up_write(&namespace_sem);
-@@ -1515,12 +1576,12 @@ static int change_mount_flags(struct vfs
-  * on it - tough luck.
+@@ -1531,12 +1592,12 @@ static int change_mount_flags(struct vfs
+  * noinline this do_mount helper to save do_mount stack space.
   */
- static int do_remount(struct path *path, int flags, int mnt_flags,
+ static noinline int do_remount(struct nameidata *nd, int flags, int mnt_flags,
 -                    void *data)
 +      void *data, xid_t xid)
  {
        int err;
-       struct super_block *sb = path->mnt->mnt_sb;
+       struct super_block *sb = nd->path.mnt->mnt_sb;
  
 -      if (!capable(CAP_SYS_ADMIN))
 +      if (!vx_capable(CAP_SYS_ADMIN, VXC_SECURE_REMOUNT))
                return -EPERM;
  
-       if (!check_mnt(path->mnt))
-@@ -1562,7 +1623,7 @@ static int do_move_mount(struct path *pa
-       struct path old_path, parent_path;
+       if (!check_mnt(nd->path.mnt))
+@@ -1582,7 +1643,7 @@ static noinline int do_move_mount(struct
+       struct path parent_path;
        struct vfsmount *p;
        int err = 0;
 -      if (!capable(CAP_SYS_ADMIN))
@@ -4674,7 +5730,7 @@ diff -NurpP --minimal linux-2.6.31/fs/namespace.c linux-2.6.31-vs2.3.0.36.14-pre
                return -EPERM;
        if (!old_name || !*old_name)
                return -EINVAL;
-@@ -1644,7 +1705,7 @@ static int do_new_mount(struct path *pat
+@@ -1665,7 +1726,7 @@ static noinline int do_new_mount(struct 
                return -EINVAL;
  
        /* we need capabilities... */
@@ -4682,18 +5738,18 @@ diff -NurpP --minimal linux-2.6.31/fs/namespace.c linux-2.6.31-vs2.3.0.36.14-pre
 +      if (!vx_capable(CAP_SYS_ADMIN, VXC_SECURE_MOUNT))
                return -EPERM;
  
-       lock_kernel();
-@@ -1891,6 +1952,7 @@ long do_mount(char *dev_name, char *dir_
-       struct path path;
+       mnt = do_kern_mount(type, flags, name, data);
+@@ -1910,6 +1971,7 @@ long do_mount(char *dev_name, char *dir_
+       struct nameidata nd;
        int retval = 0;
        int mnt_flags = 0;
 +      tag_t tag = 0;
  
        /* Discard magic */
        if ((flags & MS_MGC_MSK) == MS_MGC_VAL)
-@@ -1910,6 +1972,12 @@ long do_mount(char *dev_name, char *dir_
-       if (!(flags & MS_NOATIME))
-               mnt_flags |= MNT_RELATIME;
+@@ -1925,6 +1987,12 @@ long do_mount(char *dev_name, char *dir_
+       if (data_page)
+               ((char *)data_page)[PAGE_SIZE - 1] = 0;
  
 +      if (dx_parse_tag(data_page, &tag, 1, &mnt_flags, &flags)) {
 +              /* FIXME: bind and re-mounts get the tag flag? */
@@ -4704,28 +5760,28 @@ diff -NurpP --minimal linux-2.6.31/fs/namespace.c linux-2.6.31-vs2.3.0.36.14-pre
        /* Separate the per-mountpoint flags */
        if (flags & MS_NOSUID)
                mnt_flags |= MNT_NOSUID;
-@@ -1926,6 +1994,8 @@ long do_mount(char *dev_name, char *dir_
+@@ -1941,6 +2009,8 @@ long do_mount(char *dev_name, char *dir_
        if (flags & MS_RDONLY)
                mnt_flags |= MNT_READONLY;
  
 +      if (!capable(CAP_SYS_ADMIN))
 +              mnt_flags |= MNT_NODEV;
        flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE |
-                  MS_NOATIME | MS_NODIRATIME | MS_RELATIME| MS_KERNMOUNT |
-                  MS_STRICTATIME);
-@@ -1942,9 +2012,9 @@ long do_mount(char *dev_name, char *dir_
+                  MS_NOATIME | MS_NODIRATIME | MS_RELATIME| MS_KERNMOUNT);
+@@ -1956,9 +2026,9 @@ long do_mount(char *dev_name, char *dir_
  
        if (flags & MS_REMOUNT)
-               retval = do_remount(&path, flags & ~MS_REMOUNT, mnt_flags,
+               retval = do_remount(&nd, flags & ~MS_REMOUNT, mnt_flags,
 -                                  data_page);
 +                                  data_page, tag);
        else if (flags & MS_BIND)
--              retval = do_loopback(&path, dev_name, flags & MS_REC);
-+              retval = do_loopback(&path, dev_name, tag, flags, mnt_flags);
+-              retval = do_loopback(&nd, dev_name, flags & MS_REC);
++              retval = do_loopback(&nd, dev_name, tag, flags, mnt_flags);
        else if (flags & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE))
-               retval = do_change_type(&path, flags);
+               retval = do_change_type(&nd, flags);
        else if (flags & MS_MOVE)
-@@ -2023,6 +2093,7 @@ static struct mnt_namespace *dup_mnt_ns(
+@@ -2027,6 +2097,7 @@ static struct mnt_namespace *dup_mnt_ns(
                q = next_mnt(q, new_ns->root);
        }
        up_write(&namespace_sem);
@@ -4733,7 +5789,7 @@ diff -NurpP --minimal linux-2.6.31/fs/namespace.c linux-2.6.31-vs2.3.0.36.14-pre
  
        if (rootmnt)
                mntput(rootmnt);
-@@ -2165,9 +2236,10 @@ SYSCALL_DEFINE2(pivot_root, const char _
+@@ -2213,9 +2284,10 @@ SYSCALL_DEFINE2(pivot_root, const char _
        down_write(&namespace_sem);
        mutex_lock(&old.dentry->d_inode->i_mutex);
        error = -EINVAL;
@@ -4746,18 +5802,17 @@ diff -NurpP --minimal linux-2.6.31/fs/namespace.c linux-2.6.31-vs2.3.0.36.14-pre
                goto out2;
        if (!check_mnt(root.mnt))
                goto out2;
-@@ -2303,6 +2375,7 @@ void put_mnt_ns(struct mnt_namespace *ns
+@@ -2354,5 +2426,6 @@ void __put_mnt_ns(struct mnt_namespace *
        spin_unlock(&vfsmount_lock);
        up_write(&namespace_sem);
        release_mounts(&umount_list);
 +      atomic_dec(&vs_global_mnt_ns);
        kfree(ns);
  }
- EXPORT_SYMBOL(put_mnt_ns);
-diff -NurpP --minimal linux-2.6.31/fs/nfs/client.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/nfs/client.c
---- linux-2.6.31/fs/nfs/client.c       2009-09-10 15:26:22.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/nfs/client.c    2009-09-10 16:11:43.000000000 +0200
-@@ -732,6 +732,9 @@ static int nfs_init_server_rpcclient(str
+diff -NurpP --minimal linux-2.6.27.33/fs/nfs/client.c linux-2.6.27.33-vs2.3.0.36.6/fs/nfs/client.c
+--- linux-2.6.27.33/fs/nfs/client.c    2008-10-13 14:52:05.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/nfs/client.c       2008-10-13 14:54:20.000000000 +0200
+@@ -601,6 +601,9 @@ static int nfs_init_server_rpcclient(str
        if (server->flags & NFS_MOUNT_SOFT)
                server->client->cl_softrtry = 1;
  
@@ -4767,7 +5822,7 @@ diff -NurpP --minimal linux-2.6.31/fs/nfs/client.c linux-2.6.31-vs2.3.0.36.14-pr
        return 0;
  }
  
-@@ -899,6 +902,10 @@ static void nfs_server_set_fsinfo(struct
+@@ -766,6 +769,10 @@ static void nfs_server_set_fsinfo(struct
                server->acdirmin = server->acdirmax = 0;
        }
  
@@ -4778,10 +5833,10 @@ diff -NurpP --minimal linux-2.6.31/fs/nfs/client.c linux-2.6.31-vs2.3.0.36.14-pr
        server->maxfilesize = fsinfo->maxfilesize;
  
        /* We're airborne Set socket buffersize */
-diff -NurpP --minimal linux-2.6.31/fs/nfs/dir.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/nfs/dir.c
---- linux-2.6.31/fs/nfs/dir.c  2009-09-10 15:26:23.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/nfs/dir.c       2009-09-10 16:11:43.000000000 +0200
-@@ -33,6 +33,7 @@
+diff -NurpP --minimal linux-2.6.27.33/fs/nfs/dir.c linux-2.6.27.33-vs2.3.0.36.6/fs/nfs/dir.c
+--- linux-2.6.27.33/fs/nfs/dir.c       2009-09-13 16:16:59.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/nfs/dir.c  2009-06-15 17:22:10.000000000 +0200
+@@ -34,6 +34,7 @@
  #include <linux/namei.h>
  #include <linux/mount.h>
  #include <linux/sched.h>
@@ -4789,7 +5844,7 @@ diff -NurpP --minimal linux-2.6.31/fs/nfs/dir.c linux-2.6.31-vs2.3.0.36.14-pre8/
  
  #include "nfs4_fs.h"
  #include "delegation.h"
-@@ -949,6 +950,7 @@ static struct dentry *nfs_lookup(struct 
+@@ -938,6 +939,7 @@ static struct dentry *nfs_lookup(struct 
        if (IS_ERR(res))
                goto out_unblock_sillyrename;
  
@@ -4797,10 +5852,10 @@ diff -NurpP --minimal linux-2.6.31/fs/nfs/dir.c linux-2.6.31-vs2.3.0.36.14-pre8/
  no_entry:
        res = d_materialise_unique(dentry, inode);
        if (res != NULL) {
-diff -NurpP --minimal linux-2.6.31/fs/nfs/inode.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/nfs/inode.c
---- linux-2.6.31/fs/nfs/inode.c        2009-09-10 15:26:23.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/nfs/inode.c     2009-09-10 16:11:43.000000000 +0200
-@@ -36,6 +36,7 @@
+diff -NurpP --minimal linux-2.6.27.33/fs/nfs/inode.c linux-2.6.27.33-vs2.3.0.36.6/fs/nfs/inode.c
+--- linux-2.6.27.33/fs/nfs/inode.c     2008-10-13 14:52:05.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/nfs/inode.c        2008-10-13 14:54:20.000000000 +0200
+@@ -37,6 +37,7 @@
  #include <linux/vfs.h>
  #include <linux/inet.h>
  #include <linux/nfs_xdr.h>
@@ -4808,60 +5863,29 @@ diff -NurpP --minimal linux-2.6.31/fs/nfs/inode.c linux-2.6.31-vs2.3.0.36.14-pre
  
  #include <asm/system.h>
  #include <asm/uaccess.h>
-@@ -278,6 +279,8 @@ nfs_fhget(struct super_block *sb, struct
-       if (inode->i_state & I_NEW) {
-               struct nfs_inode *nfsi = NFS_I(inode);
-               unsigned long now = jiffies;
-+              uid_t uid;
-+              gid_t gid;
-               /* We set i_ino for the few things that still rely on it,
-                * such as stat(2) */
-@@ -321,8 +324,8 @@ nfs_fhget(struct super_block *sb, struct
-               nfsi->change_attr = 0;
-               inode->i_size = 0;
-               inode->i_nlink = 0;
--              inode->i_uid = -2;
--              inode->i_gid = -2;
-+              uid = -2;
-+              gid = -2;
-               inode->i_blocks = 0;
-               memset(nfsi->cookieverf, 0, sizeof(nfsi->cookieverf));
-@@ -341,9 +344,9 @@ nfs_fhget(struct super_block *sb, struct
-               if (fattr->valid & NFS_ATTR_FATTR_NLINK)
-                       inode->i_nlink = fattr->nlink;
-               if (fattr->valid & NFS_ATTR_FATTR_OWNER)
--                      inode->i_uid = fattr->uid;
-+                      uid = fattr->uid;
-               if (fattr->valid & NFS_ATTR_FATTR_GROUP)
--                      inode->i_gid = fattr->gid;
-+                      gid = fattr->gid;
-               if (fattr->valid & NFS_ATTR_FATTR_BLOCKS_USED)
-                       inode->i_blocks = fattr->du.nfs2.blocks;
-               if (fattr->valid & NFS_ATTR_FATTR_SPACE_USED) {
-@@ -352,6 +355,11 @@ nfs_fhget(struct super_block *sb, struct
-                        */
-                       inode->i_blocks = nfs_calc_block_size(fattr->du.nfs3.used);
-               }
-+              inode->i_uid = INOTAG_UID(DX_TAG(inode), uid, gid);
-+              inode->i_gid = INOTAG_GID(DX_TAG(inode), uid, gid);
-+              inode->i_tag = INOTAG_TAG(DX_TAG(inode), uid, gid, 0);
-+                              /* maybe fattr->xid someday */
-+
-               nfsi->attrtimeo = NFS_MINATTRTIMEO(inode);
-               nfsi->attrtimeo_timestamp = now;
-               nfsi->access_cache = RB_ROOT;
-@@ -492,6 +500,8 @@ void nfs_setattr_update_inode(struct ino
+@@ -314,8 +315,10 @@ nfs_fhget(struct super_block *sb, struct
+                       nfsi->change_attr = fattr->change_attr;
+               inode->i_size = nfs_size_to_loff_t(fattr->size);
+               inode->i_nlink = fattr->nlink;
+-              inode->i_uid = fattr->uid;
+-              inode->i_gid = fattr->gid;
++              inode->i_uid = INOTAG_UID(DX_TAG(inode), fattr->uid, fattr->gid);
++              inode->i_gid = INOTAG_GID(DX_TAG(inode), fattr->uid, fattr->gid);
++              inode->i_tag = INOTAG_TAG(DX_TAG(inode), fattr->uid, fattr->gid, 0);
++                                       /* maybe fattr->xid someday */
+               if (fattr->valid & (NFS_ATTR_FATTR_V3 | NFS_ATTR_FATTR_V4)) {
+                       /*
+                        * report the blocks in 512byte units
+@@ -462,6 +465,8 @@ void nfs_setattr_update_inode(struct ino
                        inode->i_uid = attr->ia_uid;
                if ((attr->ia_valid & ATTR_GID) != 0)
                        inode->i_gid = attr->ia_gid;
 +              if ((attr->ia_valid & ATTR_TAG) && IS_TAGGED(inode))
 +                      inode->i_tag = attr->ia_tag;
+               spin_lock(&inode->i_lock);
                NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL;
                spin_unlock(&inode->i_lock);
-       }
-@@ -902,6 +912,9 @@ static int nfs_check_inode_attributes(st
+@@ -900,6 +905,9 @@ static int nfs_check_inode_attributes(st
        struct nfs_inode *nfsi = NFS_I(inode);
        loff_t cur_size, new_isize;
        unsigned long invalid = 0;
@@ -4871,28 +5895,25 @@ diff -NurpP --minimal linux-2.6.31/fs/nfs/inode.c linux-2.6.31-vs2.3.0.36.14-pre
  
  
        /* Has the inode gone and changed behind our back? */
-@@ -925,13 +938,18 @@ static int nfs_check_inode_attributes(st
-                       invalid |= NFS_INO_INVALID_ATTR|NFS_INO_REVAL_PAGECACHE;
-       }
+@@ -924,10 +932,15 @@ static int nfs_check_inode_attributes(st
+       if (cur_size != new_isize && nfsi->npages == 0)
+               invalid |= NFS_INO_INVALID_ATTR|NFS_INO_REVAL_PAGECACHE;
  
 +      uid = INOTAG_UID(DX_TAG(inode), fattr->uid, fattr->gid);
 +      gid = INOTAG_GID(DX_TAG(inode), fattr->uid, fattr->gid);
 +      tag = INOTAG_TAG(DX_TAG(inode), fattr->uid, fattr->gid, 0);
 +
        /* Have any file permissions changed? */
-       if ((fattr->valid & NFS_ATTR_FATTR_MODE) && (inode->i_mode & S_IALLUGO) != (fattr->mode & S_IALLUGO))
+       if ((inode->i_mode & S_IALLUGO) != (fattr->mode & S_IALLUGO)
+-                      || inode->i_uid != fattr->uid
+-                      || inode->i_gid != fattr->gid)
++                      || inode->i_uid != uid
++                      || inode->i_gid != gid
++                      || inode->i_tag != tag)
                invalid |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL;
--      if ((fattr->valid & NFS_ATTR_FATTR_OWNER) && inode->i_uid != fattr->uid)
-+      if ((fattr->valid & NFS_ATTR_FATTR_OWNER) && uid != fattr->uid)
-               invalid |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL;
--      if ((fattr->valid & NFS_ATTR_FATTR_GROUP) && inode->i_gid != fattr->gid)
-+      if ((fattr->valid & NFS_ATTR_FATTR_GROUP) && gid != fattr->gid)
-               invalid |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL;
-+              /* maybe check for tag too? */
  
        /* Has the link count changed? */
-       if ((fattr->valid & NFS_ATTR_FATTR_NLINK) && inode->i_nlink != fattr->nlink)
-@@ -1145,6 +1163,9 @@ static int nfs_update_inode(struct inode
+@@ -1048,6 +1061,9 @@ static int nfs_update_inode(struct inode
        loff_t cur_isize, new_isize;
        unsigned long invalid = 0;
        unsigned long now = jiffies;
@@ -4902,46 +5923,35 @@ diff -NurpP --minimal linux-2.6.31/fs/nfs/inode.c linux-2.6.31-vs2.3.0.36.14-pre
  
        dfprintk(VFS, "NFS: %s(%s/%ld ct=%d info=0x%x)\n",
                        __func__, inode->i_sb->s_id, inode->i_ino,
-@@ -1233,6 +1254,9 @@ static int nfs_update_inode(struct inode
-               }
-       }
+@@ -1121,15 +1137,21 @@ static int nfs_update_inode(struct inode
+       memcpy(&inode->i_atime, &fattr->atime, sizeof(inode->i_atime));
+       nfsi->change_attr = fattr->change_attr;
  
 +      uid = INOTAG_UID(DX_TAG(inode), fattr->uid, fattr->gid);
 +      gid = INOTAG_GID(DX_TAG(inode), fattr->uid, fattr->gid);
 +      tag = INOTAG_TAG(DX_TAG(inode), fattr->uid, fattr->gid, 0);
-       if (fattr->valid & NFS_ATTR_FATTR_ATIME)
-               memcpy(&inode->i_atime, &fattr->atime, sizeof(inode->i_atime));
-@@ -1244,18 +1268,22 @@ static int nfs_update_inode(struct inode
-               }
-       }
-       if (fattr->valid & NFS_ATTR_FATTR_OWNER) {
--              if (inode->i_uid != fattr->uid) {
-+              if (uid != fattr->uid) {
-                       invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL;
--                      inode->i_uid = fattr->uid;
-+                      uid = fattr->uid;
-               }
-       }
-       if (fattr->valid & NFS_ATTR_FATTR_GROUP) {
--              if (inode->i_gid != fattr->gid) {
-+              if (gid != fattr->gid) {
-                       invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL;
--                      inode->i_gid = fattr->gid;
-+                      gid = fattr->gid;
-               }
-       }
++
+       if ((inode->i_mode & S_IALLUGO) != (fattr->mode & S_IALLUGO) ||
+-          inode->i_uid != fattr->uid ||
+-          inode->i_gid != fattr->gid)
++          inode->i_uid != uid ||
++          inode->i_gid != gid ||
++          inode->i_tag != tag)
+               invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL;
+       inode->i_mode = fattr->mode;
+       inode->i_nlink = fattr->nlink;
+-      inode->i_uid = fattr->uid;
+-      inode->i_gid = fattr->gid;
 +      inode->i_uid = uid;
 +      inode->i_gid = gid;
 +      inode->i_tag = tag;
-+
-       if (fattr->valid & NFS_ATTR_FATTR_NLINK) {
-               if (inode->i_nlink != fattr->nlink) {
-                       invalid |= NFS_INO_INVALID_ATTR;
-diff -NurpP --minimal linux-2.6.31/fs/nfs/nfs3xdr.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/nfs/nfs3xdr.c
---- linux-2.6.31/fs/nfs/nfs3xdr.c      2009-06-11 17:13:06.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/nfs/nfs3xdr.c   2009-09-10 16:11:43.000000000 +0200
+       if (fattr->valid & (NFS_ATTR_FATTR_V3 | NFS_ATTR_FATTR_V4)) {
+               /*
+diff -NurpP --minimal linux-2.6.27.33/fs/nfs/nfs3xdr.c linux-2.6.27.33-vs2.3.0.36.6/fs/nfs/nfs3xdr.c
+--- linux-2.6.27.33/fs/nfs/nfs3xdr.c   2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/nfs/nfs3xdr.c      2008-10-13 14:54:20.000000000 +0200
 @@ -22,6 +22,7 @@
  #include <linux/nfs3.h>
  #include <linux/nfs_fs.h>
@@ -4950,7 +5960,7 @@ diff -NurpP --minimal linux-2.6.31/fs/nfs/nfs3xdr.c linux-2.6.31-vs2.3.0.36.14-p
  #include "internal.h"
  
  #define NFSDBG_FACILITY               NFSDBG_XDR
-@@ -177,7 +178,7 @@ xdr_decode_fattr(__be32 *p, struct nfs_f
+@@ -180,7 +181,7 @@ xdr_decode_fattr(__be32 *p, struct nfs_f
  }
  
  static inline __be32 *
@@ -4959,7 +5969,7 @@ diff -NurpP --minimal linux-2.6.31/fs/nfs/nfs3xdr.c linux-2.6.31-vs2.3.0.36.14-p
  {
        if (attr->ia_valid & ATTR_MODE) {
                *p++ = xdr_one;
-@@ -185,15 +186,17 @@ xdr_encode_sattr(__be32 *p, struct iattr
+@@ -188,15 +189,17 @@ xdr_encode_sattr(__be32 *p, struct iattr
        } else {
                *p++ = xdr_zero;
        }
@@ -4981,7 +5991,7 @@ diff -NurpP --minimal linux-2.6.31/fs/nfs/nfs3xdr.c linux-2.6.31-vs2.3.0.36.14-p
        } else {
                *p++ = xdr_zero;
        }
-@@ -280,7 +283,8 @@ static int
+@@ -281,7 +284,8 @@ static int
  nfs3_xdr_sattrargs(struct rpc_rqst *req, __be32 *p, struct nfs3_sattrargs *args)
  {
        p = xdr_encode_fhandle(p, args->fh);
@@ -4991,7 +6001,7 @@ diff -NurpP --minimal linux-2.6.31/fs/nfs/nfs3xdr.c linux-2.6.31-vs2.3.0.36.14-p
        *p++ = htonl(args->guard);
        if (args->guard)
                p = xdr_encode_time3(p, &args->guardtime);
-@@ -385,7 +389,8 @@ nfs3_xdr_createargs(struct rpc_rqst *req
+@@ -386,7 +390,8 @@ nfs3_xdr_createargs(struct rpc_rqst *req
                *p++ = args->verifier[0];
                *p++ = args->verifier[1];
        } else
@@ -5001,7 +6011,7 @@ diff -NurpP --minimal linux-2.6.31/fs/nfs/nfs3xdr.c linux-2.6.31-vs2.3.0.36.14-p
  
        req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
        return 0;
-@@ -399,7 +404,8 @@ nfs3_xdr_mkdirargs(struct rpc_rqst *req,
+@@ -400,7 +405,8 @@ nfs3_xdr_mkdirargs(struct rpc_rqst *req,
  {
        p = xdr_encode_fhandle(p, args->fh);
        p = xdr_encode_array(p, args->name, args->len);
@@ -5011,7 +6021,7 @@ diff -NurpP --minimal linux-2.6.31/fs/nfs/nfs3xdr.c linux-2.6.31-vs2.3.0.36.14-p
        req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
        return 0;
  }
-@@ -412,7 +418,8 @@ nfs3_xdr_symlinkargs(struct rpc_rqst *re
+@@ -413,7 +419,8 @@ nfs3_xdr_symlinkargs(struct rpc_rqst *re
  {
        p = xdr_encode_fhandle(p, args->fromfh);
        p = xdr_encode_array(p, args->fromname, args->fromlen);
@@ -5021,7 +6031,7 @@ diff -NurpP --minimal linux-2.6.31/fs/nfs/nfs3xdr.c linux-2.6.31-vs2.3.0.36.14-p
        *p++ = htonl(args->pathlen);
        req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
  
-@@ -430,7 +437,8 @@ nfs3_xdr_mknodargs(struct rpc_rqst *req,
+@@ -431,7 +438,8 @@ nfs3_xdr_mknodargs(struct rpc_rqst *req,
        p = xdr_encode_fhandle(p, args->fh);
        p = xdr_encode_array(p, args->name, args->len);
        *p++ = htonl(args->type);
@@ -5031,10 +6041,10 @@ diff -NurpP --minimal linux-2.6.31/fs/nfs/nfs3xdr.c linux-2.6.31-vs2.3.0.36.14-p
        if (args->type == NF3CHR || args->type == NF3BLK) {
                *p++ = htonl(MAJOR(args->rdev));
                *p++ = htonl(MINOR(args->rdev));
-diff -NurpP --minimal linux-2.6.31/fs/nfs/nfsroot.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/nfs/nfsroot.c
---- linux-2.6.31/fs/nfs/nfsroot.c      2009-09-10 15:26:23.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/nfs/nfsroot.c   2009-09-10 16:11:43.000000000 +0200
-@@ -122,12 +122,12 @@ static int mount_port __initdata = 0;            /
+diff -NurpP --minimal linux-2.6.27.33/fs/nfs/nfsroot.c linux-2.6.27.33-vs2.3.0.36.6/fs/nfs/nfsroot.c
+--- linux-2.6.27.33/fs/nfs/nfsroot.c   2008-10-13 14:52:05.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/nfs/nfsroot.c      2008-10-13 14:54:20.000000000 +0200
+@@ -117,12 +117,12 @@ static int mount_port __initdata = 0;            /
  enum {
        /* Options that take integer arguments */
        Opt_port, Opt_rsize, Opt_wsize, Opt_timeo, Opt_retrans, Opt_acregmin,
@@ -5049,7 +6059,7 @@ diff -NurpP --minimal linux-2.6.31/fs/nfs/nfsroot.c linux-2.6.31-vs2.3.0.36.14-p
        /* Error token */
        Opt_err
  };
-@@ -164,6 +164,9 @@ static const match_table_t tokens __init
+@@ -159,6 +159,9 @@ static match_table_t __initdata tokens =
        {Opt_tcp, "tcp"},
        {Opt_acl, "acl"},
        {Opt_noacl, "noacl"},
@@ -5059,7 +6069,7 @@ diff -NurpP --minimal linux-2.6.31/fs/nfs/nfsroot.c linux-2.6.31-vs2.3.0.36.14-p
        {Opt_err, NULL}
        
  };
-@@ -275,6 +278,20 @@ static int __init root_nfs_parse(char *n
+@@ -270,6 +273,20 @@ static int __init root_nfs_parse(char *n
                        case Opt_noacl:
                                nfs_data.flags |= NFS_MOUNT_NOACL;
                                break;
@@ -5080,10 +6090,10 @@ diff -NurpP --minimal linux-2.6.31/fs/nfs/nfsroot.c linux-2.6.31-vs2.3.0.36.14-p
                        default:
                                printk(KERN_WARNING "Root-NFS: unknown "
                                        "option: %s\n", p);
-diff -NurpP --minimal linux-2.6.31/fs/nfs/super.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/nfs/super.c
---- linux-2.6.31/fs/nfs/super.c        2009-09-10 15:26:23.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/nfs/super.c     2009-09-10 16:11:43.000000000 +0200
-@@ -53,6 +53,7 @@
+diff -NurpP --minimal linux-2.6.27.33/fs/nfs/super.c linux-2.6.27.33-vs2.3.0.36.6/fs/nfs/super.c
+--- linux-2.6.27.33/fs/nfs/super.c     2008-10-13 14:52:05.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/nfs/super.c        2008-10-13 14:54:20.000000000 +0200
+@@ -51,6 +51,7 @@
  #include <linux/nfs_xdr.h>
  #include <linux/magic.h>
  #include <linux/parser.h>
@@ -5091,17 +6101,17 @@ diff -NurpP --minimal linux-2.6.31/fs/nfs/super.c linux-2.6.31-vs2.3.0.36.14-pre
  
  #include <asm/system.h>
  #include <asm/uaccess.h>
-@@ -546,6 +547,7 @@ static void nfs_show_mount_options(struc
+@@ -504,6 +505,7 @@ static void nfs_show_mount_options(struc
+               { NFS_MOUNT_NOACL, ",noacl", "" },
                { NFS_MOUNT_NORDIRPLUS, ",nordirplus", "" },
-               { NFS_MOUNT_UNSHARED, ",nosharecache", "" },
-               { NFS_MOUNT_NORESVPORT, ",noresvport", "" },
+               { NFS_MOUNT_UNSHARED, ",nosharecache", ""},
 +              { NFS_MOUNT_TAGGED, ",tag", "" },
                { 0, NULL, NULL }
        };
        const struct proc_nfs_info *nfs_infop;
-diff -NurpP --minimal linux-2.6.31/fs/nfsd/auth.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/nfsd/auth.c
---- linux-2.6.31/fs/nfsd/auth.c        2009-03-24 14:22:26.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/nfsd/auth.c     2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/nfsd/auth.c linux-2.6.27.33-vs2.3.0.36.6/fs/nfsd/auth.c
+--- linux-2.6.27.33/fs/nfsd/auth.c     2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/nfsd/auth.c        2008-10-13 14:54:20.000000000 +0200
 @@ -10,6 +10,7 @@
  #include <linux/sunrpc/svcauth.h>
  #include <linux/nfsd/nfsd.h>
@@ -5110,19 +6120,36 @@ diff -NurpP --minimal linux-2.6.31/fs/nfsd/auth.c linux-2.6.31-vs2.3.0.36.14-pre
  #include "auth.h"
  
  int nfsexp_flags(struct svc_rqst *rqstp, struct svc_export *exp)
-@@ -42,6 +43,9 @@ int nfsd_setuser(struct svc_rqst *rqstp,
-       new->fsuid = rqstp->rq_cred.cr_uid;
-       new->fsgid = rqstp->rq_cred.cr_gid;
-+      /* FIXME: this desperately needs a tag :)
-+      new->xid = (xid_t)INOTAG_TAG(DX_TAG_NFSD, cred.cr_uid, cred.cr_gid, 0);
-+                      */
+@@ -55,19 +56,23 @@ int nfsd_setuser(struct svc_rqst *rqstp,
+               get_group_info(cred.cr_group_info);
  
-       rqgi = rqstp->rq_cred.cr_group_info;
+       if (cred.cr_uid != (uid_t) -1)
+-              current->fsuid = cred.cr_uid;
++              current->fsuid = INOTAG_UID(DX_TAG_NFSD, cred.cr_uid, cred.cr_gid);
+       else
+               current->fsuid = exp->ex_anon_uid;
+       if (cred.cr_gid != (gid_t) -1)
+-              current->fsgid = cred.cr_gid;
++              current->fsgid = INOTAG_GID(DX_TAG_NFSD, cred.cr_uid, cred.cr_gid);
+       else
+               current->fsgid = exp->ex_anon_gid;
  
-diff -NurpP --minimal linux-2.6.31/fs/nfsd/nfs3xdr.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/nfsd/nfs3xdr.c
---- linux-2.6.31/fs/nfsd/nfs3xdr.c     2009-09-10 15:26:23.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/nfsd/nfs3xdr.c  2009-09-10 16:11:43.000000000 +0200
++      /* this desperately needs a tag :) */
++      current->xid = (xid_t)INOTAG_TAG(DX_TAG_NFSD, cred.cr_uid, cred.cr_gid, 0);
++
+       if (!cred.cr_group_info)
+               return -ENOMEM;
+       ret = set_current_groups(cred.cr_group_info);
+       put_group_info(cred.cr_group_info);
+-      if ((cred.cr_uid)) {
++
++      if (INOTAG_UID(DX_TAG_NFSD, cred.cr_uid, cred.cr_gid)) {
+               current->cap_effective =
+                       cap_drop_nfsd_set(current->cap_effective);
+       } else {
+diff -NurpP --minimal linux-2.6.27.33/fs/nfsd/nfs3xdr.c linux-2.6.27.33-vs2.3.0.36.6/fs/nfsd/nfs3xdr.c
+--- linux-2.6.27.33/fs/nfsd/nfs3xdr.c  2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/nfsd/nfs3xdr.c     2008-10-13 14:54:20.000000000 +0200
 @@ -21,6 +21,7 @@
  #include <linux/sunrpc/svc.h>
  #include <linux/nfsd/nfsd.h>
@@ -5173,10 +6200,10 @@ diff -NurpP --minimal linux-2.6.31/fs/nfsd/nfs3xdr.c linux-2.6.31-vs2.3.0.36.14-
        if (S_ISLNK(stat->mode) && stat->size > NFS3_MAXPATHLEN) {
                p = xdr_encode_hyper(p, (u64) NFS3_MAXPATHLEN);
        } else {
-diff -NurpP --minimal linux-2.6.31/fs/nfsd/nfs4xdr.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/nfsd/nfs4xdr.c
---- linux-2.6.31/fs/nfsd/nfs4xdr.c     2009-09-10 15:26:23.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/nfsd/nfs4xdr.c  2009-09-10 16:11:43.000000000 +0200
-@@ -57,6 +57,7 @@
+diff -NurpP --minimal linux-2.6.27.33/fs/nfsd/nfs4xdr.c linux-2.6.27.33-vs2.3.0.36.6/fs/nfsd/nfs4xdr.c
+--- linux-2.6.27.33/fs/nfsd/nfs4xdr.c  2009-09-13 16:16:59.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/nfsd/nfs4xdr.c     2009-05-22 00:47:30.000000000 +0200
+@@ -58,6 +58,7 @@
  #include <linux/nfs4_acl.h>
  #include <linux/sunrpc/gss_api.h>
  #include <linux/sunrpc/svcauth_gss.h>
@@ -5184,7 +6211,7 @@ diff -NurpP --minimal linux-2.6.31/fs/nfsd/nfs4xdr.c linux-2.6.31-vs2.3.0.36.14-
  
  #define NFSDDBG_FACILITY              NFSDDBG_XDR
  
-@@ -2052,14 +2053,18 @@ out_acl:
+@@ -1704,14 +1705,18 @@ out_acl:
                WRITE32(stat.nlink);
        }
        if (bmval1 & FATTR4_WORD1_OWNER) {
@@ -5205,9 +6232,9 @@ diff -NurpP --minimal linux-2.6.31/fs/nfsd/nfs4xdr.c linux-2.6.31-vs2.3.0.36.14-
                if (status == nfserr_resource)
                        goto out_resource;
                if (status)
-diff -NurpP --minimal linux-2.6.31/fs/nfsd/nfsxdr.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/nfsd/nfsxdr.c
---- linux-2.6.31/fs/nfsd/nfsxdr.c      2008-12-25 00:26:37.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/nfsd/nfsxdr.c   2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/nfsd/nfsxdr.c linux-2.6.27.33-vs2.3.0.36.6/fs/nfsd/nfsxdr.c
+--- linux-2.6.27.33/fs/nfsd/nfsxdr.c   2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/nfsd/nfsxdr.c      2008-10-13 14:54:20.000000000 +0200
 @@ -15,6 +15,7 @@
  #include <linux/nfsd/nfsd.h>
  #include <linux/nfsd/xdr.h>
@@ -5256,9 +6283,9 @@ diff -NurpP --minimal linux-2.6.31/fs/nfsd/nfsxdr.c linux-2.6.31-vs2.3.0.36.14-p
  
        if (S_ISLNK(type) && stat->size > NFS_MAXPATHLEN) {
                *p++ = htonl(NFS_MAXPATHLEN);
-diff -NurpP --minimal linux-2.6.31/fs/ocfs2/dlm/dlmfs.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/ocfs2/dlm/dlmfs.c
---- linux-2.6.31/fs/ocfs2/dlm/dlmfs.c  2009-03-24 14:22:27.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ocfs2/dlm/dlmfs.c       2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/ocfs2/dlm/dlmfs.c linux-2.6.27.33-vs2.3.0.36.6/fs/ocfs2/dlm/dlmfs.c
+--- linux-2.6.27.33/fs/ocfs2/dlm/dlmfs.c       2008-10-13 14:52:06.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ocfs2/dlm/dlmfs.c  2008-10-13 14:54:20.000000000 +0200
 @@ -43,6 +43,7 @@
  #include <linux/init.h>
  #include <linux/string.h>
@@ -5269,24 +6296,24 @@ diff -NurpP --minimal linux-2.6.31/fs/ocfs2/dlm/dlmfs.c linux-2.6.31-vs2.3.0.36.
  
 @@ -341,6 +342,7 @@ static struct inode *dlmfs_get_root_inod
                inode->i_mode = mode;
-               inode->i_uid = current_fsuid();
-               inode->i_gid = current_fsgid();
+               inode->i_uid = current->fsuid;
+               inode->i_gid = current->fsgid;
 +              inode->i_tag = dx_current_fstag(sb);
+               inode->i_blocks = 0;
                inode->i_mapping->backing_dev_info = &dlmfs_backing_dev_info;
                inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
-               inc_nlink(inode);
-@@ -366,6 +368,7 @@ static struct inode *dlmfs_get_inode(str
+@@ -367,6 +369,7 @@ static struct inode *dlmfs_get_inode(str
        inode->i_mode = mode;
-       inode->i_uid = current_fsuid();
-       inode->i_gid = current_fsgid();
+       inode->i_uid = current->fsuid;
+       inode->i_gid = current->fsgid;
 +      inode->i_tag = dx_current_fstag(sb);
+       inode->i_blocks = 0;
        inode->i_mapping->backing_dev_info = &dlmfs_backing_dev_info;
        inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
-diff -NurpP --minimal linux-2.6.31/fs/ocfs2/dlmglue.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/ocfs2/dlmglue.c
---- linux-2.6.31/fs/ocfs2/dlmglue.c    2009-09-10 15:26:23.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ocfs2/dlmglue.c 2009-09-10 16:11:43.000000000 +0200
-@@ -1960,6 +1960,7 @@ static void __ocfs2_stuff_meta_lvb(struc
+diff -NurpP --minimal linux-2.6.27.33/fs/ocfs2/dlmglue.c linux-2.6.27.33-vs2.3.0.36.6/fs/ocfs2/dlmglue.c
+--- linux-2.6.27.33/fs/ocfs2/dlmglue.c 2008-10-13 14:52:06.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ocfs2/dlmglue.c    2008-10-13 14:54:20.000000000 +0200
+@@ -1846,6 +1846,7 @@ static void __ocfs2_stuff_meta_lvb(struc
        lvb->lvb_iclusters = cpu_to_be32(oi->ip_clusters);
        lvb->lvb_iuid      = cpu_to_be32(inode->i_uid);
        lvb->lvb_igid      = cpu_to_be32(inode->i_gid);
@@ -5294,7 +6321,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ocfs2/dlmglue.c linux-2.6.31-vs2.3.0.36.14
        lvb->lvb_imode     = cpu_to_be16(inode->i_mode);
        lvb->lvb_inlink    = cpu_to_be16(inode->i_nlink);
        lvb->lvb_iatime_packed  =
-@@ -2014,6 +2015,7 @@ static void ocfs2_refresh_inode_from_lvb
+@@ -1900,6 +1901,7 @@ static void ocfs2_refresh_inode_from_lvb
  
        inode->i_uid     = be32_to_cpu(lvb->lvb_iuid);
        inode->i_gid     = be32_to_cpu(lvb->lvb_igid);
@@ -5302,9 +6329,9 @@ diff -NurpP --minimal linux-2.6.31/fs/ocfs2/dlmglue.c linux-2.6.31-vs2.3.0.36.14
        inode->i_mode    = be16_to_cpu(lvb->lvb_imode);
        inode->i_nlink   = be16_to_cpu(lvb->lvb_inlink);
        ocfs2_unpack_timespec(&inode->i_atime,
-diff -NurpP --minimal linux-2.6.31/fs/ocfs2/dlmglue.h linux-2.6.31-vs2.3.0.36.14-pre8/fs/ocfs2/dlmglue.h
---- linux-2.6.31/fs/ocfs2/dlmglue.h    2009-09-10 15:26:23.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ocfs2/dlmglue.h 2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/ocfs2/dlmglue.h linux-2.6.27.33-vs2.3.0.36.6/fs/ocfs2/dlmglue.h
+--- linux-2.6.27.33/fs/ocfs2/dlmglue.h 2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ocfs2/dlmglue.h    2008-10-13 14:54:20.000000000 +0200
 @@ -46,7 +46,8 @@ struct ocfs2_meta_lvb {
        __be16       lvb_inlink;
        __be32       lvb_iattr;
@@ -5314,11 +6341,11 @@ diff -NurpP --minimal linux-2.6.31/fs/ocfs2/dlmglue.h linux-2.6.31-vs2.3.0.36.14
 +      __be16       lvb_reserved2;
  };
  
- #define OCFS2_QINFO_LVB_VERSION 1
-diff -NurpP --minimal linux-2.6.31/fs/ocfs2/file.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/ocfs2/file.c
---- linux-2.6.31/fs/ocfs2/file.c       2009-09-10 15:26:23.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ocfs2/file.c    2009-09-10 16:11:43.000000000 +0200
-@@ -914,13 +914,15 @@ int ocfs2_setattr(struct dentry *dentry,
+ /* ocfs2_inode_lock_full() 'arg_flags' flags */
+diff -NurpP --minimal linux-2.6.27.33/fs/ocfs2/file.c linux-2.6.27.33-vs2.3.0.36.6/fs/ocfs2/file.c
+--- linux-2.6.27.33/fs/ocfs2/file.c    2009-09-13 16:16:59.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ocfs2/file.c       2009-05-22 00:47:30.000000000 +0200
+@@ -1058,13 +1058,15 @@ int ocfs2_setattr(struct dentry *dentry,
                mlog(0, "uid change: %d\n", attr->ia_uid);
        if (attr->ia_valid & ATTR_GID)
                mlog(0, "gid change: %d\n", attr->ia_gid);
@@ -5335,26 +6362,26 @@ diff -NurpP --minimal linux-2.6.31/fs/ocfs2/file.c linux-2.6.31-vs2.3.0.36.14-pr
        if (!(attr->ia_valid & OCFS2_VALID_ATTRS)) {
                mlog(0, "can't handle attrs: 0x%x\n", attr->ia_valid);
                return 0;
-@@ -2141,6 +2143,7 @@ const struct inode_operations ocfs2_file
-       .removexattr    = generic_removexattr,
-       .fallocate      = ocfs2_fallocate,
-       .fiemap         = ocfs2_fiemap,
+@@ -2285,6 +2287,7 @@ const struct inode_operations ocfs2_file
+       .setattr        = ocfs2_setattr,
+       .getattr        = ocfs2_getattr,
+       .permission     = ocfs2_permission,
 +      .sync_flags     = ocfs2_sync_flags,
+       .fallocate      = ocfs2_fallocate,
  };
  
- const struct inode_operations ocfs2_special_file_iops = {
-diff -NurpP --minimal linux-2.6.31/fs/ocfs2/inode.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/ocfs2/inode.c
---- linux-2.6.31/fs/ocfs2/inode.c      2009-09-10 15:26:23.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ocfs2/inode.c   2009-09-10 16:11:43.000000000 +0200
-@@ -29,6 +29,7 @@
+diff -NurpP --minimal linux-2.6.27.33/fs/ocfs2/inode.c linux-2.6.27.33-vs2.3.0.36.6/fs/ocfs2/inode.c
+--- linux-2.6.27.33/fs/ocfs2/inode.c   2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ocfs2/inode.c      2008-10-13 14:54:20.000000000 +0200
+@@ -28,6 +28,7 @@
+ #include <linux/slab.h>
  #include <linux/highmem.h>
  #include <linux/pagemap.h>
- #include <linux/quotaops.h>
 +#include <linux/vs_tag.h>
  
  #include <asm/byteorder.h>
  
-@@ -45,6 +46,7 @@
+@@ -42,6 +43,7 @@
  #include "file.h"
  #include "heartbeat.h"
  #include "inode.h"
@@ -5362,7 +6389,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ocfs2/inode.c linux-2.6.31-vs2.3.0.36.14-p
  #include "journal.h"
  #include "namei.h"
  #include "suballoc.h"
-@@ -78,11 +80,13 @@ void ocfs2_set_inode_flags(struct inode 
+@@ -74,11 +76,13 @@ void ocfs2_set_inode_flags(struct inode 
  {
        unsigned int flags = OCFS2_I(inode)->ip_attr;
  
@@ -5377,7 +6404,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ocfs2/inode.c linux-2.6.31-vs2.3.0.36.14-p
  
        if (flags & OCFS2_SYNC_FL)
                inode->i_flags |= S_SYNC;
-@@ -92,25 +96,85 @@ void ocfs2_set_inode_flags(struct inode 
+@@ -88,25 +92,85 @@ void ocfs2_set_inode_flags(struct inode 
                inode->i_flags |= S_NOATIME;
        if (flags & OCFS2_DIRSYNC_FL)
                inode->i_flags |= S_DIRSYNC;
@@ -5466,17 +6493,17 @@ diff -NurpP --minimal linux-2.6.31/fs/ocfs2/inode.c linux-2.6.31-vs2.3.0.36.14-p
 +      return status;
  }
  
- struct inode *ocfs2_ilookup(struct super_block *sb, u64 blkno)
-@@ -245,6 +309,8 @@ void ocfs2_populate_inode(struct inode *
+ struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, unsigned flags,
+@@ -219,6 +283,8 @@ int ocfs2_populate_inode(struct inode *i
        struct super_block *sb;
        struct ocfs2_super *osb;
-       int use_plocks = 1;
+       int status = -EINVAL;
 +      uid_t uid;
 +      gid_t gid;
  
        mlog_entry("(0x%p, size:%llu)\n", inode,
                   (unsigned long long)le64_to_cpu(fe->i_size));
-@@ -276,8 +342,12 @@ void ocfs2_populate_inode(struct inode *
+@@ -254,8 +320,12 @@ int ocfs2_populate_inode(struct inode *i
        inode->i_generation = le32_to_cpu(fe->i_generation);
        inode->i_rdev = huge_decode_dev(le64_to_cpu(fe->id1.dev1.i_rdev));
        inode->i_mode = le16_to_cpu(fe->i_mode);
@@ -5491,10 +6518,52 @@ diff -NurpP --minimal linux-2.6.31/fs/ocfs2/inode.c linux-2.6.31-vs2.3.0.36.14-p
  
        /* Fast symlinks will have i_size but no allocated clusters. */
        if (S_ISLNK(inode->i_mode) && !fe->i_clusters)
-diff -NurpP --minimal linux-2.6.31/fs/ocfs2/inode.h linux-2.6.31-vs2.3.0.36.14-pre8/fs/ocfs2/inode.h
---- linux-2.6.31/fs/ocfs2/inode.h      2009-06-11 17:13:07.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ocfs2/inode.h   2009-09-10 16:11:43.000000000 +0200
-@@ -152,6 +152,7 @@ struct buffer_head *ocfs2_bread(struct i
+@@ -1230,8 +1300,11 @@ int ocfs2_mark_inode_dirty(handle_t *han
+       fe->i_size = cpu_to_le64(i_size_read(inode));
+       fe->i_links_count = cpu_to_le16(inode->i_nlink);
+-      fe->i_uid = cpu_to_le32(inode->i_uid);
+-      fe->i_gid = cpu_to_le32(inode->i_gid);
++      fe->i_uid = cpu_to_le32(TAGINO_UID(DX_TAG(inode),
++              inode->i_uid, inode->i_tag));
++      fe->i_gid = cpu_to_le32(TAGINO_GID(DX_TAG(inode),
++              inode->i_gid, inode->i_tag));
++      /* i_tag = = cpu_to_le16(inode->i_tag); */
+       fe->i_mode = cpu_to_le16(inode->i_mode);
+       fe->i_atime = cpu_to_le64(inode->i_atime.tv_sec);
+       fe->i_atime_nsec = cpu_to_le32(inode->i_atime.tv_nsec);
+@@ -1259,16 +1332,25 @@ leave:
+ void ocfs2_refresh_inode(struct inode *inode,
+                        struct ocfs2_dinode *fe)
+ {
++      uid_t uid;
++      gid_t gid;
++
+       spin_lock(&OCFS2_I(inode)->ip_lock);
+       OCFS2_I(inode)->ip_clusters = le32_to_cpu(fe->i_clusters);
+       OCFS2_I(inode)->ip_attr = le32_to_cpu(fe->i_attr);
++      /* OCFS2_I(inode)->ip_flags &= ~OCFS2_FL_MASK;
++         OCFS2_I(inode)->ip_flags |= le32_to_cpu(fe->i_flags) & OCFS2_FL_MASK; */
+       OCFS2_I(inode)->ip_dyn_features = le16_to_cpu(fe->i_dyn_features);
+       ocfs2_set_inode_flags(inode);
+       i_size_write(inode, le64_to_cpu(fe->i_size));
+       inode->i_nlink = le16_to_cpu(fe->i_links_count);
+-      inode->i_uid = le32_to_cpu(fe->i_uid);
+-      inode->i_gid = le32_to_cpu(fe->i_gid);
++      uid = le32_to_cpu(fe->i_uid);
++      gid = le32_to_cpu(fe->i_gid);
++      inode->i_uid = INOTAG_UID(DX_TAG(inode), uid, gid);
++      inode->i_gid = INOTAG_GID(DX_TAG(inode), uid, gid);
++      inode->i_tag = INOTAG_TAG(DX_TAG(inode), uid, gid,
++              /* le16_to_cpu(raw_inode->i_raw_tag)i */ 0);
+       inode->i_mode = le16_to_cpu(fe->i_mode);
+       if (S_ISLNK(inode->i_mode) && le32_to_cpu(fe->i_clusters) == 0)
+               inode->i_blocks = 0;
+diff -NurpP --minimal linux-2.6.27.33/fs/ocfs2/inode.h linux-2.6.27.33-vs2.3.0.36.6/fs/ocfs2/inode.h
+--- linux-2.6.27.33/fs/ocfs2/inode.h   2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ocfs2/inode.h      2008-10-13 14:54:20.000000000 +0200
+@@ -143,6 +143,7 @@ int ocfs2_aio_write(struct file *file, s
  
  void ocfs2_set_inode_flags(struct inode *inode);
  void ocfs2_get_inode_flags(struct ocfs2_inode_info *oi);
@@ -5502,10 +6571,10 @@ diff -NurpP --minimal linux-2.6.31/fs/ocfs2/inode.h linux-2.6.31-vs2.3.0.36.14-p
  
  static inline blkcnt_t ocfs2_inode_sector_count(struct inode *inode)
  {
-diff -NurpP --minimal linux-2.6.31/fs/ocfs2/ioctl.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/ocfs2/ioctl.c
---- linux-2.6.31/fs/ocfs2/ioctl.c      2009-09-10 15:26:23.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ocfs2/ioctl.c   2009-09-10 16:11:43.000000000 +0200
-@@ -41,7 +41,7 @@ static int ocfs2_get_inode_attr(struct i
+diff -NurpP --minimal linux-2.6.27.33/fs/ocfs2/ioctl.c linux-2.6.27.33-vs2.3.0.36.6/fs/ocfs2/ioctl.c
+--- linux-2.6.27.33/fs/ocfs2/ioctl.c   2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ocfs2/ioctl.c      2008-10-13 14:54:20.000000000 +0200
+@@ -42,7 +42,7 @@ static int ocfs2_get_inode_attr(struct i
        return status;
  }
  
@@ -5514,7 +6583,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ocfs2/ioctl.c linux-2.6.31-vs2.3.0.36.14-p
                                unsigned mask)
  {
        struct ocfs2_inode_info *ocfs2_inode = OCFS2_I(inode);
-@@ -66,6 +66,11 @@ static int ocfs2_set_inode_attr(struct i
+@@ -67,6 +67,11 @@ static int ocfs2_set_inode_attr(struct i
        if (!S_ISDIR(inode->i_mode))
                flags &= ~OCFS2_DIRSYNC_FL;
  
@@ -5526,9 +6595,9 @@ diff -NurpP --minimal linux-2.6.31/fs/ocfs2/ioctl.c linux-2.6.31-vs2.3.0.36.14-p
        handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
        if (IS_ERR(handle)) {
                status = PTR_ERR(handle);
-diff -NurpP --minimal linux-2.6.31/fs/ocfs2/ioctl.h linux-2.6.31-vs2.3.0.36.14-pre8/fs/ocfs2/ioctl.h
---- linux-2.6.31/fs/ocfs2/ioctl.h      2008-12-25 00:26:37.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ocfs2/ioctl.h   2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/ocfs2/ioctl.h linux-2.6.27.33-vs2.3.0.36.6/fs/ocfs2/ioctl.h
+--- linux-2.6.27.33/fs/ocfs2/ioctl.h   2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ocfs2/ioctl.h      2008-10-13 14:54:20.000000000 +0200
 @@ -10,6 +10,9 @@
  #ifndef OCFS2_IOCTL_H
  #define OCFS2_IOCTL_H
@@ -5539,51 +6608,61 @@ diff -NurpP --minimal linux-2.6.31/fs/ocfs2/ioctl.h linux-2.6.31-vs2.3.0.36.14-p
  long ocfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
  long ocfs2_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg);
  
-diff -NurpP --minimal linux-2.6.31/fs/ocfs2/namei.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/ocfs2/namei.c
---- linux-2.6.31/fs/ocfs2/namei.c      2009-09-10 15:26:23.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ocfs2/namei.c   2009-09-10 16:11:43.000000000 +0200
-@@ -41,6 +41,7 @@
+diff -NurpP --minimal linux-2.6.27.33/fs/ocfs2/namei.c linux-2.6.27.33-vs2.3.0.36.6/fs/ocfs2/namei.c
+--- linux-2.6.27.33/fs/ocfs2/namei.c   2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ocfs2/namei.c      2008-10-13 14:54:20.000000000 +0200
+@@ -40,6 +40,7 @@
+ #include <linux/types.h>
  #include <linux/slab.h>
  #include <linux/highmem.h>
- #include <linux/quotaops.h>
 +#include <linux/vs_tag.h>
  
  #define MLOG_MASK_PREFIX ML_NAMEI
  #include <cluster/masklog.h>
-@@ -478,6 +479,7 @@ static int ocfs2_mknod_locked(struct ocf
+@@ -366,6 +367,9 @@ static int ocfs2_mknod_locked(struct ocf
        u64 fe_blkno = 0;
        u16 suballoc_bit;
-       u16 feat;
+       struct inode *inode = NULL;
++      uid_t uid;
++      gid_t gid;
 +      tag_t tag;
  
-       mlog_entry("(0x%p, 0x%p, %d, %lu, '%.*s')\n", dir, dentry,
-                  inode->i_mode, (unsigned long)dev, dentry->d_name.len,
-@@ -524,8 +526,11 @@ static int ocfs2_mknod_locked(struct ocf
+       mlog_entry("(0x%p, 0x%p, %d, %lu, '%.*s')\n", dir, dentry, mode,
+                  (unsigned long)dev, dentry->d_name.len,
+@@ -425,13 +429,19 @@ static int ocfs2_mknod_locked(struct ocf
        fe->i_blkno = cpu_to_le64(fe_blkno);
        fe->i_suballoc_bit = cpu_to_le16(suballoc_bit);
        fe->i_suballoc_slot = cpu_to_le16(inode_ac->ac_alloc_slot);
--      fe->i_uid = cpu_to_le32(inode->i_uid);
--      fe->i_gid = cpu_to_le32(inode->i_gid);
+-      fe->i_uid = cpu_to_le32(current->fsuid);
 +
 +      tag = dx_current_fstag(osb->sb);
-+      fe->i_uid = cpu_to_le32(TAGINO_UID(DX_TAG(inode), inode->i_uid, tag));
-+      fe->i_gid = cpu_to_le32(TAGINO_GID(DX_TAG(inode), inode->i_gid, tag));
++      uid = current->fsuid;
+       if (dir->i_mode & S_ISGID) {
+-              fe->i_gid = cpu_to_le32(dir->i_gid);
++              gid = dir->i_gid;
+               if (S_ISDIR(mode))
+                       mode |= S_ISGID;
+       } else
+-              fe->i_gid = cpu_to_le32(current->fsgid);
++              gid = current->fsgid;
++
++      fe->i_uid = cpu_to_le32(TAGINO_UID(DX_TAG(inode), uid, tag));
++      fe->i_gid = cpu_to_le32(TAGINO_GID(DX_TAG(inode), gid, tag));
 +      inode->i_tag = tag;
-       fe->i_mode = cpu_to_le16(inode->i_mode);
-       if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode))
+       fe->i_mode = cpu_to_le16(mode);
+       if (S_ISCHR(mode) || S_ISBLK(mode))
                fe->id1.dev1.i_rdev = cpu_to_le64(huge_encode_dev(dev));
-@@ -2040,6 +2045,7 @@ const struct inode_operations ocfs2_dir_
+@@ -1917,5 +1927,6 @@ const struct inode_operations ocfs2_dir_
        .rename         = ocfs2_rename,
        .setattr        = ocfs2_setattr,
        .getattr        = ocfs2_getattr,
 +      .sync_flags     = ocfs2_sync_flags,
        .permission     = ocfs2_permission,
-       .setxattr       = generic_setxattr,
-       .getxattr       = generic_getxattr,
-diff -NurpP --minimal linux-2.6.31/fs/ocfs2/ocfs2_fs.h linux-2.6.31-vs2.3.0.36.14-pre8/fs/ocfs2/ocfs2_fs.h
---- linux-2.6.31/fs/ocfs2/ocfs2_fs.h   2009-06-11 17:13:07.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ocfs2/ocfs2_fs.h        2009-09-10 16:11:43.000000000 +0200
-@@ -225,18 +225,23 @@
+ };
+diff -NurpP --minimal linux-2.6.27.33/fs/ocfs2/ocfs2_fs.h linux-2.6.27.33-vs2.3.0.36.6/fs/ocfs2/ocfs2_fs.h
+--- linux-2.6.27.33/fs/ocfs2/ocfs2_fs.h        2008-10-13 14:52:06.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ocfs2/ocfs2_fs.h   2008-10-13 14:54:20.000000000 +0200
+@@ -195,18 +195,23 @@
  #define OCFS2_INDEXED_DIR_FL  (0x0008)
  
  /* Inode attributes, keep in sync with EXT2 */
@@ -5618,39 +6697,39 @@ diff -NurpP --minimal linux-2.6.31/fs/ocfs2/ocfs2_fs.h linux-2.6.31-vs2.3.0.36.1
  
  /*
   * Extent record flags (e_node.leaf.flags)
-diff -NurpP --minimal linux-2.6.31/fs/ocfs2/ocfs2.h linux-2.6.31-vs2.3.0.36.14-pre8/fs/ocfs2/ocfs2.h
---- linux-2.6.31/fs/ocfs2/ocfs2.h      2009-09-10 15:26:23.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ocfs2/ocfs2.h   2009-09-10 16:11:43.000000000 +0200
-@@ -222,6 +222,7 @@ enum ocfs2_mount_options
-       OCFS2_MOUNT_POSIX_ACL = 1 << 8, /* POSIX access control lists */
-       OCFS2_MOUNT_USRQUOTA = 1 << 9, /* We support user quotas */
-       OCFS2_MOUNT_GRPQUOTA = 1 << 10, /* We support group quotas */
-+      OCFS2_MOUNT_TAGGED = 1 << 11, /* use tagging */
+diff -NurpP --minimal linux-2.6.27.33/fs/ocfs2/ocfs2.h linux-2.6.27.33-vs2.3.0.36.6/fs/ocfs2/ocfs2.h
+--- linux-2.6.27.33/fs/ocfs2/ocfs2.h   2008-10-13 14:52:06.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ocfs2/ocfs2.h      2008-10-13 14:54:20.000000000 +0200
+@@ -184,6 +184,7 @@ enum ocfs2_mount_options
+       OCFS2_MOUNT_ERRORS_PANIC = 1 << 3, /* Panic on errors */
+       OCFS2_MOUNT_DATA_WRITEBACK = 1 << 4, /* No data ordering */
+       OCFS2_MOUNT_LOCALFLOCKS = 1 << 5, /* No cluster aware user file locks */
++      OCFS2_MOUNT_TAGGED = 1 << 8, /* use tagging */
  };
  
- #define OCFS2_OSB_SOFT_RO                     0x0001
-diff -NurpP --minimal linux-2.6.31/fs/ocfs2/super.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/ocfs2/super.c
---- linux-2.6.31/fs/ocfs2/super.c      2009-09-10 15:26:23.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/ocfs2/super.c   2009-09-10 16:11:43.000000000 +0200
-@@ -173,6 +173,7 @@ enum {
-       Opt_noacl,
-       Opt_usrquota,
-       Opt_grpquota,
+ #define OCFS2_OSB_SOFT_RO     0x0001
+diff -NurpP --minimal linux-2.6.27.33/fs/ocfs2/super.c linux-2.6.27.33-vs2.3.0.36.6/fs/ocfs2/super.c
+--- linux-2.6.27.33/fs/ocfs2/super.c   2008-10-13 14:52:06.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/ocfs2/super.c      2008-10-13 14:54:20.000000000 +0200
+@@ -154,6 +154,7 @@ enum {
+       Opt_localalloc,
+       Opt_localflocks,
+       Opt_stack,
 +      Opt_tag, Opt_notag, Opt_tagid,
        Opt_err,
  };
  
-@@ -199,6 +200,9 @@ static const match_table_t tokens = {
-       {Opt_noacl, "noacl"},
-       {Opt_usrquota, "usrquota"},
-       {Opt_grpquota, "grpquota"},
+@@ -173,6 +174,9 @@ static match_table_t tokens = {
+       {Opt_localalloc, "localalloc=%d"},
+       {Opt_localflocks, "localflocks"},
+       {Opt_stack, "cluster_stack=%s"},
 +      {Opt_tag, "tag"},
 +      {Opt_notag, "notag"},
 +      {Opt_tagid, "tagid=%u"},
        {Opt_err, NULL}
  };
  
-@@ -605,6 +609,13 @@ static int ocfs2_remount(struct super_bl
+@@ -392,6 +396,13 @@ static int ocfs2_remount(struct super_bl
                goto out;
        }
  
@@ -5664,7 +6743,7 @@ diff -NurpP --minimal linux-2.6.31/fs/ocfs2/super.c linux-2.6.31-vs2.3.0.36.14-p
        if ((osb->s_mount_opt & OCFS2_MOUNT_HB_LOCAL) !=
            (parsed_options.mount_opt & OCFS2_MOUNT_HB_LOCAL)) {
                ret = -EINVAL;
-@@ -1146,6 +1157,9 @@ static int ocfs2_fill_super(struct super
+@@ -725,6 +736,9 @@ static int ocfs2_fill_super(struct super
  
        ocfs2_complete_mount_recovery(osb);
  
@@ -5674,10 +6753,10 @@ diff -NurpP --minimal linux-2.6.31/fs/ocfs2/super.c linux-2.6.31-vs2.3.0.36.14-p
        if (ocfs2_mount_local(osb))
                snprintf(nodestr, sizeof(nodestr), "local");
        else
-@@ -1424,6 +1438,20 @@ static int ocfs2_parse_options(struct su
-                       printk(KERN_INFO "ocfs2 (no)acl options not supported\n");
+@@ -918,6 +932,20 @@ static int ocfs2_parse_options(struct su
+                              OCFS2_STACK_LABEL_LEN);
+                       mopt->cluster_stack[OCFS2_STACK_LABEL_LEN] = '\0';
                        break;
- #endif
 +#ifndef CONFIG_TAGGING_NONE
 +              case Opt_tag:
 +                      mopt->mount_opt |= OCFS2_MOUNT_TAGGED;
@@ -5695,13 +6774,13 @@ diff -NurpP --minimal linux-2.6.31/fs/ocfs2/super.c linux-2.6.31-vs2.3.0.36.14-p
                default:
                        mlog(ML_ERROR,
                             "Unrecognized mount option \"%s\" "
-diff -NurpP --minimal linux-2.6.31/fs/open.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/open.c
---- linux-2.6.31/fs/open.c     2009-09-10 15:26:23.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/open.c  2009-09-10 16:11:43.000000000 +0200
-@@ -30,22 +30,31 @@
+diff -NurpP --minimal linux-2.6.27.33/fs/open.c linux-2.6.27.33-vs2.3.0.36.6/fs/open.c
+--- linux-2.6.27.33/fs/open.c  2009-09-13 16:16:59.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/open.c     2009-02-03 17:59:04.000000000 +0100
+@@ -29,22 +29,31 @@
+ #include <linux/rcupdate.h>
  #include <linux/audit.h>
  #include <linux/falloc.h>
- #include <linux/fs_struct.h>
 +#include <linux/vs_base.h>
 +#include <linux/vs_limit.h>
 +#include <linux/vs_dlimit.h>
@@ -5732,7 +6811,7 @@ diff -NurpP --minimal linux-2.6.31/fs/open.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/
        }
        return retval;
  }
-@@ -639,6 +648,10 @@ SYSCALL_DEFINE3(fchmodat, int, dfd, cons
+@@ -643,6 +652,10 @@ SYSCALL_DEFINE3(fchmodat, int, dfd, cons
        error = user_path_at(dfd, filename, LOOKUP_FOLLOW, &path);
        if (error)
                goto out;
@@ -5743,7 +6822,7 @@ diff -NurpP --minimal linux-2.6.31/fs/open.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/
        inode = path.dentry->d_inode;
  
        error = mnt_want_write(path.mnt);
-@@ -672,11 +685,11 @@ static int chown_common(struct dentry * 
+@@ -676,11 +689,11 @@ static int chown_common(struct dentry * 
        newattrs.ia_valid =  ATTR_CTIME;
        if (user != (uid_t) -1) {
                newattrs.ia_valid |= ATTR_UID;
@@ -5757,7 +6836,7 @@ diff -NurpP --minimal linux-2.6.31/fs/open.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/
        }
        if (!S_ISDIR(inode->i_mode))
                newattrs.ia_valid |=
-@@ -699,7 +712,11 @@ SYSCALL_DEFINE3(chown, const char __user
+@@ -703,7 +716,11 @@ SYSCALL_DEFINE3(chown, const char __user
        error = mnt_want_write(path.mnt);
        if (error)
                goto out_release;
@@ -5770,7 +6849,7 @@ diff -NurpP --minimal linux-2.6.31/fs/open.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/
        mnt_drop_write(path.mnt);
  out_release:
        path_put(&path);
-@@ -724,7 +741,11 @@ SYSCALL_DEFINE5(fchownat, int, dfd, cons
+@@ -728,7 +745,11 @@ SYSCALL_DEFINE5(fchownat, int, dfd, cons
        error = mnt_want_write(path.mnt);
        if (error)
                goto out_release;
@@ -5783,7 +6862,7 @@ diff -NurpP --minimal linux-2.6.31/fs/open.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/
        mnt_drop_write(path.mnt);
  out_release:
        path_put(&path);
-@@ -743,7 +764,11 @@ SYSCALL_DEFINE3(lchown, const char __use
+@@ -747,7 +768,11 @@ SYSCALL_DEFINE3(lchown, const char __use
        error = mnt_want_write(path.mnt);
        if (error)
                goto out_release;
@@ -5796,7 +6875,7 @@ diff -NurpP --minimal linux-2.6.31/fs/open.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/
        mnt_drop_write(path.mnt);
  out_release:
        path_put(&path);
-@@ -987,6 +1012,7 @@ static void __put_unused_fd(struct files
+@@ -986,6 +1011,7 @@ static void __put_unused_fd(struct files
        __FD_CLR(fd, fdt->open_fds);
        if (fd < files->next_fd)
                files->next_fd = fd;
@@ -5804,9 +6883,9 @@ diff -NurpP --minimal linux-2.6.31/fs/open.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/
  }
  
  void put_unused_fd(unsigned int fd)
-diff -NurpP --minimal linux-2.6.31/fs/proc/array.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/proc/array.c
---- linux-2.6.31/fs/proc/array.c       2009-06-11 17:13:07.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/proc/array.c    2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/proc/array.c linux-2.6.27.33-vs2.3.0.36.6/fs/proc/array.c
+--- linux-2.6.27.33/fs/proc/array.c    2009-09-13 16:16:59.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/proc/array.c       2009-05-20 02:14:39.000000000 +0200
 @@ -82,6 +82,8 @@
  #include <linux/pid_namespace.h>
  #include <linux/ptrace.h>
@@ -5816,7 +6895,7 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/array.c linux-2.6.31-vs2.3.0.36.14-pr
  
  #include <asm/pgtable.h>
  #include <asm/processor.h>
-@@ -138,8 +140,9 @@ static const char *task_state_array[] = 
+@@ -143,8 +145,9 @@ static const char *task_state_array[] = 
        "D (disk sleep)",       /*  2 */
        "T (stopped)",          /*  4 */
        "T (tracing stop)",     /*  8 */
@@ -5828,7 +6907,7 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/array.c linux-2.6.31-vs2.3.0.36.14-pr
  };
  
  static inline const char *get_task_state(struct task_struct *tsk)
-@@ -166,6 +169,9 @@ static inline void task_state(struct seq
+@@ -170,6 +173,9 @@ static inline void task_state(struct seq
        rcu_read_lock();
        ppid = pid_alive(p) ?
                task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0;
@@ -5838,7 +6917,7 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/array.c linux-2.6.31-vs2.3.0.36.14-pr
        tpid = 0;
        if (pid_alive(p)) {
                struct task_struct *tracer = tracehook_tracer_task(p);
-@@ -281,7 +287,7 @@ static inline void task_sig(struct seq_f
+@@ -287,7 +293,7 @@ static inline void task_sig(struct seq_f
  }
  
  static void render_cap_t(struct seq_file *m, const char *header,
@@ -5847,23 +6926,22 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/array.c linux-2.6.31-vs2.3.0.36.14-pr
  {
        unsigned __capi;
  
-@@ -306,10 +312,11 @@ static inline void task_cap(struct seq_f
-       cap_bset        = cred->cap_bset;
-       rcu_read_unlock();
+@@ -301,10 +307,10 @@ static void render_cap_t(struct seq_file
  
--      render_cap_t(m, "CapInh:\t", &cap_inheritable);
--      render_cap_t(m, "CapPrm:\t", &cap_permitted);
--      render_cap_t(m, "CapEff:\t", &cap_effective);
--      render_cap_t(m, "CapBnd:\t", &cap_bset);
-+      /* FIXME: maybe move the p->vx_info masking to __task_cred() ? */
-+      render_cap_t(m, "CapInh:\t", p->vx_info, &cap_inheritable);
-+      render_cap_t(m, "CapPrm:\t", p->vx_info, &cap_permitted);
-+      render_cap_t(m, "CapEff:\t", p->vx_info, &cap_effective);
-+      render_cap_t(m, "CapBnd:\t", p->vx_info, &cap_bset);
+ static inline void task_cap(struct seq_file *m, struct task_struct *p)
+ {
+-      render_cap_t(m, "CapInh:\t", &p->cap_inheritable);
+-      render_cap_t(m, "CapPrm:\t", &p->cap_permitted);
+-      render_cap_t(m, "CapEff:\t", &p->cap_effective);
+-      render_cap_t(m, "CapBnd:\t", &p->cap_bset);
++      render_cap_t(m, "CapInh:\t", p->vx_info, &p->cap_inheritable);
++      render_cap_t(m, "CapPrm:\t", p->vx_info, &p->cap_permitted);
++      render_cap_t(m, "CapEff:\t", p->vx_info, &p->cap_effective);
++      render_cap_t(m, "CapBnd:\t", p->vx_info, &p->cap_bset);
  }
  
  static inline void task_context_switch_counts(struct seq_file *m,
-@@ -321,6 +328,42 @@ static inline void task_context_switch_c
+@@ -316,6 +322,45 @@ static inline void task_context_switch_c
                        p->nivcsw);
  }
  
@@ -5876,6 +6954,7 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/array.c linux-2.6.31-vs2.3.0.36.14-pr
 +                      "ipc:\t%p(%c)\n"
 +                      "mnt:\t%p(%c)\n"
 +                      "pid:\t%p(%c)\n"
++                      "user:\t%p(%c)\n"
 +                      "net:\t%p(%c)\n",
 +                      task->nsproxy,
 +                      (task->nsproxy == init_task.nsproxy ? 'I' : '-'),
@@ -5888,6 +6967,8 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/array.c linux-2.6.31-vs2.3.0.36.14-pr
 +                      (task->nsproxy->mnt_ns == init_task.nsproxy->mnt_ns ? 'I' : '-'),
 +                      task->nsproxy->pid_ns,
 +                      (task->nsproxy->pid_ns == init_task.nsproxy->pid_ns ? 'I' : '-'),
++                      task->nsproxy->user_ns,
++                      (task->nsproxy->user_ns == init_task.nsproxy->user_ns ? 'I' : '-'),
 +                      task->nsproxy->net_ns,
 +                      (task->nsproxy->net_ns == init_task.nsproxy->net_ns ? 'I' : '-'));
 +      return 0;
@@ -5906,7 +6987,7 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/array.c linux-2.6.31-vs2.3.0.36.14-pr
  int proc_pid_status(struct seq_file *m, struct pid_namespace *ns,
                        struct pid *pid, struct task_struct *task)
  {
-@@ -336,6 +379,7 @@ int proc_pid_status(struct seq_file *m, 
+@@ -331,6 +376,7 @@ int proc_pid_status(struct seq_file *m, 
        task_sig(m, task);
        task_cap(m, task);
        cpuset_task_status_allowed(m, task);
@@ -5914,7 +6995,7 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/array.c linux-2.6.31-vs2.3.0.36.14-pr
  #if defined(CONFIG_S390)
        task_show_regs(m, task);
  #endif
-@@ -452,6 +496,17 @@ static int do_task_stat(struct seq_file 
+@@ -447,6 +493,17 @@ static int do_task_stat(struct seq_file 
        /* convert nsec -> ticks */
        start_time = nsec_to_clock_t(start_time);
  
@@ -5932,28 +7013,28 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/array.c linux-2.6.31-vs2.3.0.36.14-pr
        seq_printf(m, "%d (%s) %c %d %d %d %d %d %u %lu \
  %lu %lu %lu %lu %lu %ld %ld %ld %ld %d 0 %llu %lu %ld %lu %lu %lu %lu %lu \
  %lu %lu %lu %lu %lu %lu %lu %lu %d %d %u %u %llu %lu %ld\n",
-diff -NurpP --minimal linux-2.6.31/fs/proc/base.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/proc/base.c
---- linux-2.6.31/fs/proc/base.c        2009-09-10 15:26:23.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/proc/base.c     2009-09-10 16:11:43.000000000 +0200
-@@ -81,6 +81,8 @@
+diff -NurpP --minimal linux-2.6.27.33/fs/proc/base.c linux-2.6.27.33-vs2.3.0.36.6/fs/proc/base.c
+--- linux-2.6.27.33/fs/proc/base.c     2009-09-13 16:16:59.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/proc/base.c        2009-08-17 19:07:36.000000000 +0200
+@@ -79,6 +79,8 @@
+ #include <linux/oom.h>
  #include <linux/elf.h>
  #include <linux/pid_namespace.h>
- #include <linux/fs_struct.h>
 +#include <linux/vs_context.h>
 +#include <linux/vs_network.h>
  #include "internal.h"
  
  /* NOTE:
-@@ -1441,6 +1443,8 @@ static struct inode *proc_pid_make_inode
-               inode->i_gid = cred->egid;
-               rcu_read_unlock();
+@@ -1421,6 +1423,8 @@ static struct inode *proc_pid_make_inode
+               inode->i_uid = task->euid;
+               inode->i_gid = task->egid;
        }
 +      /* procfs is xid tagged */
 +      inode->i_tag = (tag_t)vx_task_xid(task);
        security_task_to_inode(task, inode);
  
  out:
-@@ -1991,6 +1995,13 @@ static struct dentry *proc_pident_lookup
+@@ -1961,6 +1965,13 @@ static struct dentry *proc_pident_lookup
        if (!task)
                goto out_no_task;
  
@@ -5967,7 +7048,7 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/base.c linux-2.6.31-vs2.3.0.36.14-pre
        /*
         * Yes, it does not scale. And it should not. Don't add
         * new entries into /proc/<tgid>/ without very good reasons.
-@@ -2382,7 +2393,7 @@ out_iput:
+@@ -2348,7 +2359,7 @@ out_iput:
  static struct dentry *proc_base_lookup(struct inode *dir, struct dentry *dentry)
  {
        struct dentry *error;
@@ -5976,7 +7057,7 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/base.c linux-2.6.31-vs2.3.0.36.14-pre
        const struct pid_entry *p, *last;
  
        error = ERR_PTR(-ENOENT);
-@@ -2472,6 +2483,9 @@ static int proc_pid_personality(struct s
+@@ -2431,6 +2442,9 @@ static int proc_tgid_io_accounting(struc
  static const struct file_operations proc_task_operations;
  static const struct inode_operations proc_task_inode_operations;
  
@@ -5984,26 +7065,26 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/base.c linux-2.6.31-vs2.3.0.36.14-pre
 +extern int proc_pid_nx_info(struct task_struct *, char *);
 +
  static const struct pid_entry tgid_base_stuff[] = {
-       DIR("task",       S_IRUGO|S_IXUGO, proc_task_inode_operations, proc_task_operations),
-       DIR("fd",         S_IRUSR|S_IXUSR, proc_fd_inode_operations, proc_fd_operations),
-@@ -2530,6 +2544,8 @@ static const struct pid_entry tgid_base_
+       DIR("task",       S_IRUGO|S_IXUGO, task),
+       DIR("fd",         S_IRUSR|S_IXUSR, fd),
+@@ -2485,6 +2499,8 @@ static const struct pid_entry tgid_base_
  #ifdef CONFIG_CGROUPS
-       REG("cgroup",  S_IRUGO, proc_cgroup_operations),
+       REG("cgroup",  S_IRUGO, cgroup),
  #endif
-+      INF("vinfo",      S_IRUGO, proc_pid_vx_info),
-+      INF("ninfo",      S_IRUGO, proc_pid_nx_info),
-       INF("oom_score",  S_IRUGO, proc_oom_score),
-       REG("oom_adj",    S_IRUGO|S_IWUSR, proc_oom_adjust_operations),
++      INF("vinfo",      S_IRUGO, pid_vx_info),
++      INF("ninfo",      S_IRUGO, pid_nx_info),
+       INF("oom_score",  S_IRUGO, oom_score),
+       REG("oom_adj",    S_IRUGO|S_IWUSR, oom_adjust),
  #ifdef CONFIG_AUDITSYSCALL
-@@ -2545,6 +2561,7 @@ static const struct pid_entry tgid_base_
+@@ -2500,6 +2516,7 @@ static const struct pid_entry tgid_base_
  #ifdef CONFIG_TASK_IO_ACCOUNTING
-       INF("io",       S_IRUGO, proc_tgid_io_accounting),
+       INF("io",       S_IRUGO, tgid_io_accounting),
  #endif
-+      ONE("nsproxy",  S_IRUGO, proc_pid_nsproxy),
++      ONE("nsproxy",  S_IRUGO, pid_nsproxy),
  };
  
  static int proc_tgid_base_readdir(struct file * filp,
-@@ -2741,7 +2758,7 @@ retry:
+@@ -2696,7 +2713,7 @@ retry:
        iter.task = NULL;
        pid = find_ge_pid(iter.tgid, ns);
        if (pid) {
@@ -6012,7 +7093,7 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/base.c linux-2.6.31-vs2.3.0.36.14-pre
                iter.task = pid_task(pid, PIDTYPE_PID);
                /* What we to know is if the pid we have find is the
                 * pid of a thread_group_leader.  Testing for task
-@@ -2771,7 +2788,7 @@ static int proc_pid_fill_cache(struct fi
+@@ -2726,7 +2743,7 @@ static int proc_pid_fill_cache(struct fi
        struct tgid_iter iter)
  {
        char name[PROC_NUMBUF];
@@ -6021,7 +7102,7 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/base.c linux-2.6.31-vs2.3.0.36.14-pre
        return proc_fill_cache(filp, dirent, filldir, name, len,
                                proc_pid_instantiate, iter.task, NULL);
  }
-@@ -2780,7 +2797,7 @@ static int proc_pid_fill_cache(struct fi
+@@ -2735,7 +2752,7 @@ static int proc_pid_fill_cache(struct fi
  int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir)
  {
        unsigned int nr = filp->f_pos - FIRST_PROCESS_ENTRY;
@@ -6030,7 +7111,7 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/base.c linux-2.6.31-vs2.3.0.36.14-pre
        struct tgid_iter iter;
        struct pid_namespace *ns;
  
-@@ -2800,6 +2817,8 @@ int proc_pid_readdir(struct file * filp,
+@@ -2755,6 +2772,8 @@ int proc_pid_readdir(struct file * filp,
             iter.task;
             iter.tgid += 1, iter = next_tgid(ns, iter)) {
                filp->f_pos = iter.tgid + TGID_OFFSET;
@@ -6039,7 +7120,7 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/base.c linux-2.6.31-vs2.3.0.36.14-pre
                if (proc_pid_fill_cache(filp, dirent, filldir, iter) < 0) {
                        put_task_struct(iter.task);
                        goto out;
-@@ -2946,6 +2965,8 @@ static struct dentry *proc_task_lookup(s
+@@ -2897,6 +2916,8 @@ static struct dentry *proc_task_lookup(s
        tid = name_to_int(dentry);
        if (tid == ~0U)
                goto out;
@@ -6048,10 +7129,10 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/base.c linux-2.6.31-vs2.3.0.36.14-pre
  
        ns = dentry->d_sb->s_fs_info;
        rcu_read_lock();
-diff -NurpP --minimal linux-2.6.31/fs/proc/generic.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/proc/generic.c
---- linux-2.6.31/fs/proc/generic.c     2009-06-11 17:13:07.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/proc/generic.c  2009-09-10 16:11:43.000000000 +0200
-@@ -20,6 +20,7 @@
+diff -NurpP --minimal linux-2.6.27.33/fs/proc/generic.c linux-2.6.27.33-vs2.3.0.36.6/fs/proc/generic.c
+--- linux-2.6.27.33/fs/proc/generic.c  2008-10-13 14:52:06.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/proc/generic.c     2008-10-13 14:54:20.000000000 +0200
+@@ -21,6 +21,7 @@
  #include <linux/bitops.h>
  #include <linux/spinlock.h>
  #include <linux/completion.h>
@@ -6059,7 +7140,7 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/generic.c linux-2.6.31-vs2.3.0.36.14-
  #include <asm/uaccess.h>
  
  #include "internal.h"
-@@ -425,6 +426,8 @@ struct dentry *proc_lookup_de(struct pro
+@@ -384,6 +385,8 @@ struct dentry *proc_lookup_de(struct pro
        for (de = de->subdir; de ; de = de->next) {
                if (de->namelen != dentry->d_name.len)
                        continue;
@@ -6068,7 +7149,7 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/generic.c linux-2.6.31-vs2.3.0.36.14-
                if (!memcmp(dentry->d_name.name, de->name, de->namelen)) {
                        unsigned int ino;
  
-@@ -433,6 +436,8 @@ struct dentry *proc_lookup_de(struct pro
+@@ -392,6 +395,8 @@ struct dentry *proc_lookup_de(struct pro
                        spin_unlock(&proc_subdir_lock);
                        error = -EINVAL;
                        inode = proc_get_inode(dir->i_sb, ino, de);
@@ -6077,7 +7158,7 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/generic.c linux-2.6.31-vs2.3.0.36.14-
                        goto out_unlock;
                }
        }
-@@ -510,6 +515,8 @@ int proc_readdir_de(struct proc_dir_entr
+@@ -472,6 +477,8 @@ int proc_readdir_de(struct proc_dir_entr
  
                                /* filldir passes info to user space */
                                de_get(de);
@@ -6086,7 +7167,7 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/generic.c linux-2.6.31-vs2.3.0.36.14-
                                spin_unlock(&proc_subdir_lock);
                                if (filldir(dirent, de->name, de->namelen, filp->f_pos,
                                            de->low_ino, de->mode >> 12) < 0) {
-@@ -517,6 +524,7 @@ int proc_readdir_de(struct proc_dir_entr
+@@ -479,6 +486,7 @@ int proc_readdir_de(struct proc_dir_entr
                                        goto out;
                                }
                                spin_lock(&proc_subdir_lock);
@@ -6094,7 +7175,7 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/generic.c linux-2.6.31-vs2.3.0.36.14-
                                filp->f_pos++;
                                next = de->next;
                                de_put(de);
-@@ -631,6 +639,7 @@ static struct proc_dir_entry *__proc_cre
+@@ -593,6 +601,7 @@ static struct proc_dir_entry *__proc_cre
        ent->nlink = nlink;
        atomic_set(&ent->count, 1);
        ent->pde_users = 0;
@@ -6102,7 +7183,7 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/generic.c linux-2.6.31-vs2.3.0.36.14-
        spin_lock_init(&ent->pde_unload_lock);
        ent->pde_unload_completion = NULL;
        INIT_LIST_HEAD(&ent->pde_openers);
-@@ -654,7 +663,8 @@ struct proc_dir_entry *proc_symlink(cons
+@@ -616,7 +625,8 @@ struct proc_dir_entry *proc_symlink(cons
                                kfree(ent->data);
                                kfree(ent);
                                ent = NULL;
@@ -6112,10 +7193,10 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/generic.c linux-2.6.31-vs2.3.0.36.14-
                } else {
                        kfree(ent);
                        ent = NULL;
-diff -NurpP --minimal linux-2.6.31/fs/proc/inode.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/proc/inode.c
---- linux-2.6.31/fs/proc/inode.c       2009-06-11 17:13:07.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/proc/inode.c    2009-09-10 16:11:43.000000000 +0200
-@@ -459,6 +459,8 @@ struct inode *proc_get_inode(struct supe
+diff -NurpP --minimal linux-2.6.27.33/fs/proc/inode.c linux-2.6.27.33-vs2.3.0.36.6/fs/proc/inode.c
+--- linux-2.6.27.33/fs/proc/inode.c    2008-10-13 14:52:06.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/proc/inode.c       2008-10-13 14:54:20.000000000 +0200
+@@ -469,6 +469,8 @@ struct inode *proc_get_inode(struct supe
                        inode->i_uid = de->uid;
                        inode->i_gid = de->gid;
                }
@@ -6124,9 +7205,9 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/inode.c linux-2.6.31-vs2.3.0.36.14-pr
                if (de->size)
                        inode->i_size = de->size;
                if (de->nlink)
-diff -NurpP --minimal linux-2.6.31/fs/proc/internal.h linux-2.6.31-vs2.3.0.36.14-pre8/fs/proc/internal.h
---- linux-2.6.31/fs/proc/internal.h    2009-09-10 15:26:23.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/proc/internal.h 2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/proc/internal.h linux-2.6.27.33-vs2.3.0.36.6/fs/proc/internal.h
+--- linux-2.6.27.33/fs/proc/internal.h 2008-10-13 14:52:06.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/proc/internal.h    2008-10-13 14:54:20.000000000 +0200
 @@ -10,6 +10,7 @@
   */
  
@@ -6135,7 +7216,7 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/internal.h linux-2.6.31-vs2.3.0.36.14
  
  extern struct proc_dir_entry proc_root;
  #ifdef CONFIG_PROC_SYSCTL
-@@ -51,6 +52,9 @@ extern int proc_pid_status(struct seq_fi
+@@ -55,6 +56,9 @@ extern int proc_pid_status(struct seq_fi
                                struct pid *pid, struct task_struct *task);
  extern int proc_pid_statm(struct seq_file *m, struct pid_namespace *ns,
                                struct pid *pid, struct task_struct *task);
@@ -6145,7 +7226,7 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/internal.h linux-2.6.31-vs2.3.0.36.14
  extern loff_t mem_lseek(struct file *file, loff_t offset, int orig);
  
  extern const struct file_operations proc_maps_operations;
-@@ -70,11 +74,16 @@ static inline struct pid *proc_pid(struc
+@@ -75,11 +79,16 @@ static inline struct pid *proc_pid(struc
        return PROC_I(inode)->pid;
  }
  
@@ -6163,55 +7244,85 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/internal.h linux-2.6.31-vs2.3.0.36.14
  static inline int proc_fd(struct inode *inode)
  {
        return PROC_I(inode)->fd;
-diff -NurpP --minimal linux-2.6.31/fs/proc/loadavg.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/proc/loadavg.c
---- linux-2.6.31/fs/proc/loadavg.c     2009-09-10 15:26:23.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/proc/loadavg.c  2009-09-10 16:58:00.000000000 +0200
-@@ -12,15 +12,27 @@
+diff -NurpP --minimal linux-2.6.27.33/fs/proc/proc_misc.c linux-2.6.27.33-vs2.3.0.36.6/fs/proc/proc_misc.c
+--- linux-2.6.27.33/fs/proc/proc_misc.c        2009-09-13 16:16:59.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/proc/proc_misc.c   2009-03-25 14:32:29.000000000 +0100
+@@ -57,6 +57,8 @@
+ #include <asm/div64.h>
+ #include "internal.h"
  
- static int loadavg_proc_show(struct seq_file *m, void *v)
++#include <linux/vs_cvirt.h>
++
+ #define LOAD_INT(x) ((x) >> FSHIFT)
+ #define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
+ /*
+@@ -84,22 +86,38 @@ static int proc_calc_metrics(char *page,
+ static int loadavg_read_proc(char *page, char **start, off_t off,
+                                int count, int *eof, void *data)
  {
 +      unsigned long running;
 +      unsigned int threads;
-       unsigned long avnrun[3];
+       int a, b, c;
+       int len;
+       unsigned long seq;
  
-       get_avenrun(avnrun, FIXED_1/200, 0);
-+      if (vx_flags(VXF_VIRT_LOAD, 0)) {
-+              struct vx_info *vxi = current->vx_info;
-+
-+              running = atomic_read(&vxi->cvirt.nr_running);
-+              threads = atomic_read(&vxi->cvirt.nr_threads);
-+      } else {
-+              running = nr_running();
-+              threads = nr_threads;
-+      }
+       do {
+               seq = read_seqbegin(&xtime_lock);
+-              a = avenrun[0] + (FIXED_1/200);
+-              b = avenrun[1] + (FIXED_1/200);
+-              c = avenrun[2] + (FIXED_1/200);
++              if (vx_flags(VXF_VIRT_LOAD, 0)) {
++                      struct vx_info *vxi = current->vx_info;
++
++                      a = vxi->cvirt.load[0] + (FIXED_1/200);
++                      b = vxi->cvirt.load[1] + (FIXED_1/200);
++                      c = vxi->cvirt.load[2] + (FIXED_1/200);
++
++                      running = atomic_read(&vxi->cvirt.nr_running);
++                      threads = atomic_read(&vxi->cvirt.nr_threads);
++              } else {
++                      a = avenrun[0] + (FIXED_1/200);
++                      b = avenrun[1] + (FIXED_1/200);
++                      c = avenrun[2] + (FIXED_1/200);
 +
-       seq_printf(m, "%lu.%02lu %lu.%02lu %lu.%02lu %ld/%d %d\n",
-               LOAD_INT(avnrun[0]), LOAD_FRAC(avnrun[0]),
-               LOAD_INT(avnrun[1]), LOAD_FRAC(avnrun[1]),
-               LOAD_INT(avnrun[2]), LOAD_FRAC(avnrun[2]),
++                      running = nr_running();
++                      threads = nr_threads;
++              }
+       } while (read_seqretry(&xtime_lock, seq));
+       len = sprintf(page,"%d.%02d %d.%02d %d.%02d %ld/%d %d\n",
+               LOAD_INT(a), LOAD_FRAC(a),
+               LOAD_INT(b), LOAD_FRAC(b),
+               LOAD_INT(c), LOAD_FRAC(c),
 -              nr_running(), nr_threads,
 +              running, threads,
                task_active_pid_ns(current)->last_pid);
-       return 0;
+       return proc_calc_metrics(page, start, off, count, eof, len);
  }
-diff -NurpP --minimal linux-2.6.31/fs/proc/meminfo.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/proc/meminfo.c
---- linux-2.6.31/fs/proc/meminfo.c     2009-09-10 15:26:23.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/proc/meminfo.c  2009-09-10 16:11:43.000000000 +0200
-@@ -41,7 +41,7 @@ static int meminfo_proc_show(struct seq_
-       cached = global_page_state(NR_FILE_PAGES) -
-                       total_swapcache_pages - i.bufferram;
--      if (cached < 0)
-+      if (cached < 0 || vx_flags(VXF_VIRT_MEM, 0))
+@@ -115,6 +133,9 @@ static int uptime_read_proc(char *page, 
+       do_posix_clock_monotonic_gettime(&uptime);
+       monotonic_to_bootbased(&uptime);
+       cputime_to_timespec(idletime, &idle);
++      if (vx_flags(VXF_VIRT_UPTIME, 0))
++              vx_vsi_uptime(&uptime, &idle);
++
+       len = sprintf(page,"%lu.%02lu %lu.%02lu\n",
+                       (unsigned long) uptime.tv_sec,
+                       (uptime.tv_nsec / (NSEC_PER_SEC / 100)),
+@@ -151,7 +172,7 @@ static int meminfo_read_proc(char *page,
+       cached = global_page_state(NR_FILE_PAGES) -
+                       total_swapcache_pages - i.bufferram;
+-      if (cached < 0)
++      if (cached < 0 || vx_flags(VXF_VIRT_MEM, 0))
                cached = 0;
  
        get_vmalloc_info(&vmi);
-diff -NurpP --minimal linux-2.6.31/fs/proc/root.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/proc/root.c
---- linux-2.6.31/fs/proc/root.c        2009-06-11 17:13:07.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/proc/root.c     2009-09-10 16:11:43.000000000 +0200
-@@ -18,9 +18,14 @@
- #include <linux/bitops.h>
+diff -NurpP --minimal linux-2.6.27.33/fs/proc/root.c linux-2.6.27.33-vs2.3.0.36.6/fs/proc/root.c
+--- linux-2.6.27.33/fs/proc/root.c     2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/proc/root.c        2008-11-20 00:58:27.000000000 +0100
+@@ -19,9 +19,14 @@
+ #include <linux/smp_lock.h>
  #include <linux/mount.h>
  #include <linux/pid_namespace.h>
 +#include <linux/vserver/inode.h>
@@ -6225,7 +7336,7 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/root.c linux-2.6.31-vs2.3.0.36.14-pre
  static int proc_test_super(struct super_block *sb, void *data)
  {
        return sb->s_fs_info == data;
-@@ -136,6 +141,7 @@ void __init proc_root_init(void)
+@@ -137,6 +142,7 @@ void __init proc_root_init(void)
  #endif
        proc_mkdir("bus", NULL);
        proc_sys_init();
@@ -6233,7 +7344,7 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/root.c linux-2.6.31-vs2.3.0.36.14-pre
  }
  
  static int proc_root_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat
-@@ -203,6 +209,7 @@ struct proc_dir_entry proc_root = {
+@@ -209,6 +215,7 @@ struct proc_dir_entry proc_root = {
        .proc_iops      = &proc_root_inode_operations, 
        .proc_fops      = &proc_root_operations,
        .parent         = &proc_root,
@@ -6241,31 +7352,9 @@ diff -NurpP --minimal linux-2.6.31/fs/proc/root.c linux-2.6.31-vs2.3.0.36.14-pre
  };
  
  int pid_ns_prepare_proc(struct pid_namespace *ns)
-diff -NurpP --minimal linux-2.6.31/fs/proc/uptime.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/proc/uptime.c
---- linux-2.6.31/fs/proc/uptime.c      2009-06-11 17:13:07.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/proc/uptime.c   2009-09-10 16:11:43.000000000 +0200
-@@ -4,6 +4,7 @@
- #include <linux/sched.h>
- #include <linux/seq_file.h>
- #include <linux/time.h>
-+#include <linux/vserver/cvirt.h>
- #include <asm/cputime.h>
- static int uptime_proc_show(struct seq_file *m, void *v)
-@@ -15,6 +16,10 @@ static int uptime_proc_show(struct seq_f
-       do_posix_clock_monotonic_gettime(&uptime);
-       monotonic_to_bootbased(&uptime);
-       cputime_to_timespec(idletime, &idle);
-+
-+      if (vx_flags(VXF_VIRT_UPTIME, 0))
-+              vx_vsi_uptime(&uptime, &idle);
-+
-       seq_printf(m, "%lu.%02lu %lu.%02lu\n",
-                       (unsigned long) uptime.tv_sec,
-                       (uptime.tv_nsec / (NSEC_PER_SEC / 100)),
-diff -NurpP --minimal linux-2.6.31/fs/quota/quota.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/quota/quota.c
---- linux-2.6.31/fs/quota/quota.c      2009-09-10 15:26:24.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/quota/quota.c   2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/quota.c linux-2.6.27.33-vs2.3.0.36.6/fs/quota.c
+--- linux-2.6.27.33/fs/quota.c 2009-09-13 16:16:59.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/quota.c    2009-02-03 17:59:04.000000000 +0100
 @@ -18,6 +18,7 @@
  #include <linux/capability.h>
  #include <linux/quotaops.h>
@@ -6273,10 +7362,10 @@ diff -NurpP --minimal linux-2.6.31/fs/quota/quota.c linux-2.6.31-vs2.3.0.36.14-p
 +#include <linux/vs_context.h>
  
  /* Check validity of generic quotactl commands */
- static int generic_quotactl_valid(struct super_block *sb, int type, int cmd,
-@@ -83,11 +84,11 @@ static int generic_quotactl_valid(struct
+ static int generic_quotactl_valid(struct super_block *sb, int type, int cmd, qid_t id)
+@@ -81,11 +82,11 @@ static int generic_quotactl_valid(struct
        if (cmd == Q_GETQUOTA) {
-               if (((type == USRQUOTA && current_euid() != id) ||
+               if (((type == USRQUOTA && current->euid != id) ||
                     (type == GRPQUOTA && !in_egroup_p(id))) &&
 -                  !capable(CAP_SYS_ADMIN))
 +                  !vx_capable(CAP_SYS_ADMIN, VXC_QUOTA_CTL))
@@ -6288,9 +7377,9 @@ diff -NurpP --minimal linux-2.6.31/fs/quota/quota.c linux-2.6.31-vs2.3.0.36.14-p
                        return -EPERM;
  
        return 0;
-@@ -135,10 +136,10 @@ static int xqm_quotactl_valid(struct sup
+@@ -132,10 +133,10 @@ static int xqm_quotactl_valid(struct sup
        if (cmd == Q_XGETQUOTA) {
-               if (((type == XQM_USRQUOTA && current_euid() != id) ||
+               if (((type == XQM_USRQUOTA && current->euid != id) ||
                     (type == XQM_GRPQUOTA && !in_egroup_p(id))) &&
 -                   !capable(CAP_SYS_ADMIN))
 +                   !vx_capable(CAP_SYS_ADMIN, VXC_QUOTA_CTL))
@@ -6301,7 +7390,7 @@ diff -NurpP --minimal linux-2.6.31/fs/quota/quota.c linux-2.6.31-vs2.3.0.36.14-p
                        return -EPERM;
        }
  
-@@ -351,6 +352,46 @@ static int do_quotactl(struct super_bloc
+@@ -334,6 +335,46 @@ static int do_quotactl(struct super_bloc
        return 0;
  }
  
@@ -6348,7 +7437,7 @@ diff -NurpP --minimal linux-2.6.31/fs/quota/quota.c linux-2.6.31-vs2.3.0.36.14-p
  /*
   * look up a superblock on which quota ops will be performed
   * - use the name of a block device to find the superblock thereon
-@@ -368,6 +409,22 @@ static struct super_block *quotactl_bloc
+@@ -351,6 +392,22 @@ static inline struct super_block *quotac
        putname(tmp);
        if (IS_ERR(bdev))
                return ERR_CAST(bdev);
@@ -6371,27 +7460,131 @@ diff -NurpP --minimal linux-2.6.31/fs/quota/quota.c linux-2.6.31-vs2.3.0.36.14-p
        sb = get_super(bdev);
        bdput(bdev);
        if (!sb)
-diff -NurpP --minimal linux-2.6.31/fs/reiserfs/file.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/reiserfs/file.c
---- linux-2.6.31/fs/reiserfs/file.c    2009-06-11 17:13:08.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/reiserfs/file.c 2009-09-10 16:11:43.000000000 +0200
-@@ -307,4 +307,5 @@ const struct inode_operations reiserfs_f
+diff -NurpP --minimal linux-2.6.27.33/fs/reiserfs/bitmap.c linux-2.6.27.33-vs2.3.0.36.6/fs/reiserfs/bitmap.c
+--- linux-2.6.27.33/fs/reiserfs/bitmap.c       2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/reiserfs/bitmap.c  2008-10-13 14:54:20.000000000 +0200
+@@ -13,6 +13,7 @@
+ #include <linux/reiserfs_fs_sb.h>
+ #include <linux/reiserfs_fs_i.h>
+ #include <linux/quotaops.h>
++#include <linux/vs_dlimit.h>
+ #define PREALLOCATION_SIZE 9
+@@ -429,8 +430,10 @@ static void _reiserfs_free_block(struct 
+       set_sb_free_blocks(rs, sb_free_blocks(rs) + 1);
+       journal_mark_dirty(th, s, sbh);
+-      if (for_unformatted)
++      if (for_unformatted) {
++              DLIMIT_FREE_BLOCK(inode, 1);
+               DQUOT_FREE_BLOCK_NODIRTY(inode, 1);
++      }
+ }
+ void reiserfs_free_block(struct reiserfs_transaction_handle *th,
+@@ -1045,6 +1048,7 @@ static inline int blocknrs_and_prealloc_
+       b_blocknr_t finish = SB_BLOCK_COUNT(s) - 1;
+       int passno = 0;
+       int nr_allocated = 0;
++      int blocks;
+       determine_prealloc_size(hint);
+       if (!hint->formatted_node) {
+@@ -1054,19 +1058,30 @@ static inline int blocknrs_and_prealloc_
+                              "reiserquota: allocating %d blocks id=%u",
+                              amount_needed, hint->inode->i_uid);
+ #endif
+-              quota_ret =
+-                  DQUOT_ALLOC_BLOCK_NODIRTY(hint->inode, amount_needed);
+-              if (quota_ret)  /* Quota exceeded? */
++              quota_ret = DQUOT_ALLOC_BLOCK_NODIRTY(hint->inode,
++                      amount_needed);
++              if (quota_ret)
+                       return QUOTA_EXCEEDED;
++              if (DLIMIT_ALLOC_BLOCK(hint->inode, amount_needed)) {
++                      DQUOT_FREE_BLOCK_NODIRTY(hint->inode,
++                              amount_needed);
++                      return NO_DISK_SPACE;
++              }
++
+               if (hint->preallocate && hint->prealloc_size) {
+ #ifdef REISERQUOTA_DEBUG
+                       reiserfs_debug(s, REISERFS_DEBUG_CODE,
+                                      "reiserquota: allocating (prealloc) %d blocks id=%u",
+                                      hint->prealloc_size, hint->inode->i_uid);
+ #endif
+-                      quota_ret =
+-                          DQUOT_PREALLOC_BLOCK_NODIRTY(hint->inode,
+-                                                       hint->prealloc_size);
++                      quota_ret = DQUOT_PREALLOC_BLOCK_NODIRTY(hint->inode,
++                              hint->prealloc_size);
++                      if (!quota_ret &&
++                              DLIMIT_ALLOC_BLOCK(hint->inode, hint->prealloc_size)) {
++                              DQUOT_FREE_BLOCK_NODIRTY(hint->inode,
++                                      hint->prealloc_size);
++                              quota_ret = 1;
++                      }
+                       if (quota_ret)
+                               hint->preallocate = hint->prealloc_size = 0;
+               }
+@@ -1098,7 +1113,10 @@ static inline int blocknrs_and_prealloc_
+                                              nr_allocated,
+                                              hint->inode->i_uid);
+ #endif
+-                              DQUOT_FREE_BLOCK_NODIRTY(hint->inode, amount_needed + hint->prealloc_size - nr_allocated);      /* Free not allocated blocks */
++                              /* Free not allocated blocks */
++                              blocks = amount_needed + hint->prealloc_size - nr_allocated;
++                              DLIMIT_FREE_BLOCK(hint->inode, blocks);
++                              DQUOT_FREE_BLOCK_NODIRTY(hint->inode, blocks);
+                       }
+                       while (nr_allocated--)
+                               reiserfs_free_block(hint->th, hint->inode,
+@@ -1129,10 +1147,10 @@ static inline int blocknrs_and_prealloc_
+                              REISERFS_I(hint->inode)->i_prealloc_count,
+                              hint->inode->i_uid);
+ #endif
+-              DQUOT_FREE_BLOCK_NODIRTY(hint->inode, amount_needed +
+-                                       hint->prealloc_size - nr_allocated -
+-                                       REISERFS_I(hint->inode)->
+-                                       i_prealloc_count);
++              blocks = amount_needed + hint->prealloc_size - nr_allocated -
++                      REISERFS_I(hint->inode)->i_prealloc_count;
++              DLIMIT_FREE_BLOCK(hint->inode, blocks);
++              DQUOT_FREE_BLOCK_NODIRTY(hint->inode, blocks);
+       }
+       return CARRY_ON;
+diff -NurpP --minimal linux-2.6.27.33/fs/reiserfs/file.c linux-2.6.27.33-vs2.3.0.36.6/fs/reiserfs/file.c
+--- linux-2.6.27.33/fs/reiserfs/file.c 2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/reiserfs/file.c    2008-10-13 14:54:20.000000000 +0200
+@@ -306,4 +306,5 @@ const struct inode_operations reiserfs_f
        .listxattr = reiserfs_listxattr,
        .removexattr = reiserfs_removexattr,
        .permission = reiserfs_permission,
 +      .sync_flags = reiserfs_sync_flags,
  };
-diff -NurpP --minimal linux-2.6.31/fs/reiserfs/inode.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/reiserfs/inode.c
---- linux-2.6.31/fs/reiserfs/inode.c   2009-09-10 15:26:24.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/reiserfs/inode.c        2009-09-10 16:11:43.000000000 +0200
-@@ -18,6 +18,7 @@
+diff -NurpP --minimal linux-2.6.27.33/fs/reiserfs/inode.c linux-2.6.27.33-vs2.3.0.36.6/fs/reiserfs/inode.c
+--- linux-2.6.27.33/fs/reiserfs/inode.c        2009-09-13 16:16:59.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/reiserfs/inode.c   2009-02-03 17:59:04.000000000 +0100
+@@ -18,6 +18,8 @@
  #include <linux/writeback.h>
  #include <linux/quotaops.h>
  #include <linux/swap.h>
++#include <linux/vs_dlimit.h>
 +#include <linux/vs_tag.h>
  
  int reiserfs_commit_write(struct file *f, struct page *page,
                          unsigned from, unsigned to);
-@@ -1117,6 +1118,8 @@ static void init_inode(struct inode *ino
+@@ -54,6 +56,7 @@ void reiserfs_delete_inode(struct inode 
+                * stat data deletion */
+               if (!err) 
+                       DQUOT_FREE_INODE(inode);
++              DLIMIT_FREE_INODE(inode);
+               if (journal_end(&th, inode->i_sb, jbegin_count))
+                       goto out;
+@@ -1116,6 +1119,8 @@ static void init_inode(struct inode *ino
        struct buffer_head *bh;
        struct item_head *ih;
        __u32 rdev;
@@ -6400,7 +7593,7 @@ diff -NurpP --minimal linux-2.6.31/fs/reiserfs/inode.c linux-2.6.31-vs2.3.0.36.1
        //int version = ITEM_VERSION_1;
  
        bh = PATH_PLAST_BUFFER(path);
-@@ -1138,12 +1141,13 @@ static void init_inode(struct inode *ino
+@@ -1139,12 +1144,13 @@ static void init_inode(struct inode *ino
                    (struct stat_data_v1 *)B_I_PITEM(bh, ih);
                unsigned long blocks;
  
@@ -6416,7 +7609,7 @@ diff -NurpP --minimal linux-2.6.31/fs/reiserfs/inode.c linux-2.6.31-vs2.3.0.36.1
                inode->i_size = sd_v1_size(sd);
                inode->i_atime.tv_sec = sd_v1_atime(sd);
                inode->i_mtime.tv_sec = sd_v1_mtime(sd);
-@@ -1185,11 +1189,12 @@ static void init_inode(struct inode *ino
+@@ -1186,11 +1192,12 @@ static void init_inode(struct inode *ino
                // (directories and symlinks)
                struct stat_data *sd = (struct stat_data *)B_I_PITEM(bh, ih);
  
@@ -6431,7 +7624,7 @@ diff -NurpP --minimal linux-2.6.31/fs/reiserfs/inode.c linux-2.6.31-vs2.3.0.36.1
                inode->i_mtime.tv_sec = sd_v2_mtime(sd);
                inode->i_atime.tv_sec = sd_v2_atime(sd);
                inode->i_ctime.tv_sec = sd_v2_ctime(sd);
-@@ -1219,6 +1224,10 @@ static void init_inode(struct inode *ino
+@@ -1220,6 +1227,10 @@ static void init_inode(struct inode *ino
                sd_attrs_to_i_attrs(sd_v2_attrs(sd), inode);
        }
  
@@ -6442,7 +7635,7 @@ diff -NurpP --minimal linux-2.6.31/fs/reiserfs/inode.c linux-2.6.31-vs2.3.0.36.1
        pathrelse(path);
        if (S_ISREG(inode->i_mode)) {
                inode->i_op = &reiserfs_file_inode_operations;
-@@ -1241,13 +1250,15 @@ static void init_inode(struct inode *ino
+@@ -1242,13 +1253,15 @@ static void init_inode(struct inode *ino
  static void inode2sd(void *sd, struct inode *inode, loff_t size)
  {
        struct stat_data *sd_v2 = (struct stat_data *)sd;
@@ -6460,7 +7653,28 @@ diff -NurpP --minimal linux-2.6.31/fs/reiserfs/inode.c linux-2.6.31-vs2.3.0.36.1
        set_sd_v2_mtime(sd_v2, inode->i_mtime.tv_sec);
        set_sd_v2_atime(sd_v2, inode->i_atime.tv_sec);
        set_sd_v2_ctime(sd_v2, inode->i_ctime.tv_sec);
-@@ -2828,14 +2839,19 @@ int reiserfs_commit_write(struct file *f
+@@ -1771,6 +1784,10 @@ int reiserfs_new_inode(struct reiserfs_t
+       BUG_ON(!th->t_trans_id);
++      if (DLIMIT_ALLOC_INODE(inode)) {
++              err = -ENOSPC;
++              goto out_bad_dlimit;
++      }
+       if (DQUOT_ALLOC_INODE(inode)) {
+               err = -EDQUOT;
+               goto out_end_trans;
+@@ -1956,6 +1973,9 @@ int reiserfs_new_inode(struct reiserfs_t
+       DQUOT_FREE_INODE(inode);
+       out_end_trans:
++      DLIMIT_FREE_INODE(inode);
++
++      out_bad_dlimit:
+       journal_end(th, th->t_super, th->t_blocks_allocated);
+       /* Drop can be outside and it needs more credits so it's better to have it outside */
+       DQUOT_DROP(inode);
+@@ -2842,14 +2862,19 @@ int reiserfs_commit_write(struct file *f
  void sd_attrs_to_i_attrs(__u16 sd_attrs, struct inode *inode)
  {
        if (reiserfs_attrs(inode->i_sb)) {
@@ -6484,7 +7698,7 @@ diff -NurpP --minimal linux-2.6.31/fs/reiserfs/inode.c linux-2.6.31-vs2.3.0.36.1
                if (sd_attrs & REISERFS_APPEND_FL)
                        inode->i_flags |= S_APPEND;
                else
-@@ -2848,6 +2864,15 @@ void sd_attrs_to_i_attrs(__u16 sd_attrs,
+@@ -2862,6 +2887,15 @@ void sd_attrs_to_i_attrs(__u16 sd_attrs,
                        REISERFS_I(inode)->i_flags |= i_nopack_mask;
                else
                        REISERFS_I(inode)->i_flags &= ~i_nopack_mask;
@@ -6500,7 +7714,7 @@ diff -NurpP --minimal linux-2.6.31/fs/reiserfs/inode.c linux-2.6.31-vs2.3.0.36.1
        }
  }
  
-@@ -2858,6 +2883,11 @@ void i_attrs_to_sd_attrs(struct inode *i
+@@ -2872,6 +2906,11 @@ void i_attrs_to_sd_attrs(struct inode *i
                        *sd_attrs |= REISERFS_IMMUTABLE_FL;
                else
                        *sd_attrs &= ~REISERFS_IMMUTABLE_FL;
@@ -6512,7 +7726,7 @@ diff -NurpP --minimal linux-2.6.31/fs/reiserfs/inode.c linux-2.6.31-vs2.3.0.36.1
                if (inode->i_flags & S_SYNC)
                        *sd_attrs |= REISERFS_SYNC_FL;
                else
-@@ -2870,6 +2900,15 @@ void i_attrs_to_sd_attrs(struct inode *i
+@@ -2884,6 +2923,15 @@ void i_attrs_to_sd_attrs(struct inode *i
                        *sd_attrs |= REISERFS_NOTAIL_FL;
                else
                        *sd_attrs &= ~REISERFS_NOTAIL_FL;
@@ -6528,7 +7742,7 @@ diff -NurpP --minimal linux-2.6.31/fs/reiserfs/inode.c linux-2.6.31-vs2.3.0.36.1
        }
  }
  
-@@ -3037,6 +3076,22 @@ static ssize_t reiserfs_direct_IO(int rw
+@@ -3051,6 +3099,22 @@ static ssize_t reiserfs_direct_IO(int rw
                                  reiserfs_get_blocks_direct_io, NULL);
  }
  
@@ -6551,7 +7765,7 @@ diff -NurpP --minimal linux-2.6.31/fs/reiserfs/inode.c linux-2.6.31-vs2.3.0.36.1
  int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
  {
        struct inode *inode = dentry->d_inode;
-@@ -3090,9 +3145,11 @@ int reiserfs_setattr(struct dentry *dent
+@@ -3104,9 +3168,11 @@ int reiserfs_setattr(struct dentry *dent
        }
  
        error = inode_change_ok(inode, attr);
@@ -6564,7 +7778,7 @@ diff -NurpP --minimal linux-2.6.31/fs/reiserfs/inode.c linux-2.6.31-vs2.3.0.36.1
                        error = reiserfs_chown_xattrs(inode, attr);
  
                        if (!error) {
-@@ -3122,6 +3179,9 @@ int reiserfs_setattr(struct dentry *dent
+@@ -3136,6 +3202,9 @@ int reiserfs_setattr(struct dentry *dent
                                        inode->i_uid = attr->ia_uid;
                                if (attr->ia_valid & ATTR_GID)
                                        inode->i_gid = attr->ia_gid;
@@ -6574,9 +7788,9 @@ diff -NurpP --minimal linux-2.6.31/fs/reiserfs/inode.c linux-2.6.31-vs2.3.0.36.1
                                mark_inode_dirty(inode);
                                error =
                                    journal_end(&th, inode->i_sb, jbegin_count);
-diff -NurpP --minimal linux-2.6.31/fs/reiserfs/ioctl.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/reiserfs/ioctl.c
---- linux-2.6.31/fs/reiserfs/ioctl.c   2009-06-11 17:13:08.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/reiserfs/ioctl.c        2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/reiserfs/ioctl.c linux-2.6.27.33-vs2.3.0.36.6/fs/reiserfs/ioctl.c
+--- linux-2.6.27.33/fs/reiserfs/ioctl.c        2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/reiserfs/ioctl.c   2008-10-13 14:54:20.000000000 +0200
 @@ -7,6 +7,7 @@
  #include <linux/mount.h>
  #include <linux/reiserfs_fs.h>
@@ -6624,9 +7838,9 @@ diff -NurpP --minimal linux-2.6.31/fs/reiserfs/ioctl.c linux-2.6.31-vs2.3.0.36.1
                        sd_attrs_to_i_attrs(flags, inode);
                        REISERFS_I(inode)->i_attrs = flags;
                        inode->i_ctime = CURRENT_TIME_SEC;
-diff -NurpP --minimal linux-2.6.31/fs/reiserfs/namei.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/reiserfs/namei.c
---- linux-2.6.31/fs/reiserfs/namei.c   2009-06-11 17:13:08.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/reiserfs/namei.c        2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/reiserfs/namei.c linux-2.6.27.33-vs2.3.0.36.6/fs/reiserfs/namei.c
+--- linux-2.6.27.33/fs/reiserfs/namei.c        2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/reiserfs/namei.c   2008-10-13 14:54:20.000000000 +0200
 @@ -17,6 +17,7 @@
  #include <linux/reiserfs_acl.h>
  #include <linux/reiserfs_xattr.h>
@@ -6635,23 +7849,23 @@ diff -NurpP --minimal linux-2.6.31/fs/reiserfs/namei.c linux-2.6.31-vs2.3.0.36.1
  
  #define INC_DIR_INODE_NLINK(i) if (i->i_nlink != 1) { inc_nlink(i); if (i->i_nlink >= REISERFS_LINK_MAX) i->i_nlink=1; }
  #define DEC_DIR_INODE_NLINK(i) if (i->i_nlink != 1) drop_nlink(i);
-@@ -354,6 +355,7 @@ static struct dentry *reiserfs_lookup(st
-       if (retval == IO_ERROR) {
-               return ERR_PTR(-EIO);
-       }
+@@ -360,6 +361,7 @@ static struct dentry *reiserfs_lookup(st
+                       reiserfs_write_unlock(dir->i_sb);
+                       return ERR_PTR(-EACCES);
+               }
 +              dx_propagate_tag(nd, inode);
  
-       return d_splice_alias(inode, dentry);
- }
-@@ -570,6 +572,7 @@ static int new_inode_init(struct inode *
+               /* Propogate the priv_object flag so we know we're in the priv tree */
+               if (is_reiserfs_priv_object(dir))
+@@ -595,6 +597,7 @@ static int new_inode_init(struct inode *
        } else {
-               inode->i_gid = current_fsgid();
+               inode->i_gid = current->fsgid;
        }
 +      inode->i_tag = dx_current_fstag(inode->i_sb);
-       vfs_dq_init(inode);
+       DQUOT_INIT(inode);
        return 0;
  }
-@@ -1515,6 +1518,7 @@ const struct inode_operations reiserfs_d
+@@ -1541,6 +1544,7 @@ const struct inode_operations reiserfs_d
        .listxattr = reiserfs_listxattr,
        .removexattr = reiserfs_removexattr,
        .permission = reiserfs_permission,
@@ -6659,7 +7873,7 @@ diff -NurpP --minimal linux-2.6.31/fs/reiserfs/namei.c linux-2.6.31-vs2.3.0.36.1
  };
  
  /*
-@@ -1531,6 +1535,7 @@ const struct inode_operations reiserfs_s
+@@ -1557,6 +1561,7 @@ const struct inode_operations reiserfs_s
        .listxattr = reiserfs_listxattr,
        .removexattr = reiserfs_removexattr,
        .permission = reiserfs_permission,
@@ -6667,17 +7881,95 @@ diff -NurpP --minimal linux-2.6.31/fs/reiserfs/namei.c linux-2.6.31-vs2.3.0.36.1
  
  };
  
-@@ -1544,5 +1549,6 @@ const struct inode_operations reiserfs_s
+@@ -1570,5 +1575,6 @@ const struct inode_operations reiserfs_s
        .listxattr = reiserfs_listxattr,
        .removexattr = reiserfs_removexattr,
        .permission = reiserfs_permission,
 +      .sync_flags = reiserfs_sync_flags,
  
  };
-diff -NurpP --minimal linux-2.6.31/fs/reiserfs/super.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/reiserfs/super.c
---- linux-2.6.31/fs/reiserfs/super.c   2009-09-10 15:26:24.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/reiserfs/super.c        2009-09-10 16:11:43.000000000 +0200
-@@ -884,6 +884,14 @@ static int reiserfs_parse_options(struct
+diff -NurpP --minimal linux-2.6.27.33/fs/reiserfs/stree.c linux-2.6.27.33-vs2.3.0.36.6/fs/reiserfs/stree.c
+--- linux-2.6.27.33/fs/reiserfs/stree.c        2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/reiserfs/stree.c   2008-10-13 14:54:20.000000000 +0200
+@@ -55,6 +55,7 @@
+ #include <linux/reiserfs_fs.h>
+ #include <linux/buffer_head.h>
+ #include <linux/quotaops.h>
++#include <linux/vs_dlimit.h>
+ /* Does the buffer contain a disk block which is in the tree. */
+ inline int B_IS_IN_TREE(const struct buffer_head *p_s_bh)
+@@ -1297,6 +1298,7 @@ int reiserfs_delete_item(struct reiserfs
+                      "reiserquota delete_item(): freeing %u, id=%u type=%c",
+                      quota_cut_bytes, p_s_inode->i_uid, head2type(&s_ih));
+ #endif
++      DLIMIT_FREE_SPACE(p_s_inode, quota_cut_bytes);
+       DQUOT_FREE_SPACE_NODIRTY(p_s_inode, quota_cut_bytes);
+       /* Return deleted body length */
+@@ -1385,6 +1387,7 @@ void reiserfs_delete_solid_item(struct r
+ #endif
+                               DQUOT_FREE_SPACE_NODIRTY(inode,
+                                                        quota_cut_bytes);
++                              DLIMIT_FREE_SPACE(inode, quota_cut_bytes);
+                       }
+                       break;
+               }
+@@ -1734,6 +1737,7 @@ int reiserfs_cut_from_item(struct reiser
+                      "reiserquota cut_from_item(): freeing %u id=%u type=%c",
+                      quota_cut_bytes, p_s_inode->i_uid, '?');
+ #endif
++      DLIMIT_FREE_SPACE(p_s_inode, quota_cut_bytes);
+       DQUOT_FREE_SPACE_NODIRTY(p_s_inode, quota_cut_bytes);
+       return n_ret_value;
+ }
+@@ -1975,6 +1979,11 @@ int reiserfs_paste_into_item(struct reis
+               pathrelse(p_s_search_path);
+               return -EDQUOT;
+       }
++      if (DLIMIT_ALLOC_SPACE(inode, n_pasted_size)) {
++              DQUOT_FREE_SPACE_NODIRTY(inode, n_pasted_size);
++              pathrelse(p_s_search_path);
++              return -ENOSPC;
++      }
+       init_tb_struct(th, &s_paste_balance, th->t_super, p_s_search_path,
+                      n_pasted_size);
+ #ifdef DISPLACE_NEW_PACKING_LOCALITIES
+@@ -2027,6 +2036,7 @@ int reiserfs_paste_into_item(struct reis
+                      n_pasted_size, inode->i_uid,
+                      key2type(&(p_s_key->on_disk_key)));
+ #endif
++      DLIMIT_FREE_SPACE(inode, n_pasted_size);
+       DQUOT_FREE_SPACE_NODIRTY(inode, n_pasted_size);
+       return retval;
+ }
+@@ -2064,6 +2074,11 @@ int reiserfs_insert_item(struct reiserfs
+                       pathrelse(p_s_path);
+                       return -EDQUOT;
+               }
++              if (DLIMIT_ALLOC_SPACE(inode, quota_bytes)) {
++                      DQUOT_FREE_SPACE_NODIRTY(inode, quota_bytes);
++                      pathrelse(p_s_path);
++                      return -ENOSPC;
++              }
+       }
+       init_tb_struct(th, &s_ins_balance, th->t_super, p_s_path,
+                      IH_SIZE + ih_item_len(p_s_ih));
+@@ -2111,7 +2126,9 @@ int reiserfs_insert_item(struct reiserfs
+                      "reiserquota insert_item(): freeing %u id=%u type=%c",
+                      quota_bytes, inode->i_uid, head2type(p_s_ih));
+ #endif
+-      if (inode)
++      if (inode) {
++              DLIMIT_FREE_SPACE(inode, quota_bytes);
+               DQUOT_FREE_SPACE_NODIRTY(inode, quota_bytes);
++      }
+       return retval;
+ }
+diff -NurpP --minimal linux-2.6.27.33/fs/reiserfs/super.c linux-2.6.27.33-vs2.3.0.36.6/fs/reiserfs/super.c
+--- linux-2.6.27.33/fs/reiserfs/super.c        2008-10-13 14:52:06.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/reiserfs/super.c   2008-10-13 14:54:20.000000000 +0200
+@@ -898,6 +898,14 @@ static int reiserfs_parse_options(struct
                {"user_xattr",.setmask = 1 << REISERFS_UNSUPPORTED_OPT},
                {"nouser_xattr",.clrmask = 1 << REISERFS_UNSUPPORTED_OPT},
  #endif
@@ -6692,21 +7984,20 @@ diff -NurpP --minimal linux-2.6.31/fs/reiserfs/super.c linux-2.6.31-vs2.3.0.36.1
  #ifdef CONFIG_REISERFS_FS_POSIX_ACL
                {"acl",.setmask = 1 << REISERFS_POSIXACL},
                {"noacl",.clrmask = 1 << REISERFS_POSIXACL},
-@@ -1190,6 +1198,13 @@ static int reiserfs_remount(struct super
+@@ -1193,6 +1201,12 @@ static int reiserfs_remount(struct super
        handle_quota_files(s, qf_names, &qfmt);
  #endif
  
 +      if ((mount_options & (1 << REISERFS_TAGGED)) &&
 +              !(s->s_flags & MS_TAGGED)) {
-+              reiserfs_warning(s, "super-vs01",
-+                      "reiserfs: tagging not permitted on remount.");
++              reiserfs_warning(s, "reiserfs: tagging not permitted on remount.");
 +              return -EINVAL;
 +      }
 +
        handle_attrs(s);
  
        /* Add options that are safe here */
-@@ -1652,6 +1667,10 @@ static int reiserfs_fill_super(struct su
+@@ -1657,6 +1671,10 @@ static int reiserfs_fill_super(struct su
                goto error;
        }
  
@@ -6717,10 +8008,10 @@ diff -NurpP --minimal linux-2.6.31/fs/reiserfs/super.c linux-2.6.31-vs2.3.0.36.1
        rs = SB_DISK_SUPER_BLOCK(s);
        /* Let's do basic sanity check to verify that underlying device is not
           smaller than the filesystem. If the check fails then abort and scream,
-diff -NurpP --minimal linux-2.6.31/fs/reiserfs/xattr.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/reiserfs/xattr.c
---- linux-2.6.31/fs/reiserfs/xattr.c   2009-09-10 15:26:24.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/reiserfs/xattr.c        2009-09-10 16:11:43.000000000 +0200
-@@ -39,6 +39,7 @@
+diff -NurpP --minimal linux-2.6.27.33/fs/reiserfs/xattr.c linux-2.6.27.33-vs2.3.0.36.6/fs/reiserfs/xattr.c
+--- linux-2.6.27.33/fs/reiserfs/xattr.c        2008-10-13 14:52:06.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/reiserfs/xattr.c   2008-10-13 14:54:20.000000000 +0200
+@@ -35,6 +35,7 @@
  #include <linux/namei.h>
  #include <linux/errno.h>
  #include <linux/fs.h>
@@ -6728,9 +8019,9 @@ diff -NurpP --minimal linux-2.6.31/fs/reiserfs/xattr.c linux-2.6.31-vs2.3.0.36.1
  #include <linux/file.h>
  #include <linux/pagemap.h>
  #include <linux/xattr.h>
-diff -NurpP --minimal linux-2.6.31/fs/stat.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/stat.c
---- linux-2.6.31/fs/stat.c     2009-06-11 17:13:08.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/stat.c  2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/stat.c linux-2.6.27.33-vs2.3.0.36.6/fs/stat.c
+--- linux-2.6.27.33/fs/stat.c  2009-09-13 16:16:59.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/stat.c     2009-02-03 17:59:04.000000000 +0100
 @@ -26,6 +26,7 @@ void generic_fillattr(struct inode *inod
        stat->nlink = inode->i_nlink;
        stat->uid = inode->i_uid;
@@ -6739,10 +8030,10 @@ diff -NurpP --minimal linux-2.6.31/fs/stat.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/
        stat->rdev = inode->i_rdev;
        stat->atime = inode->i_atime;
        stat->mtime = inode->i_mtime;
-diff -NurpP --minimal linux-2.6.31/fs/super.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/super.c
---- linux-2.6.31/fs/super.c    2009-09-10 15:26:24.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/super.c 2009-09-10 17:00:57.000000000 +0200
-@@ -37,6 +37,9 @@
+diff -NurpP --minimal linux-2.6.27.33/fs/super.c linux-2.6.27.33-vs2.3.0.36.6/fs/super.c
+--- linux-2.6.27.33/fs/super.c 2009-09-13 16:16:59.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/super.c    2009-02-03 17:59:04.000000000 +0100
+@@ -38,6 +38,9 @@
  #include <linux/kobject.h>
  #include <linux/mutex.h>
  #include <linux/file.h>
@@ -6752,7 +8043,7 @@ diff -NurpP --minimal linux-2.6.31/fs/super.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
  #include <asm/uaccess.h>
  #include "internal.h"
  
-@@ -859,12 +862,18 @@ struct vfsmount *
+@@ -887,12 +890,18 @@ struct vfsmount *
  vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void *data)
  {
        struct vfsmount *mnt;
@@ -6771,30 +8062,35 @@ diff -NurpP --minimal linux-2.6.31/fs/super.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
        error = -ENOMEM;
        mnt = alloc_vfsmnt(name);
        if (!mnt)
-@@ -883,9 +892,17 @@ vfs_kern_mount(struct file_system_type *
-       error = type->get_sb(type, flags, name, data, mnt);
-       if (error < 0)
+@@ -913,7 +922,14 @@ vfs_kern_mount(struct file_system_type *
                goto out_free_secdata;
--      BUG_ON(!mnt->mnt_sb);
+       BUG_ON(!mnt->mnt_sb);
  
--      error = security_sb_kern_mount(mnt->mnt_sb, flags, secdata);
+-      error = security_sb_kern_mount(mnt->mnt_sb, secdata);
 +      sb = mnt->mnt_sb;
-+      BUG_ON(!sb);
-+
 +      error = -EPERM;
 +      if (!vx_capable(CAP_SYS_ADMIN, VXC_BINARY_MOUNT) && !sb->s_bdev &&
 +              (sb->s_magic != PROC_SUPER_MAGIC) &&
 +              (sb->s_magic != DEVPTS_SUPER_MAGIC))
 +              goto out_sb;
 +
-+      error = security_sb_kern_mount(sb, flags, secdata);
++      error = security_sb_kern_mount(sb, secdata);
        if (error)
                goto out_sb;
  
-diff -NurpP --minimal linux-2.6.31/fs/sysfs/mount.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/sysfs/mount.c
---- linux-2.6.31/fs/sysfs/mount.c      2009-06-11 17:13:08.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/sysfs/mount.c   2009-09-10 16:11:43.000000000 +0200
-@@ -47,7 +47,7 @@ static int sysfs_fill_super(struct super
+diff -NurpP --minimal linux-2.6.27.33/fs/sysfs/mount.c linux-2.6.27.33-vs2.3.0.36.6/fs/sysfs/mount.c
+--- linux-2.6.27.33/fs/sysfs/mount.c   2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/sysfs/mount.c      2008-10-13 14:54:20.000000000 +0200
+@@ -19,8 +19,6 @@
+ #include "sysfs.h"
+-/* Random magic number */
+-#define SYSFS_MAGIC 0x62656572
+ static struct vfsmount *sysfs_mount;
+ struct super_block * sysfs_sb = NULL;
+@@ -46,7 +44,7 @@ static int sysfs_fill_super(struct super
  
        sb->s_blocksize = PAGE_CACHE_SIZE;
        sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
@@ -6803,9 +8099,9 @@ diff -NurpP --minimal linux-2.6.31/fs/sysfs/mount.c linux-2.6.31-vs2.3.0.36.14-p
        sb->s_op = &sysfs_ops;
        sb->s_time_gran = 1;
        sysfs_sb = sb;
-diff -NurpP --minimal linux-2.6.31/fs/utimes.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/utimes.c
---- linux-2.6.31/fs/utimes.c   2009-03-24 14:22:37.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/utimes.c        2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/utimes.c linux-2.6.27.33-vs2.3.0.36.6/fs/utimes.c
+--- linux-2.6.27.33/fs/utimes.c        2009-09-13 16:16:59.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/utimes.c   2009-02-03 17:59:04.000000000 +0100
 @@ -8,6 +8,8 @@
  #include <linux/stat.h>
  #include <linux/utime.h>
@@ -6815,9 +8111,9 @@ diff -NurpP --minimal linux-2.6.31/fs/utimes.c linux-2.6.31-vs2.3.0.36.14-pre8/f
  #include <asm/uaccess.h>
  #include <asm/unistd.h>
  
-diff -NurpP --minimal linux-2.6.31/fs/xattr.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/xattr.c
---- linux-2.6.31/fs/xattr.c    2009-09-10 15:26:24.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/xattr.c 2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/xattr.c linux-2.6.27.33-vs2.3.0.36.6/fs/xattr.c
+--- linux-2.6.27.33/fs/xattr.c 2009-09-13 16:16:59.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/xattr.c    2009-02-03 17:59:04.000000000 +0100
 @@ -18,6 +18,7 @@
  #include <linux/module.h>
  #include <linux/fsnotify.h>
@@ -6826,10 +8122,10 @@ diff -NurpP --minimal linux-2.6.31/fs/xattr.c linux-2.6.31-vs2.3.0.36.14-pre8/fs
  #include <asm/uaccess.h>
  
  
-diff -NurpP --minimal linux-2.6.31/fs/xfs/linux-2.6/xfs_ioctl.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/xfs/linux-2.6/xfs_ioctl.c
---- linux-2.6.31/fs/xfs/linux-2.6/xfs_ioctl.c  2009-09-10 15:26:24.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/xfs/linux-2.6/xfs_ioctl.c       2009-09-10 16:11:43.000000000 +0200
-@@ -742,6 +742,10 @@ xfs_merge_ioc_xflags(
+diff -NurpP --minimal linux-2.6.27.33/fs/xfs/linux-2.6/xfs_ioctl.c linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/linux-2.6/xfs_ioctl.c
+--- linux-2.6.27.33/fs/xfs/linux-2.6/xfs_ioctl.c       2008-10-13 14:52:06.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/linux-2.6/xfs_ioctl.c  2008-11-12 18:41:58.000000000 +0100
+@@ -806,6 +806,10 @@ xfs_merge_ioc_xflags(
                xflags |= XFS_XFLAG_IMMUTABLE;
        else
                xflags &= ~XFS_XFLAG_IMMUTABLE;
@@ -6840,7 +8136,7 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/linux-2.6/xfs_ioctl.c linux-2.6.31-vs2
        if (flags & FS_APPEND_FL)
                xflags |= XFS_XFLAG_APPEND;
        else
-@@ -770,6 +774,8 @@ xfs_di2lxflags(
+@@ -834,6 +838,8 @@ xfs_di2lxflags(
  
        if (di_flags & XFS_DIFLAG_IMMUTABLE)
                flags |= FS_IMMUTABLE_FL;
@@ -6849,7 +8145,7 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/linux-2.6/xfs_ioctl.c linux-2.6.31-vs2
        if (di_flags & XFS_DIFLAG_APPEND)
                flags |= FS_APPEND_FL;
        if (di_flags & XFS_DIFLAG_SYNC)
-@@ -828,6 +834,8 @@ xfs_set_diflags(
+@@ -892,6 +898,8 @@ xfs_set_diflags(
        di_flags = (ip->i_d.di_flags & XFS_DIFLAG_PREALLOC);
        if (xflags & XFS_XFLAG_IMMUTABLE)
                di_flags |= XFS_DIFLAG_IMMUTABLE;
@@ -6858,7 +8154,7 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/linux-2.6/xfs_ioctl.c linux-2.6.31-vs2
        if (xflags & XFS_XFLAG_APPEND)
                di_flags |= XFS_DIFLAG_APPEND;
        if (xflags & XFS_XFLAG_SYNC)
-@@ -870,6 +878,10 @@ xfs_diflags_to_linux(
+@@ -934,6 +942,10 @@ xfs_diflags_to_linux(
                inode->i_flags |= S_IMMUTABLE;
        else
                inode->i_flags &= ~S_IMMUTABLE;
@@ -6869,7 +8165,7 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/linux-2.6/xfs_ioctl.c linux-2.6.31-vs2
        if (xflags & XFS_XFLAG_APPEND)
                inode->i_flags |= S_APPEND;
        else
-@@ -1346,10 +1358,18 @@ xfs_file_ioctl(
+@@ -1392,10 +1404,18 @@ xfs_ioctl(
        case XFS_IOC_FSGETXATTRA:
                return xfs_ioc_fsgetxattr(ip, 1, arg);
        case XFS_IOC_FSSETXATTR:
@@ -6888,26 +8184,26 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/linux-2.6/xfs_ioctl.c linux-2.6.31-vs2
                return xfs_ioc_setxflags(ip, filp, arg);
  
        case XFS_IOC_FSSETDM: {
-diff -NurpP --minimal linux-2.6.31/fs/xfs/linux-2.6/xfs_iops.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/xfs/linux-2.6/xfs_iops.c
---- linux-2.6.31/fs/xfs/linux-2.6/xfs_iops.c   2009-09-10 15:26:24.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/xfs/linux-2.6/xfs_iops.c        2009-09-10 16:11:43.000000000 +0200
-@@ -56,6 +56,7 @@
+diff -NurpP --minimal linux-2.6.27.33/fs/xfs/linux-2.6/xfs_iops.c linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/linux-2.6/xfs_iops.c
+--- linux-2.6.27.33/fs/xfs/linux-2.6/xfs_iops.c        2008-10-13 14:52:06.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/linux-2.6/xfs_iops.c   2008-11-12 18:41:58.000000000 +0100
+@@ -53,6 +53,7 @@
+ #include <linux/namei.h>
  #include <linux/security.h>
  #include <linux/falloc.h>
- #include <linux/fiemap.h>
 +#include <linux/vs_tag.h>
  
  /*
   * Bring the atime in the XFS inode uptodate.
-@@ -513,6 +514,7 @@ xfs_vn_getattr(
+@@ -558,6 +559,7 @@ xfs_vn_getattr(
        stat->nlink = ip->i_d.di_nlink;
        stat->uid = ip->i_d.di_uid;
        stat->gid = ip->i_d.di_gid;
 +      stat->tag = ip->i_d.di_tag;
        stat->ino = ip->i_ino;
-       stat->atime = inode->i_atime;
-       stat->mtime.tv_sec = ip->i_d.di_mtime.t_sec;
-@@ -549,6 +551,12 @@ xfs_vn_getattr(
+ #if XFS_BIG_INUMS
+       stat->ino += mp->m_inoadd;
+@@ -597,6 +599,12 @@ xfs_vn_getattr(
  }
  
  STATIC int
@@ -6920,15 +8216,15 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/linux-2.6/xfs_iops.c linux-2.6.31-vs2.
  xfs_vn_setattr(
        struct dentry   *dentry,
        struct iattr    *iattr)
-@@ -706,6 +714,7 @@ static const struct inode_operations xfs
+@@ -671,6 +679,7 @@ static const struct inode_operations xfs
+       .removexattr            = generic_removexattr,
        .listxattr              = xfs_vn_listxattr,
        .fallocate              = xfs_vn_fallocate,
-       .fiemap                 = xfs_vn_fiemap,
 +      .sync_flags             = xfs_vn_sync_xflags,
  };
  
  static const struct inode_operations xfs_dir_inode_operations = {
-@@ -731,6 +740,7 @@ static const struct inode_operations xfs
+@@ -696,6 +705,7 @@ static const struct inode_operations xfs
        .getxattr               = generic_getxattr,
        .removexattr            = generic_removexattr,
        .listxattr              = xfs_vn_listxattr,
@@ -6936,7 +8232,7 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/linux-2.6/xfs_iops.c linux-2.6.31-vs2.
  };
  
  static const struct inode_operations xfs_dir_ci_inode_operations = {
-@@ -780,6 +790,10 @@ xfs_diflags_to_iflags(
+@@ -745,6 +755,10 @@ xfs_diflags_to_iflags(
                inode->i_flags |= S_IMMUTABLE;
        else
                inode->i_flags &= ~S_IMMUTABLE;
@@ -6947,7 +8243,7 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/linux-2.6/xfs_iops.c linux-2.6.31-vs2.
        if (ip->i_d.di_flags & XFS_DIFLAG_APPEND)
                inode->i_flags |= S_APPEND;
        else
-@@ -792,6 +806,15 @@ xfs_diflags_to_iflags(
+@@ -757,6 +771,15 @@ xfs_diflags_to_iflags(
                inode->i_flags |= S_NOATIME;
        else
                inode->i_flags &= ~S_NOATIME;
@@ -6963,7 +8259,7 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/linux-2.6/xfs_iops.c linux-2.6.31-vs2.
  }
  
  /*
-@@ -820,6 +843,7 @@ xfs_setup_inode(
+@@ -777,6 +800,7 @@ xfs_setup_inode(
        inode->i_nlink  = ip->i_d.di_nlink;
        inode->i_uid    = ip->i_d.di_uid;
        inode->i_gid    = ip->i_d.di_gid;
@@ -6971,21 +8267,21 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/linux-2.6/xfs_iops.c linux-2.6.31-vs2.
  
        switch (inode->i_mode & S_IFMT) {
        case S_IFBLK:
-diff -NurpP --minimal linux-2.6.31/fs/xfs/linux-2.6/xfs_linux.h linux-2.6.31-vs2.3.0.36.14-pre8/fs/xfs/linux-2.6/xfs_linux.h
---- linux-2.6.31/fs/xfs/linux-2.6/xfs_linux.h  2009-09-10 15:26:24.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/xfs/linux-2.6/xfs_linux.h       2009-09-10 16:11:43.000000000 +0200
-@@ -119,6 +119,7 @@
+diff -NurpP --minimal linux-2.6.27.33/fs/xfs/linux-2.6/xfs_linux.h linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/linux-2.6/xfs_linux.h
+--- linux-2.6.27.33/fs/xfs/linux-2.6/xfs_linux.h       2008-10-13 14:52:06.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/linux-2.6/xfs_linux.h  2008-10-13 15:35:26.000000000 +0200
+@@ -126,6 +126,7 @@
  
  #define current_cpu()         (raw_smp_processor_id())
  #define current_pid()         (current->pid)
-+#define current_fstag(cred,vp)        (dx_current_fstag((vp)->i_sb))
++#define current_fstag(cred,vp)        (dx_current_fstag(vp->i_sb))
  #define current_test_flags(f) (current->flags & (f))
  #define current_set_flags_nested(sp, f)               \
                (*(sp) = current->flags, current->flags |= (f))
-diff -NurpP --minimal linux-2.6.31/fs/xfs/linux-2.6/xfs_super.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/xfs/linux-2.6/xfs_super.c
---- linux-2.6.31/fs/xfs/linux-2.6/xfs_super.c  2009-09-10 15:26:24.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/xfs/linux-2.6/xfs_super.c       2009-09-10 17:01:53.000000000 +0200
-@@ -117,6 +117,9 @@ mempool_t *xfs_ioend_pool;
+diff -NurpP --minimal linux-2.6.27.33/fs/xfs/linux-2.6/xfs_super.c linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/linux-2.6/xfs_super.c
+--- linux-2.6.27.33/fs/xfs/linux-2.6/xfs_super.c       2009-09-13 16:16:59.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/linux-2.6/xfs_super.c  2009-02-03 17:59:04.000000000 +0100
+@@ -147,6 +147,9 @@ xfs_args_allocate(
  #define MNTOPT_DMAPI  "dmapi"         /* DMI enabled (DMAPI / XDSM) */
  #define MNTOPT_XDSM   "xdsm"          /* DMI enabled (DMAPI / XDSM) */
  #define MNTOPT_DMI    "dmi"           /* DMI enabled (DMAPI / XDSM) */
@@ -6995,7 +8291,7 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/linux-2.6/xfs_super.c linux-2.6.31-vs2
  
  /*
   * Table driven mount option parser.
-@@ -125,10 +128,14 @@ mempool_t *xfs_ioend_pool;
+@@ -155,10 +158,14 @@ xfs_args_allocate(
   * in the future, too.
   */
  enum {
@@ -7003,34 +8299,34 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/linux-2.6/xfs_super.c linux-2.6.31-vs2
        Opt_barrier, Opt_nobarrier, Opt_err
  };
  
- static const match_table_t tokens = {
+ static match_table_t tokens = {
 +      {Opt_tag, "tagxid"},
 +      {Opt_tag, "tag"},
 +      {Opt_notag, "notag"},
        {Opt_barrier, "barrier"},
        {Opt_nobarrier, "nobarrier"},
        {Opt_err, NULL}
-@@ -382,6 +389,19 @@ xfs_parseargs(
+@@ -383,6 +390,19 @@ xfs_parseargs(
                } else if (!strcmp(this_char, "irixsgid")) {
                        cmn_err(CE_WARN,
        "XFS: irixsgid is now a sysctl(2) variable, option is deprecated.");
 +#ifndef CONFIG_TAGGING_NONE
 +              } else if (!strcmp(this_char, MNTOPT_TAGGED)) {
-+                      mp->m_flags |= XFS_MOUNT_TAGGED;
++                      args->flags2 |= XFSMNT2_TAGGED;
 +              } else if (!strcmp(this_char, MNTOPT_NOTAGTAG)) {
-+                      mp->m_flags &= ~XFS_MOUNT_TAGGED;
++                      args->flags2 &= ~XFSMNT2_TAGGED;
 +              } else if (!strcmp(this_char, MNTOPT_TAGXID)) {
-+                      mp->m_flags |= XFS_MOUNT_TAGGED;
++                      args->flags2 |= XFSMNT2_TAGGED;
 +#endif
 +#ifdef CONFIG_PROPAGATE
 +              } else if (!strcmp(this_char, MNTOPT_TAGGED)) {
 +                      /* use value */
-+                      mp->m_flags |= XFS_MOUNT_TAGGED;
++                      args->flags2 |= XFSMNT2_TAGGED;
 +#endif
                } else {
                        cmn_err(CE_WARN,
                                "XFS: unknown mount option [%s].", this_char);
-@@ -1244,6 +1264,16 @@ xfs_fs_remount(
+@@ -1301,6 +1321,16 @@ xfs_fs_remount(
                case Opt_nobarrier:
                        mp->m_flags &= ~XFS_MOUNT_BARRIER;
                        break;
@@ -7047,20 +8343,52 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/linux-2.6/xfs_super.c linux-2.6.31-vs2
                default:
                        /*
                         * Logically we would return an error here to prevent
-@@ -1451,6 +1481,9 @@ xfs_fs_fill_super(
+@@ -1555,6 +1585,9 @@ xfs_start_flags(
+       if (ap->flags & XFSMNT_DMAPI)
+               mp->m_flags |= XFS_MOUNT_DMAPI;
++
++      if (ap->flags2 & XFSMNT2_TAGGED)
++              mp->m_flags |= XFS_MOUNT_TAGGED;
+       return 0;
  
-       XFS_SEND_MOUNT(mp, DM_RIGHT_NULL, mtpt, mp->m_fsname);
+@@ -1749,6 +1782,9 @@ xfs_fs_fill_super(
+       XFS_SEND_MOUNT(mp, DM_RIGHT_NULL, args->mtpt, args->fsname);
  
 +      if (mp->m_flags & XFS_MOUNT_TAGGED)
 +              sb->s_flags |= MS_TAGGED;
 +
+       sb->s_dirt = 1;
        sb->s_magic = XFS_SB_MAGIC;
        sb->s_blocksize = mp->m_sb.sb_blocksize;
-       sb->s_blocksize_bits = ffs(sb->s_blocksize) - 1;
-diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_dinode.h linux-2.6.31-vs2.3.0.36.14-pre8/fs/xfs/xfs_dinode.h
---- linux-2.6.31/fs/xfs/xfs_dinode.h   2009-06-11 17:13:09.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/xfs/xfs_dinode.h        2009-09-10 16:11:43.000000000 +0200
-@@ -50,7 +50,9 @@ typedef struct xfs_dinode {
+diff -NurpP --minimal linux-2.6.27.33/fs/xfs/quota/xfs_qm_syscalls.c linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/quota/xfs_qm_syscalls.c
+--- linux-2.6.27.33/fs/xfs/quota/xfs_qm_syscalls.c     2008-10-13 14:52:06.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/quota/xfs_qm_syscalls.c        2008-10-24 03:47:08.000000000 +0200
+@@ -426,7 +426,7 @@ xfs_qm_scall_quotaon(
+       uint            accflags;
+       __int64_t       sbflags;
+-      if (!capable(CAP_SYS_ADMIN))
++      if (!vx_capable(CAP_SYS_ADMIN, VXC_QUOTA_CTL))
+               return XFS_ERROR(EPERM);
+       flags &= (XFS_ALL_QUOTA_ACCT | XFS_ALL_QUOTA_ENFD);
+diff -NurpP --minimal linux-2.6.27.33/fs/xfs/xfs_clnt.h linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/xfs_clnt.h
+--- linux-2.6.27.33/fs/xfs/xfs_clnt.h  2008-10-13 14:52:06.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/xfs_clnt.h     2008-10-13 14:54:20.000000000 +0200
+@@ -101,5 +101,6 @@ struct xfs_mount_args {
+                                                * I/O size in stat(2) */
+ #define XFSMNT2_FILESTREAMS   0x00000002      /* enable the filestreams
+                                                * allocator */
++#define XFSMNT2_TAGGED                0x10000000      /* context tagging */
+ #endif        /* __XFS_CLNT_H__ */
+diff -NurpP --minimal linux-2.6.27.33/fs/xfs/xfs_dinode.h linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/xfs_dinode.h
+--- linux-2.6.27.33/fs/xfs/xfs_dinode.h        2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/xfs_dinode.h   2008-11-12 18:41:59.000000000 +0100
+@@ -53,7 +53,9 @@ typedef struct xfs_dinode_core {
        __be32          di_gid;         /* owner's group id */
        __be32          di_nlink;       /* number of links to file */
        __be16          di_projid;      /* owner's project id */
@@ -7071,7 +8399,18 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_dinode.h linux-2.6.31-vs2.3.0.36.1
        __be16          di_flushiter;   /* incremented on flush */
        xfs_timestamp_t di_atime;       /* time last accessed */
        xfs_timestamp_t di_mtime;       /* time last modified */
-@@ -183,6 +185,8 @@ static inline void xfs_dinode_put_rdev(s
+@@ -136,7 +138,9 @@ typedef struct xfs_dinode
+ #define       XFS_DI_NEXT_UNLINKED    0x1000000
+ #define       XFS_DI_U                0x2000000
+ #define       XFS_DI_A                0x4000000
+-#define       XFS_DI_NUM_BITS         27
++#define       XFS_DI_TAG              0x8000000
++#define       XFS_DI_VFLAGS           0x10000000
++#define       XFS_DI_NUM_BITS         29
+ #define       XFS_DI_ALL_BITS         ((1 << XFS_DI_NUM_BITS) - 1)
+ #define       XFS_DI_CORE_BITS        (XFS_DI_ALL_BITS & ~(XFS_DI_U|XFS_DI_A))
+@@ -223,6 +227,8 @@ typedef enum xfs_dinode_fmt
  #define XFS_DIFLAG_EXTSZINHERIT_BIT 12        /* inherit inode extent size */
  #define XFS_DIFLAG_NODEFRAG_BIT     13        /* do not reorganize/defragment */
  #define XFS_DIFLAG_FILESTREAM_BIT   14  /* use filestream allocator */
@@ -7080,7 +8419,7 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_dinode.h linux-2.6.31-vs2.3.0.36.1
  #define XFS_DIFLAG_REALTIME      (1 << XFS_DIFLAG_REALTIME_BIT)
  #define XFS_DIFLAG_PREALLOC      (1 << XFS_DIFLAG_PREALLOC_BIT)
  #define XFS_DIFLAG_NEWRTBM       (1 << XFS_DIFLAG_NEWRTBM_BIT)
-@@ -198,6 +202,7 @@ static inline void xfs_dinode_put_rdev(s
+@@ -238,6 +244,7 @@ typedef enum xfs_dinode_fmt
  #define XFS_DIFLAG_EXTSZINHERIT  (1 << XFS_DIFLAG_EXTSZINHERIT_BIT)
  #define XFS_DIFLAG_NODEFRAG      (1 << XFS_DIFLAG_NODEFRAG_BIT)
  #define XFS_DIFLAG_FILESTREAM    (1 << XFS_DIFLAG_FILESTREAM_BIT)
@@ -7088,7 +8427,7 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_dinode.h linux-2.6.31-vs2.3.0.36.1
  
  #ifdef CONFIG_XFS_RT
  #define XFS_IS_REALTIME_INODE(ip) ((ip)->i_d.di_flags & XFS_DIFLAG_REALTIME)
-@@ -210,6 +215,10 @@ static inline void xfs_dinode_put_rdev(s
+@@ -250,6 +257,10 @@ typedef enum xfs_dinode_fmt
         XFS_DIFLAG_IMMUTABLE | XFS_DIFLAG_APPEND | XFS_DIFLAG_SYNC | \
         XFS_DIFLAG_NOATIME | XFS_DIFLAG_NODUMP | XFS_DIFLAG_RTINHERIT | \
         XFS_DIFLAG_PROJINHERIT | XFS_DIFLAG_NOSYMLINKS | XFS_DIFLAG_EXTSIZE | \
@@ -7100,9 +8439,9 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_dinode.h linux-2.6.31-vs2.3.0.36.1
 +#define XFS_DIVFLAG_COW               0x02
  
  #endif        /* __XFS_DINODE_H__ */
-diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_fs.h linux-2.6.31-vs2.3.0.36.14-pre8/fs/xfs/xfs_fs.h
---- linux-2.6.31/fs/xfs/xfs_fs.h       2009-09-10 15:26:24.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/xfs/xfs_fs.h    2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/xfs/xfs_fs.h linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/xfs_fs.h
+--- linux-2.6.27.33/fs/xfs/xfs_fs.h    2008-10-13 14:52:06.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/xfs_fs.h       2008-10-13 14:54:20.000000000 +0200
 @@ -67,6 +67,9 @@ struct fsxattr {
  #define XFS_XFLAG_EXTSZINHERIT        0x00001000      /* inherit inode extent size */
  #define XFS_XFLAG_NODEFRAG    0x00002000      /* do not defragment */
@@ -7113,7 +8452,7 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_fs.h linux-2.6.31-vs2.3.0.36.14-pr
  #define XFS_XFLAG_HASATTR     0x80000000      /* no DIFLAG for this   */
  
  /*
-@@ -292,7 +295,8 @@ typedef struct xfs_bstat {
+@@ -297,7 +300,8 @@ typedef struct xfs_bstat {
        __s32           bs_extents;     /* number of extents            */
        __u32           bs_gen;         /* generation count             */
        __u16           bs_projid;      /* project id                   */
@@ -7123,20 +8462,21 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_fs.h linux-2.6.31-vs2.3.0.36.14-pr
        __u32           bs_dmevmask;    /* DMIG event mask              */
        __u16           bs_dmstate;     /* DMIG state info              */
        __u16           bs_aextents;    /* attribute number of extents  */
-diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_ialloc.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/xfs/xfs_ialloc.c
---- linux-2.6.31/fs/xfs/xfs_ialloc.c   2009-06-11 17:13:09.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/xfs/xfs_ialloc.c        2009-09-10 16:11:43.000000000 +0200
-@@ -41,7 +41,6 @@
- #include "xfs_error.h"
- #include "xfs_bmap.h"
+diff -NurpP --minimal linux-2.6.27.33/fs/xfs/xfs_ialloc.c linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/xfs_ialloc.c
+--- linux-2.6.27.33/fs/xfs/xfs_ialloc.c        2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/xfs_ialloc.c   2008-11-12 18:41:59.000000000 +0100
+@@ -84,6 +84,8 @@ xfs_ialloc_log_di(
+               offsetof(xfs_dinode_t, di_next_unlinked),
+               offsetof(xfs_dinode_t, di_u),
+               offsetof(xfs_dinode_t, di_a),
++              offsetof(xfs_dinode_core_t, di_tag),
++              offsetof(xfs_dinode_core_t, di_vflags),
+               sizeof(xfs_dinode_t)
+       };
  
--
- /*
-  * Allocation group level functions.
-  */
-diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_inode.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/xfs/xfs_inode.c
---- linux-2.6.31/fs/xfs/xfs_inode.c    2009-09-10 15:26:24.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/xfs/xfs_inode.c 2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/fs/xfs/xfs_inode.c linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/xfs_inode.c
+--- linux-2.6.27.33/fs/xfs/xfs_inode.c 2008-10-13 14:52:06.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/xfs_inode.c    2008-11-12 18:42:00.000000000 +0100
 @@ -249,6 +249,7 @@ xfs_inotobp(
        return 0;
  }
@@ -7145,12 +8485,12 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_inode.c linux-2.6.31-vs2.3.0.36.14
  
  /*
   * This routine is called to map an inode to the buffer containing
-@@ -654,15 +655,25 @@ xfs_iformat_btree(
+@@ -660,15 +661,25 @@ xfs_iformat_btree(
  void
  xfs_dinode_from_disk(
        xfs_icdinode_t          *to,
--      xfs_dinode_t            *from)
-+      xfs_dinode_t            *from,
+-      xfs_dinode_core_t       *from)
++      xfs_dinode_core_t       *from,
 +      int tagged)
  {
 +      uint32_t uid, gid, tag;
@@ -7174,7 +8514,7 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_inode.c linux-2.6.31-vs2.3.0.36.14
        to->di_nlink = be32_to_cpu(from->di_nlink);
        to->di_projid = be16_to_cpu(from->di_projid);
        memcpy(to->di_pad, from->di_pad, sizeof(to->di_pad));
-@@ -683,21 +694,26 @@ xfs_dinode_from_disk(
+@@ -689,21 +700,26 @@ xfs_dinode_from_disk(
        to->di_dmevmask = be32_to_cpu(from->di_dmevmask);
        to->di_dmstate  = be16_to_cpu(from->di_dmstate);
        to->di_flags    = be16_to_cpu(from->di_flags);
@@ -7184,7 +8524,7 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_inode.c linux-2.6.31-vs2.3.0.36.14
  
  void
  xfs_dinode_to_disk(
-       xfs_dinode_t            *to,
+       xfs_dinode_core_t       *to,
 -      xfs_icdinode_t          *from)
 +      xfs_icdinode_t          *from,
 +      int tagged)
@@ -7204,7 +8544,7 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_inode.c linux-2.6.31-vs2.3.0.36.14
        to->di_nlink = cpu_to_be32(from->di_nlink);
        to->di_projid = cpu_to_be16(from->di_projid);
        memcpy(to->di_pad, from->di_pad, sizeof(to->di_pad));
-@@ -718,12 +734,14 @@ xfs_dinode_to_disk(
+@@ -724,12 +740,14 @@ xfs_dinode_to_disk(
        to->di_dmevmask = cpu_to_be32(from->di_dmevmask);
        to->di_dmstate = cpu_to_be16(from->di_dmstate);
        to->di_flags = cpu_to_be16(from->di_flags);
@@ -7220,7 +8560,7 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_inode.c linux-2.6.31-vs2.3.0.36.14
  {
        uint                    flags = 0;
  
-@@ -734,6 +752,8 @@ _xfs_dic2xflags(
+@@ -740,6 +758,8 @@ _xfs_dic2xflags(
                        flags |= XFS_XFLAG_PREALLOC;
                if (di_flags & XFS_DIFLAG_IMMUTABLE)
                        flags |= XFS_XFLAG_IMMUTABLE;
@@ -7229,7 +8569,7 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_inode.c linux-2.6.31-vs2.3.0.36.14
                if (di_flags & XFS_DIFLAG_APPEND)
                        flags |= XFS_XFLAG_APPEND;
                if (di_flags & XFS_DIFLAG_SYNC)
-@@ -758,6 +778,10 @@ _xfs_dic2xflags(
+@@ -764,6 +784,10 @@ _xfs_dic2xflags(
                        flags |= XFS_XFLAG_FILESTREAM;
        }
  
@@ -7240,7 +8580,7 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_inode.c linux-2.6.31-vs2.3.0.36.14
        return flags;
  }
  
-@@ -767,7 +791,7 @@ xfs_ip2xflags(
+@@ -773,7 +797,7 @@ xfs_ip2xflags(
  {
        xfs_icdinode_t          *dic = &ip->i_d;
  
@@ -7249,43 +8589,35 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_inode.c linux-2.6.31-vs2.3.0.36.14
                                (XFS_IFORK_Q(ip) ? XFS_XFLAG_HASATTR : 0);
  }
  
-@@ -775,7 +799,8 @@ uint
- xfs_dic2xflags(
-       xfs_dinode_t            *dip)
+@@ -783,7 +807,8 @@ xfs_dic2xflags(
  {
--      return _xfs_dic2xflags(be16_to_cpu(dip->di_flags)) |
-+      return _xfs_dic2xflags(be16_to_cpu(dip->di_flags),
-+                              be16_to_cpu(dip->di_vflags)) |
+       xfs_dinode_core_t       *dic = &dip->di_core;
+-      return _xfs_dic2xflags(be16_to_cpu(dic->di_flags)) |
++      return _xfs_dic2xflags(be16_to_cpu(dic->di_flags),
++                              be16_to_cpu(dic->di_vflags)) |
                                (XFS_DFORK_Q(dip) ? XFS_XFLAG_HASATTR : 0);
  }
  
-@@ -811,7 +836,6 @@ xfs_iread(
-       if (error)
-               return error;
-       dip = (xfs_dinode_t *)xfs_buf_offset(bp, ip->i_imap.im_boffset);
--
-       /*
-        * If we got something that isn't an inode it means someone
-        * (nfs or dmi) has a stale handle.
-@@ -836,7 +860,8 @@ xfs_iread(
+@@ -878,7 +903,8 @@ xfs_iread(
         * Otherwise, just get the truly permanent information.
         */
-       if (dip->di_mode) {
--              xfs_dinode_from_disk(&ip->i_d, dip);
-+              xfs_dinode_from_disk(&ip->i_d, dip,
+       if (dip->di_core.di_mode) {
+-              xfs_dinode_from_disk(&ip->i_d, &dip->di_core);
++              xfs_dinode_from_disk(&ip->i_d, &dip->di_core,
 +                      mp->m_flags & XFS_MOUNT_TAGGED);
                error = xfs_iformat(ip, dip);
                if (error)  {
- #ifdef DEBUG
-@@ -1036,6 +1061,7 @@ xfs_ialloc(
+                       kmem_zone_free(xfs_inode_zone, ip);
+@@ -1083,6 +1109,7 @@ xfs_ialloc(
        ASSERT(ip->i_d.di_nlink == nlink);
        ip->i_d.di_uid = current_fsuid();
        ip->i_d.di_gid = current_fsgid();
-+      ip->i_d.di_tag = current_fstag(cr, &ip->i_vnode);
++      ip->i_d.di_tag = current_fstag(cr, ip->i_vnode);
        ip->i_d.di_projid = prid;
        memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad));
  
-@@ -1096,6 +1122,7 @@ xfs_ialloc(
+@@ -1143,6 +1170,7 @@ xfs_ialloc(
        ip->i_d.di_dmevmask = 0;
        ip->i_d.di_dmstate = 0;
        ip->i_d.di_flags = 0;
@@ -7293,7 +8625,7 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_inode.c linux-2.6.31-vs2.3.0.36.14
        flags = XFS_ILOG_CORE;
        switch (mode & S_IFMT) {
        case S_IFIFO:
-@@ -2172,6 +2199,7 @@ xfs_ifree(
+@@ -2249,6 +2277,7 @@ xfs_ifree(
        }
        ip->i_d.di_mode = 0;            /* mark incore inode as free */
        ip->i_d.di_flags = 0;
@@ -7301,20 +8633,20 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_inode.c linux-2.6.31-vs2.3.0.36.14
        ip->i_d.di_dmevmask = 0;
        ip->i_d.di_forkoff = 0;         /* mark the attr fork not in use */
        ip->i_df.if_ext_max =
-@@ -3139,7 +3167,8 @@ xfs_iflush_int(
+@@ -3342,7 +3371,8 @@ xfs_iflush_int(
         * because if the inode is dirty at all the core must
         * be.
         */
--      xfs_dinode_to_disk(dip, &ip->i_d);
-+      xfs_dinode_to_disk(dip, &ip->i_d,
+-      xfs_dinode_to_disk(&dip->di_core, &ip->i_d);
++      xfs_dinode_to_disk(&dip->di_core, &ip->i_d,
 +              mp->m_flags & XFS_MOUNT_TAGGED);
  
        /* Wrap, we never let the log put out DI_MAX_FLUSH */
        if (ip->i_d.di_flushiter == DI_MAX_FLUSH)
-diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_inode.h linux-2.6.31-vs2.3.0.36.14-pre8/fs/xfs/xfs_inode.h
---- linux-2.6.31/fs/xfs/xfs_inode.h    2009-09-10 15:26:24.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/xfs/xfs_inode.h 2009-09-10 16:11:43.000000000 +0200
-@@ -135,7 +135,9 @@ typedef struct xfs_icdinode {
+diff -NurpP --minimal linux-2.6.27.33/fs/xfs/xfs_inode.h linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/xfs_inode.h
+--- linux-2.6.27.33/fs/xfs/xfs_inode.h 2008-10-13 14:52:06.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/xfs_inode.h    2008-11-12 18:42:03.000000000 +0100
+@@ -173,7 +173,9 @@ typedef struct xfs_icdinode {
        __uint32_t      di_gid;         /* owner's group id */
        __uint32_t      di_nlink;       /* number of links to file */
        __uint16_t      di_projid;      /* owner's project id */
@@ -7325,46 +8657,46 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_inode.h linux-2.6.31-vs2.3.0.36.14
        __uint16_t      di_flushiter;   /* incremented on flush */
        xfs_ictimestamp_t di_atime;     /* time last accessed */
        xfs_ictimestamp_t di_mtime;     /* time last modified */
-@@ -573,9 +575,9 @@ int                xfs_itobp(struct xfs_mount *, struc
int           xfs_iread(struct xfs_mount *, struct xfs_trans *,
-                         struct xfs_inode *, xfs_daddr_t, uint);
+@@ -500,9 +502,9 @@ int                xfs_ialloc(struct xfs_trans *, xfs_
                         xfs_nlink_t, xfs_dev_t, struct cred *, xfs_prid_t,
+                          int, struct xfs_buf **, boolean_t *, xfs_inode_t **);
  void          xfs_dinode_from_disk(struct xfs_icdinode *,
--                                   struct xfs_dinode *);
-+                                   struct xfs_dinode *, int);
- void          xfs_dinode_to_disk(struct xfs_dinode *,
+-                                   struct xfs_dinode_core *);
++                                   struct xfs_dinode_core *, int tagged);
+ void          xfs_dinode_to_disk(struct xfs_dinode_core *,
 -                                 struct xfs_icdinode *);
-+                                 struct xfs_icdinode *, int);
- void          xfs_idestroy_fork(struct xfs_inode *, int);
void          xfs_idata_realloc(struct xfs_inode *, int, int);
void          xfs_iroot_realloc(struct xfs_inode *, int, int);
-diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_itable.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/xfs/xfs_itable.c
---- linux-2.6.31/fs/xfs/xfs_itable.c   2009-06-11 17:13:09.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/xfs/xfs_itable.c        2009-09-10 16:11:43.000000000 +0200
++                                 struct xfs_icdinode *, int tagged);
uint          xfs_ip2xflags(struct xfs_inode *);
uint          xfs_dic2xflags(struct xfs_dinode *);
+diff -NurpP --minimal linux-2.6.27.33/fs/xfs/xfs_itable.c linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/xfs_itable.c
+--- linux-2.6.27.33/fs/xfs/xfs_itable.c        2008-10-13 14:52:06.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/xfs_itable.c   2008-11-12 18:42:03.000000000 +0100
 @@ -82,6 +82,7 @@ xfs_bulkstat_one_iget(
        buf->bs_mode = dic->di_mode;
        buf->bs_uid = dic->di_uid;
        buf->bs_gid = dic->di_gid;
 +      buf->bs_tag = dic->di_tag;
        buf->bs_size = dic->di_size;
-       /*
-        * We are reading the atime from the Linux inode because the
-diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_log_recover.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/xfs/xfs_log_recover.c
---- linux-2.6.31/fs/xfs/xfs_log_recover.c      2009-09-10 15:26:24.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/xfs/xfs_log_recover.c   2009-09-10 16:11:43.000000000 +0200
-@@ -2467,7 +2467,8 @@ xlog_recover_do_inode_trans(
-       }
+       vn_atime_to_bstime(VFS_I(ip), &buf->bs_atime);
+       buf->bs_mtime.tv_sec = dic->di_mtime.t_sec;
+diff -NurpP --minimal linux-2.6.27.33/fs/xfs/xfs_log_recover.c linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/xfs_log_recover.c
+--- linux-2.6.27.33/fs/xfs/xfs_log_recover.c   2008-10-13 14:52:06.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/xfs_log_recover.c      2008-11-12 18:42:03.000000000 +0100
+@@ -2417,7 +2417,8 @@ xlog_recover_do_inode_trans(
  
        /* The core is in in-core format */
--      xfs_dinode_to_disk(dip, (xfs_icdinode_t *)item->ri_buf[1].i_addr);
-+      xfs_dinode_to_disk(dip, (xfs_icdinode_t *)item->ri_buf[1].i_addr,
+       xfs_dinode_to_disk(&dip->di_core,
+-              (xfs_icdinode_t *)item->ri_buf[1].i_addr);
++              (xfs_icdinode_t *)item->ri_buf[1].i_addr,
 +              mp->m_flags & XFS_MOUNT_TAGGED);
  
        /* the rest is in on-disk format */
-       if (item->ri_buf[1].i_len > sizeof(struct xfs_icdinode)) {
-diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_mount.h linux-2.6.31-vs2.3.0.36.14-pre8/fs/xfs/xfs_mount.h
---- linux-2.6.31/fs/xfs/xfs_mount.h    2009-09-10 15:26:24.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/xfs/xfs_mount.h 2009-09-10 16:11:43.000000000 +0200
-@@ -283,6 +283,7 @@ typedef struct xfs_mount {
+       if (item->ri_buf[1].i_len > sizeof(xfs_dinode_core_t)) {
+diff -NurpP --minimal linux-2.6.27.33/fs/xfs/xfs_mount.h linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/xfs_mount.h
+--- linux-2.6.27.33/fs/xfs/xfs_mount.h 2008-10-13 14:52:06.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/xfs_mount.h    2008-10-13 14:54:20.000000000 +0200
+@@ -384,6 +384,7 @@ typedef struct xfs_mount {
                                                   allocator */
  #define XFS_MOUNT_NOATTR2     (1ULL << 25)    /* disable use of attr2 format */
  
@@ -7372,14 +8704,13 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_mount.h linux-2.6.31-vs2.3.0.36.14
  
  /*
   * Default minimum read and write sizes.
-diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_vnodeops.c linux-2.6.31-vs2.3.0.36.14-pre8/fs/xfs/xfs_vnodeops.c
---- linux-2.6.31/fs/xfs/xfs_vnodeops.c 2009-09-10 15:26:24.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/xfs/xfs_vnodeops.c      2009-09-10 17:04:03.000000000 +0200
-@@ -54,6 +54,90 @@
- #include "xfs_filestream.h"
- #include "xfs_vnodeops.h"
+diff -NurpP --minimal linux-2.6.27.33/fs/xfs/xfs_vnodeops.c linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/xfs_vnodeops.c
+--- linux-2.6.27.33/fs/xfs/xfs_vnodeops.c      2008-10-13 14:52:06.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/xfs_vnodeops.c 2008-11-12 18:42:03.000000000 +0100
+@@ -75,6 +75,89 @@ xfs_open(
+       return 0;
+ }
  
-+
 +STATIC void
 +xfs_get_inode_flags(
 +      xfs_inode_t     *ip)
@@ -7466,24 +8797,24 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_vnodeops.c linux-2.6.31-vs2.3.0.36
  int
  xfs_setattr(
        struct xfs_inode        *ip,
-@@ -69,6 +153,7 @@ xfs_setattr(
+@@ -91,6 +174,7 @@ xfs_setattr(
        uint                    commit_flags=0;
        uid_t                   uid=0, iuid=0;
        gid_t                   gid=0, igid=0;
 +      tag_t                   tag=0, itag=0;
        int                     timeflags = 0;
        struct xfs_dquot        *udqp, *gdqp, *olddquot1, *olddquot2;
-       int                     need_iolock = 1;
-@@ -165,7 +250,7 @@ xfs_setattr(
-       /*
-        * Change file ownership.  Must be the owner or privileged.
+       int                     file_owner;
+@@ -238,7 +322,7 @@ xfs_setattr(
+        * and can change the group id only to a group of which he
+        * or she is a member.
         */
 -      if (mask & (ATTR_UID|ATTR_GID)) {
 +      if (mask & (ATTR_UID|ATTR_GID|ATTR_TAG)) {
                /*
                 * These IDs could have changed since we last looked at them.
                 * But, we're assured that if the ownership did change
-@@ -174,8 +259,10 @@ xfs_setattr(
+@@ -247,8 +331,10 @@ xfs_setattr(
                 */
                iuid = ip->i_d.di_uid;
                igid = ip->i_d.di_gid;
@@ -7493,27 +8824,28 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_vnodeops.c linux-2.6.31-vs2.3.0.36
 +              tag = (mask & ATTR_TAG) ? iattr->ia_tag : itag;
  
                /*
-                * Do a quota reservation only if uid/gid is actually
-@@ -183,7 +270,8 @@ xfs_setattr(
+                * CAP_CHOWN overrides the following restrictions:
+@@ -272,7 +358,9 @@ xfs_setattr(
+                * going to change.
                 */
-               if (XFS_IS_QUOTA_RUNNING(mp) &&
-                   ((XFS_IS_UQUOTA_ON(mp) && iuid != uid) ||
--                   (XFS_IS_GQUOTA_ON(mp) && igid != gid))) {
-+                   (XFS_IS_GQUOTA_ON(mp) && igid != gid) ||
-+                   (XFS_IS_GQUOTA_ON(mp) && itag != tag))) {
+               if ((XFS_IS_UQUOTA_ON(mp) && iuid != uid) ||
+-                  (XFS_IS_GQUOTA_ON(mp) && igid != gid)) {
++                  (XFS_IS_GQUOTA_ON(mp) && igid != gid) ||
++                  (XFS_IS_GQUOTA_ON(mp) && itag != tag)) {
++                      /* TODO: handle tagging? */
                        ASSERT(tp);
-                       code = xfs_qm_vop_chown_reserve(tp, ip, udqp, gdqp,
+                       code = XFS_QM_DQVOPCHOWNRESV(mp, tp, ip, udqp, gdqp,
                                                capable(CAP_FOWNER) ?
-@@ -336,7 +424,7 @@ xfs_setattr(
-       /*
-        * Change file ownership.  Must be the owner or privileged.
+@@ -461,7 +549,7 @@ xfs_setattr(
+        * and can change the group id only to a group of which he
+        * or she is a member.
         */
 -      if (mask & (ATTR_UID|ATTR_GID)) {
 +      if (mask & (ATTR_UID|ATTR_GID|ATTR_TAG)) {
                /*
                 * CAP_FSETID overrides the following restrictions:
                 *
-@@ -352,6 +440,10 @@ xfs_setattr(
+@@ -477,6 +565,10 @@ xfs_setattr(
                 * Change the ownerships and register quota modifications
                 * in the transaction.
                 */
@@ -7522,22 +8854,22 @@ diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_vnodeops.c linux-2.6.31-vs2.3.0.36
 +                      inode->i_tag = tag;
 +              }
                if (iuid != uid) {
-                       if (XFS_IS_QUOTA_RUNNING(mp) && XFS_IS_UQUOTA_ON(mp)) {
+                       if (XFS_IS_UQUOTA_ON(mp)) {
                                ASSERT(mask & ATTR_UID);
-diff -NurpP --minimal linux-2.6.31/fs/xfs/xfs_vnodeops.h linux-2.6.31-vs2.3.0.36.14-pre8/fs/xfs/xfs_vnodeops.h
---- linux-2.6.31/fs/xfs/xfs_vnodeops.h 2009-09-10 15:26:24.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/fs/xfs/xfs_vnodeops.h      2009-09-10 16:11:43.000000000 +0200
-@@ -14,6 +14,7 @@ struct xfs_inode;
- struct xfs_iomap;
+diff -NurpP --minimal linux-2.6.27.33/fs/xfs/xfs_vnodeops.h linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/xfs_vnodeops.h
+--- linux-2.6.27.33/fs/xfs/xfs_vnodeops.h      2008-10-13 14:52:06.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/fs/xfs/xfs_vnodeops.h 2008-11-12 18:42:03.000000000 +0100
+@@ -15,6 +15,7 @@ struct xfs_iomap;
  
  
+ int xfs_open(struct xfs_inode *ip);
 +int xfs_sync_xflags(struct xfs_inode *ip);
- int xfs_setattr(struct xfs_inode *ip, struct iattr *vap, int flags);
+ int xfs_setattr(struct xfs_inode *ip, struct iattr *vap, int flags,
+               struct cred *credp);
  #define       XFS_ATTR_DMI            0x01    /* invocation from a DMI function */
- #define       XFS_ATTR_NONBLOCK       0x02    /* return EAGAIN if operation would block */
-diff -NurpP --minimal linux-2.6.31/include/asm-generic/tlb.h linux-2.6.31-vs2.3.0.36.14-pre8/include/asm-generic/tlb.h
---- linux-2.6.31/include/asm-generic/tlb.h     2009-09-10 15:26:24.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/asm-generic/tlb.h  2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/asm-generic/tlb.h linux-2.6.27.33-vs2.3.0.36.6/include/asm-generic/tlb.h
+--- linux-2.6.27.33/include/asm-generic/tlb.h  2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/asm-generic/tlb.h     2008-10-13 14:54:20.000000000 +0200
 @@ -14,6 +14,7 @@
  #define _ASM_GENERIC__TLB_H
  
@@ -7546,10 +8878,22 @@ diff -NurpP --minimal linux-2.6.31/include/asm-generic/tlb.h linux-2.6.31-vs2.3.
  #include <asm/pgalloc.h>
  #include <asm/tlbflush.h>
  
-diff -NurpP --minimal linux-2.6.31/include/linux/capability.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/capability.h
---- linux-2.6.31/include/linux/capability.h    2009-06-11 17:13:13.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/capability.h 2009-09-10 16:11:43.000000000 +0200
-@@ -285,6 +285,7 @@ struct cpu_vfs_cap_data {
+diff -NurpP --minimal linux-2.6.27.33/include/asm-x86/unistd_64.h linux-2.6.27.33-vs2.3.0.36.6/include/asm-x86/unistd_64.h
+--- linux-2.6.27.33/include/asm-x86/unistd_64.h        2008-10-13 14:52:08.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/asm-x86/unistd_64.h   2008-10-13 14:54:20.000000000 +0200
+@@ -535,7 +535,7 @@ __SYSCALL(__NR_tgkill, sys_tgkill)
+ #define __NR_utimes                           235
+ __SYSCALL(__NR_utimes, sys_utimes)
+ #define __NR_vserver                          236
+-__SYSCALL(__NR_vserver, sys_ni_syscall)
++__SYSCALL(__NR_vserver, sys_vserver)
+ #define __NR_mbind                            237
+ __SYSCALL(__NR_mbind, sys_mbind)
+ #define __NR_set_mempolicy                    238
+diff -NurpP --minimal linux-2.6.27.33/include/linux/capability.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/capability.h
+--- linux-2.6.27.33/include/linux/capability.h 2009-09-13 16:17:00.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/capability.h    2009-05-15 22:57:04.000000000 +0200
+@@ -274,6 +274,7 @@ typedef struct kernel_cap_struct {
     arbitrary SCSI commands */
  /* Allow setting encryption key on loopback filesystem */
  /* Allow setting zone reclaim policy */
@@ -7557,7 +8901,7 @@ diff -NurpP --minimal linux-2.6.31/include/linux/capability.h linux-2.6.31-vs2.3
  
  #define CAP_SYS_ADMIN        21
  
-@@ -357,7 +358,13 @@ struct cpu_vfs_cap_data {
+@@ -346,7 +347,13 @@ typedef struct kernel_cap_struct {
  
  #define CAP_MAC_ADMIN        33
  
@@ -7572,18 +8916,18 @@ diff -NurpP --minimal linux-2.6.31/include/linux/capability.h linux-2.6.31-vs2.3
  
  #define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)
  
-diff -NurpP --minimal linux-2.6.31/include/linux/devpts_fs.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/devpts_fs.h
---- linux-2.6.31/include/linux/devpts_fs.h     2008-12-25 00:26:37.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/devpts_fs.h  2009-09-10 16:11:43.000000000 +0200
-@@ -45,5 +45,4 @@ static inline void devpts_pty_kill(struc
+diff -NurpP --minimal linux-2.6.27.33/include/linux/devpts_fs.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/devpts_fs.h
+--- linux-2.6.27.33/include/linux/devpts_fs.h  2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/devpts_fs.h     2008-10-13 14:54:20.000000000 +0200
+@@ -34,5 +34,4 @@ static inline void devpts_pty_kill(int n
  
  #endif
  
 -
  #endif /* _LINUX_DEVPTS_FS_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/ext2_fs.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/ext2_fs.h
---- linux-2.6.31/include/linux/ext2_fs.h       2009-03-24 14:22:41.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/ext2_fs.h    2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/ext2_fs.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/ext2_fs.h
+--- linux-2.6.27.33/include/linux/ext2_fs.h    2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/ext2_fs.h       2008-10-13 14:54:20.000000000 +0200
 @@ -189,8 +189,12 @@ struct ext2_group_desc
  #define EXT2_NOTAIL_FL                        FS_NOTAIL_FL    /* file tail should not be merged */
  #define EXT2_DIRSYNC_FL                       FS_DIRSYNC_FL   /* dirsync behaviour (directories only) */
@@ -7597,7 +8941,7 @@ diff -NurpP --minimal linux-2.6.31/include/linux/ext2_fs.h linux-2.6.31-vs2.3.0.
  #define EXT2_FL_USER_VISIBLE          FS_FL_USER_VISIBLE      /* User visible flags */
  #define EXT2_FL_USER_MODIFIABLE               FS_FL_USER_MODIFIABLE   /* User modifiable flags */
  
-@@ -271,7 +275,7 @@ struct ext2_inode {
+@@ -247,7 +251,7 @@ struct ext2_inode {
                struct {
                        __u8    l_i_frag;       /* Fragment number */
                        __u8    l_i_fsize;      /* Fragment size */
@@ -7606,7 +8950,7 @@ diff -NurpP --minimal linux-2.6.31/include/linux/ext2_fs.h linux-2.6.31-vs2.3.0.
                        __le16  l_i_uid_high;   /* these 2 fields    */
                        __le16  l_i_gid_high;   /* were reserved2[0] */
                        __u32   l_i_reserved2;
-@@ -303,6 +307,7 @@ struct ext2_inode {
+@@ -279,6 +283,7 @@ struct ext2_inode {
  #define i_gid_low     i_gid
  #define i_uid_high    osd2.linux2.l_i_uid_high
  #define i_gid_high    osd2.linux2.l_i_gid_high
@@ -7614,7 +8958,7 @@ diff -NurpP --minimal linux-2.6.31/include/linux/ext2_fs.h linux-2.6.31-vs2.3.0.
  #define i_reserved2   osd2.linux2.l_i_reserved2
  #endif
  
-@@ -347,6 +352,7 @@ struct ext2_inode {
+@@ -323,6 +328,7 @@ struct ext2_inode {
  #define EXT2_MOUNT_USRQUOTA           0x020000  /* user quota */
  #define EXT2_MOUNT_GRPQUOTA           0x040000  /* group quota */
  #define EXT2_MOUNT_RESERVATION                0x080000  /* Preallocation */
@@ -7622,9 +8966,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/ext2_fs.h linux-2.6.31-vs2.3.0.
  
  
  #define clear_opt(o, opt)             o &= ~EXT2_MOUNT_##opt
-diff -NurpP --minimal linux-2.6.31/include/linux/ext3_fs.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/ext3_fs.h
---- linux-2.6.31/include/linux/ext3_fs.h       2009-09-10 15:26:25.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/ext3_fs.h    2009-09-10 17:14:14.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/ext3_fs.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/ext3_fs.h
+--- linux-2.6.27.33/include/linux/ext3_fs.h    2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/ext3_fs.h       2008-10-31 18:15:18.000000000 +0100
 @@ -173,10 +173,14 @@ struct ext3_group_desc
  #define EXT3_NOTAIL_FL                        0x00008000 /* file tail should not be merged */
  #define EXT3_DIRSYNC_FL                       0x00010000 /* dirsync behaviour (directories only) */
@@ -7640,9 +8984,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/ext3_fs.h linux-2.6.31-vs2.3.0.
 +#define EXT3_FL_USER_VISIBLE          0x0103DFFF /* User visible flags */
 +#define EXT3_FL_USER_MODIFIABLE               0x010380FF /* User modifiable flags */
  
- /* Flags that should be inherited by new inodes from their parent. */
- #define EXT3_FL_INHERITED (EXT3_SECRM_FL | EXT3_UNRM_FL | EXT3_COMPR_FL |\
-@@ -317,7 +321,7 @@ struct ext3_inode {
+ /*
+  * Inode dynamic state flags
+@@ -292,7 +296,7 @@ struct ext3_inode {
                struct {
                        __u8    l_i_frag;       /* Fragment number */
                        __u8    l_i_fsize;      /* Fragment size */
@@ -7651,7 +8995,7 @@ diff -NurpP --minimal linux-2.6.31/include/linux/ext3_fs.h linux-2.6.31-vs2.3.0.
                        __le16  l_i_uid_high;   /* these 2 fields    */
                        __le16  l_i_gid_high;   /* were reserved2[0] */
                        __u32   l_i_reserved2;
-@@ -351,6 +355,7 @@ struct ext3_inode {
+@@ -326,6 +330,7 @@ struct ext3_inode {
  #define i_gid_low     i_gid
  #define i_uid_high    osd2.linux2.l_i_uid_high
  #define i_gid_high    osd2.linux2.l_i_gid_high
@@ -7659,36 +9003,36 @@ diff -NurpP --minimal linux-2.6.31/include/linux/ext3_fs.h linux-2.6.31-vs2.3.0.
  #define i_reserved2   osd2.linux2.l_i_reserved2
  
  #elif defined(__GNU__)
-@@ -414,6 +419,7 @@ struct ext3_inode {
+@@ -380,6 +385,7 @@ struct ext3_inode {
+ #define EXT3_MOUNT_QUOTA              0x80000 /* Some quota option set */
+ #define EXT3_MOUNT_USRQUOTA           0x100000 /* "old" user quota */
  #define EXT3_MOUNT_GRPQUOTA           0x200000 /* "old" group quota */
- #define EXT3_MOUNT_DATA_ERR_ABORT     0x400000 /* Abort on file data write
-                                                 * error in ordered mode */
 +#define EXT3_MOUNT_TAGGED             (1<<24) /* Enable Context Tags */
  
  /* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */
  #ifndef _LINUX_EXT2_FS_H
-@@ -875,6 +881,7 @@ struct buffer_head * ext3_bread (handle_
+@@ -822,6 +828,7 @@ struct buffer_head * ext3_bread (handle_
  int ext3_get_blocks_handle(handle_t *handle, struct inode *inode,
        sector_t iblock, unsigned long maxblocks, struct buffer_head *bh_result,
-       int create);
+       int create, int extend_disksize);
 +extern int ext3_sync_flags(struct inode *inode);
  
  extern struct inode *ext3_iget(struct super_block *, unsigned long);
  extern int  ext3_write_inode (struct inode *, int);
-diff -NurpP --minimal linux-2.6.31/include/linux/fs.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/fs.h
---- linux-2.6.31/include/linux/fs.h    2009-09-10 15:26:25.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/fs.h 2009-09-10 16:11:43.000000000 +0200
-@@ -205,6 +205,9 @@ struct inodes_stat_t {
+diff -NurpP --minimal linux-2.6.27.33/include/linux/fs.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/fs.h
+--- linux-2.6.27.33/include/linux/fs.h 2009-09-13 16:17:00.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/fs.h    2009-03-25 14:32:29.000000000 +0100
+@@ -133,6 +133,9 @@ extern int dir_notify_enable;
+ #define MS_RELATIME   (1<<21) /* Update atime relative to mtime/ctime. */
  #define MS_KERNMOUNT  (1<<22) /* this is a kern_mount call */
  #define MS_I_VERSION  (1<<23) /* Update inode I_version field */
- #define MS_STRICTATIME        (1<<24) /* Always perform atime updates */
-+#define MS_TAGGED     (1<<25) /* use generic inode tagging */
-+#define MS_TAGID      (1<<26) /* use specific tag for this mount */
-+#define MS_NOTAGCHECK (1<<27) /* don't check tags */
++#define MS_TAGGED     (1<<24) /* use generic inode tagging */
++#define MS_TAGID      (1<<25) /* use specific tag for this mount */
++#define MS_NOTAGCHECK (1<<26) /* don't check tags */
  #define MS_ACTIVE     (1<<30)
  #define MS_NOUSER     (1<<31)
  
-@@ -231,6 +234,14 @@ struct inodes_stat_t {
+@@ -159,6 +162,14 @@ extern int dir_notify_enable;
  #define S_NOCMTIME    128     /* Do not update file c/mtime */
  #define S_SWAPFILE    256     /* Do not truncate: swapon got its bmaps */
  #define S_PRIVATE     512     /* Inode is fs-internal */
@@ -7703,7 +9047,7 @@ diff -NurpP --minimal linux-2.6.31/include/linux/fs.h linux-2.6.31-vs2.3.0.36.14
  
  /*
   * Note that nosuid etc flags are inode-specific: setting some file-system
-@@ -253,12 +264,15 @@ struct inodes_stat_t {
+@@ -181,12 +192,15 @@ extern int dir_notify_enable;
  #define IS_DIRSYNC(inode)     (__IS_FLG(inode, MS_SYNCHRONOUS|MS_DIRSYNC) || \
                                        ((inode)->i_flags & (S_SYNC|S_DIRSYNC)))
  #define IS_MANDLOCK(inode)    __IS_FLG(inode, MS_MANDLOCK)
@@ -7721,7 +9065,7 @@ diff -NurpP --minimal linux-2.6.31/include/linux/fs.h linux-2.6.31-vs2.3.0.36.14
  #define IS_POSIXACL(inode)    __IS_FLG(inode, MS_POSIXACL)
  
  #define IS_DEADDIR(inode)     ((inode)->i_flags & S_DEAD)
-@@ -266,6 +280,16 @@ struct inodes_stat_t {
+@@ -194,6 +208,16 @@ extern int dir_notify_enable;
  #define IS_SWAPFILE(inode)    ((inode)->i_flags & S_SWAPFILE)
  #define IS_PRIVATE(inode)     ((inode)->i_flags & S_PRIVATE)
  
@@ -7738,7 +9082,7 @@ diff -NurpP --minimal linux-2.6.31/include/linux/fs.h linux-2.6.31-vs2.3.0.36.14
  /* the read-only stuff doesn't really belong here, but any other place is
     probably as bad and I don't want to create yet another include file. */
  
-@@ -343,11 +367,14 @@ struct inodes_stat_t {
+@@ -267,11 +291,14 @@ extern int dir_notify_enable;
  #define FS_TOPDIR_FL                  0x00020000 /* Top of directory hierarchies*/
  #define FS_EXTENT_FL                  0x00080000 /* Extents */
  #define FS_DIRECTIO_FL                        0x00100000 /* Use direct i/o */
@@ -7755,7 +9099,7 @@ diff -NurpP --minimal linux-2.6.31/include/linux/fs.h linux-2.6.31-vs2.3.0.36.14
  
  #define SYNC_FILE_RANGE_WAIT_BEFORE   1
  #define SYNC_FILE_RANGE_WRITE         2
-@@ -429,6 +456,7 @@ typedef void (dio_iodone_t)(struct kiocb
+@@ -342,6 +369,7 @@ typedef void (dio_iodone_t)(struct kiocb
  #define ATTR_KILL_PRIV        (1 << 14)
  #define ATTR_OPEN     (1 << 15) /* Truncating from open(O_TRUNC) */
  #define ATTR_TIMES_SET        (1 << 16)
@@ -7763,7 +9107,7 @@ diff -NurpP --minimal linux-2.6.31/include/linux/fs.h linux-2.6.31-vs2.3.0.36.14
  
  /*
   * This is the Inode Attributes structure, used for notify_change().  It
-@@ -444,6 +472,7 @@ struct iattr {
+@@ -357,6 +385,7 @@ struct iattr {
        umode_t         ia_mode;
        uid_t           ia_uid;
        gid_t           ia_gid;
@@ -7771,7 +9115,7 @@ diff -NurpP --minimal linux-2.6.31/include/linux/fs.h linux-2.6.31-vs2.3.0.36.14
        loff_t          ia_size;
        struct timespec ia_atime;
        struct timespec ia_mtime;
-@@ -457,6 +486,9 @@ struct iattr {
+@@ -370,6 +399,9 @@ struct iattr {
        struct file     *ia_file;
  };
  
@@ -7781,7 +9125,7 @@ diff -NurpP --minimal linux-2.6.31/include/linux/fs.h linux-2.6.31-vs2.3.0.36.14
  /*
   * Includes for diskquotas.
   */
-@@ -723,7 +755,9 @@ struct inode {
+@@ -634,7 +666,9 @@ struct inode {
        unsigned int            i_nlink;
        uid_t                   i_uid;
        gid_t                   i_gid;
@@ -7791,7 +9135,7 @@ diff -NurpP --minimal linux-2.6.31/include/linux/fs.h linux-2.6.31-vs2.3.0.36.14
        u64                     i_version;
        loff_t                  i_size;
  #ifdef __NEED_I_SIZE_ORDERED
-@@ -770,7 +804,8 @@ struct inode {
+@@ -682,7 +716,8 @@ struct inode {
        unsigned long           i_state;
        unsigned long           dirtied_when;   /* jiffies of first dirtying */
  
@@ -7801,7 +9145,7 @@ diff -NurpP --minimal linux-2.6.31/include/linux/fs.h linux-2.6.31-vs2.3.0.36.14
  
        atomic_t                i_writecount;
  #ifdef CONFIG_SECURITY
-@@ -858,12 +893,12 @@ static inline void i_size_write(struct i
+@@ -769,12 +804,12 @@ static inline void i_size_write(struct i
  
  static inline unsigned iminor(const struct inode *inode)
  {
@@ -7816,15 +9160,15 @@ diff -NurpP --minimal linux-2.6.31/include/linux/fs.h linux-2.6.31-vs2.3.0.36.14
  }
  
  extern struct block_device *I_BDEV(struct inode *inode);
-@@ -922,6 +957,7 @@ struct file {
+@@ -832,6 +867,7 @@ struct file {
        loff_t                  f_pos;
        struct fown_struct      f_owner;
-       const struct cred       *f_cred;
+       unsigned int            f_uid, f_gid;
 +      xid_t                   f_xid;
        struct file_ra_state    f_ra;
  
        u64                     f_version;
-@@ -1063,6 +1099,7 @@ struct file_lock {
+@@ -966,6 +1002,7 @@ struct file_lock {
        struct file *fl_file;
        loff_t fl_start;
        loff_t fl_end;
@@ -7832,15 +9176,15 @@ diff -NurpP --minimal linux-2.6.31/include/linux/fs.h linux-2.6.31-vs2.3.0.36.14
  
        struct fasync_struct *  fl_fasync; /* for lease break notifications */
        unsigned long fl_break_time;    /* for nonblocking lease breaks */
-@@ -1539,6 +1576,7 @@ struct inode_operations {
+@@ -1294,6 +1331,7 @@ struct inode_operations {
+       void (*truncate_range)(struct inode *, loff_t, loff_t);
+       long (*fallocate)(struct inode *inode, int mode, loff_t offset,
                          loff_t len);
-       int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start,
-                     u64 len);
 +      int (*sync_flags) (struct inode *);
  };
  
  struct seq_file;
-@@ -1554,6 +1592,7 @@ extern ssize_t vfs_readv(struct file *, 
+@@ -1309,6 +1347,7 @@ extern ssize_t vfs_readv(struct file *, 
                unsigned long, loff_t *);
  extern ssize_t vfs_writev(struct file *, const struct iovec __user *,
                unsigned long, loff_t *);
@@ -7848,7 +9192,7 @@ diff -NurpP --minimal linux-2.6.31/include/linux/fs.h linux-2.6.31-vs2.3.0.36.14
  
  struct super_operations {
        struct inode *(*alloc_inode)(struct super_block *sb);
-@@ -2328,6 +2367,7 @@ extern int dcache_dir_open(struct inode 
+@@ -1999,6 +2038,7 @@ extern int dcache_dir_open(struct inode 
  extern int dcache_dir_close(struct inode *, struct file *);
  extern loff_t dcache_dir_lseek(struct file *, loff_t, int);
  extern int dcache_readdir(struct file *, void *, filldir_t);
@@ -7856,24 +9200,24 @@ diff -NurpP --minimal linux-2.6.31/include/linux/fs.h linux-2.6.31-vs2.3.0.36.14
  extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *);
  extern int simple_statfs(struct dentry *, struct kstatfs *);
  extern int simple_link(struct dentry *, struct inode *, struct dentry *);
-diff -NurpP --minimal linux-2.6.31/include/linux/if_tun.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/if_tun.h
---- linux-2.6.31/include/linux/if_tun.h        2009-09-10 15:26:25.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/if_tun.h     2009-09-10 16:11:43.000000000 +0200
-@@ -48,6 +48,7 @@
+diff -NurpP --minimal linux-2.6.27.33/include/linux/if_tun.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/if_tun.h
+--- linux-2.6.27.33/include/linux/if_tun.h     2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/if_tun.h        2008-10-13 14:54:20.000000000 +0200
+@@ -46,6 +46,7 @@
+ #define TUNSETOFFLOAD  _IOW('T', 208, unsigned int)
+ #define TUNSETTXFILTER _IOW('T', 209, unsigned int)
  #define TUNGETIFF      _IOR('T', 210, unsigned int)
- #define TUNGETSNDBUF   _IOR('T', 211, int)
- #define TUNSETSNDBUF   _IOW('T', 212, int)
 +#define TUNSETNID     _IOW('T', 215, int)
  
  /* TUNSETIFF ifr flags */
  #define IFF_TUN               0x0001
-diff -NurpP --minimal linux-2.6.31/include/linux/init_task.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/init_task.h
---- linux-2.6.31/include/linux/init_task.h     2009-09-10 15:26:25.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/init_task.h  2009-09-10 17:13:45.000000000 +0200
-@@ -173,6 +173,10 @@ extern struct cred init_cred;
+diff -NurpP --minimal linux-2.6.27.33/include/linux/init_task.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/init_task.h
+--- linux-2.6.27.33/include/linux/init_task.h  2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/init_task.h     2008-10-13 14:54:20.000000000 +0200
+@@ -179,6 +179,10 @@ extern struct group_info init_groups;
+       INIT_IDS                                                        \
+       INIT_TRACE_IRQFLAGS                                             \
        INIT_LOCKDEP                                                    \
-       INIT_FTRACE_GRAPH                                               \
-       INIT_TRACE_RECURSION                                            \
 +      .xid            = 0,                                            \
 +      .vx_info        = NULL,                                         \
 +      .nid            = 0,                                            \
@@ -7881,22 +9225,22 @@ diff -NurpP --minimal linux-2.6.31/include/linux/init_task.h linux-2.6.31-vs2.3.
  }
  
  
-diff -NurpP --minimal linux-2.6.31/include/linux/interrupt.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/interrupt.h
---- linux-2.6.31/include/linux/interrupt.h     2009-09-10 15:26:25.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/interrupt.h  2009-09-10 16:11:43.000000000 +0200
-@@ -9,8 +9,8 @@
+diff -NurpP --minimal linux-2.6.27.33/include/linux/interrupt.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/interrupt.h
+--- linux-2.6.27.33/include/linux/interrupt.h  2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/interrupt.h     2008-10-13 14:54:20.000000000 +0200
+@@ -8,8 +8,8 @@
+ #include <linux/preempt.h>
  #include <linux/cpumask.h>
  #include <linux/irqreturn.h>
- #include <linux/irqnr.h>
 -#include <linux/hardirq.h>
  #include <linux/sched.h>
 +#include <linux/hardirq.h>
  #include <linux/irqflags.h>
- #include <linux/smp.h>
- #include <linux/percpu.h>
-diff -NurpP --minimal linux-2.6.31/include/linux/ipc.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/ipc.h
---- linux-2.6.31/include/linux/ipc.h   2008-12-25 00:26:37.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/ipc.h        2009-09-10 16:11:43.000000000 +0200
+ #include <asm/atomic.h>
+ #include <asm/ptrace.h>
+diff -NurpP --minimal linux-2.6.27.33/include/linux/ipc.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/ipc.h
+--- linux-2.6.27.33/include/linux/ipc.h        2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/ipc.h   2008-10-13 14:54:20.000000000 +0200
 @@ -93,6 +93,7 @@ struct kern_ipc_perm
        key_t           key;
        uid_t           uid;
@@ -7905,21 +9249,19 @@ diff -NurpP --minimal linux-2.6.31/include/linux/ipc.h linux-2.6.31-vs2.3.0.36.1
        uid_t           cuid;
        gid_t           cgid;
        mode_t          mode; 
-diff -NurpP --minimal linux-2.6.31/include/linux/Kbuild linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/Kbuild
---- linux-2.6.31/include/linux/Kbuild  2009-09-10 15:26:24.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/Kbuild       2009-09-10 16:11:43.000000000 +0200
-@@ -376,5 +376,8 @@ unifdef-y += xattr.h
+diff -NurpP --minimal linux-2.6.27.33/include/linux/Kbuild linux-2.6.27.33-vs2.3.0.36.6/include/linux/Kbuild
+--- linux-2.6.27.33/include/linux/Kbuild       2009-09-13 16:17:00.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/Kbuild  2009-02-03 18:03:38.000000000 +0100
+@@ -370,3 +370,6 @@ unifdef-y += xattr.h
  unifdef-y += xfrm.h
  
  objhdr-y += version.h
 +
 +header-y += vserver/
- header-y += wimax.h
- header-y += wimax/
 +
-diff -NurpP --minimal linux-2.6.31/include/linux/loop.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/loop.h
---- linux-2.6.31/include/linux/loop.h  2009-09-10 15:26:25.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/loop.h       2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/loop.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/loop.h
+--- linux-2.6.27.33/include/linux/loop.h       2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/loop.h  2008-10-13 14:54:20.000000000 +0200
 @@ -45,6 +45,7 @@ struct loop_device {
        struct loop_func_table *lo_encryption;
        __u32           lo_init[2];
@@ -7928,9 +9270,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/loop.h linux-2.6.31-vs2.3.0.36.
        int             (*ioctl)(struct loop_device *, int cmd, 
                                 unsigned long arg); 
  
-diff -NurpP --minimal linux-2.6.31/include/linux/magic.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/magic.h
---- linux-2.6.31/include/linux/magic.h 2009-09-10 15:26:25.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/magic.h      2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/magic.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/magic.h
+--- linux-2.6.27.33/include/linux/magic.h      2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/magic.h 2008-10-13 14:54:20.000000000 +0200
 @@ -3,7 +3,7 @@
  
  #define ADFS_SUPER_MAGIC      0xadf5
@@ -7939,8 +9281,8 @@ diff -NurpP --minimal linux-2.6.31/include/linux/magic.h linux-2.6.31-vs2.3.0.36
 +#define AFS_SUPER_MAGIC               0x5346414F
  #define AUTOFS_SUPER_MAGIC    0x0187
  #define CODA_SUPER_MAGIC      0x73757245
- #define CRAMFS_MAGIC          0x28cd3d45      /* some random number */
-@@ -36,6 +36,7 @@
+ #define EFS_SUPER_MAGIC               0x414A53
+@@ -26,6 +26,7 @@
  #define NFS_SUPER_MAGIC               0x6969
  #define OPENPROM_SUPER_MAGIC  0x9fa1
  #define PROC_SUPER_MAGIC      0x9fa0
@@ -7948,9 +9290,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/magic.h linux-2.6.31-vs2.3.0.36
  #define QNX4_SUPER_MAGIC      0x002f          /* qnx4 fs detection */
  
  #define REISERFS_SUPER_MAGIC  0x52654973      /* used by gcc */
-diff -NurpP --minimal linux-2.6.31/include/linux/major.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/major.h
---- linux-2.6.31/include/linux/major.h 2009-09-10 15:26:25.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/major.h      2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/major.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/major.h
+--- linux-2.6.27.33/include/linux/major.h      2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/major.h 2008-10-13 14:54:20.000000000 +0200
 @@ -15,6 +15,7 @@
  #define HD_MAJOR              IDE0_MAJOR
  #define PTY_SLAVE_MAJOR               3
@@ -7959,10 +9301,10 @@ diff -NurpP --minimal linux-2.6.31/include/linux/major.h linux-2.6.31-vs2.3.0.36
  #define TTYAUX_MAJOR          5
  #define LP_MAJOR              6
  #define VCS_MAJOR             7
-diff -NurpP --minimal linux-2.6.31/include/linux/mm_types.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/mm_types.h
---- linux-2.6.31/include/linux/mm_types.h      2009-09-10 15:26:25.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/mm_types.h   2009-09-10 16:11:43.000000000 +0200
-@@ -244,6 +244,7 @@ struct mm_struct {
+diff -NurpP --minimal linux-2.6.27.33/include/linux/mm_types.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/mm_types.h
+--- linux-2.6.27.33/include/linux/mm_types.h   2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/mm_types.h      2008-10-13 14:54:20.000000000 +0200
+@@ -216,6 +216,7 @@ struct mm_struct {
  
        /* Architecture-specific MM context */
        mm_context_t context;
@@ -7970,10 +9312,10 @@ diff -NurpP --minimal linux-2.6.31/include/linux/mm_types.h linux-2.6.31-vs2.3.0
  
        /* Swap token stuff */
        /*
-diff -NurpP --minimal linux-2.6.31/include/linux/mount.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/mount.h
---- linux-2.6.31/include/linux/mount.h 2009-09-10 15:26:25.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/mount.h      2009-09-10 17:14:39.000000000 +0200
-@@ -36,6 +36,9 @@ struct mnt_namespace;
+diff -NurpP --minimal linux-2.6.27.33/include/linux/mount.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/mount.h
+--- linux-2.6.27.33/include/linux/mount.h      2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/mount.h 2008-10-24 03:34:52.000000000 +0200
+@@ -37,6 +37,9 @@ struct mnt_namespace;
  #define MNT_UNBINDABLE        0x2000  /* if the vfsmount is a unbindable mount */
  #define MNT_PNODE_MASK        0x3000  /* propagation flag mask */
  
@@ -7983,17 +9325,17 @@ diff -NurpP --minimal linux-2.6.31/include/linux/mount.h linux-2.6.31-vs2.3.0.36
  struct vfsmount {
        struct list_head mnt_hash;
        struct vfsmount *mnt_parent;    /* fs we are mounted on */
-@@ -70,6 +73,7 @@ struct vfsmount {
- #else
-       int mnt_writers;
- #endif
+@@ -71,6 +74,7 @@ struct vfsmount {
+        * are held, and all mnt_writer[]s on this mount have 0 as their ->count
+        */
+       atomic_t __mnt_writers;
 +      tag_t mnt_tag;                  /* tagging used for vfsmount */
  };
  
- static inline int *get_mnt_writers_ptr(struct vfsmount *mnt)
-diff -NurpP --minimal linux-2.6.31/include/linux/net.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/net.h
---- linux-2.6.31/include/linux/net.h   2009-06-11 17:13:15.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/net.h        2009-09-10 16:11:43.000000000 +0200
+ static inline struct vfsmount *mntget(struct vfsmount *mnt)
+diff -NurpP --minimal linux-2.6.27.33/include/linux/net.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/net.h
+--- linux-2.6.27.33/include/linux/net.h        2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/net.h   2008-10-13 14:54:20.000000000 +0200
 @@ -68,6 +68,7 @@ struct net;
  #define SOCK_NOSPACE          2
  #define SOCK_PASSCRED         3
@@ -8002,10 +9344,10 @@ diff -NurpP --minimal linux-2.6.31/include/linux/net.h linux-2.6.31-vs2.3.0.36.1
  
  #ifndef ARCH_HAS_SOCKET_TYPES
  /**
-diff -NurpP --minimal linux-2.6.31/include/linux/nfs_mount.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/nfs_mount.h
---- linux-2.6.31/include/linux/nfs_mount.h     2009-03-24 14:22:43.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/nfs_mount.h  2009-09-10 16:11:43.000000000 +0200
-@@ -63,7 +63,8 @@ struct nfs_mount_data {
+diff -NurpP --minimal linux-2.6.27.33/include/linux/nfs_mount.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/nfs_mount.h
+--- linux-2.6.27.33/include/linux/nfs_mount.h  2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/nfs_mount.h     2008-10-13 14:54:20.000000000 +0200
+@@ -63,6 +63,7 @@ struct nfs_mount_data {
  #define NFS_MOUNT_SECFLAVOUR  0x2000  /* 5 */
  #define NFS_MOUNT_NORDIRPLUS  0x4000  /* 5 */
  #define NFS_MOUNT_UNSHARED    0x8000  /* 5 */
@@ -8013,11 +9355,10 @@ diff -NurpP --minimal linux-2.6.31/include/linux/nfs_mount.h linux-2.6.31-vs2.3.
 +#define NFS_MOUNT_TAGGED      0x10000 /* context tagging */
 +#define NFS_MOUNT_FLAGMASK    0x1FFFF
  
- /* The following are for internal use only */
- #define NFS_MOUNT_LOOKUP_CACHE_NONEG  0x10000
-diff -NurpP --minimal linux-2.6.31/include/linux/nsproxy.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/nsproxy.h
---- linux-2.6.31/include/linux/nsproxy.h       2009-06-11 17:13:17.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/nsproxy.h    2009-09-10 16:11:43.000000000 +0200
+ #endif
+diff -NurpP --minimal linux-2.6.27.33/include/linux/nsproxy.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/nsproxy.h
+--- linux-2.6.27.33/include/linux/nsproxy.h    2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/nsproxy.h       2008-10-13 14:54:20.000000000 +0200
 @@ -3,6 +3,7 @@
  
  #include <linux/spinlock.h>
@@ -8066,9 +9407,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/nsproxy.h linux-2.6.31-vs2.3.0.
  }
  
  #ifdef CONFIG_CGROUP_NS
-diff -NurpP --minimal linux-2.6.31/include/linux/pid.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/pid.h
---- linux-2.6.31/include/linux/pid.h   2009-03-24 14:22:43.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/pid.h        2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/pid.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/pid.h
+--- linux-2.6.27.33/include/linux/pid.h        2009-09-13 16:17:00.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/pid.h   2009-02-22 22:58:33.000000000 +0100
 @@ -8,7 +8,8 @@ enum pid_type
        PIDTYPE_PID,
        PIDTYPE_PGID,
@@ -8087,10 +9428,10 @@ diff -NurpP --minimal linux-2.6.31/include/linux/pid.h linux-2.6.31-vs2.3.0.36.1
  pid_t pid_vnr(struct pid *pid);
  
  #define do_each_pid_task(pid, type, task)                             \
-diff -NurpP --minimal linux-2.6.31/include/linux/proc_fs.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/proc_fs.h
---- linux-2.6.31/include/linux/proc_fs.h       2009-09-10 15:26:26.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/proc_fs.h    2009-09-10 16:11:43.000000000 +0200
-@@ -56,6 +56,7 @@ struct proc_dir_entry {
+diff -NurpP --minimal linux-2.6.27.33/include/linux/proc_fs.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/proc_fs.h
+--- linux-2.6.27.33/include/linux/proc_fs.h    2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/proc_fs.h       2008-10-13 14:54:20.000000000 +0200
+@@ -59,6 +59,7 @@ struct proc_dir_entry {
        nlink_t nlink;
        uid_t uid;
        gid_t gid;
@@ -8098,7 +9439,7 @@ diff -NurpP --minimal linux-2.6.31/include/linux/proc_fs.h linux-2.6.31-vs2.3.0.
        loff_t size;
        const struct inode_operations *proc_iops;
        /*
-@@ -240,12 +241,18 @@ static inline void kclist_add(struct kco
+@@ -274,12 +275,18 @@ static inline void kclist_add(struct kco
  extern void kclist_add(struct kcore_list *, void *, size_t);
  #endif
  
@@ -8117,7 +9458,7 @@ diff -NurpP --minimal linux-2.6.31/include/linux/proc_fs.h linux-2.6.31-vs2.3.0.
  };
  
  struct ctl_table_header;
-@@ -253,6 +260,7 @@ struct ctl_table;
+@@ -287,6 +294,7 @@ struct ctl_table;
  
  struct proc_inode {
        struct pid *pid;
@@ -8125,10 +9466,10 @@ diff -NurpP --minimal linux-2.6.31/include/linux/proc_fs.h linux-2.6.31-vs2.3.0.
        int fd;
        union proc_op op;
        struct proc_dir_entry *pde;
-diff -NurpP --minimal linux-2.6.31/include/linux/reiserfs_fs.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/reiserfs_fs.h
---- linux-2.6.31/include/linux/reiserfs_fs.h   2009-09-10 15:26:26.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/reiserfs_fs.h        2009-09-10 16:11:43.000000000 +0200
-@@ -899,6 +899,11 @@ struct stat_data_v1 {
+diff -NurpP --minimal linux-2.6.27.33/include/linux/reiserfs_fs.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/reiserfs_fs.h
+--- linux-2.6.27.33/include/linux/reiserfs_fs.h        2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/reiserfs_fs.h   2008-10-13 14:54:20.000000000 +0200
+@@ -837,6 +837,11 @@ struct stat_data_v1 {
  #define REISERFS_COMPR_FL     FS_COMPR_FL
  #define REISERFS_NOTAIL_FL    FS_NOTAIL_FL
  
@@ -8140,7 +9481,7 @@ diff -NurpP --minimal linux-2.6.31/include/linux/reiserfs_fs.h linux-2.6.31-vs2.
  /* persistent flags that file inherits from the parent directory */
  #define REISERFS_INHERIT_MASK ( REISERFS_IMMUTABLE_FL |       \
                                REISERFS_SYNC_FL |      \
-@@ -908,6 +913,9 @@ struct stat_data_v1 {
+@@ -846,6 +851,9 @@ struct stat_data_v1 {
                                REISERFS_COMPR_FL |     \
                                REISERFS_NOTAIL_FL )
  
@@ -8150,7 +9491,7 @@ diff -NurpP --minimal linux-2.6.31/include/linux/reiserfs_fs.h linux-2.6.31-vs2.
  /* Stat Data on disk (reiserfs version of UFS disk inode minus the
     address blocks) */
  struct stat_data {
-@@ -1989,6 +1997,7 @@ static inline void reiserfs_update_sd(st
+@@ -1911,6 +1919,7 @@ static inline void reiserfs_update_sd(st
  void sd_attrs_to_i_attrs(__u16 sd_attrs, struct inode *inode);
  void i_attrs_to_sd_attrs(struct inode *inode, __u16 * sd_attrs);
  int reiserfs_setattr(struct dentry *dentry, struct iattr *attr);
@@ -8158,29 +9499,29 @@ diff -NurpP --minimal linux-2.6.31/include/linux/reiserfs_fs.h linux-2.6.31-vs2.
  
  /* namei.c */
  void set_de_name_and_namelen(struct reiserfs_dir_entry *de);
-diff -NurpP --minimal linux-2.6.31/include/linux/reiserfs_fs_sb.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/reiserfs_fs_sb.h
---- linux-2.6.31/include/linux/reiserfs_fs_sb.h        2009-09-10 15:26:26.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/reiserfs_fs_sb.h     2009-09-10 16:11:43.000000000 +0200
-@@ -456,6 +456,7 @@ enum reiserfs_mount_options {
-       REISERFS_EXPOSE_PRIVROOT,
+diff -NurpP --minimal linux-2.6.27.33/include/linux/reiserfs_fs_sb.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/reiserfs_fs_sb.h
+--- linux-2.6.27.33/include/linux/reiserfs_fs_sb.h     2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/reiserfs_fs_sb.h        2008-10-13 14:54:20.000000000 +0200
+@@ -455,6 +455,7 @@ enum reiserfs_mount_options {
+       REISERFS_POSIXACL,
        REISERFS_BARRIER_NONE,
        REISERFS_BARRIER_FLUSH,
 +      REISERFS_TAGGED,
  
        /* Actions on error */
        REISERFS_ERROR_PANIC,
-diff -NurpP --minimal linux-2.6.31/include/linux/sched.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/sched.h
---- linux-2.6.31/include/linux/sched.h 2009-09-10 15:26:26.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/sched.h      2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/sched.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/sched.h
+--- linux-2.6.27.33/include/linux/sched.h      2009-09-13 16:17:00.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/sched.h 2009-05-15 22:57:04.000000000 +0200
 @@ -71,7 +71,6 @@ struct sched_param {
- #include <linux/path.h>
+ #include <linux/fs_struct.h>
  #include <linux/compiler.h>
  #include <linux/completion.h>
 -#include <linux/pid.h>
  #include <linux/percpu.h>
  #include <linux/topology.h>
  #include <linux/proportions.h>
-@@ -89,6 +88,7 @@ struct sched_param {
+@@ -88,6 +87,7 @@ struct sched_param {
  #include <linux/kobject.h>
  #include <linux/latencytop.h>
  #include <linux/cred.h>
@@ -8188,7 +9529,7 @@ diff -NurpP --minimal linux-2.6.31/include/linux/sched.h linux-2.6.31-vs2.3.0.36
  
  #include <asm/processor.h>
  
-@@ -182,12 +182,13 @@ extern unsigned long long time_sync_thre
+@@ -175,12 +175,13 @@ extern unsigned long long time_sync_thre
  #define TASK_UNINTERRUPTIBLE  2
  #define __TASK_STOPPED                4
  #define __TASK_TRACED         8
@@ -8206,7 +9547,7 @@ diff -NurpP --minimal linux-2.6.31/include/linux/sched.h linux-2.6.31-vs2.3.0.36
  
  /* Convenience macros for the sake of set_task_state */
  #define TASK_KILLABLE         (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE)
-@@ -383,25 +384,28 @@ extern void arch_unmap_area_topdown(stru
+@@ -358,25 +359,27 @@ extern void arch_unmap_area_topdown(stru
   * The mm counters are not protected by its page_table_lock,
   * so must be incremented atomically.
   */
@@ -8215,12 +9556,12 @@ diff -NurpP --minimal linux-2.6.31/include/linux/sched.h linux-2.6.31-vs2.3.0.36
 -#define add_mm_counter(mm, member, value) atomic_long_add(value, &(mm)->_##member)
 -#define inc_mm_counter(mm, member) atomic_long_inc(&(mm)->_##member)
 -#define dec_mm_counter(mm, member) atomic_long_dec(&(mm)->_##member)
+-
 +#define __set_mm_counter(mm, member, value) \
 +      atomic_long_set(&(mm)->_##member, value)
 +#define get_mm_counter(mm, member) \
 +      ((unsigned long)atomic_long_read(&(mm)->_##member))
- #else  /* !USE_SPLIT_PTLOCKS */
+ #else  /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */
  /*
   * The mm counters are protected by its page_table_lock,
   * so can be incremented directly.
@@ -8232,7 +9573,7 @@ diff -NurpP --minimal linux-2.6.31/include/linux/sched.h linux-2.6.31-vs2.3.0.36
 -#define inc_mm_counter(mm, member) (mm)->_##member++
 -#define dec_mm_counter(mm, member) (mm)->_##member--
  
- #endif /* !USE_SPLIT_PTLOCKS */
+ #endif /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */
  
 +#define set_mm_counter(mm, member, value) \
 +      vx_ ## member ## pages_sub((mm), (get_mm_counter(mm, member) - value))
@@ -8244,7 +9585,7 @@ diff -NurpP --minimal linux-2.6.31/include/linux/sched.h linux-2.6.31-vs2.3.0.36
  #define get_mm_rss(mm)                                        \
        (get_mm_counter(mm, file_rss) + get_mm_counter(mm, anon_rss))
  #define update_hiwater_rss(mm)        do {                    \
-@@ -1183,7 +1187,9 @@ struct task_struct {
+@@ -1048,7 +1051,9 @@ struct task_struct {
        const struct sched_class *sched_class;
        struct sched_entity se;
        struct sched_rt_entity rt;
@@ -8255,7 +9596,7 @@ diff -NurpP --minimal linux-2.6.31/include/linux/sched.h linux-2.6.31-vs2.3.0.36
  #ifdef CONFIG_PREEMPT_NOTIFIERS
        /* list of struct preempt_notifier: */
        struct hlist_head preempt_notifiers;
-@@ -1335,6 +1341,14 @@ struct task_struct {
+@@ -1200,6 +1205,14 @@ struct task_struct {
  #endif
        seccomp_t seccomp;
  
@@ -8270,9 +9611,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/sched.h linux-2.6.31-vs2.3.0.36
  /* Thread group tracking */
        u32 parent_exec_id;
        u32 self_exec_id;
-@@ -1559,6 +1573,11 @@ struct pid_namespace;
- pid_t __task_pid_nr_ns(struct task_struct *task, enum pid_type type,
-                       struct pid_namespace *ns);
+@@ -1386,6 +1399,11 @@ struct pid_namespace;
+  * see also pid_nr() etc in include/linux/pid.h
+  */
  
 +#include <linux/vserver/base.h>
 +#include <linux/vserver/context.h>
@@ -8282,17 +9623,16 @@ diff -NurpP --minimal linux-2.6.31/include/linux/sched.h linux-2.6.31-vs2.3.0.36
  static inline pid_t task_pid_nr(struct task_struct *tsk)
  {
        return tsk->pid;
-@@ -1572,7 +1591,8 @@ static inline pid_t task_pid_nr_ns(struc
+@@ -1395,7 +1413,7 @@ pid_t task_pid_nr_ns(struct task_struct 
  
  static inline pid_t task_pid_vnr(struct task_struct *tsk)
  {
--      return __task_pid_nr_ns(tsk, PIDTYPE_PID, NULL);
-+      // return __task_pid_nr_ns(tsk, PIDTYPE_PID, NULL);
-+      return vx_map_pid(__task_pid_nr_ns(tsk, PIDTYPE_PID, NULL));
+-      return pid_vnr(task_pid(tsk));
++      return vx_map_pid(pid_vnr(task_pid(tsk)));
  }
  
  
-@@ -1585,7 +1605,7 @@ pid_t task_tgid_nr_ns(struct task_struct
+@@ -1408,7 +1426,7 @@ pid_t task_tgid_nr_ns(struct task_struct
  
  static inline pid_t task_tgid_vnr(struct task_struct *tsk)
  {
@@ -8301,9 +9641,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/sched.h linux-2.6.31-vs2.3.0.36
  }
  
  
-diff -NurpP --minimal linux-2.6.31/include/linux/shmem_fs.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/shmem_fs.h
---- linux-2.6.31/include/linux/shmem_fs.h      2009-09-10 15:26:26.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/shmem_fs.h   2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/shmem_fs.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/shmem_fs.h
+--- linux-2.6.27.33/include/linux/shmem_fs.h   2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/shmem_fs.h      2008-10-13 14:54:20.000000000 +0200
 @@ -8,6 +8,9 @@
  
  #define SHMEM_NR_DIRECT 16
@@ -8314,9 +9654,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/shmem_fs.h linux-2.6.31-vs2.3.0
  struct shmem_inode_info {
        spinlock_t              lock;
        unsigned long           flags;
-diff -NurpP --minimal linux-2.6.31/include/linux/stat.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/stat.h
---- linux-2.6.31/include/linux/stat.h  2008-12-25 00:26:37.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/stat.h       2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/stat.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/stat.h
+--- linux-2.6.27.33/include/linux/stat.h       2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/stat.h  2008-10-13 14:54:20.000000000 +0200
 @@ -66,6 +66,7 @@ struct kstat {
        unsigned int    nlink;
        uid_t           uid;
@@ -8325,9 +9665,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/stat.h linux-2.6.31-vs2.3.0.36.
        dev_t           rdev;
        loff_t          size;
        struct timespec  atime;
-diff -NurpP --minimal linux-2.6.31/include/linux/sunrpc/auth.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/sunrpc/auth.h
---- linux-2.6.31/include/linux/sunrpc/auth.h   2008-12-25 00:26:37.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/sunrpc/auth.h        2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/sunrpc/auth.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/sunrpc/auth.h
+--- linux-2.6.27.33/include/linux/sunrpc/auth.h        2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/sunrpc/auth.h   2008-10-13 14:54:20.000000000 +0200
 @@ -25,6 +25,7 @@
  struct auth_cred {
        uid_t   uid;
@@ -8336,9 +9676,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/sunrpc/auth.h linux-2.6.31-vs2.
        struct group_info *group_info;
        unsigned char machine_cred : 1;
  };
-diff -NurpP --minimal linux-2.6.31/include/linux/sunrpc/clnt.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/sunrpc/clnt.h
---- linux-2.6.31/include/linux/sunrpc/clnt.h   2009-09-10 15:26:26.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/sunrpc/clnt.h        2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/sunrpc/clnt.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/sunrpc/clnt.h
+--- linux-2.6.27.33/include/linux/sunrpc/clnt.h        2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/sunrpc/clnt.h   2008-10-13 14:54:20.000000000 +0200
 @@ -43,7 +43,8 @@ struct rpc_clnt {
        unsigned int            cl_softrtry : 1,/* soft timeouts */
                                cl_discrtry : 1,/* disconnect before retry */
@@ -8349,10 +9689,10 @@ diff -NurpP --minimal linux-2.6.31/include/linux/sunrpc/clnt.h linux-2.6.31-vs2.
  
        struct rpc_rtt *        cl_rtt;         /* RTO estimator data */
        const struct rpc_timeout *cl_timeout;   /* Timeout strategy */
-diff -NurpP --minimal linux-2.6.31/include/linux/syscalls.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/syscalls.h
---- linux-2.6.31/include/linux/syscalls.h      2009-09-10 15:26:26.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/syscalls.h   2009-09-10 16:11:43.000000000 +0200
-@@ -428,6 +428,8 @@ asmlinkage long sys_symlink(const char _
+diff -NurpP --minimal linux-2.6.27.33/include/linux/syscalls.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/syscalls.h
+--- linux-2.6.27.33/include/linux/syscalls.h   2009-09-13 16:17:00.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/syscalls.h      2009-02-22 22:58:33.000000000 +0100
+@@ -364,6 +364,8 @@ asmlinkage long sys_symlink(const char _
  asmlinkage long sys_unlink(const char __user *pathname);
  asmlinkage long sys_rename(const char __user *oldname,
                                const char __user *newname);
@@ -8361,9 +9701,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/syscalls.h linux-2.6.31-vs2.3.0
  asmlinkage long sys_chmod(const char __user *filename, mode_t mode);
  asmlinkage long sys_fchmod(unsigned int fd, mode_t mode);
  
-diff -NurpP --minimal linux-2.6.31/include/linux/sysctl.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/sysctl.h
---- linux-2.6.31/include/linux/sysctl.h        2009-06-11 17:13:18.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/sysctl.h     2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/sysctl.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/sysctl.h
+--- linux-2.6.27.33/include/linux/sysctl.h     2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/sysctl.h        2008-10-13 14:54:20.000000000 +0200
 @@ -70,6 +70,7 @@ enum
        CTL_ABI=9,              /* Binary emulation */
        CTL_CPU=10,             /* CPU stuff (speed scaling, etc) */
@@ -8380,9 +9720,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/sysctl.h linux-2.6.31-vs2.3.0.3
  
        KERN_SPARC_REBOOT=21,   /* reboot command on Sparc */
        KERN_CTLALTDEL=22,      /* int: allow ctl-alt-del to reboot */
-diff -NurpP --minimal linux-2.6.31/include/linux/sysfs.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/sysfs.h
---- linux-2.6.31/include/linux/sysfs.h 2008-12-25 00:26:37.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/sysfs.h      2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/sysfs.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/sysfs.h
+--- linux-2.6.27.33/include/linux/sysfs.h      2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/sysfs.h 2008-10-13 14:54:20.000000000 +0200
 @@ -17,6 +17,8 @@
  #include <linux/list.h>
  #include <asm/atomic.h>
@@ -8392,10 +9732,10 @@ diff -NurpP --minimal linux-2.6.31/include/linux/sysfs.h linux-2.6.31-vs2.3.0.36
  struct kobject;
  struct module;
  
-diff -NurpP --minimal linux-2.6.31/include/linux/time.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/time.h
---- linux-2.6.31/include/linux/time.h  2009-09-10 15:26:26.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/time.h       2009-09-10 16:11:43.000000000 +0200
-@@ -205,6 +205,9 @@ static __always_inline void timespec_add
+diff -NurpP --minimal linux-2.6.27.33/include/linux/time.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/time.h
+--- linux-2.6.27.33/include/linux/time.h       2009-09-13 16:17:00.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/time.h  2009-02-03 17:59:04.000000000 +0100
+@@ -180,6 +180,9 @@ static __always_inline void timespec_add
        a->tv_sec += __iter_div_u64_rem(a->tv_nsec + ns, NSEC_PER_SEC, &ns);
        a->tv_nsec = ns;
  }
@@ -8405,10 +9745,10 @@ diff -NurpP --minimal linux-2.6.31/include/linux/time.h linux-2.6.31-vs2.3.0.36.
  #endif /* __KERNEL__ */
  
  #define NFDBITS                       __NFDBITS
-diff -NurpP --minimal linux-2.6.31/include/linux/types.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/types.h
---- linux-2.6.31/include/linux/types.h 2009-09-10 15:26:26.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/types.h      2009-09-10 16:11:43.000000000 +0200
-@@ -37,6 +37,9 @@ typedef __kernel_uid32_t     uid_t;
+diff -NurpP --minimal linux-2.6.27.33/include/linux/types.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/types.h
+--- linux-2.6.27.33/include/linux/types.h      2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/types.h 2008-10-13 14:54:20.000000000 +0200
+@@ -36,6 +36,9 @@ typedef __kernel_uid32_t     uid_t;
  typedef __kernel_gid32_t      gid_t;
  typedef __kernel_uid16_t        uid16_t;
  typedef __kernel_gid16_t        gid16_t;
@@ -8418,9 +9758,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/types.h linux-2.6.31-vs2.3.0.36
  
  typedef unsigned long         uintptr_t;
  
-diff -NurpP --minimal linux-2.6.31/include/linux/vroot.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vroot.h
---- linux-2.6.31/include/linux/vroot.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vroot.h      2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vroot.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vroot.h
+--- linux-2.6.27.33/include/linux/vroot.h      1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vroot.h 2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,51 @@
 +
 +/*
@@ -8473,9 +9813,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vroot.h linux-2.6.31-vs2.3.0.36
 +#define VROOT_CLR_DEV         0x5601
 +
 +#endif /* _LINUX_VROOT_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vs_base.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_base.h
---- linux-2.6.31/include/linux/vs_base.h       1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_base.h    2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vs_base.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_base.h
+--- linux-2.6.27.33/include/linux/vs_base.h    1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_base.h       2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,10 @@
 +#ifndef _VS_BASE_H
 +#define _VS_BASE_H
@@ -8487,9 +9827,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vs_base.h linux-2.6.31-vs2.3.0.
 +#else
 +#warning duplicate inclusion
 +#endif
-diff -NurpP --minimal linux-2.6.31/include/linux/vs_context.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_context.h
---- linux-2.6.31/include/linux/vs_context.h    1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_context.h 2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vs_context.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_context.h
+--- linux-2.6.27.33/include/linux/vs_context.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_context.h    2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,227 @@
 +#ifndef _VS_CONTEXT_H
 +#define _VS_CONTEXT_H
@@ -8718,9 +10058,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vs_context.h linux-2.6.31-vs2.3
 +#else
 +#warning duplicate inclusion
 +#endif
-diff -NurpP --minimal linux-2.6.31/include/linux/vs_cowbl.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_cowbl.h
---- linux-2.6.31/include/linux/vs_cowbl.h      1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_cowbl.h   2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vs_cowbl.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_cowbl.h
+--- linux-2.6.27.33/include/linux/vs_cowbl.h   1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_cowbl.h      2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,47 @@
 +#ifndef _VS_COWBL_H
 +#define _VS_COWBL_H
@@ -8769,9 +10109,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vs_cowbl.h linux-2.6.31-vs2.3.0
 +#else
 +#warning duplicate inclusion
 +#endif
-diff -NurpP --minimal linux-2.6.31/include/linux/vs_cvirt.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_cvirt.h
---- linux-2.6.31/include/linux/vs_cvirt.h      1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_cvirt.h   2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vs_cvirt.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_cvirt.h
+--- linux-2.6.27.33/include/linux/vs_cvirt.h   1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_cvirt.h      2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,50 @@
 +#ifndef _VS_CVIRT_H
 +#define _VS_CVIRT_H
@@ -8823,9 +10163,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vs_cvirt.h linux-2.6.31-vs2.3.0
 +#else
 +#warning duplicate inclusion
 +#endif
-diff -NurpP --minimal linux-2.6.31/include/linux/vs_device.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_device.h
---- linux-2.6.31/include/linux/vs_device.h     1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_device.h  2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vs_device.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_device.h
+--- linux-2.6.27.33/include/linux/vs_device.h  1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_device.h     2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,45 @@
 +#ifndef _VS_DEVICE_H
 +#define _VS_DEVICE_H
@@ -8872,9 +10212,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vs_device.h linux-2.6.31-vs2.3.
 +#else
 +#warning duplicate inclusion
 +#endif
-diff -NurpP --minimal linux-2.6.31/include/linux/vs_dlimit.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_dlimit.h
---- linux-2.6.31/include/linux/vs_dlimit.h     1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_dlimit.h  2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vs_dlimit.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_dlimit.h
+--- linux-2.6.27.33/include/linux/vs_dlimit.h  1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_dlimit.h     2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,211 @@
 +#ifndef _VS_DLIMIT_H
 +#define _VS_DLIMIT_H
@@ -9087,9 +10427,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vs_dlimit.h linux-2.6.31-vs2.3.
 +#else
 +#warning duplicate inclusion
 +#endif
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/base.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/base.h
---- linux-2.6.31/include/linux/vserver/base.h  1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/base.h       2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/base.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/base.h
+--- linux-2.6.27.33/include/linux/vserver/base.h       1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/base.h  2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,157 @@
 +#ifndef _VX_BASE_H
 +#define _VX_BASE_H
@@ -9228,10 +10568,10 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/base.h linux-2.6.31-vs2
 +#define vx_cap_raised(v, c, f)        cap_raised(vx_info_mbcaps(v, c), f)
 +
 +#define vx_capable(b, c) (capable(b) || \
-+      (cap_raised(current_cap(), b) && vx_ccaps(c)))
++      (cap_raised(current->cap_effective, b) && vx_ccaps(c)))
 +
 +#define nx_capable(b, c) (capable(b) || \
-+      (cap_raised(current_cap(), b) && nx_ncaps(c)))
++      (cap_raised(current->cap_effective, b) && nx_ncaps(c)))
 +
 +#define vx_current_initpid(n) \
 +      (current->vx_info && \
@@ -9248,9 +10588,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/base.h linux-2.6.31-vs2
 +#define nx_info_state(n, m)   (__nx_state(n) & (m))
 +
 +#endif
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/cacct_cmd.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/cacct_cmd.h
---- linux-2.6.31/include/linux/vserver/cacct_cmd.h     1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/cacct_cmd.h  2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/cacct_cmd.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/cacct_cmd.h
+--- linux-2.6.27.33/include/linux/vserver/cacct_cmd.h  1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/cacct_cmd.h     2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,23 @@
 +#ifndef _VX_CACCT_CMD_H
 +#define _VX_CACCT_CMD_H
@@ -9275,9 +10615,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/cacct_cmd.h linux-2.6.3
 +
 +#endif        /* __KERNEL__ */
 +#endif        /* _VX_CACCT_CMD_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/cacct_def.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/cacct_def.h
---- linux-2.6.31/include/linux/vserver/cacct_def.h     1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/cacct_def.h  2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/cacct_def.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/cacct_def.h
+--- linux-2.6.27.33/include/linux/vserver/cacct_def.h  1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/cacct_def.h     2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,43 @@
 +#ifndef _VX_CACCT_DEF_H
 +#define _VX_CACCT_DEF_H
@@ -9322,9 +10662,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/cacct_def.h linux-2.6.3
 +#endif
 +
 +#endif        /* _VX_CACCT_DEF_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/cacct.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/cacct.h
---- linux-2.6.31/include/linux/vserver/cacct.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/cacct.h      2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/cacct.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/cacct.h
+--- linux-2.6.27.33/include/linux/vserver/cacct.h      1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/cacct.h 2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,15 @@
 +#ifndef _VX_CACCT_H
 +#define _VX_CACCT_H
@@ -9341,9 +10681,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/cacct.h linux-2.6.31-vs
 +};
 +
 +#endif        /* _VX_CACCT_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/cacct_int.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/cacct_int.h
---- linux-2.6.31/include/linux/vserver/cacct_int.h     1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/cacct_int.h  2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/cacct_int.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/cacct_int.h
+--- linux-2.6.27.33/include/linux/vserver/cacct_int.h  1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/cacct_int.h     2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,21 @@
 +#ifndef _VX_CACCT_INT_H
 +#define _VX_CACCT_INT_H
@@ -9366,9 +10706,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/cacct_int.h linux-2.6.3
 +
 +#endif        /* __KERNEL__ */
 +#endif        /* _VX_CACCT_INT_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/check.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/check.h
---- linux-2.6.31/include/linux/vserver/check.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/check.h      2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/check.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/check.h
+--- linux-2.6.27.33/include/linux/vserver/check.h      1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/check.h 2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,89 @@
 +#ifndef _VS_CHECK_H
 +#define _VS_CHECK_H
@@ -9459,9 +10799,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/check.h linux-2.6.31-vs
 +#define nx_weak_check(c, m)   ((m) ? nx_check(c, m) : 1)
 +
 +#endif
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/context_cmd.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/context_cmd.h
---- linux-2.6.31/include/linux/vserver/context_cmd.h   1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/context_cmd.h        2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/context_cmd.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/context_cmd.h
+--- linux-2.6.27.33/include/linux/vserver/context_cmd.h        1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/context_cmd.h   2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,128 @@
 +#ifndef _VX_CONTEXT_CMD_H
 +#define _VX_CONTEXT_CMD_H
@@ -9591,10 +10931,10 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/context_cmd.h linux-2.6
 +
 +#endif        /* __KERNEL__ */
 +#endif        /* _VX_CONTEXT_CMD_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/context.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/context.h
---- linux-2.6.31/include/linux/vserver/context.h       1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/context.h    2009-09-10 16:11:43.000000000 +0200
-@@ -0,0 +1,180 @@
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/context.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/context.h
+--- linux-2.6.27.33/include/linux/vserver/context.h    1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/context.h       2009-03-09 15:36:36.000000000 +0100
+@@ -0,0 +1,179 @@
 +#ifndef _VX_CONTEXT_H
 +#define _VX_CONTEXT_H
 +
@@ -9670,7 +11010,6 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/context.h linux-2.6.31-
 +#define VXC_ADMIN_CLOOP               0x00400000
 +
 +#define VXC_KTHREAD           0x01000000
-+#define VXC_NAMESPACE         0x02000000
 +
 +
 +#ifdef        __KERNEL__
@@ -9775,9 +11114,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/context.h linux-2.6.31-
 +
 +#endif        /* __KERNEL__ */
 +#endif        /* _VX_CONTEXT_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/cvirt_cmd.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/cvirt_cmd.h
---- linux-2.6.31/include/linux/vserver/cvirt_cmd.h     1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/cvirt_cmd.h  2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/cvirt_cmd.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/cvirt_cmd.h
+--- linux-2.6.27.33/include/linux/vserver/cvirt_cmd.h  1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/cvirt_cmd.h     2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,53 @@
 +#ifndef _VX_CVIRT_CMD_H
 +#define _VX_CVIRT_CMD_H
@@ -9832,9 +11171,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/cvirt_cmd.h linux-2.6.3
 +
 +#endif        /* __KERNEL__ */
 +#endif        /* _VX_CVIRT_CMD_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/cvirt_def.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/cvirt_def.h
---- linux-2.6.31/include/linux/vserver/cvirt_def.h     1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/cvirt_def.h  2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/cvirt_def.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/cvirt_def.h
+--- linux-2.6.27.33/include/linux/vserver/cvirt_def.h  1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/cvirt_def.h     2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,80 @@
 +#ifndef _VX_CVIRT_DEF_H
 +#define _VX_CVIRT_DEF_H
@@ -9916,9 +11255,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/cvirt_def.h linux-2.6.3
 +#endif
 +
 +#endif        /* _VX_CVIRT_DEF_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/cvirt.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/cvirt.h
---- linux-2.6.31/include/linux/vserver/cvirt.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/cvirt.h      2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/cvirt.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/cvirt.h
+--- linux-2.6.27.33/include/linux/vserver/cvirt.h      1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/cvirt.h 2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,20 @@
 +#ifndef _VX_CVIRT_H
 +#define _VX_CVIRT_H
@@ -9940,9 +11279,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/cvirt.h linux-2.6.31-vs
 +
 +#endif        /* __KERNEL__ */
 +#endif        /* _VX_CVIRT_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/debug_cmd.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/debug_cmd.h
---- linux-2.6.31/include/linux/vserver/debug_cmd.h     1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/debug_cmd.h  2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/debug_cmd.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/debug_cmd.h
+--- linux-2.6.27.33/include/linux/vserver/debug_cmd.h  1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/debug_cmd.h     2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,58 @@
 +#ifndef _VX_DEBUG_CMD_H
 +#define _VX_DEBUG_CMD_H
@@ -10002,9 +11341,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/debug_cmd.h linux-2.6.3
 +
 +#endif        /* __KERNEL__ */
 +#endif        /* _VX_DEBUG_CMD_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/debug.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/debug.h
---- linux-2.6.31/include/linux/vserver/debug.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/debug.h      2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/debug.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/debug.h
+--- linux-2.6.27.33/include/linux/vserver/debug.h      1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/debug.h 2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,127 @@
 +#ifndef _VX_DEBUG_H
 +#define _VX_DEBUG_H
@@ -10133,9 +11472,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/debug.h linux-2.6.31-vs
 +
 +
 +#endif /* _VX_DEBUG_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/device_cmd.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/device_cmd.h
---- linux-2.6.31/include/linux/vserver/device_cmd.h    1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/device_cmd.h 2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/device_cmd.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/device_cmd.h
+--- linux-2.6.27.33/include/linux/vserver/device_cmd.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/device_cmd.h    2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,44 @@
 +#ifndef _VX_DEVICE_CMD_H
 +#define _VX_DEVICE_CMD_H
@@ -10181,9 +11520,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/device_cmd.h linux-2.6.
 +
 +#endif        /* __KERNEL__ */
 +#endif        /* _VX_DEVICE_CMD_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/device_def.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/device_def.h
---- linux-2.6.31/include/linux/vserver/device_def.h    1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/device_def.h 2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/device_def.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/device_def.h
+--- linux-2.6.27.33/include/linux/vserver/device_def.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/device_def.h    2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,17 @@
 +#ifndef _VX_DEVICE_DEF_H
 +#define _VX_DEVICE_DEF_H
@@ -10202,9 +11541,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/device_def.h linux-2.6.
 +};
 +
 +#endif        /* _VX_DEVICE_DEF_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/device.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/device.h
---- linux-2.6.31/include/linux/vserver/device.h        1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/device.h     2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/device.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/device.h
+--- linux-2.6.27.33/include/linux/vserver/device.h     1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/device.h        2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,15 @@
 +#ifndef _VX_DEVICE_H
 +#define _VX_DEVICE_H
@@ -10221,9 +11560,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/device.h linux-2.6.31-v
 +#else /* _VX_DEVICE_H */
 +#warning duplicate inclusion
 +#endif        /* _VX_DEVICE_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/dlimit_cmd.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/dlimit_cmd.h
---- linux-2.6.31/include/linux/vserver/dlimit_cmd.h    1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/dlimit_cmd.h 2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/dlimit_cmd.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/dlimit_cmd.h
+--- linux-2.6.27.33/include/linux/vserver/dlimit_cmd.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/dlimit_cmd.h    2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,74 @@
 +#ifndef _VX_DLIMIT_CMD_H
 +#define _VX_DLIMIT_CMD_H
@@ -10299,9 +11638,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/dlimit_cmd.h linux-2.6.
 +
 +#endif        /* __KERNEL__ */
 +#endif        /* _VX_DLIMIT_CMD_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/dlimit.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/dlimit.h
---- linux-2.6.31/include/linux/vserver/dlimit.h        1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/dlimit.h     2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/dlimit.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/dlimit.h
+--- linux-2.6.27.33/include/linux/vserver/dlimit.h     1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/dlimit.h        2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,54 @@
 +#ifndef _VX_DLIMIT_H
 +#define _VX_DLIMIT_H
@@ -10357,10 +11696,10 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/dlimit.h linux-2.6.31-v
 +#else /* _VX_DLIMIT_H */
 +#warning duplicate inclusion
 +#endif        /* _VX_DLIMIT_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/global.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/global.h
---- linux-2.6.31/include/linux/vserver/global.h        1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/global.h     2009-09-10 16:11:43.000000000 +0200
-@@ -0,0 +1,19 @@
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/global.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/global.h
+--- linux-2.6.27.33/include/linux/vserver/global.h     1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/global.h        2008-10-13 14:54:20.000000000 +0200
+@@ -0,0 +1,20 @@
 +#ifndef _VX_GLOBAL_H
 +#define _VX_GLOBAL_H
 +
@@ -10375,14 +11714,15 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/global.h linux-2.6.31-v
 +extern atomic_t vs_global_fs;
 +extern atomic_t vs_global_mnt_ns;
 +extern atomic_t vs_global_uts_ns;
++extern atomic_t vs_global_ipc_ns;
 +extern atomic_t vs_global_user_ns;
 +extern atomic_t vs_global_pid_ns;
 +
 +
 +#endif /* _VX_GLOBAL_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/history.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/history.h
---- linux-2.6.31/include/linux/vserver/history.h       1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/history.h    2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/history.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/history.h
+--- linux-2.6.27.33/include/linux/vserver/history.h    1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/history.h       2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,197 @@
 +#ifndef _VX_HISTORY_H
 +#define _VX_HISTORY_H
@@ -10581,9 +11921,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/history.h linux-2.6.31-
 +#endif /* CONFIG_VSERVER_HISTORY */
 +
 +#endif /* _VX_HISTORY_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/inode_cmd.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/inode_cmd.h
---- linux-2.6.31/include/linux/vserver/inode_cmd.h     1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/inode_cmd.h  2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/inode_cmd.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/inode_cmd.h
+--- linux-2.6.27.33/include/linux/vserver/inode_cmd.h  1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/inode_cmd.h     2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,59 @@
 +#ifndef _VX_INODE_CMD_H
 +#define _VX_INODE_CMD_H
@@ -10644,9 +11984,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/inode_cmd.h linux-2.6.3
 +
 +#endif        /* __KERNEL__ */
 +#endif        /* _VX_INODE_CMD_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/inode.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/inode.h
---- linux-2.6.31/include/linux/vserver/inode.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/inode.h      2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/inode.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/inode.h
+--- linux-2.6.27.33/include/linux/vserver/inode.h      1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/inode.h 2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,38 @@
 +#ifndef _VX_INODE_H
 +#define _VX_INODE_H
@@ -10686,9 +12026,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/inode.h linux-2.6.31-vs
 +#else /* _VX_INODE_H */
 +#warning duplicate inclusion
 +#endif        /* _VX_INODE_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/Kbuild linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/Kbuild
---- linux-2.6.31/include/linux/vserver/Kbuild  1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/Kbuild       2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/Kbuild linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/Kbuild
+--- linux-2.6.27.33/include/linux/vserver/Kbuild       1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/Kbuild  2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,8 @@
 +
 +unifdef-y += context_cmd.h network_cmd.h space_cmd.h \
@@ -10698,10 +12038,10 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/Kbuild linux-2.6.31-vs2
 +
 +unifdef-y += switch.h network.h monitor.h inode.h device.h
 +
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/limit_cmd.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/limit_cmd.h
---- linux-2.6.31/include/linux/vserver/limit_cmd.h     1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/limit_cmd.h  2009-09-10 16:11:43.000000000 +0200
-@@ -0,0 +1,71 @@
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/limit_cmd.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/limit_cmd.h
+--- linux-2.6.27.33/include/linux/vserver/limit_cmd.h  1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/limit_cmd.h     2009-01-04 02:28:31.000000000 +0100
+@@ -0,0 +1,69 @@
 +#ifndef _VX_LIMIT_CMD_H
 +#define _VX_LIMIT_CMD_H
 +
@@ -10711,7 +12051,6 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/limit_cmd.h linux-2.6.3
 +#define VCMD_get_rlimit               VC_CMD(RLIMIT, 1, 0)
 +#define VCMD_set_rlimit               VC_CMD(RLIMIT, 2, 0)
 +#define VCMD_get_rlimit_mask  VC_CMD(RLIMIT, 3, 0)
-+#define VCMD_reset_hits               VC_CMD(RLIMIT, 7, 0)
 +#define VCMD_reset_minmax     VC_CMD(RLIMIT, 9, 0)
 +
 +struct        vcmd_ctx_rlimit_v0 {
@@ -10759,7 +12098,6 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/limit_cmd.h linux-2.6.3
 +extern int vc_get_rlimit_mask(uint32_t, void __user *);
 +extern int vc_get_rlimit(struct vx_info *, void __user *);
 +extern int vc_set_rlimit(struct vx_info *, void __user *);
-+extern int vc_reset_hits(struct vx_info *, void __user *);
 +extern int vc_reset_minmax(struct vx_info *, void __user *);
 +
 +extern int vc_rlimit_stat(struct vx_info *, void __user *);
@@ -10773,9 +12111,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/limit_cmd.h linux-2.6.3
 +
 +#endif        /* __KERNEL__ */
 +#endif        /* _VX_LIMIT_CMD_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/limit_def.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/limit_def.h
---- linux-2.6.31/include/linux/vserver/limit_def.h     1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/limit_def.h  2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/limit_def.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/limit_def.h
+--- linux-2.6.27.33/include/linux/vserver/limit_def.h  1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/limit_def.h     2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,47 @@
 +#ifndef _VX_LIMIT_DEF_H
 +#define _VX_LIMIT_DEF_H
@@ -10824,9 +12162,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/limit_def.h linux-2.6.3
 +#endif
 +
 +#endif        /* _VX_LIMIT_DEF_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/limit.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/limit.h
---- linux-2.6.31/include/linux/vserver/limit.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/limit.h      2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/limit.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/limit.h
+--- linux-2.6.27.33/include/linux/vserver/limit.h      1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/limit.h 2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,70 @@
 +#ifndef _VX_LIMIT_H
 +#define _VX_LIMIT_H
@@ -10898,9 +12236,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/limit.h linux-2.6.31-vs
 +
 +#endif        /* __KERNEL__ */
 +#endif        /* _VX_LIMIT_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/limit_int.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/limit_int.h
---- linux-2.6.31/include/linux/vserver/limit_int.h     1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/limit_int.h  2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/limit_int.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/limit_int.h
+--- linux-2.6.27.33/include/linux/vserver/limit_int.h  1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/limit_int.h     2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,198 @@
 +#ifndef _VX_LIMIT_INT_H
 +#define _VX_LIMIT_INT_H
@@ -11100,9 +12438,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/limit_int.h linux-2.6.3
 +
 +#endif        /* __KERNEL__ */
 +#endif        /* _VX_LIMIT_INT_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/monitor.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/monitor.h
---- linux-2.6.31/include/linux/vserver/monitor.h       1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/monitor.h    2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/monitor.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/monitor.h
+--- linux-2.6.27.33/include/linux/vserver/monitor.h    1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/monitor.h       2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,96 @@
 +#ifndef _VX_MONITOR_H
 +#define _VX_MONITOR_H
@@ -11200,9 +12538,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/monitor.h linux-2.6.31-
 +
 +
 +#endif /* _VX_MONITOR_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/network_cmd.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/network_cmd.h
---- linux-2.6.31/include/linux/vserver/network_cmd.h   1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/network_cmd.h        2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/network_cmd.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/network_cmd.h
+--- linux-2.6.27.33/include/linux/vserver/network_cmd.h        1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/network_cmd.h   2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,150 @@
 +#ifndef _VX_NETWORK_CMD_H
 +#define _VX_NETWORK_CMD_H
@@ -11354,9 +12692,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/network_cmd.h linux-2.6
 +
 +#endif        /* __KERNEL__ */
 +#endif        /* _VX_CONTEXT_CMD_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/network.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/network.h
---- linux-2.6.31/include/linux/vserver/network.h       1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/network.h    2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/network.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/network.h
+--- linux-2.6.27.33/include/linux/vserver/network.h    1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/network.h       2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,146 @@
 +#ifndef _VX_NETWORK_H
 +#define _VX_NETWORK_H
@@ -11504,9 +12842,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/network.h linux-2.6.31-
 +
 +#endif        /* __KERNEL__ */
 +#endif        /* _VX_NETWORK_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/percpu.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/percpu.h
---- linux-2.6.31/include/linux/vserver/percpu.h        1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/percpu.h     2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/percpu.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/percpu.h
+--- linux-2.6.27.33/include/linux/vserver/percpu.h     1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/percpu.h        2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,14 @@
 +#ifndef _VX_PERCPU_H
 +#define _VX_PERCPU_H
@@ -11522,9 +12860,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/percpu.h linux-2.6.31-v
 +#define       PERCPU_PERCTX   (sizeof(struct _vx_percpu))
 +
 +#endif        /* _VX_PERCPU_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/pid.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/pid.h
---- linux-2.6.31/include/linux/vserver/pid.h   1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/pid.h        2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/pid.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/pid.h
+--- linux-2.6.27.33/include/linux/vserver/pid.h        1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/pid.h   2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,51 @@
 +#ifndef _VSERVER_PID_H
 +#define _VSERVER_PID_H
@@ -11577,9 +12915,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/pid.h linux-2.6.31-vs2.
 +}
 +
 +#endif
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/sched_cmd.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/sched_cmd.h
---- linux-2.6.31/include/linux/vserver/sched_cmd.h     1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/sched_cmd.h  2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/sched_cmd.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/sched_cmd.h
+--- linux-2.6.27.33/include/linux/vserver/sched_cmd.h  1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/sched_cmd.h     2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,108 @@
 +#ifndef _VX_SCHED_CMD_H
 +#define _VX_SCHED_CMD_H
@@ -11689,9 +13027,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/sched_cmd.h linux-2.6.3
 +
 +#endif        /* __KERNEL__ */
 +#endif        /* _VX_SCHED_CMD_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/sched_def.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/sched_def.h
---- linux-2.6.31/include/linux/vserver/sched_def.h     1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/sched_def.h  2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/sched_def.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/sched_def.h
+--- linux-2.6.27.33/include/linux/vserver/sched_def.h  1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/sched_def.h     2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,68 @@
 +#ifndef _VX_SCHED_DEF_H
 +#define _VX_SCHED_DEF_H
@@ -11761,9 +13099,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/sched_def.h linux-2.6.3
 +#endif
 +
 +#endif        /* _VX_SCHED_DEF_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/sched.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/sched.h
---- linux-2.6.31/include/linux/vserver/sched.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/sched.h      2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/sched.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/sched.h
+--- linux-2.6.27.33/include/linux/vserver/sched.h      1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/sched.h 2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,26 @@
 +#ifndef _VX_SCHED_H
 +#define _VX_SCHED_H
@@ -11791,9 +13129,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/sched.h linux-2.6.31-vs
 +#else /* _VX_SCHED_H */
 +#warning duplicate inclusion
 +#endif        /* _VX_SCHED_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/signal_cmd.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/signal_cmd.h
---- linux-2.6.31/include/linux/vserver/signal_cmd.h    1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/signal_cmd.h 2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/signal_cmd.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/signal_cmd.h
+--- linux-2.6.27.33/include/linux/vserver/signal_cmd.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/signal_cmd.h    2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,43 @@
 +#ifndef _VX_SIGNAL_CMD_H
 +#define _VX_SIGNAL_CMD_H
@@ -11838,9 +13176,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/signal_cmd.h linux-2.6.
 +
 +#endif        /* __KERNEL__ */
 +#endif        /* _VX_SIGNAL_CMD_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/signal.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/signal.h
---- linux-2.6.31/include/linux/vserver/signal.h        1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/signal.h     2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/signal.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/signal.h
+--- linux-2.6.27.33/include/linux/vserver/signal.h     1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/signal.h        2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,14 @@
 +#ifndef _VX_SIGNAL_H
 +#define _VX_SIGNAL_H
@@ -11856,9 +13194,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/signal.h linux-2.6.31-v
 +#else /* _VX_SIGNAL_H */
 +#warning duplicate inclusion
 +#endif        /* _VX_SIGNAL_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/space_cmd.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/space_cmd.h
---- linux-2.6.31/include/linux/vserver/space_cmd.h     1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/space_cmd.h  2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/space_cmd.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/space_cmd.h
+--- linux-2.6.27.33/include/linux/vserver/space_cmd.h  1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/space_cmd.h     2008-10-31 03:49:36.000000000 +0100
 @@ -0,0 +1,38 @@
 +#ifndef _VX_SPACE_CMD_H
 +#define _VX_SPACE_CMD_H
@@ -11898,9 +13236,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/space_cmd.h linux-2.6.3
 +
 +#endif        /* __KERNEL__ */
 +#endif        /* _VX_SPACE_CMD_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/space.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/space.h
---- linux-2.6.31/include/linux/vserver/space.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/space.h      2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/space.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/space.h
+--- linux-2.6.27.33/include/linux/vserver/space.h      1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/space.h 2008-10-31 04:02:02.000000000 +0100
 @@ -0,0 +1,12 @@
 +#ifndef _VX_SPACE_H
 +#define _VX_SPACE_H
@@ -11914,9 +13252,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/space.h linux-2.6.31-vs
 +#else /* _VX_SPACE_H */
 +#warning duplicate inclusion
 +#endif        /* _VX_SPACE_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/switch.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/switch.h
---- linux-2.6.31/include/linux/vserver/switch.h        1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/switch.h     2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/switch.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/switch.h
+--- linux-2.6.27.33/include/linux/vserver/switch.h     1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/switch.h        2008-11-22 20:32:00.000000000 +0100
 @@ -0,0 +1,98 @@
 +#ifndef _VX_SWITCH_H
 +#define _VX_SWITCH_H
@@ -12016,9 +13354,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/switch.h linux-2.6.31-v
 +
 +#endif        /* _VX_SWITCH_H */
 +
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/tag_cmd.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/tag_cmd.h
---- linux-2.6.31/include/linux/vserver/tag_cmd.h       1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/tag_cmd.h    2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/tag_cmd.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/tag_cmd.h
+--- linux-2.6.27.33/include/linux/vserver/tag_cmd.h    1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/tag_cmd.h       2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,22 @@
 +#ifndef _VX_TAG_CMD_H
 +#define _VX_TAG_CMD_H
@@ -12042,9 +13380,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/tag_cmd.h linux-2.6.31-
 +
 +#endif        /* __KERNEL__ */
 +#endif        /* _VX_TAG_CMD_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vserver/tag.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/tag.h
---- linux-2.6.31/include/linux/vserver/tag.h   1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vserver/tag.h        2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vserver/tag.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/tag.h
+--- linux-2.6.27.33/include/linux/vserver/tag.h        1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vserver/tag.h   2008-10-24 03:34:52.000000000 +0200
 @@ -0,0 +1,143 @@
 +#ifndef _DX_TAG_H
 +#define _DX_TAG_H
@@ -12189,9 +13527,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vserver/tag.h linux-2.6.31-vs2.
 +#endif
 +
 +#endif /* _DX_TAG_H */
-diff -NurpP --minimal linux-2.6.31/include/linux/vs_inet6.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_inet6.h
---- linux-2.6.31/include/linux/vs_inet6.h      1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_inet6.h   2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vs_inet6.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_inet6.h
+--- linux-2.6.27.33/include/linux/vs_inet6.h   1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_inet6.h      2008-11-16 17:35:20.000000000 +0100
 @@ -0,0 +1,246 @@
 +#ifndef _VS_INET6_H
 +#define _VS_INET6_H
@@ -12202,8 +13540,8 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vs_inet6.h linux-2.6.31-vs2.3.0
 +
 +#include <net/ipv6.h>
 +
-+#define NXAV6(a)      &(a)->ip, &(a)->mask, (a)->prefix, (a)->type
-+#define NXAV6_FMT     "[%pI6/%pI6/%d:%04x]"
++#define NXAV6(a)      NIP6((a)->ip), NIP6((a)->mask), (a)->prefix, (a)->type
++#define NXAV6_FMT     "[" NIP6_FMT "/" NIP6_FMT "/%d:%04x]"
 +
 +
 +#ifdef        CONFIG_IPV6
@@ -12226,8 +13564,8 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vs_inet6.h linux-2.6.31-vs2.3.0
 +              break;
 +      }
 +      vxdprintk(VXD_CBIT(net, 0),
-+              "v6_addr_match(%p" NXAV6_FMT ",%pI6,%04x) = %d",
-+              nxa, NXAV6(nxa), addr, mask, ret);
++              "v6_addr_match(%p" NXAV6_FMT ", " NIP6_FMT ", %04x) = %d",
++              nxa, NXAV6(nxa), NIP6(*addr), mask, ret);
 +      return ret;
 +}
 +
@@ -12246,8 +13584,8 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vs_inet6.h linux-2.6.31-vs2.3.0
 +      ret = 0;
 +out:
 +      vxdprintk(VXD_CBIT(net, 0),
-+              "v6_addr_in_nx_info(%p[#%u],%pI6,%04x) = %d",
-+              nxi, nxi ? nxi->nx_id : 0, addr, mask, ret);
++              "v6_addr_in_nx_info(%p[#%u]," NIP6_FMT ",%04x) = %d",
++              nxi, nxi ? nxi->nx_id : 0, NIP6(*addr), mask, ret);
 +      return ret;
 +}
 +
@@ -12307,8 +13645,8 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vs_inet6.h linux-2.6.31-vs2.3.0
 +      struct in6_addr *saddr = inet6_rcv_saddr(sk);
 +
 +      vxdprintk(VXD_CBIT(net, 5),
-+              "__v6_addr_in_socket(%p," NXAV6_FMT ") %p:%pI6 %p;%lx",
-+              sk, NXAV6(nxa), nxi, saddr, sk->sk_socket,
++              "__v6_addr_in_socket(%p," NXAV6_FMT ") %p:" NIP6_FMT " %p;%lx",
++              sk, NXAV6(nxa), nxi, NIP6(*saddr), sk->sk_socket,
 +              (sk->sk_socket?sk->sk_socket->flags:0));
 +
 +      if (!ipv6_addr_any(saddr)) {    /* direct address match */
@@ -12439,9 +13777,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vs_inet6.h linux-2.6.31-vs2.3.0
 +#else
 +#warning duplicate inclusion
 +#endif
-diff -NurpP --minimal linux-2.6.31/include/linux/vs_inet.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_inet.h
---- linux-2.6.31/include/linux/vs_inet.h       1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_inet.h    2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vs_inet.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_inet.h
+--- linux-2.6.27.33/include/linux/vs_inet.h    1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_inet.h       2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,342 @@
 +#ifndef _VS_INET_H
 +#define _VS_INET_H
@@ -12785,9 +14123,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vs_inet.h linux-2.6.31-vs2.3.0.
 +#else
 +// #warning duplicate inclusion
 +#endif
-diff -NurpP --minimal linux-2.6.31/include/linux/vs_limit.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_limit.h
---- linux-2.6.31/include/linux/vs_limit.h      1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_limit.h   2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vs_limit.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_limit.h
+--- linux-2.6.27.33/include/linux/vs_limit.h   1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_limit.h      2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,140 @@
 +#ifndef _VS_LIMIT_H
 +#define _VS_LIMIT_H
@@ -12929,9 +14267,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vs_limit.h linux-2.6.31-vs2.3.0
 +#else
 +#warning duplicate inclusion
 +#endif
-diff -NurpP --minimal linux-2.6.31/include/linux/vs_memory.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_memory.h
---- linux-2.6.31/include/linux/vs_memory.h     1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_memory.h  2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vs_memory.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_memory.h
+--- linux-2.6.27.33/include/linux/vs_memory.h  1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_memory.h     2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,159 @@
 +#ifndef _VS_MEMORY_H
 +#define _VS_MEMORY_H
@@ -13092,9 +14430,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vs_memory.h linux-2.6.31-vs2.3.
 +#else
 +#warning duplicate inclusion
 +#endif
-diff -NurpP --minimal linux-2.6.31/include/linux/vs_network.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_network.h
---- linux-2.6.31/include/linux/vs_network.h    1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_network.h 2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vs_network.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_network.h
+--- linux-2.6.27.33/include/linux/vs_network.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_network.h    2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,169 @@
 +#ifndef _NX_VS_NETWORK_H
 +#define _NX_VS_NETWORK_H
@@ -13265,9 +14603,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vs_network.h linux-2.6.31-vs2.3
 +#else
 +#warning duplicate inclusion
 +#endif
-diff -NurpP --minimal linux-2.6.31/include/linux/vs_pid.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_pid.h
---- linux-2.6.31/include/linux/vs_pid.h        1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_pid.h     2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vs_pid.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_pid.h
+--- linux-2.6.27.33/include/linux/vs_pid.h     1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_pid.h        2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,95 @@
 +#ifndef _VS_PID_H
 +#define _VS_PID_H
@@ -13364,9 +14702,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vs_pid.h linux-2.6.31-vs2.3.0.3
 +#else
 +#warning duplicate inclusion
 +#endif
-diff -NurpP --minimal linux-2.6.31/include/linux/vs_sched.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_sched.h
---- linux-2.6.31/include/linux/vs_sched.h      1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_sched.h   2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vs_sched.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_sched.h
+--- linux-2.6.27.33/include/linux/vs_sched.h   1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_sched.h      2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,110 @@
 +#ifndef _VS_SCHED_H
 +#define _VS_SCHED_H
@@ -13478,9 +14816,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vs_sched.h linux-2.6.31-vs2.3.0
 +#else
 +#warning duplicate inclusion
 +#endif
-diff -NurpP --minimal linux-2.6.31/include/linux/vs_socket.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_socket.h
---- linux-2.6.31/include/linux/vs_socket.h     1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_socket.h  2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vs_socket.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_socket.h
+--- linux-2.6.27.33/include/linux/vs_socket.h  1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_socket.h     2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,67 @@
 +#ifndef _VS_SOCKET_H
 +#define _VS_SOCKET_H
@@ -13549,9 +14887,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vs_socket.h linux-2.6.31-vs2.3.
 +#else
 +#warning duplicate inclusion
 +#endif
-diff -NurpP --minimal linux-2.6.31/include/linux/vs_tag.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_tag.h
---- linux-2.6.31/include/linux/vs_tag.h        1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_tag.h     2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vs_tag.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_tag.h
+--- linux-2.6.27.33/include/linux/vs_tag.h     1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_tag.h        2008-10-24 03:34:52.000000000 +0200
 @@ -0,0 +1,47 @@
 +#ifndef _VS_TAG_H
 +#define _VS_TAG_H
@@ -13600,9 +14938,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vs_tag.h linux-2.6.31-vs2.3.0.3
 +#else
 +#warning duplicate inclusion
 +#endif
-diff -NurpP --minimal linux-2.6.31/include/linux/vs_time.h linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_time.h
---- linux-2.6.31/include/linux/vs_time.h       1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/linux/vs_time.h    2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/linux/vs_time.h linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_time.h
+--- linux-2.6.27.33/include/linux/vs_time.h    1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/include/linux/vs_time.h       2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,19 @@
 +#ifndef _VS_TIME_H
 +#define _VS_TIME_H
@@ -13623,9 +14961,9 @@ diff -NurpP --minimal linux-2.6.31/include/linux/vs_time.h linux-2.6.31-vs2.3.0.
 +#else
 +#warning duplicate inclusion
 +#endif
-diff -NurpP --minimal linux-2.6.31/include/net/addrconf.h linux-2.6.31-vs2.3.0.36.14-pre8/include/net/addrconf.h
---- linux-2.6.31/include/net/addrconf.h        2009-06-11 17:13:18.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/net/addrconf.h     2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/net/addrconf.h linux-2.6.27.33-vs2.3.0.36.6/include/net/addrconf.h
+--- linux-2.6.27.33/include/net/addrconf.h     2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/net/addrconf.h        2008-10-13 14:54:20.000000000 +0200
 @@ -84,7 +84,8 @@ extern int                   ipv6_dev_get_saddr(struct n
                                               struct net_device *dev,
                                               const struct in6_addr *daddr,
@@ -13636,9 +14974,9 @@ diff -NurpP --minimal linux-2.6.31/include/net/addrconf.h linux-2.6.31-vs2.3.0.3
  extern int                    ipv6_get_lladdr(struct net_device *dev,
                                                struct in6_addr *addr,
                                                unsigned char banned_flags);
-diff -NurpP --minimal linux-2.6.31/include/net/af_unix.h linux-2.6.31-vs2.3.0.36.14-pre8/include/net/af_unix.h
---- linux-2.6.31/include/net/af_unix.h 2008-12-25 00:26:37.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/net/af_unix.h      2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/include/net/af_unix.h linux-2.6.27.33-vs2.3.0.36.6/include/net/af_unix.h
+--- linux-2.6.27.33/include/net/af_unix.h      2009-09-13 16:17:00.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/net/af_unix.h 2009-02-03 17:59:04.000000000 +0100
 @@ -4,6 +4,7 @@
  #include <linux/socket.h>
  #include <linux/un.h>
@@ -13647,10 +14985,52 @@ diff -NurpP --minimal linux-2.6.31/include/net/af_unix.h linux-2.6.31-vs2.3.0.36
  #include <net/sock.h>
  
  extern void unix_inflight(struct file *fp);
-diff -NurpP --minimal linux-2.6.31/include/net/inet_timewait_sock.h linux-2.6.31-vs2.3.0.36.14-pre8/include/net/inet_timewait_sock.h
---- linux-2.6.31/include/net/inet_timewait_sock.h      2009-09-10 15:26:27.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/net/inet_timewait_sock.h   2009-09-10 16:11:43.000000000 +0200
-@@ -117,6 +117,10 @@ struct inet_timewait_sock {
+diff -NurpP --minimal linux-2.6.27.33/include/net/inet_sock.h linux-2.6.27.33-vs2.3.0.36.6/include/net/inet_sock.h
+--- linux-2.6.27.33/include/net/inet_sock.h    2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/net/inet_sock.h       2008-10-13 14:54:20.000000000 +0200
+@@ -24,7 +24,7 @@
+ #include <net/flow.h>
+ #include <net/sock.h>
+ #include <net/request_sock.h>
+-#include <net/route.h>
++// #include <net/route.h>
+ #include <net/netns/hash.h>
+ /** struct ip_options - IP Options
+@@ -195,11 +195,6 @@ static inline int inet_sk_ehashfn(const 
+ }
+-static inline int inet_iif(const struct sk_buff *skb)
+-{
+-      return skb->rtable->rt_iif;
+-}
+-
+ static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops)
+ {
+       struct request_sock *req = reqsk_alloc(ops);
+diff -NurpP --minimal linux-2.6.27.33/include/net/inet_timewait_sock.h linux-2.6.27.33-vs2.3.0.36.6/include/net/inet_timewait_sock.h
+--- linux-2.6.27.33/include/net/inet_timewait_sock.h   2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/net/inet_timewait_sock.h      2008-10-13 14:54:20.000000000 +0200
+@@ -15,15 +15,14 @@
+ #ifndef _INET_TIMEWAIT_SOCK_
+ #define _INET_TIMEWAIT_SOCK_
++// #include <net/inet_sock.h>
++#include <net/sock.h>
+ #include <linux/list.h>
+ #include <linux/module.h>
+ #include <linux/timer.h>
+ #include <linux/types.h>
+ #include <linux/workqueue.h>
+-
+-#include <net/inet_sock.h>
+-#include <net/sock.h>
+ #include <net/tcp_states.h>
+ #include <net/timewait_sock.h>
+@@ -116,6 +115,10 @@ struct inet_timewait_sock {
  #define tw_hash                       __tw_common.skc_hash
  #define tw_prot                       __tw_common.skc_prot
  #define tw_net                        __tw_common.skc_net
@@ -13661,10 +15041,30 @@ diff -NurpP --minimal linux-2.6.31/include/net/inet_timewait_sock.h linux-2.6.31
        int                     tw_timeout;
        volatile unsigned char  tw_substate;
        /* 3 bits hole, try to pack */
-diff -NurpP --minimal linux-2.6.31/include/net/route.h linux-2.6.31-vs2.3.0.36.14-pre8/include/net/route.h
---- linux-2.6.31/include/net/route.h   2009-09-10 15:26:27.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/net/route.h        2009-09-10 16:11:43.000000000 +0200
-@@ -135,6 +135,9 @@ static inline void ip_rt_put(struct rtab
+diff -NurpP --minimal linux-2.6.27.33/include/net/route.h linux-2.6.27.33-vs2.3.0.36.6/include/net/route.h
+--- linux-2.6.27.33/include/net/route.h        2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/net/route.h   2008-10-13 14:54:20.000000000 +0200
+@@ -28,6 +28,7 @@
+ #include <net/inetpeer.h>
+ #include <net/flow.h>
+ #include <net/sock.h>
++// #include <linux/in.h>
+ #include <linux/in_route.h>
+ #include <linux/rtnetlink.h>
+ #include <linux/route.h>
+@@ -85,6 +86,11 @@ struct ip_rt_acct
+       __u32   i_packets;
+ };
++static inline int inet_iif(const struct sk_buff *skb)
++{
++      return skb->rtable->rt_iif;
++}
++
+ struct rt_cache_stat 
+ {
+         unsigned int in_hit;
+@@ -135,6 +141,9 @@ static inline void ip_rt_put(struct rtab
                dst_release(&rt->u.dst);
  }
  
@@ -13674,7 +15074,7 @@ diff -NurpP --minimal linux-2.6.31/include/net/route.h linux-2.6.31-vs2.3.0.36.1
  #define IPTOS_RT_MASK (IPTOS_TOS_MASK & ~3)
  
  extern const __u8 ip_tos2prio[16];
-@@ -144,6 +147,9 @@ static inline char rt_tos2priority(u8 to
+@@ -144,6 +153,9 @@ static inline char rt_tos2priority(u8 to
        return ip_tos2prio[IPTOS_TOS(tos)>>1];
  }
  
@@ -13684,16 +15084,13 @@ diff -NurpP --minimal linux-2.6.31/include/net/route.h linux-2.6.31-vs2.3.0.36.1
  static inline int ip_route_connect(struct rtable **rp, __be32 dst,
                                   __be32 src, u32 tos, int oif, u8 protocol,
                                   __be16 sport, __be16 dport, struct sock *sk,
-@@ -161,11 +167,24 @@ static inline int ip_route_connect(struc
+@@ -161,7 +173,21 @@ static inline int ip_route_connect(struc
  
        int err;
        struct net *net = sock_net(sk);
-+      struct nx_info *nx_info = current->nx_info;
-       if (inet_sk(sk)->transparent)
-               fl.flags |= FLOWI_FLAG_ANYSRC;
 -      if (!dst || !src) {
++      struct nx_info *nx_info = current->nx_info;
++
 +      if (sk)
 +              nx_info = sk->sk_nx_info;
 +
@@ -13710,10 +15107,10 @@ diff -NurpP --minimal linux-2.6.31/include/net/route.h linux-2.6.31-vs2.3.0.36.1
                err = __ip_route_output_key(net, rp, &fl);
                if (err)
                        return err;
-diff -NurpP --minimal linux-2.6.31/include/net/sock.h linux-2.6.31-vs2.3.0.36.14-pre8/include/net/sock.h
---- linux-2.6.31/include/net/sock.h    2009-09-10 15:26:27.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/include/net/sock.h 2009-09-10 17:15:39.000000000 +0200
-@@ -139,6 +139,10 @@ struct sock_common {
+diff -NurpP --minimal linux-2.6.27.33/include/net/sock.h linux-2.6.27.33-vs2.3.0.36.6/include/net/sock.h
+--- linux-2.6.27.33/include/net/sock.h 2009-09-13 16:17:00.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/include/net/sock.h    2009-03-25 14:32:29.000000000 +0100
+@@ -128,6 +128,10 @@ struct sock_common {
  #ifdef CONFIG_NET_NS
        struct net              *skc_net;
  #endif
@@ -13724,29 +15121,29 @@ diff -NurpP --minimal linux-2.6.31/include/net/sock.h linux-2.6.31-vs2.3.0.36.14
  };
  
  /**
-@@ -225,6 +229,10 @@ struct sock {
- #define sk_bind_node          __sk_common.skc_bind_node
+@@ -211,6 +215,10 @@ struct sock {
+ #define sk_hash                       __sk_common.skc_hash
  #define sk_prot                       __sk_common.skc_prot
  #define sk_net                        __sk_common.skc_net
 +#define sk_xid                        __sk_common.skc_xid
 +#define sk_vx_info            __sk_common.skc_vx_info
 +#define sk_nid                        __sk_common.skc_nid
 +#define sk_nx_info            __sk_common.skc_nx_info
-       kmemcheck_bitfield_begin(flags);
        unsigned char           sk_shutdown : 2,
                                sk_no_check : 2,
-diff -NurpP --minimal linux-2.6.31/init/main.c linux-2.6.31-vs2.3.0.36.14-pre8/init/main.c
---- linux-2.6.31/init/main.c   2009-09-10 15:26:27.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/init/main.c        2009-09-10 16:11:43.000000000 +0200
-@@ -69,6 +69,7 @@
- #include <linux/kmemcheck.h>
- #include <linux/kmemtrace.h>
- #include <trace/boot.h>
+                               sk_userlocks : 4;
+diff -NurpP --minimal linux-2.6.27.33/init/main.c linux-2.6.27.33-vs2.3.0.36.6/init/main.c
+--- linux-2.6.27.33/init/main.c        2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/init/main.c   2008-10-13 14:54:20.000000000 +0200
+@@ -60,6 +60,7 @@
+ #include <linux/sched.h>
+ #include <linux/signal.h>
+ #include <linux/idr.h>
 +#include <linux/vserver/percpu.h>
  
  #include <asm/io.h>
  #include <asm/bugs.h>
-@@ -381,12 +382,14 @@ EXPORT_SYMBOL(__per_cpu_offset);
+@@ -391,12 +392,14 @@ EXPORT_SYMBOL(__per_cpu_offset);
  
  static void __init setup_per_cpu_areas(void)
  {
@@ -13763,19 +15160,19 @@ diff -NurpP --minimal linux-2.6.31/init/main.c linux-2.6.31-vs2.3.0.36.14-pre8/i
        ptr = alloc_bootmem_pages(size * nr_possible_cpus);
  
        for_each_possible_cpu(i) {
-diff -NurpP --minimal linux-2.6.31/ipc/mqueue.c linux-2.6.31-vs2.3.0.36.14-pre8/ipc/mqueue.c
---- linux-2.6.31/ipc/mqueue.c  2009-09-10 15:26:27.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/ipc/mqueue.c       2009-09-10 16:31:20.000000000 +0200
-@@ -33,6 +33,8 @@
+diff -NurpP --minimal linux-2.6.27.33/ipc/mqueue.c linux-2.6.27.33-vs2.3.0.36.6/ipc/mqueue.c
+--- linux-2.6.27.33/ipc/mqueue.c       2009-09-13 16:17:00.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/ipc/mqueue.c  2009-02-22 22:58:33.000000000 +0100
+@@ -31,6 +31,8 @@
+ #include <linux/mutex.h>
+ #include <linux/nsproxy.h>
  #include <linux/pid.h>
- #include <linux/ipc_namespace.h>
- #include <linux/ima.h>
 +#include <linux/vs_context.h>
 +#include <linux/vs_limit.h>
  
  #include <net/sock.h>
  #include "util.h"
-@@ -66,6 +68,7 @@ struct mqueue_inode_info {
+@@ -71,6 +73,7 @@ struct mqueue_inode_info {
        struct sigevent notify;
        struct pid* notify_owner;
        struct user_struct *user;       /* user who created, for accounting */
@@ -13783,23 +15180,23 @@ diff -NurpP --minimal linux-2.6.31/ipc/mqueue.c linux-2.6.31-vs2.3.0.36.14-pre8/
        struct sock *notify_sock;
        struct sk_buff *notify_cookie;
  
-@@ -125,6 +128,7 @@ static struct inode *mqueue_get_inode(st
-               if (S_ISREG(mode)) {
+@@ -119,6 +122,7 @@ static struct inode *mqueue_get_inode(st
                        struct mqueue_inode_info *info;
                        struct task_struct *p = current;
+                       struct user_struct *u = p->user;
 +                      struct vx_info *vxi = p->vx_info;
                        unsigned long mq_bytes, mq_msg_tblsz;
  
                        inode->i_fop = &mqueue_file_operations;
-@@ -139,6 +143,7 @@ static struct inode *mqueue_get_inode(st
+@@ -133,6 +137,7 @@ static struct inode *mqueue_get_inode(st
                        info->notify_owner = NULL;
                        info->qsize = 0;
                        info->user = NULL;      /* set when all is ok */
 +                      info->vxi = NULL;
                        memset(&info->attr, 0, sizeof(info->attr));
-                       info->attr.mq_maxmsg = ipc_ns->mq_msg_max;
-                       info->attr.mq_msgsize = ipc_ns->mq_msgsize_max;
-@@ -153,22 +158,26 @@ static struct inode *mqueue_get_inode(st
+                       info->attr.mq_maxmsg = DFLT_MSGMAX;
+                       info->attr.mq_msgsize = DFLT_MSGSIZEMAX;
+@@ -147,22 +152,26 @@ static struct inode *mqueue_get_inode(st
                        spin_lock(&mq_lock);
                        if (u->mq_bytes + mq_bytes < u->mq_bytes ||
                            u->mq_bytes + mq_bytes >
@@ -13827,7 +15224,7 @@ diff -NurpP --minimal linux-2.6.31/ipc/mqueue.c linux-2.6.31-vs2.3.0.36.14-pre8/
                } else if (S_ISDIR(mode)) {
                        inc_nlink(inode);
                        /* Some things misbehave if size == 0 on a directory */
-@@ -269,8 +278,11 @@ static void mqueue_delete_inode(struct i
+@@ -253,10 +262,14 @@ static void mqueue_delete_inode(struct i
                   (info->attr.mq_maxmsg * info->attr.mq_msgsize));
        user = info->user;
        if (user) {
@@ -13836,20 +15233,15 @@ diff -NurpP --minimal linux-2.6.31/ipc/mqueue.c linux-2.6.31-vs2.3.0.36.14-pre8/
                spin_lock(&mq_lock);
                user->mq_bytes -= mq_bytes;
 +              vx_ipcmsg_sub(vxi, user, mq_bytes);
-               /*
-                * get_ns_from_inode() ensures that the
-                * (ipc_ns = sb->s_fs_info) is either a valid ipc_ns
-@@ -280,6 +292,7 @@ static void mqueue_delete_inode(struct i
-               if (ipc_ns)
-                       ipc_ns->mq_queues_count--;
+               queues_count--;
                spin_unlock(&mq_lock);
 +              put_vx_info(vxi);
                free_uid(user);
        }
-       if (ipc_ns)
-diff -NurpP --minimal linux-2.6.31/ipc/msg.c linux-2.6.31-vs2.3.0.36.14-pre8/ipc/msg.c
---- linux-2.6.31/ipc/msg.c     2009-03-24 14:22:44.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/ipc/msg.c  2009-09-10 16:11:43.000000000 +0200
+ }
+diff -NurpP --minimal linux-2.6.27.33/ipc/msg.c linux-2.6.27.33-vs2.3.0.36.6/ipc/msg.c
+--- linux-2.6.27.33/ipc/msg.c  2009-09-13 16:17:00.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/ipc/msg.c     2009-02-03 17:59:04.000000000 +0100
 @@ -38,6 +38,7 @@
  #include <linux/rwsem.h>
  #include <linux/nsproxy.h>
@@ -13866,21 +15258,37 @@ diff -NurpP --minimal linux-2.6.31/ipc/msg.c linux-2.6.31-vs2.3.0.36.14-pre8/ipc
  
        msq->q_perm.security = NULL;
        retval = security_msg_queue_alloc(msq);
-diff -NurpP --minimal linux-2.6.31/ipc/namespace.c linux-2.6.31-vs2.3.0.36.14-pre8/ipc/namespace.c
---- linux-2.6.31/ipc/namespace.c       2009-09-10 15:26:27.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/ipc/namespace.c    2009-09-10 16:11:43.000000000 +0200
-@@ -11,6 +11,8 @@
+diff -NurpP --minimal linux-2.6.27.33/ipc/namespace.c linux-2.6.27.33-vs2.3.0.36.6/ipc/namespace.c
+--- linux-2.6.27.33/ipc/namespace.c    2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/ipc/namespace.c       2008-10-13 14:54:20.000000000 +0200
+@@ -9,6 +9,8 @@
+ #include <linux/rcupdate.h>
+ #include <linux/nsproxy.h>
  #include <linux/slab.h>
- #include <linux/fs.h>
- #include <linux/mount.h>
 +#include <linux/vs_base.h>
 +#include <linux/vserver/global.h>
  
  #include "util.h"
  
-diff -NurpP --minimal linux-2.6.31/ipc/sem.c linux-2.6.31-vs2.3.0.36.14-pre8/ipc/sem.c
---- linux-2.6.31/ipc/sem.c     2009-09-10 15:26:27.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/ipc/sem.c  2009-09-10 16:11:43.000000000 +0200
+@@ -35,6 +37,7 @@ static struct ipc_namespace *clone_ipc_n
+       register_ipcns_notifier(ns);
+       kref_init(&ns->kref);
++      atomic_inc(&vs_global_ipc_ns);
+       return ns;
+ }
+@@ -101,6 +104,7 @@ void free_ipc_ns(struct kref *kref)
+       sem_exit_ns(ns);
+       msg_exit_ns(ns);
+       shm_exit_ns(ns);
++      atomic_dec(&vs_global_ipc_ns);
+       kfree(ns);
+       atomic_dec(&nr_ipc_ns);
+diff -NurpP --minimal linux-2.6.27.33/ipc/sem.c linux-2.6.27.33-vs2.3.0.36.6/ipc/sem.c
+--- linux-2.6.27.33/ipc/sem.c  2009-09-13 16:17:00.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/ipc/sem.c     2009-03-31 19:53:55.000000000 +0200
 @@ -83,6 +83,8 @@
  #include <linux/rwsem.h>
  #include <linux/nsproxy.h>
@@ -13918,19 +15326,19 @@ diff -NurpP --minimal linux-2.6.31/ipc/sem.c linux-2.6.31-vs2.3.0.36.14-pre8/ipc
        security_sem_free(sma);
        ipc_rcu_putref(sma);
  }
-diff -NurpP --minimal linux-2.6.31/ipc/shm.c linux-2.6.31-vs2.3.0.36.14-pre8/ipc/shm.c
---- linux-2.6.31/ipc/shm.c     2009-09-10 15:26:27.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/ipc/shm.c  2009-09-10 16:11:43.000000000 +0200
-@@ -40,6 +40,8 @@
+diff -NurpP --minimal linux-2.6.27.33/ipc/shm.c linux-2.6.27.33-vs2.3.0.36.6/ipc/shm.c
+--- linux-2.6.27.33/ipc/shm.c  2009-09-13 16:17:00.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/ipc/shm.c     2009-02-22 22:58:33.000000000 +0100
+@@ -39,6 +39,8 @@
+ #include <linux/nsproxy.h>
  #include <linux/mount.h>
  #include <linux/ipc_namespace.h>
- #include <linux/ima.h>
 +#include <linux/vs_context.h>
 +#include <linux/vs_limit.h>
  
  #include <asm/uaccess.h>
  
-@@ -169,7 +171,12 @@ static void shm_open(struct vm_area_stru
+@@ -168,7 +170,12 @@ static void shm_open(struct vm_area_stru
   */
  static void shm_destroy(struct ipc_namespace *ns, struct shmid_kernel *shp)
  {
@@ -13944,7 +15352,7 @@ diff -NurpP --minimal linux-2.6.31/ipc/shm.c linux-2.6.31-vs2.3.0.36.14-pre8/ipc
        shm_rmid(ns, shp);
        shm_unlock(shp);
        if (!is_file_hugepages(shp->shm_file))
-@@ -179,6 +186,7 @@ static void shm_destroy(struct ipc_names
+@@ -178,6 +185,7 @@ static void shm_destroy(struct ipc_names
                                                shp->mlock_user);
        fput (shp->shm_file);
        security_shm_free(shp);
@@ -13952,7 +15360,7 @@ diff -NurpP --minimal linux-2.6.31/ipc/shm.c linux-2.6.31-vs2.3.0.36.14-pre8/ipc
        ipc_rcu_putref(shp);
  }
  
-@@ -349,11 +357,15 @@ static int newseg(struct ipc_namespace *
+@@ -347,11 +355,15 @@ static int newseg(struct ipc_namespace *
        if (ns->shm_tot + numpages > ns->shm_ctlall)
                return -ENOSPC;
  
@@ -13968,7 +15376,7 @@ diff -NurpP --minimal linux-2.6.31/ipc/shm.c linux-2.6.31-vs2.3.0.36.14-pre8/ipc
        shp->shm_perm.mode = (shmflg & S_IRWXUGO);
        shp->mlock_user = NULL;
  
-@@ -407,6 +419,7 @@ static int newseg(struct ipc_namespace *
+@@ -404,6 +416,7 @@ static int newseg(struct ipc_namespace *
        ns->shm_tot += numpages;
        error = shp->shm_perm.id;
        shm_unlock(shp);
@@ -13976,26 +15384,27 @@ diff -NurpP --minimal linux-2.6.31/ipc/shm.c linux-2.6.31-vs2.3.0.36.14-pre8/ipc
        return error;
  
  no_id:
-diff -NurpP --minimal linux-2.6.31/kernel/capability.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/capability.c
---- linux-2.6.31/kernel/capability.c   2009-03-24 14:22:44.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/capability.c        2009-09-10 16:11:43.000000000 +0200
-@@ -14,6 +14,7 @@
+diff -NurpP --minimal linux-2.6.27.33/kernel/capability.c linux-2.6.27.33-vs2.3.0.36.6/kernel/capability.c
+--- linux-2.6.27.33/kernel/capability.c        2009-09-13 16:17:00.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/capability.c   2009-02-03 17:59:04.000000000 +0100
+@@ -13,6 +13,7 @@
  #include <linux/security.h>
  #include <linux/syscalls.h>
  #include <linux/pid_namespace.h>
 +#include <linux/vs_context.h>
  #include <asm/uaccess.h>
- #include "cred-internals.h"
-@@ -122,6 +123,7 @@ static int cap_validate_magic(cap_user_h
-       return 0;
- }
  
-+
  /*
-  * The only thing that can change the capabilities of the current
-  * process is the current process. As such, we can't be in this code
-@@ -289,6 +291,8 @@ error:
+@@ -166,6 +167,8 @@ static inline int cap_set_pg(int pgrp_nr
+       pgrp = find_vpid(pgrp_nr);
+       do_each_pid_task(pgrp, PIDTYPE_PGID, g) {
++              if (!vx_check(g->xid, VS_ADMIN_P | VS_IDENT))
++                      continue;
+               target = g;
+               while_each_thread(g, target) {
+                       if (!security_capset_check(target, effective,
+@@ -486,6 +489,8 @@ SYSCALL_DEFINE2(capset, cap_user_header_
        return ret;
  }
  
@@ -14004,20 +15413,20 @@ diff -NurpP --minimal linux-2.6.31/kernel/capability.c linux-2.6.31-vs2.3.0.36.1
  /**
   * capable - Determine if the current task has a superior capability in effect
   * @cap: The capability to be tested for
-@@ -301,6 +305,9 @@ error:
+@@ -498,6 +503,9 @@ SYSCALL_DEFINE2(capset, cap_user_header_
   */
  int capable(int cap)
  {
 +      /* here for now so we don't require task locking */
 +      if (vs_check_bit(VXC_CAP_MASK, cap) && !vx_mcaps(1L << cap))
 +              return 0;
-       if (unlikely(!cap_valid(cap))) {
-               printk(KERN_CRIT "capable() called with invalid cap=%u\n", cap);
-               BUG();
-diff -NurpP --minimal linux-2.6.31/kernel/compat.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/compat.c
---- linux-2.6.31/kernel/compat.c       2009-09-10 15:26:27.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/compat.c    2009-09-10 16:11:43.000000000 +0200
-@@ -902,7 +902,7 @@ asmlinkage long compat_sys_time(compat_t
+       if (has_capability(current, cap)) {
+               current->flags |= PF_SUPERPRIV;
+               return 1;
+diff -NurpP --minimal linux-2.6.27.33/kernel/compat.c linux-2.6.27.33-vs2.3.0.36.6/kernel/compat.c
+--- linux-2.6.27.33/kernel/compat.c    2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/compat.c       2008-10-13 14:54:20.000000000 +0200
+@@ -845,7 +845,7 @@ asmlinkage long compat_sys_time(compat_t
        compat_time_t i;
        struct timeval tv;
  
@@ -14026,7 +15435,7 @@ diff -NurpP --minimal linux-2.6.31/kernel/compat.c linux-2.6.31-vs2.3.0.36.14-pr
        i = tv.tv_sec;
  
        if (tloc) {
-@@ -927,7 +927,7 @@ asmlinkage long compat_sys_stime(compat_
+@@ -869,7 +869,7 @@ asmlinkage long compat_sys_stime(compat_
        if (err)
                return err;
  
@@ -14035,21 +15444,22 @@ diff -NurpP --minimal linux-2.6.31/kernel/compat.c linux-2.6.31-vs2.3.0.36.14-pr
        return 0;
  }
  
-diff -NurpP --minimal linux-2.6.31/kernel/exit.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/exit.c
---- linux-2.6.31/kernel/exit.c 2009-09-10 15:26:27.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/exit.c      2009-09-10 16:43:10.000000000 +0200
-@@ -48,6 +48,10 @@
- #include <linux/fs_struct.h>
- #include <linux/init_task.h>
- #include <linux/perf_counter.h>
+diff -NurpP --minimal linux-2.6.27.33/kernel/exit.c linux-2.6.27.33-vs2.3.0.36.6/kernel/exit.c
+--- linux-2.6.27.33/kernel/exit.c      2009-09-13 16:17:00.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/exit.c 2009-05-15 22:57:04.000000000 +0200
+@@ -47,6 +47,11 @@
+ #include <linux/blkdev.h>
+ #include <linux/task_io_accounting_ops.h>
+ #include <linux/tracehook.h>
 +#include <linux/vs_limit.h>
 +#include <linux/vs_context.h>
 +#include <linux/vs_network.h>
 +#include <linux/vs_pid.h>
- #include <trace/events/sched.h>
++#include <linux/vserver/global.h>
  
  #include <asm/uaccess.h>
-@@ -488,9 +492,11 @@ static void close_files(struct files_str
+ #include <asm/unistd.h>
+@@ -485,9 +490,11 @@ static void close_files(struct files_str
                                        filp_close(file, files);
                                        cond_resched();
                                }
@@ -14061,7 +15471,15 @@ diff -NurpP --minimal linux-2.6.31/kernel/exit.c linux-2.6.31-vs2.3.0.36.14-pre8
                }
        }
  }
-@@ -1009,10 +1015,15 @@ NORET_TYPE void do_exit(long code)
+@@ -554,6 +561,7 @@ void put_fs_struct(struct fs_struct *fs)
+       if (atomic_dec_and_test(&fs->count)) {
+               path_put(&fs->root);
+               path_put(&fs->pwd);
++              atomic_dec(&vs_global_fs);
+               kmem_cache_free(fs_cachep, fs);
+       }
+ }
+@@ -1121,11 +1129,16 @@ NORET_TYPE void do_exit(long code)
        if (tsk->splice_pipe)
                __free_pipe_info(tsk->splice_pipe);
  
@@ -14072,44 +15490,46 @@ diff -NurpP --minimal linux-2.6.31/kernel/exit.c linux-2.6.31-vs2.3.0.36.14-pre8
        preempt_disable();
        /* causes final put_task_struct in finish_task_switch(). */
        tsk->state = TASK_DEAD;
        schedule();
 +      printk("bad task: %p [%lx]\n", current, current->state);
        BUG();
        /* Avoid "noreturn function does return".  */
        for (;;)
-diff -NurpP --minimal linux-2.6.31/kernel/fork.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/fork.c
---- linux-2.6.31/kernel/fork.c 2009-09-10 15:26:27.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/fork.c      2009-09-10 16:42:52.000000000 +0200
-@@ -62,6 +62,10 @@
- #include <linux/fs_struct.h>
- #include <linux/magic.h>
- #include <linux/perf_counter.h>
+diff -NurpP --minimal linux-2.6.27.33/kernel/fork.c linux-2.6.27.33-vs2.3.0.36.6/kernel/fork.c
+--- linux-2.6.27.33/kernel/fork.c      2009-09-13 16:17:00.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/fork.c 2009-09-13 16:19:24.000000000 +0200
+@@ -58,6 +58,11 @@
+ #include <linux/tty.h>
+ #include <linux/proc_fs.h>
+ #include <linux/blkdev.h>
 +#include <linux/vs_context.h>
 +#include <linux/vs_network.h>
 +#include <linux/vs_limit.h>
 +#include <linux/vs_memory.h>
++#include <linux/vserver/global.h>
  
  #include <asm/pgtable.h>
  #include <asm/pgalloc.h>
-@@ -141,6 +145,8 @@ void free_task(struct task_struct *tsk)
+@@ -135,6 +140,8 @@ void free_task(struct task_struct *tsk)
        prop_local_destroy_single(&tsk->dirties);
        free_thread_info(tsk->stack);
        rt_mutex_debug_task_free(tsk);
 +      clr_vx_info(&tsk->vx_info);
 +      clr_nx_info(&tsk->nx_info);
-       ftrace_graph_exit_task(tsk);
        free_task_struct(tsk);
  }
-@@ -284,6 +290,8 @@ static int dup_mmap(struct mm_struct *mm
+ EXPORT_SYMBOL(free_task);
+@@ -274,6 +281,8 @@ static int dup_mmap(struct mm_struct *mm
        mm->free_area_cache = oldmm->mmap_base;
        mm->cached_hole_size = ~0UL;
        mm->map_count = 0;
 +      __set_mm_counter(mm, file_rss, 0);
 +      __set_mm_counter(mm, anon_rss, 0);
-       cpumask_clear(mm_cpumask(mm));
+       cpus_clear(mm->cpu_vm_mask);
        mm->mm_rb = RB_ROOT;
        rb_link = &mm->mm_rb.rb_node;
-@@ -295,7 +303,7 @@ static int dup_mmap(struct mm_struct *mm
+@@ -285,7 +294,7 @@ static int dup_mmap(struct mm_struct *mm
  
                if (mpnt->vm_flags & VM_DONTCOPY) {
                        long pages = vma_pages(mpnt);
@@ -14118,8 +15538,8 @@ diff -NurpP --minimal linux-2.6.31/kernel/fork.c linux-2.6.31-vs2.3.0.36.14-pre8
                        vm_stat_account(mm, mpnt->vm_flags, mpnt->vm_file,
                                                                -pages);
                        continue;
-@@ -428,8 +436,8 @@ static struct mm_struct * mm_init(struct
-       mm->flags = (current->mm) ? current->mm->flags : default_dump_filter;
+@@ -407,8 +416,8 @@ static struct mm_struct * mm_init(struct
+                                 : MMF_DUMP_FILTER_DEFAULT;
        mm->core_state = NULL;
        mm->nr_ptes = 0;
 -      set_mm_counter(mm, file_rss, 0);
@@ -14127,9 +15547,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/fork.c linux-2.6.31-vs2.3.0.36.14-pre8
 +      __set_mm_counter(mm, file_rss, 0);
 +      __set_mm_counter(mm, anon_rss, 0);
        spin_lock_init(&mm->page_table_lock);
-       spin_lock_init(&mm->ioctx_lock);
-       INIT_HLIST_HEAD(&mm->ioctx_list);
-@@ -440,6 +448,7 @@ static struct mm_struct * mm_init(struct
+       rwlock_init(&mm->ioctx_list_lock);
+       mm->ioctx_list = NULL;
+@@ -419,6 +428,7 @@ static struct mm_struct * mm_init(struct
        if (likely(!mm_alloc_pgd(mm))) {
                mm->def_flags = 0;
                mmu_notifier_mm_init(mm);
@@ -14137,7 +15557,7 @@ diff -NurpP --minimal linux-2.6.31/kernel/fork.c linux-2.6.31-vs2.3.0.36.14-pre8
                return mm;
        }
  
-@@ -473,6 +482,7 @@ void __mmdrop(struct mm_struct *mm)
+@@ -452,6 +462,7 @@ void __mmdrop(struct mm_struct *mm)
        mm_free_pgd(mm);
        destroy_context(mm);
        mmu_notifier_mm_destroy(mm);
@@ -14145,7 +15565,7 @@ diff -NurpP --minimal linux-2.6.31/kernel/fork.c linux-2.6.31-vs2.3.0.36.14-pre8
        free_mm(mm);
  }
  EXPORT_SYMBOL_GPL(__mmdrop);
-@@ -599,6 +609,7 @@ struct mm_struct *dup_mm(struct task_str
+@@ -568,6 +579,7 @@ struct mm_struct *dup_mm(struct task_str
                goto fail_nomem;
  
        memcpy(mm, oldmm, sizeof(*mm));
@@ -14153,7 +15573,7 @@ diff -NurpP --minimal linux-2.6.31/kernel/fork.c linux-2.6.31-vs2.3.0.36.14-pre8
  
        /* Initializing for Swap token stuff */
        mm->token_priority = 0;
-@@ -632,6 +643,7 @@ fail_nocontext:
+@@ -601,6 +613,7 @@ fail_nocontext:
         * If init_new_context() failed, we cannot use mmput() to free the mm
         * because it calls destroy_context()
         */
@@ -14161,7 +15581,15 @@ diff -NurpP --minimal linux-2.6.31/kernel/fork.c linux-2.6.31-vs2.3.0.36.14-pre8
        mm_free_pgd(mm);
        free_mm(mm);
        return NULL;
-@@ -940,6 +952,8 @@ static struct task_struct *copy_process(
+@@ -664,6 +677,7 @@ static struct fs_struct *__copy_fs_struc
+               fs->pwd = old->pwd;
+               path_get(&old->pwd);
+               read_unlock(&old->lock);
++              atomic_inc(&vs_global_fs);
+       }
+       return fs;
+ }
+@@ -895,6 +909,8 @@ static struct task_struct *copy_process(
        int retval;
        struct task_struct *p;
        int cgroup_callbacks_done = 0;
@@ -14170,7 +15598,7 @@ diff -NurpP --minimal linux-2.6.31/kernel/fork.c linux-2.6.31-vs2.3.0.36.14-pre8
  
        if ((clone_flags & (CLONE_NEWNS|CLONE_FS)) == (CLONE_NEWNS|CLONE_FS))
                return ERR_PTR(-EINVAL);
-@@ -976,12 +990,28 @@ static struct task_struct *copy_process(
+@@ -929,12 +945,28 @@ static struct task_struct *copy_process(
        DEBUG_LOCKS_WARN_ON(!p->hardirqs_enabled);
        DEBUG_LOCKS_WARN_ON(!p->softirqs_enabled);
  #endif
@@ -14191,16 +15619,16 @@ diff -NurpP --minimal linux-2.6.31/kernel/fork.c linux-2.6.31-vs2.3.0.36.14-pre8
        retval = -EAGAIN;
 +      if (!vx_nproc_avail(1))
 +              goto bad_fork_cleanup_vm;
-       if (atomic_read(&p->real_cred->user->processes) >=
+       if (atomic_read(&p->user->processes) >=
                        p->signal->rlim[RLIMIT_NPROC].rlim_cur) {
                if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RESOURCE) &&
-                   p->real_cred->user != INIT_USER)
+                   p->user != current->nsproxy->user_ns->root_user)
 -                      goto bad_fork_free;
 +                      goto bad_fork_cleanup_vm;
        }
  
-       retval = copy_creds(p, clone_flags);
-@@ -1254,6 +1284,18 @@ static struct task_struct *copy_process(
+       atomic_inc(&p->user->__count);
+@@ -1233,6 +1265,18 @@ static struct task_struct *copy_process(
  
        total_forks++;
        spin_unlock(&current->sighand->siglock);
@@ -14219,41 +15647,50 @@ diff -NurpP --minimal linux-2.6.31/kernel/fork.c linux-2.6.31-vs2.3.0.36.14-pre8
        write_unlock_irq(&tasklist_lock);
        proc_fork_connector(p);
        cgroup_post_fork(p);
-@@ -1299,6 +1341,9 @@ bad_fork_cleanup_count:
-       atomic_dec(&p->cred->user->processes);
-       put_cred(p->real_cred);
-       put_cred(p->cred);
+@@ -1280,6 +1324,9 @@ bad_fork_cleanup_count:
+       put_group_info(p->group_info);
+       atomic_dec(&p->user->processes);
+       free_uid(p->user);
 +bad_fork_cleanup_vm:
 +      if (p->mm && !(clone_flags & CLONE_VM))
 +              vx_pages_sub(p->vx_info, RLIMIT_AS, p->mm->total_vm);
  bad_fork_free:
        free_task(p);
  fork_out:
-diff -NurpP --minimal linux-2.6.31/kernel/kthread.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/kthread.c
---- linux-2.6.31/kernel/kthread.c      2009-09-10 15:26:28.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/kthread.c   2009-09-10 16:43:27.000000000 +0200
-@@ -14,6 +14,7 @@
+diff -NurpP --minimal linux-2.6.27.33/kernel/kthread.c linux-2.6.27.33-vs2.3.0.36.6/kernel/kthread.c
+--- linux-2.6.27.33/kernel/kthread.c   2009-09-13 16:17:00.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/kthread.c      2009-09-13 16:19:24.000000000 +0200
+@@ -13,6 +13,7 @@
  #include <linux/file.h>
  #include <linux/module.h>
  #include <linux/mutex.h>
 +#include <linux/vs_pid.h>
- #include <trace/events/sched.h>
  
  #define KTHREAD_NICE_LEVEL (-5)
-diff -NurpP --minimal linux-2.6.31/kernel/Makefile linux-2.6.31-vs2.3.0.36.14-pre8/kernel/Makefile
---- linux-2.6.31/kernel/Makefile       2009-09-10 15:26:27.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/Makefile    2009-09-10 16:11:43.000000000 +0200
-@@ -23,6 +23,7 @@ CFLAGS_REMOVE_cgroup-debug.o = -pg
- CFLAGS_REMOVE_sched_clock.o = -pg
+@@ -98,7 +99,7 @@ static void create_kthread(struct kthrea
+               struct sched_param param = { .sched_priority = 0 };
+               wait_for_completion(&create->started);
+               read_lock(&tasklist_lock);
+-              create->result = find_task_by_pid_ns(pid, &init_pid_ns);
++              create->result = find_task_by_real_pid(pid);
+               read_unlock(&tasklist_lock);
+               /*
+                * root may have changed our (kthreadd's) priority or CPU mask.
+diff -NurpP --minimal linux-2.6.27.33/kernel/Makefile linux-2.6.27.33-vs2.3.0.36.6/kernel/Makefile
+--- linux-2.6.27.33/kernel/Makefile    2009-09-13 16:17:00.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/Makefile       2009-02-03 17:59:04.000000000 +0100
+@@ -22,6 +22,7 @@ CFLAGS_REMOVE_sched_clock.o = -pg
+ CFLAGS_REMOVE_sched.o = -pg
  endif
  
 +obj-y += vserver/
- obj-$(CONFIG_FREEZER) += freezer.o
  obj-$(CONFIG_PROFILING) += profile.o
  obj-$(CONFIG_SYSCTL_SYSCALL_CHECK) += sysctl_check.o
-diff -NurpP --minimal linux-2.6.31/kernel/nsproxy.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/nsproxy.c
---- linux-2.6.31/kernel/nsproxy.c      2009-09-10 15:26:28.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/nsproxy.c   2009-09-10 17:37:49.000000000 +0200
+ obj-$(CONFIG_STACKTRACE) += stacktrace.o
+diff -NurpP --minimal linux-2.6.27.33/kernel/nsproxy.c linux-2.6.27.33-vs2.3.0.36.6/kernel/nsproxy.c
+--- linux-2.6.27.33/kernel/nsproxy.c   2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/nsproxy.c      2008-10-13 14:54:20.000000000 +0200
 @@ -19,6 +19,8 @@
  #include <linux/mnt_namespace.h>
  #include <linux/utsname.h>
@@ -14263,20 +15700,17 @@ diff -NurpP --minimal linux-2.6.31/kernel/nsproxy.c linux-2.6.31-vs2.3.0.36.14-p
  #include <net/net_namespace.h>
  #include <linux/ipc_namespace.h>
  
-@@ -31,8 +33,11 @@ static inline struct nsproxy *create_nsp
-       struct nsproxy *nsproxy;
-       nsproxy = kmem_cache_alloc(nsproxy_cachep, GFP_KERNEL);
--      if (nsproxy)
-+      if (nsproxy) {
-               atomic_set(&nsproxy->count, 1);
+@@ -37,6 +39,9 @@ static inline struct nsproxy *clone_nspr
+       if (ns) {
+               memcpy(ns, orig, sizeof(struct nsproxy));
+               atomic_set(&ns->count, 1);
++              vxdprintk(VXD_CBIT(space, 2), "clone_nsproxy(%p[%u] = %p[1]",
++                      orig, atomic_read(&orig->count), ns);
 +              atomic_inc(&vs_global_nsproxy);
-+      }
-+      vxdprintk(VXD_CBIT(space, 2), "create_nsproxy = %p[1]", nsproxy);
-       return nsproxy;
+       }
+       return ns;
  }
-@@ -41,41 +46,52 @@ static inline struct nsproxy *create_nsp
+@@ -46,47 +51,51 @@ static inline struct nsproxy *clone_nspr
   * Return the newly created nsproxy.  Do not attach this to the task,
   * leave it to the caller to do proper locking and attach it to task.
   */
@@ -14288,11 +15722,12 @@ diff -NurpP --minimal linux-2.6.31/kernel/nsproxy.c linux-2.6.31-vs2.3.0.36.14-p
        struct nsproxy *new_nsp;
        int err;
  
+-      new_nsp = clone_nsproxy(tsk->nsproxy);
 +      vxdprintk(VXD_CBIT(space, 4),
 +              "unshare_namespaces(0x%08lx,%p,%p)",
 +              flags, orig, new_fs);
 +
-       new_nsp = create_nsproxy();
++      new_nsp = clone_nsproxy(orig);
        if (!new_nsp)
                return ERR_PTR(-ENOMEM);
  
@@ -14324,19 +15759,19 @@ diff -NurpP --minimal linux-2.6.31/kernel/nsproxy.c linux-2.6.31-vs2.3.0.36.14-p
                goto out_pid;
        }
  
--      new_nsp->net_ns = copy_net_ns(flags, tsk->nsproxy->net_ns);
-+      /* disabled now?
+-      new_nsp->user_ns = copy_user_ns(flags, tsk->nsproxy->user_ns);
 +      new_nsp->user_ns = copy_user_ns(flags, orig->user_ns);
-+      if (IS_ERR(new_nsp->user_ns)) {
-+              err = PTR_ERR(new_nsp->user_ns);
-+              goto out_user;
-+      } */
-+
+       if (IS_ERR(new_nsp->user_ns)) {
+               err = PTR_ERR(new_nsp->user_ns);
+               goto out_user;
+       }
+-      new_nsp->net_ns = copy_net_ns(flags, tsk->nsproxy->net_ns);
 +      new_nsp->net_ns = copy_net_ns(flags, orig->net_ns);
        if (IS_ERR(new_nsp->net_ns)) {
                err = PTR_ERR(new_nsp->net_ns);
                goto out_net;
-@@ -100,6 +116,38 @@ out_ns:
+@@ -114,6 +123,37 @@ out_ns:
        return ERR_PTR(err);
  }
  
@@ -14352,12 +15787,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/nsproxy.c linux-2.6.31-vs2.3.0.36.14-p
 + */
 +struct nsproxy *copy_nsproxy(struct nsproxy *orig)
 +{
-+      struct nsproxy *ns = create_nsproxy();
++      struct nsproxy *ns = clone_nsproxy(orig);
 +
 +      if (ns) {
-+              memcpy(ns, orig, sizeof(struct nsproxy));
-+              atomic_set(&ns->count, 1);
-+
 +              if (ns->mnt_ns)
 +                      get_mnt_ns(ns->mnt_ns);
 +              if (ns->uts_ns)
@@ -14366,6 +15798,8 @@ diff -NurpP --minimal linux-2.6.31/kernel/nsproxy.c linux-2.6.31-vs2.3.0.36.14-p
 +                      get_ipc_ns(ns->ipc_ns);
 +              if (ns->pid_ns)
 +                      get_pid_ns(ns->pid_ns);
++              if (ns->user_ns)
++                      get_user_ns(ns->user_ns);
 +              if (ns->net_ns)
 +                      get_net(ns->net_ns);
 +      }
@@ -14375,7 +15809,7 @@ diff -NurpP --minimal linux-2.6.31/kernel/nsproxy.c linux-2.6.31-vs2.3.0.36.14-p
  /*
   * called from clone.  This now handles copy for nsproxy and all
   * namespaces therein.
-@@ -107,9 +155,12 @@ out_ns:
+@@ -121,9 +161,12 @@ out_ns:
  int copy_namespaces(unsigned long flags, struct task_struct *tsk)
  {
        struct nsproxy *old_ns = tsk->nsproxy;
@@ -14389,16 +15823,7 @@ diff -NurpP --minimal linux-2.6.31/kernel/nsproxy.c linux-2.6.31-vs2.3.0.36.14-p
        if (!old_ns)
                return 0;
  
-@@ -119,7 +170,7 @@ int copy_namespaces(unsigned long flags,
-                               CLONE_NEWPID | CLONE_NEWNET)))
-               return 0;
--      if (!capable(CAP_SYS_ADMIN)) {
-+      if (!vx_capable(CAP_SYS_ADMIN, VXC_NAMESPACE)) {
-               err = -EPERM;
-               goto out;
-       }
-@@ -146,6 +197,9 @@ int copy_namespaces(unsigned long flags,
+@@ -160,6 +203,9 @@ int copy_namespaces(unsigned long flags,
  
  out:
        put_nsproxy(old_ns);
@@ -14408,10 +15833,10 @@ diff -NurpP --minimal linux-2.6.31/kernel/nsproxy.c linux-2.6.31-vs2.3.0.36.14-p
        return err;
  }
  
-@@ -159,7 +213,9 @@ void free_nsproxy(struct nsproxy *ns)
-               put_ipc_ns(ns->ipc_ns);
-       if (ns->pid_ns)
+@@ -175,7 +221,9 @@ void free_nsproxy(struct nsproxy *ns)
                put_pid_ns(ns->pid_ns);
+       if (ns->user_ns)
+               put_user_ns(ns->user_ns);
 -      put_net(ns->net_ns);
 +      if (ns->net_ns)
 +              put_net(ns->net_ns);
@@ -14419,7 +15844,7 @@ diff -NurpP --minimal linux-2.6.31/kernel/nsproxy.c linux-2.6.31-vs2.3.0.36.14-p
        kmem_cache_free(nsproxy_cachep, ns);
  }
  
-@@ -172,11 +228,15 @@ int unshare_nsproxy_namespaces(unsigned 
+@@ -188,6 +236,10 @@ int unshare_nsproxy_namespaces(unsigned 
  {
        int err = 0;
  
@@ -14428,26 +15853,21 @@ diff -NurpP --minimal linux-2.6.31/kernel/nsproxy.c linux-2.6.31-vs2.3.0.36.14-p
 +              unshare_flags, current->nsproxy);
 +
        if (!(unshare_flags & (CLONE_NEWNS | CLONE_NEWUTS | CLONE_NEWIPC |
-                              CLONE_NEWNET)))
+                              CLONE_NEWUSER | CLONE_NEWNET)))
                return 0;
--      if (!capable(CAP_SYS_ADMIN))
-+      if (!vx_capable(CAP_SYS_ADMIN, VXC_NAMESPACE))
-               return -EPERM;
-       *new_nsp = create_new_namespaces(unshare_flags, current,
-diff -NurpP --minimal linux-2.6.31/kernel/pid.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/pid.c
---- linux-2.6.31/kernel/pid.c  2009-09-10 15:26:28.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/pid.c       2009-09-10 16:36:49.000000000 +0200
-@@ -36,6 +36,7 @@
+diff -NurpP --minimal linux-2.6.27.33/kernel/pid.c linux-2.6.27.33-vs2.3.0.36.6/kernel/pid.c
+--- linux-2.6.27.33/kernel/pid.c       2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/pid.c  2008-10-13 14:54:20.000000000 +0200
+@@ -36,6 +36,8 @@
  #include <linux/pid_namespace.h>
  #include <linux/init_task.h>
  #include <linux/syscalls.h>
 +#include <linux/vs_pid.h>
++#include <linux/vserver/global.h>
  
  #define pid_hashfn(nr, ns)    \
        hash_long((unsigned long)nr + (unsigned long)ns, pidhash_shift)
-@@ -305,7 +306,7 @@ EXPORT_SYMBOL_GPL(find_pid_ns);
+@@ -305,7 +307,7 @@ EXPORT_SYMBOL_GPL(find_pid_ns);
  
  struct pid *find_vpid(int nr)
  {
@@ -14456,7 +15876,7 @@ diff -NurpP --minimal linux-2.6.31/kernel/pid.c linux-2.6.31-vs2.3.0.36.14-pre8/
  }
  EXPORT_SYMBOL_GPL(find_vpid);
  
-@@ -365,6 +366,9 @@ void transfer_pid(struct task_struct *ol
+@@ -365,6 +367,9 @@ void transfer_pid(struct task_struct *ol
  struct task_struct *pid_task(struct pid *pid, enum pid_type type)
  {
        struct task_struct *result = NULL;
@@ -14466,16 +15886,24 @@ diff -NurpP --minimal linux-2.6.31/kernel/pid.c linux-2.6.31-vs2.3.0.36.14-pre8/
        if (pid) {
                struct hlist_node *first;
                first = rcu_dereference(pid->tasks[type].first);
-@@ -380,7 +384,7 @@ EXPORT_SYMBOL(pid_task);
-  */
+@@ -388,14 +393,14 @@ EXPORT_SYMBOL(find_task_by_pid_type_ns);
+ struct task_struct *find_task_by_vpid(pid_t vnr)
+ {
+-      return find_task_by_pid_type_ns(PIDTYPE_PID, vnr,
++      return find_task_by_pid_type_ns(PIDTYPE_PID, vx_rmap_pid(vnr),
+                       current->nsproxy->pid_ns);
+ }
+ EXPORT_SYMBOL(find_task_by_vpid);
  struct task_struct *find_task_by_pid_ns(pid_t nr, struct pid_namespace *ns)
  {
--      return pid_task(find_pid_ns(nr, ns), PIDTYPE_PID);
-+      return pid_task(find_pid_ns(vx_rmap_pid(nr), ns), PIDTYPE_PID);
+-      return find_task_by_pid_type_ns(PIDTYPE_PID, nr, ns);
++      return find_task_by_pid_type_ns(PIDTYPE_PID, vx_rmap_pid(nr), ns);
  }
+ EXPORT_SYMBOL(find_task_by_pid_ns);
  
- struct task_struct *find_task_by_vpid(pid_t vnr)
-@@ -422,7 +426,7 @@ struct pid *find_get_pid(pid_t nr)
+@@ -431,7 +436,7 @@ struct pid *find_get_pid(pid_t nr)
  }
  EXPORT_SYMBOL_GPL(find_get_pid);
  
@@ -14484,7 +15912,7 @@ diff -NurpP --minimal linux-2.6.31/kernel/pid.c linux-2.6.31-vs2.3.0.36.14-pre8/
  {
        struct upid *upid;
        pid_t nr = 0;
-@@ -435,6 +439,11 @@ pid_t pid_nr_ns(struct pid *pid, struct 
+@@ -444,6 +449,11 @@ pid_t pid_nr_ns(struct pid *pid, struct 
        return nr;
  }
  
@@ -14496,9 +15924,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/pid.c linux-2.6.31-vs2.3.0.36.14-pre8/
  pid_t pid_vnr(struct pid *pid)
  {
        return pid_nr_ns(pid, current->nsproxy->pid_ns);
-diff -NurpP --minimal linux-2.6.31/kernel/pid_namespace.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/pid_namespace.c
---- linux-2.6.31/kernel/pid_namespace.c        2009-09-10 15:26:28.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/pid_namespace.c     2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/pid_namespace.c linux-2.6.27.33-vs2.3.0.36.6/kernel/pid_namespace.c
+--- linux-2.6.27.33/kernel/pid_namespace.c     2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/pid_namespace.c        2008-10-13 14:54:20.000000000 +0200
 @@ -13,6 +13,7 @@
  #include <linux/syscalls.h>
  #include <linux/err.h>
@@ -14507,15 +15935,15 @@ diff -NurpP --minimal linux-2.6.31/kernel/pid_namespace.c linux-2.6.31-vs2.3.0.3
  
  #define BITS_PER_PAGE         (PAGE_SIZE*8)
  
-@@ -86,6 +87,7 @@ static struct pid_namespace *create_pid_
+@@ -85,6 +86,7 @@ static struct pid_namespace *create_pid_
                goto out_free_map;
  
        kref_init(&ns->kref);
 +      atomic_inc(&vs_global_pid_ns);
        ns->level = level;
-       ns->parent = get_pid_ns(parent_pid_ns);
  
-@@ -111,6 +113,7 @@ static void destroy_pid_namespace(struct
+       set_bit(0, ns->pidmap[0].page);
+@@ -109,6 +111,7 @@ static void destroy_pid_namespace(struct
  
        for (i = 0; i < PIDMAP_ENTRIES; i++)
                kfree(ns->pidmap[i].page);
@@ -14523,9 +15951,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/pid_namespace.c linux-2.6.31-vs2.3.0.3
        kmem_cache_free(pid_ns_cachep, ns);
  }
  
-diff -NurpP --minimal linux-2.6.31/kernel/posix-timers.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/posix-timers.c
---- linux-2.6.31/kernel/posix-timers.c 2009-09-10 15:26:28.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/posix-timers.c      2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/posix-timers.c linux-2.6.27.33-vs2.3.0.36.6/kernel/posix-timers.c
+--- linux-2.6.27.33/kernel/posix-timers.c      2009-09-13 16:17:00.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/posix-timers.c 2009-02-03 17:59:04.000000000 +0100
 @@ -46,6 +46,7 @@
  #include <linux/wait.h>
  #include <linux/workqueue.h>
@@ -14534,45 +15962,58 @@ diff -NurpP --minimal linux-2.6.31/kernel/posix-timers.c linux-2.6.31-vs2.3.0.36
  
  /*
   * Management arrays for POSIX timers.         Timers are kept in slab memory
-@@ -328,6 +329,7 @@ int posix_timer_event(struct k_itimer *t
+@@ -298,6 +299,12 @@ void do_schedule_next_timer(struct sigin
+ int posix_timer_event(struct k_itimer *timr, int si_private)
  {
-       struct task_struct *task;
-       int shared, ret = -1;
++      struct vx_info_save vxis;
++      struct vx_info *vxi;
++      int ret;
 +
++      vxi = task_get_vx_info(timr->it_process);
++      enter_vx_info(vxi, &vxis);
        /*
         * FIXME: if ->sigq is queued we can race with
         * dequeue_signal()->do_schedule_next_timer().
-@@ -344,10 +346,18 @@ int posix_timer_event(struct k_itimer *t
-       rcu_read_lock();
-       task = pid_task(timr->it_pid, PIDTYPE_PID);
-       if (task) {
-+              struct vx_info_save vxis;
-+              struct vx_info *vxi;
-+
-+              vxi = task_get_vx_info(task);
-+              enter_vx_info(vxi, &vxis);
-               shared = !(timr->it_sigev_notify & SIGEV_THREAD_ID);
-               ret = send_sigqueue(timr->sigq, task, shared);
-+              leave_vx_info(&vxis);
-+              put_vx_info(vxi);
-       }
-       rcu_read_unlock();
+@@ -318,10 +325,11 @@ int posix_timer_event(struct k_itimer *t
+       if (timr->it_sigev_notify & SIGEV_THREAD_ID) {
+               struct task_struct *leader;
+-              int ret = send_sigqueue(timr->sigq, timr->it_process, 0);
 +
-       /* If we failed to send the signal the timer stops. */
-       return ret > 0;
++              ret = send_sigqueue(timr->sigq, timr->it_process, 0);
+               if (likely(ret >= 0))
+-                      return ret;
++                      goto out;
+               timr->it_sigev_notify = SIGEV_SIGNAL;
+               leader = timr->it_process->group_leader;
+@@ -329,7 +337,11 @@ int posix_timer_event(struct k_itimer *t
+               timr->it_process = leader;
+       }
+-      return send_sigqueue(timr->sigq, timr->it_process, 1);
++      ret = send_sigqueue(timr->sigq, timr->it_process, 1);
++out:
++      leave_vx_info(&vxis);
++      put_vx_info(vxi);
++      return ret;
  }
-diff -NurpP --minimal linux-2.6.31/kernel/printk.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/printk.c
---- linux-2.6.31/kernel/printk.c       2009-09-10 15:26:28.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/printk.c    2009-09-10 16:11:43.000000000 +0200
-@@ -33,6 +33,7 @@
+ EXPORT_SYMBOL_GPL(posix_timer_event);
+diff -NurpP --minimal linux-2.6.27.33/kernel/printk.c linux-2.6.27.33-vs2.3.0.36.6/kernel/printk.c
+--- linux-2.6.27.33/kernel/printk.c    2009-09-13 16:17:00.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/printk.c       2009-02-03 17:59:04.000000000 +0100
+@@ -32,6 +32,7 @@
+ #include <linux/security.h>
  #include <linux/bootmem.h>
  #include <linux/syscalls.h>
- #include <linux/kexec.h>
 +#include <linux/vs_cvirt.h>
  
  #include <asm/uaccess.h>
  
-@@ -270,18 +271,13 @@ int do_syslog(int type, char __user *buf
+@@ -291,18 +292,13 @@ int do_syslog(int type, char __user *buf
        unsigned i, j, limit, count;
        int do_clear = 0;
        char c;
@@ -14593,7 +16034,7 @@ diff -NurpP --minimal linux-2.6.31/kernel/printk.c linux-2.6.31-vs2.3.0.36.14-pr
                error = -EINVAL;
                if (!buf || len < 0)
                        goto out;
-@@ -292,6 +288,16 @@ int do_syslog(int type, char __user *buf
+@@ -313,6 +309,16 @@ int do_syslog(int type, char __user *buf
                        error = -EFAULT;
                        goto out;
                }
@@ -14610,7 +16051,7 @@ diff -NurpP --minimal linux-2.6.31/kernel/printk.c linux-2.6.31-vs2.3.0.36.14-pr
                error = wait_event_interruptible(log_wait,
                                                        (log_start - log_end));
                if (error)
-@@ -316,16 +322,6 @@ int do_syslog(int type, char __user *buf
+@@ -337,16 +343,6 @@ int do_syslog(int type, char __user *buf
                do_clear = 1;
                /* FALL THRU */
        case 3:         /* Read last kernel messages */
@@ -14627,18 +16068,18 @@ diff -NurpP --minimal linux-2.6.31/kernel/printk.c linux-2.6.31-vs2.3.0.36.14-pr
                count = len;
                if (count > log_buf_len)
                        count = log_buf_len;
-diff -NurpP --minimal linux-2.6.31/kernel/ptrace.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/ptrace.c
---- linux-2.6.31/kernel/ptrace.c       2009-09-10 15:26:28.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/ptrace.c    2009-09-10 16:11:43.000000000 +0200
-@@ -22,6 +22,7 @@
+diff -NurpP --minimal linux-2.6.27.33/kernel/ptrace.c linux-2.6.27.33-vs2.3.0.36.6/kernel/ptrace.c
+--- linux-2.6.27.33/kernel/ptrace.c    2009-09-13 16:17:00.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/ptrace.c       2009-02-03 17:59:04.000000000 +0100
+@@ -21,6 +21,7 @@
+ #include <linux/audit.h>
  #include <linux/pid_namespace.h>
  #include <linux/syscalls.h>
- #include <linux/uaccess.h>
 +#include <linux/vs_context.h>
  
- /*
-@@ -151,6 +152,11 @@ int __ptrace_may_access(struct task_stru
+ #include <asm/pgtable.h>
+ #include <asm/uaccess.h>
+@@ -139,6 +140,11 @@ int __ptrace_may_access(struct task_stru
                dumpable = get_dumpable(task->mm);
        if (!dumpable && !capable(CAP_SYS_PTRACE))
                return -EPERM;
@@ -14650,7 +16091,7 @@ diff -NurpP --minimal linux-2.6.31/kernel/ptrace.c linux-2.6.31-vs2.3.0.36.14-pr
  
        return security_ptrace_may_access(task, mode);
  }
-@@ -618,6 +624,10 @@ SYSCALL_DEFINE4(ptrace, long, request, l
+@@ -567,6 +573,10 @@ SYSCALL_DEFINE4(ptrace, long, request, l
                goto out;
        }
  
@@ -14661,10 +16102,10 @@ diff -NurpP --minimal linux-2.6.31/kernel/ptrace.c linux-2.6.31-vs2.3.0.36.14-pr
        if (request == PTRACE_ATTACH) {
                ret = ptrace_attach(child);
                /*
-diff -NurpP --minimal linux-2.6.31/kernel/sched.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/sched.c
---- linux-2.6.31/kernel/sched.c        2009-09-10 15:26:28.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/sched.c     2009-09-10 16:57:32.000000000 +0200
-@@ -72,6 +72,8 @@
+diff -NurpP --minimal linux-2.6.27.33/kernel/sched.c linux-2.6.27.33-vs2.3.0.36.6/kernel/sched.c
+--- linux-2.6.27.33/kernel/sched.c     2009-09-13 16:17:00.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/sched.c        2009-03-09 15:36:36.000000000 +0100
+@@ -71,6 +71,8 @@
  #include <linux/debugfs.h>
  #include <linux/ctype.h>
  #include <linux/ftrace.h>
@@ -14673,7 +16114,7 @@ diff -NurpP --minimal linux-2.6.31/kernel/sched.c linux-2.6.31-vs2.3.0.36.14-pre
  
  #include <asm/tlb.h>
  #include <asm/irq_regs.h>
-@@ -639,6 +641,16 @@ struct rq {
+@@ -577,6 +579,16 @@ struct rq {
  #endif
        struct hrtimer hrtick_timer;
  #endif
@@ -14690,7 +16131,15 @@ diff -NurpP --minimal linux-2.6.31/kernel/sched.c linux-2.6.31-vs2.3.0.36.14-pre
  
  #ifdef CONFIG_SCHEDSTATS
        /* latency stats */
-@@ -1914,6 +1926,8 @@ static inline void check_class_changed(s
+@@ -1640,6 +1652,7 @@ static void update_avg(u64 *avg, u64 sam
+ static void enqueue_task(struct rq *rq, struct task_struct *p, int wakeup)
+ {
++      // BUG_ON(p->state & TASK_ONHOLD);
+       sched_info_queued(p);
+       p->sched_class->enqueue_task(rq, p, wakeup);
+       p->se.on_rq = 1;
+@@ -1763,6 +1776,8 @@ static inline void check_class_changed(s
                p->sched_class->prio_changed(rq, p, oldprio, running);
  }
  
@@ -14699,7 +16148,7 @@ diff -NurpP --minimal linux-2.6.31/kernel/sched.c linux-2.6.31-vs2.3.0.36.14-pre
  #ifdef CONFIG_SMP
  
  /* Used instead of source_load when we know the type == 0 */
-@@ -2006,6 +2020,7 @@ migrate_task(struct task_struct *p, int 
+@@ -1846,6 +1861,7 @@ migrate_task(struct task_struct *p, int 
  {
        struct rq *rq = task_rq(p);
  
@@ -14707,18 +16156,18 @@ diff -NurpP --minimal linux-2.6.31/kernel/sched.c linux-2.6.31-vs2.3.0.36.14-pre
        /*
         * If the task is not on a runqueue (and not running), then
         * it is sufficient to simply update the task's cpu field.
-@@ -2398,6 +2413,8 @@ void task_oncpu_function_call(struct tas
-       preempt_enable();
- }
+@@ -2178,6 +2194,8 @@ static int sched_balance_self(int cpu, i
+ #endif /* CONFIG_SMP */
  
 +#include "sched_hard.h"
 +
  /***
   * try_to_wake_up - wake up a thread
   * @p: the to-be-woken-up thread
-@@ -2442,6 +2459,13 @@ static int try_to_wake_up(struct task_st
+@@ -2221,6 +2239,13 @@ static int try_to_wake_up(struct task_st
+       smp_wmb();
        rq = task_rq_lock(p, &flags);
-       update_rq_clock(rq);
        old_state = p->state;
 +
 +      /* we need to unhold suspended tasks */
@@ -14730,7 +16179,7 @@ diff -NurpP --minimal linux-2.6.31/kernel/sched.c linux-2.6.31-vs2.3.0.36.14-pre
        if (!(old_state & state))
                goto out;
  
-@@ -2463,6 +2487,12 @@ static int try_to_wake_up(struct task_st
+@@ -2242,6 +2267,12 @@ static int try_to_wake_up(struct task_st
                /* might preempt at this point */
                rq = task_rq_lock(p, &flags);
                old_state = p->state;
@@ -14743,40 +16192,16 @@ diff -NurpP --minimal linux-2.6.31/kernel/sched.c linux-2.6.31-vs2.3.0.36.14-pre
                if (!(old_state & state))
                        goto out;
                if (p->se.on_rq)
-@@ -2981,9 +3011,17 @@ EXPORT_SYMBOL(avenrun);
-  */
- void get_avenrun(unsigned long *loads, unsigned long offset, int shift)
- {
--      loads[0] = (avenrun[0] + offset) << shift;
--      loads[1] = (avenrun[1] + offset) << shift;
--      loads[2] = (avenrun[2] + offset) << shift;
-+      if (vx_flags(VXF_VIRT_LOAD, 0)) {
-+              struct vx_info *vxi = current->vx_info;
-+
-+              loads[0] = (vxi->cvirt.load[0] + offset) << shift;
-+              loads[0] = (vxi->cvirt.load[1] + offset) << shift;
-+              loads[0] = (vxi->cvirt.load[2] + offset) << shift;
-+      } else {
-+              loads[0] = (avenrun[0] + offset) << shift;
-+              loads[1] = (avenrun[1] + offset) << shift;
-+              loads[2] = (avenrun[2] + offset) << shift;
-+      }
- }
- static unsigned long
-@@ -4912,16 +4950,19 @@ void account_user_time(struct task_struc
-                      cputime_t cputime_scaled)
+@@ -4067,13 +4098,16 @@ unsigned long long task_sched_runtime(st
+ void account_user_time(struct task_struct *p, cputime_t cputime)
  {
        struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
 +      struct vx_info *vxi = p->vx_info;  /* p is _always_ current */
        cputime64_t tmp;
 +      int nice = (TASK_NICE(p) > 0);
  
-       /* Add user time to process. */
        p->utime = cputime_add(p->utime, cputime);
-       p->utimescaled = cputime_add(p->utimescaled, cputime_scaled);
 +      vx_account_user(vxi, cputime, nice);
-       account_group_user_time(p, cputime);
  
        /* Add user time to cpustat. */
        tmp = cputime_to_cputime64(cputime);
@@ -14785,35 +16210,35 @@ diff -NurpP --minimal linux-2.6.31/kernel/sched.c linux-2.6.31-vs2.3.0.36.14-pre
                cpustat->nice = cputime64_add(cpustat->nice, tmp);
        else
                cpustat->user = cputime64_add(cpustat->user, tmp);
-@@ -4967,6 +5008,7 @@ void account_system_time(struct task_str
-                        cputime_t cputime, cputime_t cputime_scaled)
+@@ -4120,6 +4154,7 @@ void account_system_time(struct task_str
+                        cputime_t cputime)
  {
        struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
 +      struct vx_info *vxi = p->vx_info;  /* p is _always_ current */
+       struct rq *rq = this_rq();
        cputime64_t tmp;
  
-       if ((p->flags & PF_VCPU) && (irq_count() - hardirq_offset == 0)) {
-@@ -4977,6 +5019,7 @@ void account_system_time(struct task_str
-       /* Add system time to process. */
+@@ -4129,6 +4164,7 @@ void account_system_time(struct task_str
+       }
        p->stime = cputime_add(p->stime, cputime);
-       p->stimescaled = cputime_add(p->stimescaled, cputime_scaled);
-+      vx_account_system(vxi, cputime, 0 /* do we have idle time? */);
-       account_group_system_time(p, cputime);
++      vx_account_system(vxi, cputime, (p == rq->idle));
  
        /* Add system time to cpustat. */
-@@ -5358,6 +5401,11 @@ need_resched_nonpreemptible:
+       tmp = cputime_to_cputime64(cputime);
+@@ -4451,6 +4487,11 @@ need_resched_nonpreemptible:
                idle_balance(cpu, rq);
  
-       put_prev_task(rq, prev);
+       prev->sched_class->put_prev_task(rq, prev);
 +
 +      vx_set_rq_time(rq, jiffies);    /* update time */
 +      vx_schedule(prev, rq, cpu);     /* hold if over limit */
 +      vx_try_unhold(rq, cpu);         /* unhold if refilled */
 +
-       next = pick_next_task(rq);
+       next = pick_next_task(rq, prev);
  
        if (likely(prev != next)) {
-@@ -6012,7 +6060,7 @@ SYSCALL_DEFINE1(nice, int, increment)
+@@ -4963,7 +5004,7 @@ SYSCALL_DEFINE1(nice, int, increment)
                nice = 19;
  
        if (increment < 0 && !can_nice(current, nice))
@@ -14822,7 +16247,7 @@ diff -NurpP --minimal linux-2.6.31/kernel/sched.c linux-2.6.31-vs2.3.0.36.14-pre
  
        retval = security_task_setnice(current, nice);
        if (retval)
-@@ -9314,7 +9362,10 @@ void __init sched_init(void)
+@@ -8173,7 +8214,10 @@ void __init sched_init(void)
  
  #endif
  #endif /* CONFIG_FAIR_GROUP_SCHED */
@@ -14834,10 +16259,10 @@ diff -NurpP --minimal linux-2.6.31/kernel/sched.c linux-2.6.31-vs2.3.0.36.14-pre
                rq->rt.rt_runtime = def_rt_bandwidth.rt_runtime;
  #ifdef CONFIG_RT_GROUP_SCHED
                INIT_LIST_HEAD(&rq->leaf_rt_rq_list);
-diff -NurpP --minimal linux-2.6.31/kernel/sched_fair.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/sched_fair.c
---- linux-2.6.31/kernel/sched_fair.c   2009-09-10 15:26:28.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/sched_fair.c        2009-09-10 16:11:43.000000000 +0200
-@@ -731,6 +731,9 @@ enqueue_entity(struct cfs_rq *cfs_rq, st
+diff -NurpP --minimal linux-2.6.27.33/kernel/sched_fair.c linux-2.6.27.33-vs2.3.0.36.6/kernel/sched_fair.c
+--- linux-2.6.27.33/kernel/sched_fair.c        2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/sched_fair.c   2008-10-13 14:54:20.000000000 +0200
+@@ -724,6 +724,9 @@ enqueue_entity(struct cfs_rq *cfs_rq, st
        check_spread(cfs_rq, se);
        if (se != cfs_rq->curr)
                __enqueue_entity(cfs_rq, se);
@@ -14846,19 +16271,19 @@ diff -NurpP --minimal linux-2.6.31/kernel/sched_fair.c linux-2.6.31-vs2.3.0.36.1
 +              vx_activate_task(task_of(se));
  }
  
- static void __clear_buddies(struct cfs_rq *cfs_rq, struct sched_entity *se)
-@@ -774,6 +777,8 @@ dequeue_entity(struct cfs_rq *cfs_rq, st
+ static void
+@@ -750,6 +753,8 @@ dequeue_entity(struct cfs_rq *cfs_rq, st
  
        if (se != cfs_rq->curr)
                __dequeue_entity(cfs_rq, se);
 +      if (entity_is_task(se))
 +              vx_deactivate_task(task_of(se));
        account_entity_dequeue(cfs_rq, se);
-       update_min_vruntime(cfs_rq);
  }
-diff -NurpP --minimal linux-2.6.31/kernel/sched_hard.h linux-2.6.31-vs2.3.0.36.14-pre8/kernel/sched_hard.h
---- linux-2.6.31/kernel/sched_hard.h   1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/sched_hard.h        2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/sched_hard.h linux-2.6.27.33-vs2.3.0.36.6/kernel/sched_hard.h
+--- linux-2.6.27.33/kernel/sched_hard.h        1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/sched_hard.h   2009-03-09 15:36:36.000000000 +0100
 @@ -0,0 +1,353 @@
 +
 +#ifdef CONFIG_VSERVER_IDLELIMIT
@@ -15213,9 +16638,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/sched_hard.h linux-2.6.31-vs2.3.0.36.1
 +
 +#endif /* CONFIG_VSERVER_HARDCPU */
 +
-diff -NurpP --minimal linux-2.6.31/kernel/sched_mon.h linux-2.6.31-vs2.3.0.36.14-pre8/kernel/sched_mon.h
---- linux-2.6.31/kernel/sched_mon.h    1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/sched_mon.h 2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/sched_mon.h linux-2.6.27.33-vs2.3.0.36.6/kernel/sched_mon.h
+--- linux-2.6.27.33/kernel/sched_mon.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/sched_mon.h    2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,200 @@
 +
 +#include <linux/vserver/monitor.h>
@@ -15401,2390 +16826,222 @@ diff -NurpP --minimal linux-2.6.31/kernel/sched_mon.h linux-2.6.31-vs2.3.0.36.14
 +
 +#else  /* CONFIG_VSERVER_MONITOR */
 +
-+#define       vxm_activate_task(t,q)          do { } while (0)
-+#define       vxm_activate_idle(t,q)          do { } while (0)
-+#define       vxm_deactivate_task(t,q)        do { } while (0)
-+#define       vxm_hold_task(t,q)              do { } while (0)
-+#define       vxm_unhold_task(t,q)            do { } while (0)
-+#define       vxm_migrate_task(t,q,d)         do { } while (0)
-+#define       vxm_idle_skip(q,c)              do { } while (0)
-+#define       vxm_need_resched(t,s,c)         do { } while (0)
-+#define       vxm_sync(s,c)                   do { } while (0)
-+#define       vxm_sched_info(s,v,c)           do { } while (0)
-+#define       vxm_tokens_recalc(s,q,v,c)      do { } while (0)
-+#define       vxm_update_sched(s,v,c)         do { } while (0)
-+#define       vxm_rq_max_min(q,c)             do { } while (0)
-+
-+#endif /* CONFIG_VSERVER_MONITOR */
-+
-diff -NurpP --minimal linux-2.6.31/kernel/signal.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/signal.c
---- linux-2.6.31/kernel/signal.c       2009-09-10 15:26:28.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/signal.c    2009-09-10 16:43:45.000000000 +0200
-@@ -27,6 +27,8 @@
- #include <linux/freezer.h>
- #include <linux/pid_namespace.h>
- #include <linux/nsproxy.h>
-+#include <linux/vs_context.h>
-+#include <linux/vs_pid.h>
- #include <trace/events/sched.h>
- #include <asm/param.h>
-@@ -598,6 +600,14 @@ static int check_kill_permission(int sig
-       if (!valid_signal(sig))
-               return -EINVAL;
-+      if ((info != SEND_SIG_NOINFO) &&
-+              (is_si_special(info) || !SI_FROMUSER(info)))
-+              goto skip;
-+
-+      vxdprintk(VXD_CBIT(misc, 7),
-+              "check_kill_permission(%d,%p,%p[#%u,%u])",
-+              sig, info, t, vx_task_xid(t), t->pid);
-+
-       if (info != SEND_SIG_NOINFO && (is_si_special(info) || SI_FROMKERNEL(info)))
-               return 0;
-@@ -625,6 +635,20 @@ static int check_kill_permission(int sig
-               }
-       }
-+      error = -EPERM;
-+      if (t->pid == 1 && current->xid)
-+              return error;
-+
-+      error = -ESRCH;
-+      /* FIXME: we shouldn't return ESRCH ever, to avoid
-+                loops, maybe ENOENT or EACCES? */
-+      if (!vx_check(vx_task_xid(t), VS_WATCH_P | VS_IDENT)) {
-+              vxdprintk(current->xid || VXD_CBIT(misc, 7),
-+                      "signal %d[%p] xid mismatch %p[#%u,%u] xid=#%u",
-+                      sig, info, t, vx_task_xid(t), t->pid, current->xid);
-+              return error;
-+      }
-+skip:
-       return security_task_kill(t, info, sig, 0);
- }
-@@ -1112,7 +1136,7 @@ int kill_pid_info(int sig, struct siginf
-       rcu_read_lock();
- retry:
-       p = pid_task(pid, PIDTYPE_PID);
--      if (p) {
-+      if (p && vx_check(vx_task_xid(p), VS_IDENT)) {
-               error = group_send_sig_info(sig, info, p);
-               if (unlikely(error == -ESRCH))
-                       /*
-@@ -1151,7 +1175,7 @@ int kill_pid_info_as_uid(int sig, struct
-       read_lock(&tasklist_lock);
-       p = pid_task(pid, PIDTYPE_PID);
--      if (!p) {
-+      if (!p || !vx_check(vx_task_xid(p), VS_IDENT)) {
-               ret = -ESRCH;
-               goto out_unlock;
-       }
-@@ -1205,8 +1229,10 @@ static int kill_something_info(int sig, 
-               struct task_struct * p;
-               for_each_process(p) {
--                      if (task_pid_vnr(p) > 1 &&
--                                      !same_thread_group(p, current)) {
-+                      if (vx_check(vx_task_xid(p), VS_ADMIN|VS_IDENT) &&
-+                              task_pid_vnr(p) > 1 &&
-+                              !same_thread_group(p, current) &&
-+                              !vx_current_initpid(p->pid)) {
-                               int err = group_send_sig_info(sig, info, p);
-                               ++count;
-                               if (err != -EPERM)
-@@ -1892,6 +1918,11 @@ relock:
-                               !sig_kernel_only(signr))
-                       continue;
-+              /* virtual init is protected against user signals */
-+              if ((info->si_code == SI_USER) &&
-+                      vx_current_initpid(current->pid))
-+                      continue;
-+
-               if (sig_kernel_stop(signr)) {
-                       /*
-                        * The default action is to stop all threads in
-diff -NurpP --minimal linux-2.6.31/kernel/softirq.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/softirq.c
---- linux-2.6.31/kernel/softirq.c      2009-09-10 15:26:28.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/softirq.c   2009-09-10 16:33:13.000000000 +0200
-@@ -24,6 +24,7 @@
- #include <linux/ftrace.h>
- #include <linux/smp.h>
- #include <linux/tick.h>
-+#include <linux/vs_context.h>
- #define CREATE_TRACE_POINTS
- #include <trace/events/irq.h>
-diff -NurpP --minimal linux-2.6.31/kernel/sys.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/sys.c
---- linux-2.6.31/kernel/sys.c  2009-09-10 15:26:28.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/sys.c       2009-09-10 16:46:48.000000000 +0200
-@@ -2,7 +2,7 @@
-  *  linux/kernel/sys.c
-  *
-  *  Copyright (C) 1991, 1992  Linus Torvalds
-- */
-+       */
- #include <linux/module.h>
- #include <linux/mm.h>
-@@ -41,6 +41,7 @@
- #include <linux/syscalls.h>
- #include <linux/kprobes.h>
- #include <linux/user_namespace.h>
-+#include <linux/vs_pid.h>
- #include <asm/uaccess.h>
- #include <asm/io.h>
-@@ -77,1216 +78,1229 @@
- # define SET_TSC_CTL(a)               (-EINVAL)
- #endif
--/*
-- * this is where the system-wide overflow UID and GID are defined, for
-- * architectures that now have 32-bit UID/GID but didn't in the past
-- */
-+      /*
-+       * this is where the system-wide overflow UID and GID are defined, for
-+       * architectures that now have 32-bit UID/GID but didn't in the past
-+       */
--int overflowuid = DEFAULT_OVERFLOWUID;
--int overflowgid = DEFAULT_OVERFLOWGID;
-+      int overflowuid = DEFAULT_OVERFLOWUID;
-+      int overflowgid = DEFAULT_OVERFLOWGID;
- #ifdef CONFIG_UID16
--EXPORT_SYMBOL(overflowuid);
--EXPORT_SYMBOL(overflowgid);
-+      EXPORT_SYMBOL(overflowuid);
-+      EXPORT_SYMBOL(overflowgid);
- #endif
--/*
-- * the same as above, but for filesystems which can only store a 16-bit
-- * UID and GID. as such, this is needed on all architectures
-- */
-+      /*
-+       * the same as above, but for filesystems which can only store a 16-bit
-+       * UID and GID. as such, this is needed on all architectures
-+       */
--int fs_overflowuid = DEFAULT_FS_OVERFLOWUID;
--int fs_overflowgid = DEFAULT_FS_OVERFLOWUID;
-+      int fs_overflowuid = DEFAULT_FS_OVERFLOWUID;
-+      int fs_overflowgid = DEFAULT_FS_OVERFLOWUID;
--EXPORT_SYMBOL(fs_overflowuid);
--EXPORT_SYMBOL(fs_overflowgid);
-+      EXPORT_SYMBOL(fs_overflowuid);
-+      EXPORT_SYMBOL(fs_overflowgid);
--/*
-- * this indicates whether you can reboot with ctrl-alt-del: the default is yes
-- */
-+      /*
-+       * this indicates whether you can reboot with ctrl-alt-del: the default is yes
-+       */
--int C_A_D = 1;
--struct pid *cad_pid;
--EXPORT_SYMBOL(cad_pid);
-+      int C_A_D = 1;
-+      struct pid *cad_pid;
-+      EXPORT_SYMBOL(cad_pid);
--/*
-- * If set, this is used for preparing the system to power off.
-- */
-+      /*
-+       * If set, this is used for preparing the system to power off.
-+       */
--void (*pm_power_off_prepare)(void);
-+      void (*pm_power_off_prepare)(void);
--/*
-- * set the priority of a task
-- * - the caller must hold the RCU read lock
-- */
--static int set_one_prio(struct task_struct *p, int niceval, int error)
--{
--      const struct cred *cred = current_cred(), *pcred = __task_cred(p);
--      int no_nice;
-+      /*
-+       * set the priority of a task
-+       * - the caller must hold the RCU read lock
-+       */
-+      static int set_one_prio(struct task_struct *p, int niceval, int error)
-+      {
-+              const struct cred *cred = current_cred(), *pcred = __task_cred(p);
-+              int no_nice;
--      if (pcred->uid  != cred->euid &&
--          pcred->euid != cred->euid && !capable(CAP_SYS_NICE)) {
--              error = -EPERM;
--              goto out;
--      }
--      if (niceval < task_nice(p) && !can_nice(p, niceval)) {
--              error = -EACCES;
--              goto out;
--      }
--      no_nice = security_task_setnice(p, niceval);
--      if (no_nice) {
--              error = no_nice;
--              goto out;
-+              if (pcred->uid  != cred->euid &&
-+                  pcred->euid != cred->euid && !capable(CAP_SYS_NICE)) {
-+                      error = -EPERM;
-+                      goto out;
-+              }
-+              if (niceval < task_nice(p) && !can_nice(p, niceval)) {
-+                      if (vx_flags(VXF_IGNEG_NICE, 0))
-+                              error = 0;
-+                      else
-+                              error = -EACCES;
-+                      goto out;
-+              }
-+              no_nice = security_task_setnice(p, niceval);
-+              if (no_nice) {
-+                      error = no_nice;
-+                      goto out;
-+              }
-+              if (error == -ESRCH)
-+                      error = 0;
-+              set_user_nice(p, niceval);
-+      out:
-+              return error;
-       }
--      if (error == -ESRCH)
--              error = 0;
--      set_user_nice(p, niceval);
--out:
--      return error;
--}
--SYSCALL_DEFINE3(setpriority, int, which, int, who, int, niceval)
--{
--      struct task_struct *g, *p;
--      struct user_struct *user;
--      const struct cred *cred = current_cred();
--      int error = -EINVAL;
--      struct pid *pgrp;
--
--      if (which > PRIO_USER || which < PRIO_PROCESS)
--              goto out;
-+      SYSCALL_DEFINE3(setpriority, int, which, int, who, int, niceval)
-+      {
-+              struct task_struct *g, *p;
-+              struct user_struct *user;
-+              const struct cred *cred = current_cred();
-+              int error = -EINVAL;
-+              struct pid *pgrp;
--      /* normalize: avoid signed division (rounding problems) */
--      error = -ESRCH;
--      if (niceval < -20)
--              niceval = -20;
--      if (niceval > 19)
--              niceval = 19;
-+              if (which > PRIO_USER || which < PRIO_PROCESS)
-+                      goto out;
--      read_lock(&tasklist_lock);
--      switch (which) {
--              case PRIO_PROCESS:
--                      if (who)
--                              p = find_task_by_vpid(who);
--                      else
--                              p = current;
--                      if (p)
--                              error = set_one_prio(p, niceval, error);
--                      break;
--              case PRIO_PGRP:
--                      if (who)
--                              pgrp = find_vpid(who);
--                      else
--                              pgrp = task_pgrp(current);
--                      do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
--                              error = set_one_prio(p, niceval, error);
--                      } while_each_pid_thread(pgrp, PIDTYPE_PGID, p);
--                      break;
--              case PRIO_USER:
--                      user = (struct user_struct *) cred->user;
--                      if (!who)
--                              who = cred->uid;
--                      else if ((who != cred->uid) &&
--                               !(user = find_user(who)))
--                              goto out_unlock;        /* No processes for this user */
-+              /* normalize: avoid signed division (rounding problems) */
-+              error = -ESRCH;
-+              if (niceval < -20)
-+                      niceval = -20;
-+              if (niceval > 19)
-+                      niceval = 19;
--                      do_each_thread(g, p)
--                              if (__task_cred(p)->uid == who)
-+              read_lock(&tasklist_lock);
-+              switch (which) {
-+                      case PRIO_PROCESS:
-+                              if (who)
-+                                      p = find_task_by_vpid(who);
-+                              else
-+                                      p = current;
-+                              if (p)
-                                       error = set_one_prio(p, niceval, error);
--                      while_each_thread(g, p);
--                      if (who != cred->uid)
--                              free_uid(user);         /* For find_user() */
--                      break;
--      }
--out_unlock:
--      read_unlock(&tasklist_lock);
--out:
--      return error;
--}
-+                              break;
-+                      case PRIO_PGRP:
-+                              if (who)
-+                                      pgrp = find_vpid(who);
-+                              else
-+                                      pgrp = task_pgrp(current);
-+                              do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
-+                                      if (!vx_check(p->xid, VS_ADMIN_P | VS_IDENT))
-+                                              continue;
-+                                      error = set_one_prio(p, niceval, error);
-+                              } while_each_pid_thread(pgrp, PIDTYPE_PGID, p);
-+                              break;
-+                      case PRIO_USER:
-+                              user = (struct user_struct *) cred->user;
-+                              if (!who)
-+                                      who = cred->uid;
-+                              else if ((who != cred->uid) &&
-+                                       !(user = find_user(who)))
-+                                      goto out_unlock;        /* No processes for this user */
--/*
-- * Ugh. To avoid negative return values, "getpriority()" will
-- * not return the normal nice-value, but a negated value that
-- * has been offset by 20 (ie it returns 40..1 instead of -20..19)
-- * to stay compatible.
-- */
--SYSCALL_DEFINE2(getpriority, int, which, int, who)
--{
--      struct task_struct *g, *p;
--      struct user_struct *user;
--      const struct cred *cred = current_cred();
--      long niceval, retval = -ESRCH;
--      struct pid *pgrp;
-+                              do_each_thread(g, p)
-+                                      if (__task_cred(p)->uid == who)
-+                                              error = set_one_prio(p, niceval, error);
-+                              while_each_thread(g, p);
-+                              if (who != cred->uid)
-+                                      free_uid(user);         /* For find_user() */
-+                              break;
-+              }
-+      out_unlock:
-+              read_unlock(&tasklist_lock);
-+      out:
-+              return error;
-+      }
--      if (which > PRIO_USER || which < PRIO_PROCESS)
--              return -EINVAL;
-+      /*
-+       * Ugh. To avoid negative return values, "getpriority()" will
-+       * not return the normal nice-value, but a negated value that
-+       * has been offset by 20 (ie it returns 40..1 instead of -20..19)
-+       * to stay compatible.
-+       */
-+      SYSCALL_DEFINE2(getpriority, int, which, int, who)
-+      {
-+              struct task_struct *g, *p;
-+              struct user_struct *user;
-+              const struct cred *cred = current_cred();
-+              long niceval, retval = -ESRCH;
-+              struct pid *pgrp;
--      read_lock(&tasklist_lock);
--      switch (which) {
--              case PRIO_PROCESS:
--                      if (who)
--                              p = find_task_by_vpid(who);
--                      else
--                              p = current;
--                      if (p) {
--                              niceval = 20 - task_nice(p);
--                              if (niceval > retval)
--                                      retval = niceval;
--                      }
--                      break;
--              case PRIO_PGRP:
--                      if (who)
--                              pgrp = find_vpid(who);
--                      else
--                              pgrp = task_pgrp(current);
--                      do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
--                              niceval = 20 - task_nice(p);
--                              if (niceval > retval)
--                                      retval = niceval;
--                      } while_each_pid_thread(pgrp, PIDTYPE_PGID, p);
--                      break;
--              case PRIO_USER:
--                      user = (struct user_struct *) cred->user;
--                      if (!who)
--                              who = cred->uid;
--                      else if ((who != cred->uid) &&
--                               !(user = find_user(who)))
--                              goto out_unlock;        /* No processes for this user */
-+              if (which > PRIO_USER || which < PRIO_PROCESS)
-+                      return -EINVAL;
--                      do_each_thread(g, p)
--                              if (__task_cred(p)->uid == who) {
-+              read_lock(&tasklist_lock);
-+              switch (which) {
-+                      case PRIO_PROCESS:
-+                              if (who)
-+                                      p = find_task_by_vpid(who);
-+                              else
-+                                      p = current;
-+                              if (p) {
-                                       niceval = 20 - task_nice(p);
-                                       if (niceval > retval)
-                                               retval = niceval;
-                               }
--                      while_each_thread(g, p);
--                      if (who != cred->uid)
--                              free_uid(user);         /* for find_user() */
--                      break;
--      }
--out_unlock:
--      read_unlock(&tasklist_lock);
-+                              break;
-+                      case PRIO_PGRP:
-+                              if (who)
-+                                      pgrp = find_vpid(who);
-+                              else
-+                                      pgrp = task_pgrp(current);
-+                              do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
-+                                      if (!vx_check(p->xid, VS_ADMIN_P | VS_IDENT))
-+                                              continue;
-+                                      niceval = 20 - task_nice(p);
-+                                      if (niceval > retval)
-+                                              retval = niceval;
-+                              } while_each_pid_thread(pgrp, PIDTYPE_PGID, p);
-+                              break;
-+                      case PRIO_USER:
-+                              user = (struct user_struct *) cred->user;
-+                              if (!who)
-+                                      who = cred->uid;
-+                              else if ((who != cred->uid) &&
-+                                       !(user = find_user(who)))
-+                                      goto out_unlock;        /* No processes for this user */
--      return retval;
--}
-+                              do_each_thread(g, p)
-+                                      if (__task_cred(p)->uid == who) {
-+                                              niceval = 20 - task_nice(p);
-+                                              if (niceval > retval)
-+                                                      retval = niceval;
-+                                      }
-+                              while_each_thread(g, p);
-+                              if (who != cred->uid)
-+                                      free_uid(user);         /* for find_user() */
-+                              break;
-+              }
-+      out_unlock:
-+              read_unlock(&tasklist_lock);
--/**
-- *    emergency_restart - reboot the system
-- *
-- *    Without shutting down any hardware or taking any locks
-- *    reboot the system.  This is called when we know we are in
-- *    trouble so this is our best effort to reboot.  This is
-- *    safe to call in interrupt context.
-- */
--void emergency_restart(void)
--{
--      machine_emergency_restart();
--}
--EXPORT_SYMBOL_GPL(emergency_restart);
-+              return retval;
-+      }
--void kernel_restart_prepare(char *cmd)
--{
--      blocking_notifier_call_chain(&reboot_notifier_list, SYS_RESTART, cmd);
--      system_state = SYSTEM_RESTART;
--      device_shutdown();
--      sysdev_shutdown();
--}
-+      /**
-+       *      emergency_restart - reboot the system
-+       *
-+       *      Without shutting down any hardware or taking any locks
-+       *      reboot the system.  This is called when we know we are in
-+       *      trouble so this is our best effort to reboot.  This is
-+       *      safe to call in interrupt context.
-+       */
-+      void emergency_restart(void)
-+      {
-+              machine_emergency_restart();
-+      }
-+      EXPORT_SYMBOL_GPL(emergency_restart);
--/**
-- *    kernel_restart - reboot the system
-- *    @cmd: pointer to buffer containing command to execute for restart
-- *            or %NULL
-- *
-- *    Shutdown everything and perform a clean reboot.
-- *    This is not safe to call in interrupt context.
-- */
--void kernel_restart(char *cmd)
--{
--      kernel_restart_prepare(cmd);
--      if (!cmd)
--              printk(KERN_EMERG "Restarting system.\n");
--      else
--              printk(KERN_EMERG "Restarting system with command '%s'.\n", cmd);
--      machine_restart(cmd);
--}
--EXPORT_SYMBOL_GPL(kernel_restart);
-+      void kernel_restart_prepare(char *cmd)
-+      {
-+              blocking_notifier_call_chain(&reboot_notifier_list, SYS_RESTART, cmd);
-+              system_state = SYSTEM_RESTART;
-+              device_shutdown();
-+              sysdev_shutdown();
-+      }
--static void kernel_shutdown_prepare(enum system_states state)
--{
--      blocking_notifier_call_chain(&reboot_notifier_list,
--              (state == SYSTEM_HALT)?SYS_HALT:SYS_POWER_OFF, NULL);
--      system_state = state;
--      device_shutdown();
--}
--/**
-- *    kernel_halt - halt the system
-- *
-- *    Shutdown everything and perform a clean system halt.
-- */
--void kernel_halt(void)
--{
--      kernel_shutdown_prepare(SYSTEM_HALT);
--      sysdev_shutdown();
--      printk(KERN_EMERG "System halted.\n");
--      machine_halt();
--}
-+      /**
-+       *      kernel_restart - reboot the system
-+       *      @cmd: pointer to buffer containing command to execute for restart
-+       *              or %NULL
-+       *
-+       *      Shutdown everything and perform a clean reboot.
-+       *      This is not safe to call in interrupt context.
-+       */
-+      void kernel_restart(char *cmd)
-+      {
-+              kernel_restart_prepare(cmd);
-+              if (!cmd)
-+                      printk(KERN_EMERG "Restarting system.\n");
-+              else
-+                      printk(KERN_EMERG "Restarting system with command '%s'.\n", cmd);
-+              machine_restart(cmd);
-+      }
-+      EXPORT_SYMBOL_GPL(kernel_restart);
--EXPORT_SYMBOL_GPL(kernel_halt);
-+      static void kernel_shutdown_prepare(enum system_states state)
-+      {
-+              blocking_notifier_call_chain(&reboot_notifier_list,
-+                      (state == SYSTEM_HALT)?SYS_HALT:SYS_POWER_OFF, NULL);
-+              system_state = state;
-+              device_shutdown();
-+      }
-+      /**
-+       *      kernel_halt - halt the system
-+       *
-+       *      Shutdown everything and perform a clean system halt.
-+       */
-+      void kernel_halt(void)
-+      {
-+              kernel_shutdown_prepare(SYSTEM_HALT);
-+              sysdev_shutdown();
-+              printk(KERN_EMERG "System halted.\n");
-+              machine_halt();
-+      }
--/**
-- *    kernel_power_off - power_off the system
-- *
-- *    Shutdown everything and perform a clean system power_off.
-- */
--void kernel_power_off(void)
--{
--      kernel_shutdown_prepare(SYSTEM_POWER_OFF);
--      if (pm_power_off_prepare)
--              pm_power_off_prepare();
--      disable_nonboot_cpus();
--      sysdev_shutdown();
--      printk(KERN_EMERG "Power down.\n");
--      machine_power_off();
--}
--EXPORT_SYMBOL_GPL(kernel_power_off);
--/*
-- * Reboot system call: for obvious reasons only root may call it,
-- * and even root needs to set up some magic numbers in the registers
-- * so that some mistake won't make this reboot the whole machine.
-- * You can also set the meaning of the ctrl-alt-del-key here.
-- *
-- * reboot doesn't sync: do that yourself before calling this.
-- */
--SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
--              void __user *, arg)
--{
--      char buffer[256];
--      int ret = 0;
-+      EXPORT_SYMBOL_GPL(kernel_halt);
--      /* We only trust the superuser with rebooting the system. */
--      if (!capable(CAP_SYS_BOOT))
--              return -EPERM;
-+      /**
-+       *      kernel_power_off - power_off the system
-+       *
-+       *      Shutdown everything and perform a clean system power_off.
-+       */
-+      void kernel_power_off(void)
-+      {
-+              kernel_shutdown_prepare(SYSTEM_POWER_OFF);
-+              if (pm_power_off_prepare)
-+                      pm_power_off_prepare();
-+              disable_nonboot_cpus();
-+              sysdev_shutdown();
-+              printk(KERN_EMERG "Power down.\n");
-+              machine_power_off();
-+      }
-+      EXPORT_SYMBOL_GPL(kernel_power_off);
--      /* For safety, we require "magic" arguments. */
--      if (magic1 != LINUX_REBOOT_MAGIC1 ||
--          (magic2 != LINUX_REBOOT_MAGIC2 &&
--                      magic2 != LINUX_REBOOT_MAGIC2A &&
--                      magic2 != LINUX_REBOOT_MAGIC2B &&
--                      magic2 != LINUX_REBOOT_MAGIC2C))
--              return -EINVAL;
-+      long vs_reboot(unsigned int, void __user *);
--      /* Instead of trying to make the power_off code look like
--       * halt when pm_power_off is not set do it the easy way.
-+      /*
-+       * Reboot system call: for obvious reasons only root may call it,
-+       * and even root needs to set up some magic numbers in the registers
-+       * so that some mistake won't make this reboot the whole machine.
-+       * You can also set the meaning of the ctrl-alt-del-key here.
-+       *
-+       * reboot doesn't sync: do that yourself before calling this.
-        */
--      if ((cmd == LINUX_REBOOT_CMD_POWER_OFF) && !pm_power_off)
--              cmd = LINUX_REBOOT_CMD_HALT;
-+      SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
-+                      void __user *, arg)
-+      {
-+              char buffer[256];
-+              int ret = 0;
--      lock_kernel();
--      switch (cmd) {
--      case LINUX_REBOOT_CMD_RESTART:
--              kernel_restart(NULL);
--              break;
-+              /* We only trust the superuser with rebooting the system. */
-+              if (!capable(CAP_SYS_BOOT))
-+                      return -EPERM;
--      case LINUX_REBOOT_CMD_CAD_ON:
--              C_A_D = 1;
--              break;
-+              /* For safety, we require "magic" arguments. */
-+              if (magic1 != LINUX_REBOOT_MAGIC1 ||
-+                  (magic2 != LINUX_REBOOT_MAGIC2 &&
-+                              magic2 != LINUX_REBOOT_MAGIC2A &&
-+                              magic2 != LINUX_REBOOT_MAGIC2B &&
-+                              magic2 != LINUX_REBOOT_MAGIC2C))
-+                      return -EINVAL;
--      case LINUX_REBOOT_CMD_CAD_OFF:
--              C_A_D = 0;
--              break;
-+              /* Instead of trying to make the power_off code look like
-+               * halt when pm_power_off is not set do it the easy way.
-+               */
-+              if ((cmd == LINUX_REBOOT_CMD_POWER_OFF) && !pm_power_off)
-+                      cmd = LINUX_REBOOT_CMD_HALT;
--      case LINUX_REBOOT_CMD_HALT:
--              kernel_halt();
--              unlock_kernel();
--              do_exit(0);
--              panic("cannot halt");
-+              if (!vx_check(0, VS_ADMIN|VS_WATCH))
-+                      return vs_reboot(cmd, arg);
--      case LINUX_REBOOT_CMD_POWER_OFF:
--              kernel_power_off();
--              unlock_kernel();
--              do_exit(0);
--              break;
-+              lock_kernel();
-+              switch (cmd) {
-+              case LINUX_REBOOT_CMD_RESTART:
-+                      kernel_restart(NULL);
-+                      break;
--      case LINUX_REBOOT_CMD_RESTART2:
--              if (strncpy_from_user(&buffer[0], arg, sizeof(buffer) - 1) < 0) {
-+              case LINUX_REBOOT_CMD_CAD_ON:
-+                      C_A_D = 1;
-+                      break;
-+
-+              case LINUX_REBOOT_CMD_CAD_OFF:
-+                      C_A_D = 0;
-+                      break;
-+
-+              case LINUX_REBOOT_CMD_HALT:
-+                      kernel_halt();
-                       unlock_kernel();
--                      return -EFAULT;
--              }
--              buffer[sizeof(buffer) - 1] = '\0';
-+                      do_exit(0);
-+                      panic("cannot halt");
--              kernel_restart(buffer);
--              break;
-+              case LINUX_REBOOT_CMD_POWER_OFF:
-+                      kernel_power_off();
-+                      unlock_kernel();
-+                      do_exit(0);
-+                      break;
-+
-+              case LINUX_REBOOT_CMD_RESTART2:
-+                      if (strncpy_from_user(&buffer[0], arg, sizeof(buffer) - 1) < 0) {
-+                              unlock_kernel();
-+                              return -EFAULT;
-+                      }
-+                      buffer[sizeof(buffer) - 1] = '\0';
-+
-+                      kernel_restart(buffer);
-+                      break;
- #ifdef CONFIG_KEXEC
--      case LINUX_REBOOT_CMD_KEXEC:
--              ret = kernel_kexec();
--              break;
-+              case LINUX_REBOOT_CMD_KEXEC:
-+                      ret = kernel_kexec();
-+                      break;
- #endif
- #ifdef CONFIG_HIBERNATION
--      case LINUX_REBOOT_CMD_SW_SUSPEND:
--              ret = hibernate();
--              break;
-+              case LINUX_REBOOT_CMD_SW_SUSPEND:
-+                      ret = hibernate();
-+                      break;
- #endif
--      default:
--              ret = -EINVAL;
--              break;
-+              default:
-+                      ret = -EINVAL;
-+                      break;
-+              }
-+              unlock_kernel();
-+              return ret;
-       }
--      unlock_kernel();
--      return ret;
--}
--static void deferred_cad(struct work_struct *dummy)
--{
--      kernel_restart(NULL);
--}
--
--/*
-- * This function gets called by ctrl-alt-del - ie the keyboard interrupt.
-- * As it's called within an interrupt, it may NOT sync: the only choice
-- * is whether to reboot at once, or just ignore the ctrl-alt-del.
-- */
--void ctrl_alt_del(void)
--{
--      static DECLARE_WORK(cad_work, deferred_cad);
--
--      if (C_A_D)
--              schedule_work(&cad_work);
--      else
--              kill_cad_pid(SIGINT, 1);
--}
--      
--/*
-- * Unprivileged users may change the real gid to the effective gid
-- * or vice versa.  (BSD-style)
-- *
-- * If you set the real gid at all, or set the effective gid to a value not
-- * equal to the real gid, then the saved gid is set to the new effective gid.
-- *
-- * This makes it possible for a setgid program to completely drop its
-- * privileges, which is often a useful assertion to make when you are doing
-- * a security audit over a program.
-- *
-- * The general idea is that a program which uses just setregid() will be
-- * 100% compatible with BSD.  A program which uses just setgid() will be
-- * 100% compatible with POSIX with saved IDs. 
-- *
-- * SMP: There are not races, the GIDs are checked only by filesystem
-- *      operations (as far as semantic preservation is concerned).
-- */
--SYSCALL_DEFINE2(setregid, gid_t, rgid, gid_t, egid)
--{
--      const struct cred *old;
--      struct cred *new;
--      int retval;
--
--      new = prepare_creds();
--      if (!new)
--              return -ENOMEM;
--      old = current_cred();
-+      static void deferred_cad(struct work_struct *dummy)
-+      {
-+              kernel_restart(NULL);
-+      }
--      retval = security_task_setgid(rgid, egid, (gid_t)-1, LSM_SETID_RE);
--      if (retval)
--              goto error;
-+      /*
-+       * This function gets called by ctrl-alt-del - ie the keyboard interrupt.
-+       * As it's called within an interrupt, it may NOT sync: the only choice
-+       * is whether to reboot at once, or just ignore the ctrl-alt-del.
-+       */
-+      void ctrl_alt_del(void)
-+      {
-+              static DECLARE_WORK(cad_work, deferred_cad);
--      retval = -EPERM;
--      if (rgid != (gid_t) -1) {
--              if (old->gid == rgid ||
--                  old->egid == rgid ||
--                  capable(CAP_SETGID))
--                      new->gid = rgid;
--              else
--                      goto error;
--      }
--      if (egid != (gid_t) -1) {
--              if (old->gid == egid ||
--                  old->egid == egid ||
--                  old->sgid == egid ||
--                  capable(CAP_SETGID))
--                      new->egid = egid;
-+              if (C_A_D)
-+                      schedule_work(&cad_work);
-               else
--                      goto error;
-+                      kill_cad_pid(SIGINT, 1);
-       }
-+
-+      /*
-+       * Unprivileged users may change the real gid to the effective gid
-+       * or vice versa.  (BSD-style)
-+       *
-+       * If you set the real gid at all, or set the effective gid to a value not
-+       * equal to the real gid, then the saved gid is set to the new effective gid.
-+       *
-+       * This makes it possible for a setgid program to completely drop its
-+       * privileges, which is often a useful assertion to make when you are doing
-+       * a security audit over a program.
-+       *
-+       * The general idea is that a program which uses just setregid() will be
-+       * 100% compatible with BSD.  A program which uses just setgid() will be
-+       * 100% compatible with POSIX with saved IDs.
-+       *
-+       * SMP: There are not races, the GIDs are checked only by filesystem
-+       *      operations (as far as semantic preservation is concerned).
-+       */
-+      SYSCALL_DEFINE2(setregid, gid_t, rgid, gid_t, egid)
-+      {
-+              const struct cred *old;
-+              struct cred *new;
-+              int retval;
--      if (rgid != (gid_t) -1 ||
--          (egid != (gid_t) -1 && egid != old->gid))
--              new->sgid = new->egid;
--      new->fsgid = new->egid;
--
--      return commit_creds(new);
-+              new = prepare_creds();
-+              if (!new)
-+                      return -ENOMEM;
-+              old = current_cred();
--error:
--      abort_creds(new);
--      return retval;
--}
-+              retval = security_task_setgid(rgid, egid, (gid_t)-1, LSM_SETID_RE);
-+              if (retval)
-+                      goto error;
--/*
-- * setgid() is implemented like SysV w/ SAVED_IDS 
-- *
-- * SMP: Same implicit races as above.
-- */
--SYSCALL_DEFINE1(setgid, gid_t, gid)
--{
--      const struct cred *old;
--      struct cred *new;
--      int retval;
-+              retval = -EPERM;
-+              if (rgid != (gid_t) -1) {
-+                      if (old->gid == rgid ||
-+                          old->egid == rgid ||
-+                          capable(CAP_SETGID))
-+                              new->gid = rgid;
-+                      else
-+                              goto error;
-+              }
-+              if (egid != (gid_t) -1) {
-+                      if (old->gid == egid ||
-+                          old->egid == egid ||
-+                          old->sgid == egid ||
-+                          capable(CAP_SETGID))
-+                              new->egid = egid;
-+                      else
-+                              goto error;
-+              }
--      new = prepare_creds();
--      if (!new)
--              return -ENOMEM;
--      old = current_cred();
-+              if (rgid != (gid_t) -1 ||
-+                  (egid != (gid_t) -1 && egid != old->gid))
-+                      new->sgid = new->egid;
-+              new->fsgid = new->egid;
--      retval = security_task_setgid(gid, (gid_t)-1, (gid_t)-1, LSM_SETID_ID);
--      if (retval)
--              goto error;
-+              return commit_creds(new);
--      retval = -EPERM;
--      if (capable(CAP_SETGID))
--              new->gid = new->egid = new->sgid = new->fsgid = gid;
--      else if (gid == old->gid || gid == old->sgid)
--              new->egid = new->fsgid = gid;
--      else
--              goto error;
-+      error:
-+              abort_creds(new);
-+              return retval;
-+      }
--      return commit_creds(new);
-+      /*
-+       * setgid() is implemented like SysV w/ SAVED_IDS
-+       *
-+       * SMP: Same implicit races as above.
-+       */
-+      SYSCALL_DEFINE1(setgid, gid_t, gid)
-+      {
-+              const struct cred *old;
-+              struct cred *new;
-+              int retval;
--error:
--      abort_creds(new);
--      return retval;
--}
-+              new = prepare_creds();
-+              if (!new)
-+                      return -ENOMEM;
-+              old = current_cred();
--/*
-- * change the user struct in a credentials set to match the new UID
-- */
--static int set_user(struct cred *new)
--{
--      struct user_struct *new_user;
-+              retval = security_task_setgid(gid, (gid_t)-1, (gid_t)-1, LSM_SETID_ID);
-+              if (retval)
-+                      goto error;
--      new_user = alloc_uid(current_user_ns(), new->uid);
--      if (!new_user)
--              return -EAGAIN;
-+              retval = -EPERM;
-+              if (capable(CAP_SETGID))
-+                      new->gid = new->egid = new->sgid = new->fsgid = gid;
-+              else if (gid == old->gid || gid == old->sgid)
-+                      new->egid = new->fsgid = gid;
-+              else
-+                      goto error;
--      if (!task_can_switch_user(new_user, current)) {
--              free_uid(new_user);
--              return -EINVAL;
--      }
-+              return commit_creds(new);
--      if (atomic_read(&new_user->processes) >=
--                              current->signal->rlim[RLIMIT_NPROC].rlim_cur &&
--                      new_user != INIT_USER) {
--              free_uid(new_user);
--              return -EAGAIN;
-+      error:
-+              abort_creds(new);
-+              return retval;
-       }
--      free_uid(new->user);
--      new->user = new_user;
--      return 0;
--}
--
--/*
-- * Unprivileged users may change the real uid to the effective uid
-- * or vice versa.  (BSD-style)
-- *
-- * If you set the real uid at all, or set the effective uid to a value not
-- * equal to the real uid, then the saved uid is set to the new effective uid.
-- *
-- * This makes it possible for a setuid program to completely drop its
-- * privileges, which is often a useful assertion to make when you are doing
-- * a security audit over a program.
-- *
-- * The general idea is that a program which uses just setreuid() will be
-- * 100% compatible with BSD.  A program which uses just setuid() will be
-- * 100% compatible with POSIX with saved IDs. 
-- */
--SYSCALL_DEFINE2(setreuid, uid_t, ruid, uid_t, euid)
--{
--      const struct cred *old;
--      struct cred *new;
--      int retval;
--
--      new = prepare_creds();
--      if (!new)
--              return -ENOMEM;
--      old = current_cred();
-+      /*
-+       * change the user struct in a credentials set to match the new UID
-+       */
-+      static int set_user(struct cred *new)
-+      {
-+              struct user_struct *new_user;
--      retval = security_task_setuid(ruid, euid, (uid_t)-1, LSM_SETID_RE);
--      if (retval)
--              goto error;
-+              new_user = alloc_uid(current_user_ns(), new->uid);
-+              if (!new_user)
-+                      return -EAGAIN;
--      retval = -EPERM;
--      if (ruid != (uid_t) -1) {
--              new->uid = ruid;
--              if (old->uid != ruid &&
--                  old->euid != ruid &&
--                  !capable(CAP_SETUID))
--                      goto error;
--      }
-+              if (!task_can_switch_user(new_user, current)) {
-+                      free_uid(new_user);
-+                      return -EINVAL;
-+              }
--      if (euid != (uid_t) -1) {
--              new->euid = euid;
--              if (old->uid != euid &&
--                  old->euid != euid &&
--                  old->suid != euid &&
--                  !capable(CAP_SETUID))
--                      goto error;
--      }
-+              if (atomic_read(&new_user->processes) >=
-+                                      current->signal->rlim[RLIMIT_NPROC].rlim_cur &&
-+                              new_user != INIT_USER) {
-+                      free_uid(new_user);
-+                      return -EAGAIN;
-+              }
--      if (new->uid != old->uid) {
--              retval = set_user(new);
--              if (retval < 0)
--                      goto error;
-+              free_uid(new->user);
-+              new->user = new_user;
-+              return 0;
-       }
--      if (ruid != (uid_t) -1 ||
--          (euid != (uid_t) -1 && euid != old->uid))
--              new->suid = new->euid;
--      new->fsuid = new->euid;
--      retval = security_task_fix_setuid(new, old, LSM_SETID_RE);
--      if (retval < 0)
--              goto error;
-+      /*
-+       * Unprivileged users may change the real uid to the effective uid
-+       * or vice versa.  (BSD-style)
-+       *
-+       * If you set the real uid at all, or set the effective uid to a value not
-+       * equal to the real uid, then the saved uid is set to the new effective uid.
-+       *
-+       * This makes it possible for a setuid program to completely drop its
-+       * privileges, which is often a useful assertion to make when you are doing
-+       * a security audit over a program.
-+       *
-+       * The general idea is that a program which uses just setreuid() will be
-+       * 100% compatible with BSD.  A program which uses just setuid() will be
-+       * 100% compatible with POSIX with saved IDs.
-+       */
-+      SYSCALL_DEFINE2(setreuid, uid_t, ruid, uid_t, euid)
-+      {
-+              const struct cred *old;
-+              struct cred *new;
-+              int retval;
--      return commit_creds(new);
-+              new = prepare_creds();
-+              if (!new)
-+                      return -ENOMEM;
-+              old = current_cred();
--error:
--      abort_creds(new);
--      return retval;
--}
--              
--/*
-- * setuid() is implemented like SysV with SAVED_IDS 
-- * 
-- * Note that SAVED_ID's is deficient in that a setuid root program
-- * like sendmail, for example, cannot set its uid to be a normal 
-- * user and then switch back, because if you're root, setuid() sets
-- * the saved uid too.  If you don't like this, blame the bright people
-- * in the POSIX committee and/or USG.  Note that the BSD-style setreuid()
-- * will allow a root program to temporarily drop privileges and be able to
-- * regain them by swapping the real and effective uid.  
-- */
--SYSCALL_DEFINE1(setuid, uid_t, uid)
--{
--      const struct cred *old;
--      struct cred *new;
--      int retval;
-+              retval = security_task_setuid(ruid, euid, (uid_t)-1, LSM_SETID_RE);
-+              if (retval)
-+                      goto error;
--      new = prepare_creds();
--      if (!new)
--              return -ENOMEM;
--      old = current_cred();
-+              retval = -EPERM;
-+              if (ruid != (uid_t) -1) {
-+                      new->uid = ruid;
-+                      if (old->uid != ruid &&
-+                          old->euid != ruid &&
-+                          !capable(CAP_SETUID))
-+                              goto error;
-+              }
--      retval = security_task_setuid(uid, (uid_t)-1, (uid_t)-1, LSM_SETID_ID);
--      if (retval)
--              goto error;
-+              if (euid != (uid_t) -1) {
-+                      new->euid = euid;
-+                      if (old->uid != euid &&
-+                          old->euid != euid &&
-+                          old->suid != euid &&
-+                          !capable(CAP_SETUID))
-+                              goto error;
-+              }
--      retval = -EPERM;
--      if (capable(CAP_SETUID)) {
--              new->suid = new->uid = uid;
--              if (uid != old->uid) {
-+              if (new->uid != old->uid) {
-                       retval = set_user(new);
-                       if (retval < 0)
-                               goto error;
-               }
--      } else if (uid != old->uid && uid != new->suid) {
--              goto error;
-+              if (ruid != (uid_t) -1 ||
-+                  (euid != (uid_t) -1 && euid != old->uid))
-+                      new->suid = new->euid;
-+              new->fsuid = new->euid;
-+
-+              retval = security_task_fix_setuid(new, old, LSM_SETID_RE);
-+              if (retval < 0)
-+                      goto error;
-+
-+              return commit_creds(new);
-+
-+      error:
-+              abort_creds(new);
-+              return retval;
-       }
-+
-+      /*
-+       * setuid() is implemented like SysV with SAVED_IDS
-+       *
-+       * Note that SAVED_ID's is deficient in that a setuid root program
-+       * like sendmail, for example, cannot set its uid to be a normal
-+       * user and then switch back, because if you're root, setuid() sets
-+       * the saved uid too.  If you don't like this, blame the bright people
-+       * in the POSIX committee and/or USG.  Note that the BSD-style setreuid()
-+       * will allow a root program to temporarily drop privileges and be able to
-+       * regain them by swapping the real and effective uid.
-+       */
-+      SYSCALL_DEFINE1(setuid, uid_t, uid)
-+      {
-+              const struct cred *old;
-+              struct cred *new;
-+              int retval;
--      new->fsuid = new->euid = uid;
-+              new = prepare_creds();
-+              if (!new)
-+                      return -ENOMEM;
-+              old = current_cred();
--      retval = security_task_fix_setuid(new, old, LSM_SETID_ID);
--      if (retval < 0)
--              goto error;
-+              retval = security_task_setuid(uid, (uid_t)-1, (uid_t)-1, LSM_SETID_ID);
-+              if (retval)
-+                      goto error;
--      return commit_creds(new);
-+              retval = -EPERM;
-+              if (capable(CAP_SETUID)) {
-+                      new->suid = new->uid = uid;
-+                      if (uid != old->uid) {
-+                              retval = set_user(new);
-+                              if (retval < 0)
-+                                      goto error;
-+                      }
-+              } else if (uid != old->uid && uid != new->suid) {
-+                      goto error;
-+              }
--error:
--      abort_creds(new);
--      return retval;
--}
-+              new->fsuid = new->euid = uid;
-+              retval = security_task_fix_setuid(new, old, LSM_SETID_ID);
-+              if (retval < 0)
-+                      goto error;
--/*
-- * This function implements a generic ability to update ruid, euid,
-- * and suid.  This allows you to implement the 4.4 compatible seteuid().
-- */
--SYSCALL_DEFINE3(setresuid, uid_t, ruid, uid_t, euid, uid_t, suid)
--{
--      const struct cred *old;
--      struct cred *new;
--      int retval;
-+              return commit_creds(new);
--      new = prepare_creds();
--      if (!new)
--              return -ENOMEM;
-+      error:
-+              abort_creds(new);
-+              return retval;
-+      }
--      retval = security_task_setuid(ruid, euid, suid, LSM_SETID_RES);
--      if (retval)
--              goto error;
--      old = current_cred();
--      retval = -EPERM;
--      if (!capable(CAP_SETUID)) {
--              if (ruid != (uid_t) -1 && ruid != old->uid &&
--                  ruid != old->euid  && ruid != old->suid)
--                      goto error;
--              if (euid != (uid_t) -1 && euid != old->uid &&
--                  euid != old->euid  && euid != old->suid)
--                      goto error;
--              if (suid != (uid_t) -1 && suid != old->uid &&
--                  suid != old->euid  && suid != old->suid)
-+      /*
-+       * This function implements a generic ability to update ruid, euid,
-+       * and suid.  This allows you to implement the 4.4 compatible seteuid().
-+       */
-+      SYSCALL_DEFINE3(setresuid, uid_t, ruid, uid_t, euid, uid_t, suid)
-+      {
-+              const struct cred *old;
-+              struct cred *new;
-+              int retval;
-+
-+              new = prepare_creds();
-+              if (!new)
-+                      return -ENOMEM;
-+
-+              retval = security_task_setuid(ruid, euid, suid, LSM_SETID_RES);
-+              if (retval)
-                       goto error;
--      }
-+              old = current_cred();
--      if (ruid != (uid_t) -1) {
--              new->uid = ruid;
--              if (ruid != old->uid) {
--                      retval = set_user(new);
--                      if (retval < 0)
-+              retval = -EPERM;
-+              if (!capable(CAP_SETUID)) {
-+                      if (ruid != (uid_t) -1 && ruid != old->uid &&
-+                          ruid != old->euid  && ruid != old->suid)
-+                              goto error;
-+                      if (euid != (uid_t) -1 && euid != old->uid &&
-+                          euid != old->euid  && euid != old->suid)
-+                              goto error;
-+                      if (suid != (uid_t) -1 && suid != old->uid &&
-+                          suid != old->euid  && suid != old->suid)
-                               goto error;
-               }
--      }
--      if (euid != (uid_t) -1)
--              new->euid = euid;
--      if (suid != (uid_t) -1)
--              new->suid = suid;
--      new->fsuid = new->euid;
--      retval = security_task_fix_setuid(new, old, LSM_SETID_RES);
--      if (retval < 0)
--              goto error;
-+              if (ruid != (uid_t) -1) {
-+                      new->uid = ruid;
-+                      if (ruid != old->uid) {
-+                              retval = set_user(new);
-+                              if (retval < 0)
-+                                      goto error;
-+                      }
-+              }
-+              if (euid != (uid_t) -1)
-+                      new->euid = euid;
-+              if (suid != (uid_t) -1)
-+                      new->suid = suid;
-+              new->fsuid = new->euid;
--      return commit_creds(new);
-+              retval = security_task_fix_setuid(new, old, LSM_SETID_RES);
-+              if (retval < 0)
-+                      goto error;
--error:
--      abort_creds(new);
--      return retval;
--}
-+              return commit_creds(new);
--SYSCALL_DEFINE3(getresuid, uid_t __user *, ruid, uid_t __user *, euid, uid_t __user *, suid)
--{
--      const struct cred *cred = current_cred();
--      int retval;
-+      error:
-+              abort_creds(new);
-+              return retval;
-+      }
--      if (!(retval   = put_user(cred->uid,  ruid)) &&
--          !(retval   = put_user(cred->euid, euid)))
--              retval = put_user(cred->suid, suid);
-+      SYSCALL_DEFINE3(getresuid, uid_t __user *, ruid, uid_t __user *, euid, uid_t __user *, suid)
-+      {
-+              const struct cred *cred = current_cred();
-+              int retval;
--      return retval;
--}
-+              if (!(retval   = put_user(cred->uid,  ruid)) &&
-+                  !(retval   = put_user(cred->euid, euid)))
-+                      retval = put_user(cred->suid, suid);
--/*
-- * Same as above, but for rgid, egid, sgid.
-- */
--SYSCALL_DEFINE3(setresgid, gid_t, rgid, gid_t, egid, gid_t, sgid)
--{
--      const struct cred *old;
--      struct cred *new;
--      int retval;
-+              return retval;
-+      }
--      new = prepare_creds();
--      if (!new)
--              return -ENOMEM;
--      old = current_cred();
-+      /*
-+       * Same as above, but for rgid, egid, sgid.
-+       */
-+      SYSCALL_DEFINE3(setresgid, gid_t, rgid, gid_t, egid, gid_t, sgid)
-+      {
-+              const struct cred *old;
-+              struct cred *new;
-+              int retval;
--      retval = security_task_setgid(rgid, egid, sgid, LSM_SETID_RES);
--      if (retval)
--              goto error;
-+              new = prepare_creds();
-+              if (!new)
-+                      return -ENOMEM;
-+              old = current_cred();
--      retval = -EPERM;
--      if (!capable(CAP_SETGID)) {
--              if (rgid != (gid_t) -1 && rgid != old->gid &&
--                  rgid != old->egid  && rgid != old->sgid)
--                      goto error;
--              if (egid != (gid_t) -1 && egid != old->gid &&
--                  egid != old->egid  && egid != old->sgid)
--                      goto error;
--              if (sgid != (gid_t) -1 && sgid != old->gid &&
--                  sgid != old->egid  && sgid != old->sgid)
-+              retval = security_task_setgid(rgid, egid, sgid, LSM_SETID_RES);
-+              if (retval)
-                       goto error;
--      }
--      if (rgid != (gid_t) -1)
--              new->gid = rgid;
--      if (egid != (gid_t) -1)
--              new->egid = egid;
--      if (sgid != (gid_t) -1)
--              new->sgid = sgid;
--      new->fsgid = new->egid;
-+              retval = -EPERM;
-+              if (!capable(CAP_SETGID)) {
-+                      if (rgid != (gid_t) -1 && rgid != old->gid &&
-+                          rgid != old->egid  && rgid != old->sgid)
-+                              goto error;
-+                      if (egid != (gid_t) -1 && egid != old->gid &&
-+                          egid != old->egid  && egid != old->sgid)
-+                              goto error;
-+                      if (sgid != (gid_t) -1 && sgid != old->gid &&
-+                          sgid != old->egid  && sgid != old->sgid)
-+                              goto error;
-+              }
--      return commit_creds(new);
-+              if (rgid != (gid_t) -1)
-+                      new->gid = rgid;
-+              if (egid != (gid_t) -1)
-+                      new->egid = egid;
-+              if (sgid != (gid_t) -1)
-+                      new->sgid = sgid;
-+              new->fsgid = new->egid;
--error:
--      abort_creds(new);
--      return retval;
--}
-+              return commit_creds(new);
--SYSCALL_DEFINE3(getresgid, gid_t __user *, rgid, gid_t __user *, egid, gid_t __user *, sgid)
--{
--      const struct cred *cred = current_cred();
--      int retval;
-+      error:
-+              abort_creds(new);
-+              return retval;
-+      }
--      if (!(retval   = put_user(cred->gid,  rgid)) &&
--          !(retval   = put_user(cred->egid, egid)))
--              retval = put_user(cred->sgid, sgid);
-+      SYSCALL_DEFINE3(getresgid, gid_t __user *, rgid, gid_t __user *, egid, gid_t __user *, sgid)
-+      {
-+              const struct cred *cred = current_cred();
-+              int retval;
--      return retval;
--}
-+              if (!(retval   = put_user(cred->gid,  rgid)) &&
-+                  !(retval   = put_user(cred->egid, egid)))
-+                      retval = put_user(cred->sgid, sgid);
-+              return retval;
-+      }
--/*
-- * "setfsuid()" sets the fsuid - the uid used for filesystem checks. This
-- * is used for "access()" and for the NFS daemon (letting nfsd stay at
-- * whatever uid it wants to). It normally shadows "euid", except when
-- * explicitly set by setfsuid() or for access..
-- */
--SYSCALL_DEFINE1(setfsuid, uid_t, uid)
--{
--      const struct cred *old;
--      struct cred *new;
--      uid_t old_fsuid;
--      new = prepare_creds();
--      if (!new)
--              return current_fsuid();
--      old = current_cred();
--      old_fsuid = old->fsuid;
-+      /*
-+       * "setfsuid()" sets the fsuid - the uid used for filesystem checks. This
-+       * is used for "access()" and for the NFS daemon (letting nfsd stay at
-+       * whatever uid it wants to). It normally shadows "euid", except when
-+       * explicitly set by setfsuid() or for access..
-+       */
-+      SYSCALL_DEFINE1(setfsuid, uid_t, uid)
-+      {
-+              const struct cred *old;
-+              struct cred *new;
-+              uid_t old_fsuid;
--      if (security_task_setuid(uid, (uid_t)-1, (uid_t)-1, LSM_SETID_FS) < 0)
--              goto error;
-+              new = prepare_creds();
-+              if (!new)
-+                      return current_fsuid();
-+              old = current_cred();
-+              old_fsuid = old->fsuid;
--      if (uid == old->uid  || uid == old->euid  ||
--          uid == old->suid || uid == old->fsuid ||
--          capable(CAP_SETUID)) {
--              if (uid != old_fsuid) {
--                      new->fsuid = uid;
--                      if (security_task_fix_setuid(new, old, LSM_SETID_FS) == 0)
--                              goto change_okay;
-+              if (security_task_setuid(uid, (uid_t)-1, (uid_t)-1, LSM_SETID_FS) < 0)
-+                      goto error;
-+
-+              if (uid == old->uid  || uid == old->euid  ||
-+                  uid == old->suid || uid == old->fsuid ||
-+                  capable(CAP_SETUID)) {
-+                      if (uid != old_fsuid) {
-+                              new->fsuid = uid;
-+                              if (security_task_fix_setuid(new, old, LSM_SETID_FS) == 0)
-+                                      goto change_okay;
-+                      }
-               }
--      }
--error:
--      abort_creds(new);
--      return old_fsuid;
-+      error:
-+              abort_creds(new);
-+              return old_fsuid;
--change_okay:
--      commit_creds(new);
--      return old_fsuid;
--}
-+      change_okay:
-+              commit_creds(new);
-+              return old_fsuid;
-+      }
--/*
-- * Samma på svenska..
-- */
--SYSCALL_DEFINE1(setfsgid, gid_t, gid)
--{
--      const struct cred *old;
--      struct cred *new;
--      gid_t old_fsgid;
-+      /*
-+       * Samma på svenska..
-+       */
-+      SYSCALL_DEFINE1(setfsgid, gid_t, gid)
-+      {
-+              const struct cred *old;
-+              struct cred *new;
-+              gid_t old_fsgid;
--      new = prepare_creds();
--      if (!new)
--              return current_fsgid();
--      old = current_cred();
--      old_fsgid = old->fsgid;
-+              new = prepare_creds();
-+              if (!new)
-+                      return current_fsgid();
-+              old = current_cred();
-+              old_fsgid = old->fsgid;
--      if (security_task_setgid(gid, (gid_t)-1, (gid_t)-1, LSM_SETID_FS))
--              goto error;
-+              if (security_task_setgid(gid, (gid_t)-1, (gid_t)-1, LSM_SETID_FS))
-+                      goto error;
--      if (gid == old->gid  || gid == old->egid  ||
--          gid == old->sgid || gid == old->fsgid ||
--          capable(CAP_SETGID)) {
--              if (gid != old_fsgid) {
--                      new->fsgid = gid;
--                      goto change_okay;
-+              if (gid == old->gid  || gid == old->egid  ||
-+                  gid == old->sgid || gid == old->fsgid ||
-+                  capable(CAP_SETGID)) {
-+                      if (gid != old_fsgid) {
-+                              new->fsgid = gid;
-+                              goto change_okay;
-+                      }
-               }
--      }
--
--error:
--      abort_creds(new);
--      return old_fsgid;
--change_okay:
--      commit_creds(new);
--      return old_fsgid;
--}
--
--void do_sys_times(struct tms *tms)
--{
--      struct task_cputime cputime;
--      cputime_t cutime, cstime;
-+      error:
-+              abort_creds(new);
-+              return old_fsgid;
--      thread_group_cputime(current, &cputime);
--      spin_lock_irq(&current->sighand->siglock);
--      cutime = current->signal->cutime;
--      cstime = current->signal->cstime;
--      spin_unlock_irq(&current->sighand->siglock);
--      tms->tms_utime = cputime_to_clock_t(cputime.utime);
--      tms->tms_stime = cputime_to_clock_t(cputime.stime);
--      tms->tms_cutime = cputime_to_clock_t(cutime);
--      tms->tms_cstime = cputime_to_clock_t(cstime);
--}
-+      change_okay:
-+              commit_creds(new);
-+              return old_fsgid;
-+      }
--SYSCALL_DEFINE1(times, struct tms __user *, tbuf)
--{
--      if (tbuf) {
--              struct tms tmp;
-+      void do_sys_times(struct tms *tms)
-+      {
-+              struct task_cputime cputime;
-+              cputime_t cutime, cstime;
--              do_sys_times(&tmp);
--              if (copy_to_user(tbuf, &tmp, sizeof(struct tms)))
--                      return -EFAULT;
-+              thread_group_cputime(current, &cputime);
-+              spin_lock_irq(&current->sighand->siglock);
-+              cutime = current->signal->cutime;
-+              cstime = current->signal->cstime;
-+              spin_unlock_irq(&current->sighand->siglock);
-+              tms->tms_utime = cputime_to_clock_t(cputime.utime);
-+              tms->tms_stime = cputime_to_clock_t(cputime.stime);
-+              tms->tms_cutime = cputime_to_clock_t(cutime);
-+              tms->tms_cstime = cputime_to_clock_t(cstime);
-       }
--      force_successful_syscall_return();
--      return (long) jiffies_64_to_clock_t(get_jiffies_64());
--}
--/*
-- * This needs some heavy checking ...
-- * I just haven't the stomach for it. I also don't fully
-- * understand sessions/pgrp etc. Let somebody who does explain it.
-- *
-- * OK, I think I have the protection semantics right.... this is really
-- * only important on a multi-user system anyway, to make sure one user
-- * can't send a signal to a process owned by another.  -TYT, 12/12/91
-- *
-- * Auch. Had to add the 'did_exec' flag to conform completely to POSIX.
-- * LBT 04.03.94
-- */
--SYSCALL_DEFINE2(setpgid, pid_t, pid, pid_t, pgid)
--{
--      struct task_struct *p;
--      struct task_struct *group_leader = current->group_leader;
--      struct pid *pgrp;
--      int err;
-+      SYSCALL_DEFINE1(times, struct tms __user *, tbuf)
-+      {
-+              if (tbuf) {
-+                      struct tms tmp;
--      if (!pid)
--              pid = task_pid_vnr(group_leader);
--      if (!pgid)
--              pgid = pid;
--      if (pgid < 0)
--              return -EINVAL;
-+                      do_sys_times(&tmp);
-+                      if (copy_to_user(tbuf, &tmp, sizeof(struct tms)))
-+                              return -EFAULT;
-+              }
-+              force_successful_syscall_return();
-+              return (long) jiffies_64_to_clock_t(get_jiffies_64());
-+      }
--      /* From this point forward we keep holding onto the tasklist lock
--       * so that our parent does not change from under us. -DaveM
-+      /*
-+       * This needs some heavy checking ...
-+       * I just haven't the stomach for it. I also don't fully
-+       * understand sessions/pgrp etc. Let somebody who does explain it.
-+       *
-+       * OK, I think I have the protection semantics right.... this is really
-+       * only important on a multi-user system anyway, to make sure one user
-+       * can't send a signal to a process owned by another.  -TYT, 12/12/91
-+       *
-+       * Auch. Had to add the 'did_exec' flag to conform completely to POSIX.
-+       * LBT 04.03.94
-        */
--      write_lock_irq(&tasklist_lock);
-+      SYSCALL_DEFINE2(setpgid, pid_t, pid, pid_t, pgid)
-+      {
-+              struct task_struct *p;
-+              struct task_struct *group_leader = current->group_leader;
-+              struct pid *pgrp;
-+              int err;
--      err = -ESRCH;
--      p = find_task_by_vpid(pid);
--      if (!p)
--              goto out;
-+              if (!pid)
-+                      pid = task_pid_vnr(group_leader);
-+              if (!pgid)
-+                      pgid = pid;
-+              if (pgid < 0)
-+                      return -EINVAL;
--      err = -EINVAL;
--      if (!thread_group_leader(p))
--              goto out;
-+              /* From this point forward we keep holding onto the tasklist lock
-+               * so that our parent does not change from under us. -DaveM
-+               */
-+              write_lock_irq(&tasklist_lock);
--      if (same_thread_group(p->real_parent, group_leader)) {
--              err = -EPERM;
--              if (task_session(p) != task_session(group_leader))
--                      goto out;
--              err = -EACCES;
--              if (p->did_exec)
--                      goto out;
--      } else {
-               err = -ESRCH;
--              if (p != group_leader)
-+              p = find_task_by_vpid(pid);
-+              if (!p)
-                       goto out;
--      }
--      err = -EPERM;
--      if (p->signal->leader)
--              goto out;
-+              err = -EINVAL;
-+              if (!thread_group_leader(p))
-+                      goto out;
--      pgrp = task_pid(p);
--      if (pgid != pid) {
--              struct task_struct *g;
-+              if (same_thread_group(p->real_parent, group_leader)) {
-+                      err = -EPERM;
-+                      if (task_session(p) != task_session(group_leader))
-+                              goto out;
-+                      err = -EACCES;
-+                      if (p->did_exec)
-+                              goto out;
-+              } else {
-+                      err = -ESRCH;
-+                      if (p != group_leader)
-+                              goto out;
-+              }
--              pgrp = find_vpid(pgid);
--              g = pid_task(pgrp, PIDTYPE_PGID);
--              if (!g || task_session(g) != task_session(group_leader))
-+              err = -EPERM;
-+              if (p->signal->leader)
-                       goto out;
--      }
--      err = security_task_setpgid(p, pgid);
--      if (err)
--              goto out;
-+              pgrp = task_pid(p);
-+              if (pgid != pid) {
-+                      struct task_struct *g;
--      if (task_pgrp(p) != pgrp)
--              change_pid(p, PIDTYPE_PGID, pgrp);
-+                      pgrp = find_vpid(pgid);
-+                      g = pid_task(pgrp, PIDTYPE_PGID);
-+                      if (!g || task_session(g) != task_session(group_leader))
-+                              goto out;
-+              }
--      err = 0;
--out:
--      /* All paths lead to here, thus we are safe. -DaveM */
--      write_unlock_irq(&tasklist_lock);
--      return err;
--}
-+              err = security_task_setpgid(p, pgid);
-+              if (err)
-+                      goto out;
--SYSCALL_DEFINE1(getpgid, pid_t, pid)
--{
--      struct task_struct *p;
--      struct pid *grp;
--      int retval;
-+              if (task_pgrp(p) != pgrp)
-+                      change_pid(p, PIDTYPE_PGID, pgrp);
--      rcu_read_lock();
--      if (!pid)
--              grp = task_pgrp(current);
--      else {
--              retval = -ESRCH;
--              p = find_task_by_vpid(pid);
--              if (!p)
--                      goto out;
--              grp = task_pgrp(p);
--              if (!grp)
--                      goto out;
-+              err = 0;
-+      out:
-+              /* All paths lead to here, thus we are safe. -DaveM */
-+              write_unlock_irq(&tasklist_lock);
-+              return err;
-+      }
--              retval = security_task_getpgid(p);
--              if (retval)
--                      goto out;
-+      SYSCALL_DEFINE1(getpgid, pid_t, pid)
-+      {
-+              struct task_struct *p;
-+              struct pid *grp;
-+              int retval;
-+
-+              rcu_read_lock();
-+              if (!pid)
-+                      grp = task_pgrp(current);
-+              else {
-+                      retval = -ESRCH;
-+                      p = find_task_by_vpid(pid);
-+                      if (!p)
-+                              goto out;
-+                      grp = task_pgrp(p);
-+                      if (!grp)
-+                              goto out;
-+
-+                      retval = security_task_getpgid(p);
-+                      if (retval)
-+                              goto out;
-+              }
-+              retval = pid_vnr(grp);
-+      out:
-+              rcu_read_unlock();
-+              return retval;
-       }
--      retval = pid_vnr(grp);
--out:
--      rcu_read_unlock();
--      return retval;
--}
- #ifdef __ARCH_WANT_SYS_GETPGRP
--SYSCALL_DEFINE0(getpgrp)
--{
--      return sys_getpgid(0);
--}
-+      SYSCALL_DEFINE0(getpgrp)
-+      {
-+              return sys_getpgid(0);
-+      }
- #endif
--SYSCALL_DEFINE1(getsid, pid_t, pid)
--{
--      struct task_struct *p;
--      struct pid *sid;
--      int retval;
-+      SYSCALL_DEFINE1(getsid, pid_t, pid)
-+      {
-+              struct task_struct *p;
-+              struct pid *sid;
-+              int retval;
--      rcu_read_lock();
--      if (!pid)
--              sid = task_session(current);
--      else {
--              retval = -ESRCH;
--              p = find_task_by_vpid(pid);
--              if (!p)
--                      goto out;
--              sid = task_session(p);
--              if (!sid)
--                      goto out;
-+              rcu_read_lock();
-+              if (!pid)
-+                      sid = task_session(current);
-+              else {
-+                      retval = -ESRCH;
-+                      p = find_task_by_vpid(pid);
-+                      if (!p)
-+                              goto out;
-+                      sid = task_session(p);
-+                      if (!sid)
-+                              goto out;
--              retval = security_task_getsid(p);
--              if (retval)
--                      goto out;
-+                      retval = security_task_getsid(p);
-+                      if (retval)
-+                              goto out;
-+              }
-+              retval = pid_vnr(sid);
-+      out:
-+              rcu_read_unlock();
-+              return retval;
-       }
--      retval = pid_vnr(sid);
--out:
--      rcu_read_unlock();
--      return retval;
--}
--SYSCALL_DEFINE0(setsid)
--{
--      struct task_struct *group_leader = current->group_leader;
--      struct pid *sid = task_pid(group_leader);
--      pid_t session = pid_vnr(sid);
--      int err = -EPERM;
-+      SYSCALL_DEFINE0(setsid)
-+      {
-+              struct task_struct *group_leader = current->group_leader;
-+              struct pid *sid = task_pid(group_leader);
-+              pid_t session = pid_vnr(sid);
-+              int err = -EPERM;
--      write_lock_irq(&tasklist_lock);
--      /* Fail if I am already a session leader */
--      if (group_leader->signal->leader)
--              goto out;
-+              write_lock_irq(&tasklist_lock);
-+              /* Fail if I am already a session leader */
-+              if (group_leader->signal->leader)
-+                      goto out;
--      /* Fail if a process group id already exists that equals the
--       * proposed session id.
--       */
--      if (pid_task(sid, PIDTYPE_PGID))
--              goto out;
-+              /* Fail if a process group id already exists that equals the
-+               * proposed session id.
-+               */
-+              if (pid_task(sid, PIDTYPE_PGID))
-+                      goto out;
--      group_leader->signal->leader = 1;
--      __set_special_pids(sid);
-+              group_leader->signal->leader = 1;
-+              __set_special_pids(sid);
--      proc_clear_tty(group_leader);
-+              proc_clear_tty(group_leader);
++#define       vxm_activate_task(t,q)          do { } while (0)
++#define       vxm_activate_idle(t,q)          do { } while (0)
++#define       vxm_deactivate_task(t,q)        do { } while (0)
++#define       vxm_hold_task(t,q)              do { } while (0)
++#define       vxm_unhold_task(t,q)            do { } while (0)
++#define       vxm_migrate_task(t,q,d)         do { } while (0)
++#define       vxm_idle_skip(q,c)              do { } while (0)
++#define       vxm_need_resched(t,s,c)         do { } while (0)
++#define       vxm_sync(s,c)                   do { } while (0)
++#define       vxm_sched_info(s,v,c)           do { } while (0)
++#define       vxm_tokens_recalc(s,q,v,c)      do { } while (0)
++#define       vxm_update_sched(s,v,c)         do { } while (0)
++#define       vxm_rq_max_min(q,c)             do { } while (0)
++
++#endif /* CONFIG_VSERVER_MONITOR */
++
+diff -NurpP --minimal linux-2.6.27.33/kernel/signal.c linux-2.6.27.33-vs2.3.0.36.6/kernel/signal.c
+--- linux-2.6.27.33/kernel/signal.c    2009-09-13 16:17:00.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/signal.c       2009-09-13 16:19:24.000000000 +0200
+@@ -27,6 +27,8 @@
+ #include <linux/freezer.h>
+ #include <linux/pid_namespace.h>
+ #include <linux/nsproxy.h>
++#include <linux/vs_context.h>
++#include <linux/vs_pid.h>
  
--      err = session;
--out:
--      write_unlock_irq(&tasklist_lock);
--      return err;
--}
-+              err = session;
-+      out:
-+              write_unlock_irq(&tasklist_lock);
-+              return err;
-+      }
+ #include <asm/param.h>
+ #include <asm/uaccess.h>
+@@ -571,6 +573,14 @@ static int check_kill_permission(int sig
+       if (!valid_signal(sig))
+               return -EINVAL;
  
--DECLARE_RWSEM(uts_sem);
-+      DECLARE_RWSEM(uts_sem);
++      if ((info != SEND_SIG_NOINFO) &&
++              (is_si_special(info) || !SI_FROMUSER(info)))
++              goto skip;
++
++      vxdprintk(VXD_CBIT(misc, 7),
++              "check_kill_permission(%d,%p,%p[#%u,%u])",
++              sig, info, t, vx_task_xid(t), t->pid);
++
+       if (info != SEND_SIG_NOINFO && (is_si_special(info) || SI_FROMKERNEL(info)))
+               return 0;
  
--SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
--{
--      int errno = 0;
-+      SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
-+      {
-+              int errno = 0;
+@@ -595,6 +605,18 @@ static int check_kill_permission(int sig
+               }
+       }
  
--      down_read(&uts_sem);
--      if (copy_to_user(name, utsname(), sizeof *name))
--              errno = -EFAULT;
--      up_read(&uts_sem);
--      return errno;
--}
-+              down_read(&uts_sem);
-+              if (copy_to_user(name, utsname(), sizeof *name))
-+                      errno = -EFAULT;
-+              up_read(&uts_sem);
-+              return errno;
++      error = -EPERM;
++      if (t->pid == 1 && current->xid)
++              return error;
++
++      error = -ESRCH;
++      if (!vx_check(vx_task_xid(t), VS_WATCH_P | VS_IDENT)) {
++              vxdprintk(current->xid || VXD_CBIT(misc, 7),
++                      "signal %d[%p] xid mismatch %p[#%u,%u] xid=#%u",
++                      sig, info, t, vx_task_xid(t), t->pid, current->xid);
++              return error;
 +      }
++skip:
+       return security_task_kill(t, info, sig, 0);
+ }
  
--SYSCALL_DEFINE2(sethostname, char __user *, name, int, len)
--{
--      int errno;
--      char tmp[__NEW_UTS_LEN];
-+      SYSCALL_DEFINE2(sethostname, char __user *, name, int, len)
-+      {
-+              int errno;
-+              char tmp[__NEW_UTS_LEN];
+@@ -1051,7 +1073,7 @@ int kill_pid_info(int sig, struct siginf
+       rcu_read_lock();
+ retry:
+       p = pid_task(pid, PIDTYPE_PID);
+-      if (p) {
++      if (p && vx_check(vx_task_xid(p), VS_ADMIN | VS_IDENT)) {
+               error = group_send_sig_info(sig, info, p);
+               if (unlikely(error == -ESRCH))
+                       /*
+@@ -1089,7 +1111,7 @@ int kill_pid_info_as_uid(int sig, struct
  
--      if (!capable(CAP_SYS_ADMIN))
--              return -EPERM;
--      if (len < 0 || len > __NEW_UTS_LEN)
--              return -EINVAL;
--      down_write(&uts_sem);
--      errno = -EFAULT;
--      if (!copy_from_user(tmp, name, len)) {
--              struct new_utsname *u = utsname();
-+              if (!vx_capable(CAP_SYS_ADMIN, VXC_SET_UTSNAME))
-+                      return -EPERM;
-+              if (len < 0 || len > __NEW_UTS_LEN)
-+                      return -EINVAL;
-+              down_write(&uts_sem);
-+              errno = -EFAULT;
-+              if (!copy_from_user(tmp, name, len)) {
-+                      struct new_utsname *u = utsname();
--              memcpy(u->nodename, tmp, len);
--              memset(u->nodename + len, 0, sizeof(u->nodename) - len);
--              errno = 0;
-+                      memcpy(u->nodename, tmp, len);
-+                      memset(u->nodename + len, 0, sizeof(u->nodename) - len);
-+                      errno = 0;
-+              }
-+              up_write(&uts_sem);
-+              return errno;
+       read_lock(&tasklist_lock);
+       p = pid_task(pid, PIDTYPE_PID);
+-      if (!p) {
++      if (!p || !vx_check(vx_task_xid(p), VS_IDENT)) {
+               ret = -ESRCH;
+               goto out_unlock;
        }
--      up_write(&uts_sem);
--      return errno;
--}
- #ifdef __ARCH_WANT_SYS_GETHOSTNAME
--SYSCALL_DEFINE2(gethostname, char __user *, name, int, len)
--{
--      int i, errno;
--      struct new_utsname *u;
-+      SYSCALL_DEFINE2(gethostname, char __user *, name, int, len)
-+      {
-+              int i, errno;
-+              struct new_utsname *u;
--      if (len < 0)
--              return -EINVAL;
--      down_read(&uts_sem);
--      u = utsname();
--      i = 1 + strlen(u->nodename);
--      if (i > len)
--              i = len;
--      errno = 0;
--      if (copy_to_user(name, u->nodename, i))
--              errno = -EFAULT;
--      up_read(&uts_sem);
--      return errno;
--}
-+              if (len < 0)
-+                      return -EINVAL;
-+              down_read(&uts_sem);
-+              u = utsname();
-+              i = 1 + strlen(u->nodename);
-+              if (i > len)
-+                      i = len;
-+              errno = 0;
-+              if (copy_to_user(name, u->nodename, i))
-+                      errno = -EFAULT;
-+              up_read(&uts_sem);
-+              return errno;
-+      }
+@@ -1141,8 +1163,10 @@ static int kill_something_info(int sig, 
+               struct task_struct * p;
  
- #endif
+               for_each_process(p) {
+-                      if (task_pid_vnr(p) > 1 &&
+-                                      !same_thread_group(p, current)) {
++                      if (vx_check(vx_task_xid(p), VS_ADMIN|VS_IDENT) &&
++                              task_pid_vnr(p) > 1 &&
++                              !same_thread_group(p, current) &&
++                              !vx_current_initpid(p->pid)) {
+                               int err = group_send_sig_info(sig, info, p);
+                               ++count;
+                               if (err != -EPERM)
+@@ -1823,6 +1847,11 @@ relock:
+                   !signal_group_exit(signal))
+                       continue;
  
--/*
-- * Only setdomainname; getdomainname can be implemented by calling
-- * uname()
-- */
--SYSCALL_DEFINE2(setdomainname, char __user *, name, int, len)
--{
--      int errno;
--      char tmp[__NEW_UTS_LEN];
-+      /*
-+       * Only setdomainname; getdomainname can be implemented by calling
-+       * uname()
-+       */
-+      SYSCALL_DEFINE2(setdomainname, char __user *, name, int, len)
-+      {
-+              int errno;
-+              char tmp[__NEW_UTS_LEN];
++              /* virtual init is protected against user signals */
++              if ((info->si_code == SI_USER) &&
++                      vx_current_initpid(current->pid))
++                      continue;
++
+               if (sig_kernel_stop(signr)) {
+                       /*
+                        * The default action is to stop all threads in
+diff -NurpP --minimal linux-2.6.27.33/kernel/softirq.c linux-2.6.27.33-vs2.3.0.36.6/kernel/softirq.c
+--- linux-2.6.27.33/kernel/softirq.c   2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/softirq.c      2008-10-13 14:54:20.000000000 +0200
+@@ -21,6 +21,7 @@
+ #include <linux/rcupdate.h>
+ #include <linux/smp.h>
+ #include <linux/tick.h>
++#include <linux/vs_context.h>
  
--      if (!capable(CAP_SYS_ADMIN))
--              return -EPERM;
--      if (len < 0 || len > __NEW_UTS_LEN)
--              return -EINVAL;
-+              if (!vx_capable(CAP_SYS_ADMIN, VXC_SET_UTSNAME))
-+                      return -EPERM;
-+              if (len < 0 || len > __NEW_UTS_LEN)
-+                      return -EINVAL;
+ #include <asm/irq.h>
+ /*
+diff -NurpP --minimal linux-2.6.27.33/kernel/sys.c linux-2.6.27.33-vs2.3.0.36.6/kernel/sys.c
+--- linux-2.6.27.33/kernel/sys.c       2009-09-13 16:17:00.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/sys.c  2009-02-03 17:59:04.000000000 +0100
+@@ -38,6 +38,7 @@
+ #include <linux/syscalls.h>
+ #include <linux/kprobes.h>
+ #include <linux/user_namespace.h>
++#include <linux/vs_pid.h>
  
--      down_write(&uts_sem);
--      errno = -EFAULT;
--      if (!copy_from_user(tmp, name, len)) {
--              struct new_utsname *u = utsname();
-+              down_write(&uts_sem);
-+              errno = -EFAULT;
-+              if (!copy_from_user(tmp, name, len)) {
-+                      struct new_utsname *u = utsname();
--              memcpy(u->domainname, tmp, len);
--              memset(u->domainname + len, 0, sizeof(u->domainname) - len);
--              errno = 0;
-+                      memcpy(u->domainname, tmp, len);
-+                      memset(u->domainname + len, 0, sizeof(u->domainname) - len);
-+                      errno = 0;
-+              }
-+              up_write(&uts_sem);
-+              return errno;
+ #include <asm/uaccess.h>
+ #include <asm/io.h>
+@@ -122,7 +123,10 @@ static int set_one_prio(struct task_stru
+               goto out;
        }
--      up_write(&uts_sem);
--      return errno;
--}
--SYSCALL_DEFINE2(getrlimit, unsigned int, resource, struct rlimit __user *, rlim)
--{
--      if (resource >= RLIM_NLIMITS)
--              return -EINVAL;
--      else {
--              struct rlimit value;
--              task_lock(current->group_leader);
--              value = current->signal->rlim[resource];
--              task_unlock(current->group_leader);
--              return copy_to_user(rlim, &value, sizeof(*rlim)) ? -EFAULT : 0;
-+      SYSCALL_DEFINE2(getrlimit, unsigned int, resource, struct rlimit __user *, rlim)
-+      {
-+              if (resource >= RLIM_NLIMITS)
-+                      return -EINVAL;
-+              else {
-+                      struct rlimit value;
-+                      task_lock(current->group_leader);
-+                      value = current->signal->rlim[resource];
-+                      task_unlock(current->group_leader);
-+                      return copy_to_user(rlim, &value, sizeof(*rlim)) ? -EFAULT : 0;
-+              }
+       if (niceval < task_nice(p) && !can_nice(p, niceval)) {
+-              error = -EACCES;
++              if (vx_flags(VXF_IGNEG_NICE, 0))
++                      error = 0;
++              else
++                      error = -EACCES;
+               goto out;
        }
--}
- #ifdef __ARCH_WANT_SYS_OLD_GETRLIMIT
--/*
-- *    Back compatibility for getrlimit. Needed for some apps.
-- */
-- 
--SYSCALL_DEFINE2(old_getrlimit, unsigned int, resource,
--              struct rlimit __user *, rlim)
--{
--      struct rlimit x;
--      if (resource >= RLIM_NLIMITS)
--              return -EINVAL;
-+      /*
-+       *      Back compatibility for getrlimit. Needed for some apps.
-+       */
+       no_nice = security_task_setnice(p, niceval);
+@@ -170,6 +174,8 @@ SYSCALL_DEFINE3(setpriority, int, which,
+                       else
+                               pgrp = task_pgrp(current);
+                       do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
++                              if (!vx_check(p->xid, VS_ADMIN_P | VS_IDENT))
++                                      continue;
+                               error = set_one_prio(p, niceval, error);
+                       } while_each_pid_thread(pgrp, PIDTYPE_PGID, p);
+                       break;
+@@ -230,6 +236,8 @@ SYSCALL_DEFINE2(getpriority, int, which,
+                       else
+                               pgrp = task_pgrp(current);
+                       do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
++                              if (!vx_check(p->xid, VS_ADMIN_P | VS_IDENT))
++                                      continue;
+                               niceval = 20 - task_nice(p);
+                               if (niceval > retval)
+                                       retval = niceval;
+@@ -339,6 +347,9 @@ void kernel_power_off(void)
+       machine_power_off();
+ }
+ EXPORT_SYMBOL_GPL(kernel_power_off);
 +
-+      SYSCALL_DEFINE2(old_getrlimit, unsigned int, resource,
-+                      struct rlimit __user *, rlim)
-+      {
-+              struct rlimit x;
-+              if (resource >= RLIM_NLIMITS)
-+                      return -EINVAL;
++long vs_reboot(unsigned int, void __user *);
++
+ /*
+  * Reboot system call: for obvious reasons only root may call it,
+  * and even root needs to set up some magic numbers in the registers
+@@ -370,6 +381,9 @@ SYSCALL_DEFINE4(reboot, int, magic1, int
+       if ((cmd == LINUX_REBOOT_CMD_POWER_OFF) && !pm_power_off)
+               cmd = LINUX_REBOOT_CMD_HALT;
  
--      task_lock(current->group_leader);
--      x = current->signal->rlim[resource];
--      task_unlock(current->group_leader);
--      if (x.rlim_cur > 0x7FFFFFFF)
--              x.rlim_cur = 0x7FFFFFFF;
--      if (x.rlim_max > 0x7FFFFFFF)
--              x.rlim_max = 0x7FFFFFFF;
--      return copy_to_user(rlim, &x, sizeof(x))?-EFAULT:0;
--}
-+              task_lock(current->group_leader);
-+              x = current->signal->rlim[resource];
-+              task_unlock(current->group_leader);
-+              if (x.rlim_cur > 0x7FFFFFFF)
-+                      x.rlim_cur = 0x7FFFFFFF;
-+              if (x.rlim_max > 0x7FFFFFFF)
-+                      x.rlim_max = 0x7FFFFFFF;
-+              return copy_to_user(rlim, &x, sizeof(x))?-EFAULT:0;
-+      }
++      if (!vx_check(0, VS_ADMIN|VS_WATCH))
++              return vs_reboot(cmd, arg);
++
+       lock_kernel();
+       switch (cmd) {
+       case LINUX_REBOOT_CMD_RESTART:
+@@ -1345,7 +1359,7 @@ SYSCALL_DEFINE2(sethostname, char __user
+       int errno;
+       char tmp[__NEW_UTS_LEN];
  
- #endif
+-      if (!capable(CAP_SYS_ADMIN))
++      if (!vx_capable(CAP_SYS_ADMIN, VXC_SET_UTSNAME))
+               return -EPERM;
+       if (len < 0 || len > __NEW_UTS_LEN)
+               return -EINVAL;
+@@ -1390,7 +1404,7 @@ SYSCALL_DEFINE2(setdomainname, char __us
+       int errno;
+       char tmp[__NEW_UTS_LEN];
  
--SYSCALL_DEFINE2(setrlimit, unsigned int, resource, struct rlimit __user *, rlim)
--{
--      struct rlimit new_rlim, *old_rlim;
--      int retval;
-+      SYSCALL_DEFINE2(setrlimit, unsigned int, resource, struct rlimit __user *, rlim)
-+      {
-+              struct rlimit new_rlim, *old_rlim;
-+              int retval;
--      if (resource >= RLIM_NLIMITS)
--              return -EINVAL;
--      if (copy_from_user(&new_rlim, rlim, sizeof(*rlim)))
--              return -EFAULT;
--      if (new_rlim.rlim_cur > new_rlim.rlim_max)
--              return -EINVAL;
--      old_rlim = current->signal->rlim + resource;
--      if ((new_rlim.rlim_max > old_rlim->rlim_max) &&
+-      if (!capable(CAP_SYS_ADMIN))
++      if (!vx_capable(CAP_SYS_ADMIN, VXC_SET_UTSNAME))
+               return -EPERM;
+       if (len < 0 || len > __NEW_UTS_LEN)
+               return -EINVAL;
+@@ -1458,7 +1472,7 @@ SYSCALL_DEFINE2(setrlimit, unsigned int,
+               return -EINVAL;
+       old_rlim = current->signal->rlim + resource;
+       if ((new_rlim.rlim_max > old_rlim->rlim_max) &&
 -          !capable(CAP_SYS_RESOURCE))
--              return -EPERM;
--      if (resource == RLIMIT_NOFILE && new_rlim.rlim_max > sysctl_nr_open)
--              return -EPERM;
-+              if (resource >= RLIM_NLIMITS)
-+                      return -EINVAL;
-+              if (copy_from_user(&new_rlim, rlim, sizeof(*rlim)))
-+                      return -EFAULT;
-+              if (new_rlim.rlim_cur > new_rlim.rlim_max)
-+                      return -EINVAL;
-+              old_rlim = current->signal->rlim + resource;
-+              if ((new_rlim.rlim_max > old_rlim->rlim_max) &&
-+                  !vx_capable(CAP_SYS_RESOURCE, VXC_SET_RLIMIT))
-+                      return -EPERM;
-+              if (resource == RLIMIT_NOFILE && new_rlim.rlim_max > sysctl_nr_open)
-+                      return -EPERM;
--      retval = security_task_setrlimit(resource, &new_rlim);
--      if (retval)
--              return retval;
-+              retval = security_task_setrlimit(resource, &new_rlim);
-+              if (retval)
-+                      return retval;
--      if (resource == RLIMIT_CPU && new_rlim.rlim_cur == 0) {
--              /*
--               * The caller is asking for an immediate RLIMIT_CPU
--               * expiry.  But we use the zero value to mean "it was
--               * never set".  So let's cheat and make it one second
--               * instead
--               */
--              new_rlim.rlim_cur = 1;
--      }
-+              if (resource == RLIMIT_CPU && new_rlim.rlim_cur == 0) {
-+                      /*
-+                       * The caller is asking for an immediate RLIMIT_CPU
-+                       * expiry.  But we use the zero value to mean "it was
-+                       * never set".  So let's cheat and make it one second
-+                       * instead
-+                       */
-+                      new_rlim.rlim_cur = 1;
-+              }
--      task_lock(current->group_leader);
--      *old_rlim = new_rlim;
--      task_unlock(current->group_leader);
-+              task_lock(current->group_leader);
-+              *old_rlim = new_rlim;
-+              task_unlock(current->group_leader);
--      if (resource != RLIMIT_CPU)
--              goto out;
-+              if (resource != RLIMIT_CPU)
-+                      goto out;
--      /*
--       * RLIMIT_CPU handling.   Note that the kernel fails to return an error
--       * code if it rejected the user's attempt to set RLIMIT_CPU.  This is a
--       * very long-standing error, and fixing it now risks breakage of
--       * applications, so we live with it
--       */
--      if (new_rlim.rlim_cur == RLIM_INFINITY)
--              goto out;
-+              /*
-+               * RLIMIT_CPU handling.   Note that the kernel fails to return an error
-+               * code if it rejected the user's attempt to set RLIMIT_CPU.  This is a
-+               * very long-standing error, and fixing it now risks breakage of
-+               * applications, so we live with it
-+               */
-+              if (new_rlim.rlim_cur == RLIM_INFINITY)
-+                      goto out;
--      update_rlimit_cpu(new_rlim.rlim_cur);
--out:
--      return 0;
-+              update_rlimit_cpu(new_rlim.rlim_cur);
-+      out:
-+              return 0;
- }
- /*
-diff -NurpP --minimal linux-2.6.31/kernel/sysctl.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/sysctl.c
---- linux-2.6.31/kernel/sysctl.c       2009-09-10 15:26:28.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/sysctl.c    2009-09-10 16:11:43.000000000 +0200
-@@ -119,6 +119,7 @@ static int ngroups_max = NGROUPS_MAX;
++          !vx_capable(CAP_SYS_RESOURCE, VXC_SET_RLIMIT))
+               return -EPERM;
+       if (resource == RLIMIT_NOFILE && new_rlim.rlim_max > sysctl_nr_open)
+               return -EPERM;
+diff -NurpP --minimal linux-2.6.27.33/kernel/sysctl.c linux-2.6.27.33-vs2.3.0.36.6/kernel/sysctl.c
+--- linux-2.6.27.33/kernel/sysctl.c    2009-09-13 16:17:00.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/sysctl.c       2009-07-21 15:54:27.000000000 +0200
+@@ -114,6 +114,7 @@ static int ngroups_max = NGROUPS_MAX;
+ #ifdef CONFIG_MODULES
  extern char modprobe_path[];
- extern int modules_disabled;
  #endif
 +extern char vshelper_path[];
  #ifdef CONFIG_CHR_DEV_SG
  extern int sg_big_buff;
  #endif
-@@ -572,6 +573,15 @@ static struct ctl_table kern_table[] = {
+@@ -503,6 +504,15 @@ static struct ctl_table kern_table[] = {
                .strategy       = &sysctl_string,
        },
  #endif
@@ -17800,9 +17057,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/sysctl.c linux-2.6.31-vs2.3.0.36.14-pr
  #ifdef CONFIG_CHR_DEV_SG
        {
                .ctl_name       = KERN_SG_BIG_BUFF,
-diff -NurpP --minimal linux-2.6.31/kernel/sysctl_check.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/sysctl_check.c
---- linux-2.6.31/kernel/sysctl_check.c 2009-06-11 17:13:26.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/sysctl_check.c      2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/sysctl_check.c linux-2.6.27.33-vs2.3.0.36.6/kernel/sysctl_check.c
+--- linux-2.6.27.33/kernel/sysctl_check.c      2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/sysctl_check.c 2008-10-13 14:54:20.000000000 +0200
 @@ -39,6 +39,7 @@ static const struct trans_ctl_table tran
  
        { KERN_PANIC,                   "panic" },
@@ -17842,10 +17099,10 @@ diff -NurpP --minimal linux-2.6.31/kernel/sysctl_check.c linux-2.6.31-vs2.3.0.36
        {}
  };
  
-diff -NurpP --minimal linux-2.6.31/kernel/time.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/time.c
---- linux-2.6.31/kernel/time.c 2009-03-24 14:22:45.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/time.c      2009-09-10 16:11:43.000000000 +0200
-@@ -63,6 +63,7 @@ EXPORT_SYMBOL(sys_tz);
+diff -NurpP --minimal linux-2.6.27.33/kernel/time.c linux-2.6.27.33-vs2.3.0.36.6/kernel/time.c
+--- linux-2.6.27.33/kernel/time.c      2009-09-13 16:17:00.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/time.c 2009-02-03 17:59:04.000000000 +0100
+@@ -62,6 +62,7 @@ EXPORT_SYMBOL(sys_tz);
  SYSCALL_DEFINE1(time, time_t __user *, tloc)
  {
        time_t i = get_seconds();
@@ -17853,7 +17110,7 @@ diff -NurpP --minimal linux-2.6.31/kernel/time.c linux-2.6.31-vs2.3.0.36.14-pre8
  
        if (tloc) {
                if (put_user(i,tloc))
-@@ -93,7 +94,7 @@ SYSCALL_DEFINE1(stime, time_t __user *, 
+@@ -91,7 +92,7 @@ SYSCALL_DEFINE1(stime, time_t __user *, 
        if (err)
                return err;
  
@@ -17862,7 +17119,7 @@ diff -NurpP --minimal linux-2.6.31/kernel/time.c linux-2.6.31-vs2.3.0.36.14-pre8
        return 0;
  }
  
-@@ -104,7 +105,7 @@ SYSCALL_DEFINE2(gettimeofday, struct tim
+@@ -102,7 +103,7 @@ SYSCALL_DEFINE2(gettimeofday, struct tim
  {
        if (likely(tv != NULL)) {
                struct timeval ktv;
@@ -17871,7 +17128,7 @@ diff -NurpP --minimal linux-2.6.31/kernel/time.c linux-2.6.31-vs2.3.0.36.14-pre8
                if (copy_to_user(tv, &ktv, sizeof(ktv)))
                        return -EFAULT;
        }
-@@ -179,7 +180,7 @@ int do_sys_settimeofday(struct timespec 
+@@ -177,7 +178,7 @@ int do_sys_settimeofday(struct timespec 
                /* SMP safe, again the code in arch/foo/time.c should
                 * globally block out interrupts when it runs.
                 */
@@ -17880,7 +17137,7 @@ diff -NurpP --minimal linux-2.6.31/kernel/time.c linux-2.6.31-vs2.3.0.36.14-pre8
        }
        return 0;
  }
-@@ -311,7 +312,7 @@ void getnstimeofday(struct timespec *tv)
+@@ -309,7 +310,7 @@ void getnstimeofday(struct timespec *tv)
  {
        struct timeval x;
  
@@ -17889,13 +17146,13 @@ diff -NurpP --minimal linux-2.6.31/kernel/time.c linux-2.6.31-vs2.3.0.36.14-pre8
        tv->tv_sec = x.tv_sec;
        tv->tv_nsec = x.tv_usec * NSEC_PER_USEC;
  }
-diff -NurpP --minimal linux-2.6.31/kernel/timer.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/timer.c
---- linux-2.6.31/kernel/timer.c        2009-09-10 15:26:28.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/timer.c     2009-09-10 16:38:09.000000000 +0200
-@@ -39,6 +39,10 @@
+diff -NurpP --minimal linux-2.6.27.33/kernel/timer.c linux-2.6.27.33-vs2.3.0.36.6/kernel/timer.c
+--- linux-2.6.27.33/kernel/timer.c     2009-09-13 16:17:01.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/timer.c        2009-03-09 15:36:36.000000000 +0100
+@@ -37,6 +37,10 @@
+ #include <linux/delay.h>
+ #include <linux/tick.h>
  #include <linux/kallsyms.h>
- #include <linux/perf_counter.h>
- #include <linux/sched.h>
 +#include <linux/vs_base.h>
 +#include <linux/vs_cvirt.h>
 +#include <linux/vs_pid.h>
@@ -17903,7 +17160,7 @@ diff -NurpP --minimal linux-2.6.31/kernel/timer.c linux-2.6.31-vs2.3.0.36.14-pre
  
  #include <asm/uaccess.h>
  #include <asm/unistd.h>
-@@ -1144,6 +1148,25 @@ unsigned long get_next_timer_interrupt(u
+@@ -964,6 +968,25 @@ void account_process_tick(struct task_st
  }
  #endif
  
@@ -17929,15 +17186,15 @@ diff -NurpP --minimal linux-2.6.31/kernel/timer.c linux-2.6.31-vs2.3.0.36.14-pre
  /*
   * Called from the timer interrupt handler to charge one tick to the current
   * process.  user_tick is 1 if the tick is user time, 0 for system.
-@@ -1160,6 +1183,7 @@ void update_process_times(int user_tick)
+@@ -979,6 +1002,7 @@ void update_process_times(int user_tick)
+       if (rcu_pending(cpu))
                rcu_check_callbacks(cpu, user_tick);
-       printk_tick();
        scheduler_tick();
 +      vx_hard_tick(p, cpu);
        run_posix_cpu_timers(p);
  }
  
-@@ -1214,12 +1238,6 @@ SYSCALL_DEFINE1(alarm, unsigned int, sec
+@@ -1081,12 +1105,6 @@ SYSCALL_DEFINE1(alarm, unsigned int, sec
  
  #endif
  
@@ -17950,7 +17207,7 @@ diff -NurpP --minimal linux-2.6.31/kernel/timer.c linux-2.6.31-vs2.3.0.36.14-pre
  
  /**
   * sys_getpid - return the thread group id of the current process
-@@ -1248,10 +1266,23 @@ SYSCALL_DEFINE0(getppid)
+@@ -1115,10 +1133,23 @@ SYSCALL_DEFINE0(getppid)
        rcu_read_lock();
        pid = task_tgid_vnr(current->real_parent);
        rcu_read_unlock();
@@ -17975,24 +17232,22 @@ diff -NurpP --minimal linux-2.6.31/kernel/timer.c linux-2.6.31-vs2.3.0.36.14-pre
  SYSCALL_DEFINE0(getuid)
  {
        /* Only we change this so SMP safe */
-@@ -1405,6 +1436,10 @@ int do_sysinfo(struct sysinfo *info)
-       ktime_get_ts(&tp);
-       monotonic_to_bootbased(&tp);
-+
-+      if (vx_flags(VXF_VIRT_UPTIME, 0))
-+              vx_vsi_uptime(&tp, NULL);
-+
-       info->uptime = tp.tv_sec + (tp.tv_nsec ? 1 : 0);
+@@ -1289,6 +1320,8 @@ int do_sysinfo(struct sysinfo *info)
+                       tp.tv_nsec = tp.tv_nsec - NSEC_PER_SEC;
+                       tp.tv_sec++;
+               }
++              if (vx_flags(VXF_VIRT_UPTIME, 0))
++                      vx_vsi_uptime(&tp, NULL);
+               info->uptime = tp.tv_sec + (tp.tv_nsec ? 1 : 0);
+               info->loads[0] = avenrun[0] << (SI_LOAD_SHIFT - FSHIFT);
+diff -NurpP --minimal linux-2.6.27.33/kernel/user.c linux-2.6.27.33-vs2.3.0.36.6/kernel/user.c
+--- linux-2.6.27.33/kernel/user.c      2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/user.c 2008-10-13 14:54:20.000000000 +0200
+@@ -243,12 +243,15 @@ static struct kobj_type uids_ktype = {
+ };
  
-       get_avenrun(info->loads, 0, SI_LOAD_SHIFT - FSHIFT);
-diff -NurpP --minimal linux-2.6.31/kernel/user.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/user.c
---- linux-2.6.31/kernel/user.c 2009-09-10 15:26:28.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/user.c      2009-09-10 16:11:43.000000000 +0200
-@@ -251,10 +251,10 @@ static struct kobj_type uids_ktype = {
-  *
-  * See Documentation/scheduler/sched-design-CFS.txt for ramifications.
-  */
+ /* create /sys/kernel/uids/<uid>/cpu_share file for this user */
 -static int uids_user_create(struct user_struct *up)
 +static int uids_user_create(struct user_namespace *ns, struct user_struct *up)
  {
@@ -18001,8 +17256,13 @@ diff -NurpP --minimal linux-2.6.31/kernel/user.c linux-2.6.31-vs2.3.0.36.14-pre8
 +      int error = 0;
  
        memset(kobj, 0, sizeof(struct kobject));
-       if (up->user_ns != &init_user_ns)
-@@ -282,7 +282,7 @@ int __init uids_sysfs_init(void)
++      if (ns != &init_user_ns)
++              goto done;
++
+       kobj->kset = uids_kset;
+       error = kobject_init_and_add(kobj, &uids_ktype, NULL, "%d", up->uid);
+       if (error) {
+@@ -272,7 +275,7 @@ int __init uids_sysfs_init(void)
        if (!uids_kset)
                return -ENOMEM;
  
@@ -18010,9 +17270,24 @@ diff -NurpP --minimal linux-2.6.31/kernel/user.c linux-2.6.31-vs2.3.0.36.14-pre8
 +      return uids_user_create(NULL, &root_user);
  }
  
- /* delayed work function to remove sysfs directory for a user and free up
-@@ -353,7 +353,8 @@ static struct user_struct *uid_hash_find
- }
+ /* work function to remove sysfs directory for a user and free up
+@@ -302,9 +305,11 @@ static void remove_user_sysfs_dir(struct
+       if (!remove_user)
+               goto done;
+-      kobject_uevent(&up->kobj, KOBJ_REMOVE);
+-      kobject_del(&up->kobj);
+-      kobject_put(&up->kobj);
++      if (up->kobj.name) {
++              kobject_uevent(&up->kobj, KOBJ_REMOVE);
++              kobject_del(&up->kobj);
++              kobject_put(&up->kobj);
++      }
+       sched_destroy_user(up);
+       key_put(up->uid_keyring);
+@@ -332,7 +337,8 @@ static inline void free_user(struct user
+ #else /* CONFIG_USER_SCHED && CONFIG_SYSFS */
  
  int uids_sysfs_init(void) { return 0; }
 -static inline int uids_user_create(struct user_struct *up) { return 0; }
@@ -18021,75 +17296,71 @@ diff -NurpP --minimal linux-2.6.31/kernel/user.c linux-2.6.31-vs2.3.0.36.14-pre8
  static inline void uids_mutex_lock(void) { }
  static inline void uids_mutex_unlock(void) { }
  
-@@ -450,7 +451,7 @@ struct user_struct *alloc_uid(struct use
-               new->user_ns = get_user_ns(ns);
+@@ -409,7 +415,7 @@ struct user_struct *alloc_uid(struct use
+               if (sched_create_user(new) < 0)
+                       goto out_free_user;
  
 -              if (uids_user_create(new))
 +              if (uids_user_create(ns, new))
                        goto out_destoy_sched;
  
                /*
-diff -NurpP --minimal linux-2.6.31/kernel/user_namespace.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/user_namespace.c
---- linux-2.6.31/kernel/user_namespace.c       2009-03-24 14:22:45.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/user_namespace.c    2009-09-10 16:11:43.000000000 +0200
-@@ -10,6 +10,7 @@
+diff -NurpP --minimal linux-2.6.27.33/kernel/user_namespace.c linux-2.6.27.33-vs2.3.0.36.6/kernel/user_namespace.c
+--- linux-2.6.27.33/kernel/user_namespace.c    2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/user_namespace.c       2008-10-13 14:54:20.000000000 +0200
+@@ -9,6 +9,7 @@
+ #include <linux/nsproxy.h>
  #include <linux/slab.h>
  #include <linux/user_namespace.h>
- #include <linux/cred.h>
 +#include <linux/vserver/global.h>
  
  /*
-  * Create a new user namespace, deriving the creator from the user in the
-@@ -30,6 +31,7 @@ int create_user_ns(struct cred *new)
-               return -ENOMEM;
+  * Clone a new ns copying an original user ns, setting refcount to 1
+@@ -26,6 +27,7 @@ static struct user_namespace *clone_user
+               return ERR_PTR(-ENOMEM);
  
        kref_init(&ns->kref);
 +      atomic_inc(&vs_global_user_ns);
  
        for (n = 0; n < UIDHASH_SZ; ++n)
                INIT_HLIST_HEAD(ns->uidhash_table + n);
-@@ -78,6 +80,8 @@ void free_user_ns(struct kref *kref)
-       struct user_namespace *ns =
-               container_of(kref, struct user_namespace, kref);
+@@ -71,6 +73,7 @@ void free_user_ns(struct kref *kref)
  
-+      /* FIXME: maybe move into destroyer? */
+       ns = container_of(kref, struct user_namespace, kref);
+       release_uids(ns);
 +      atomic_dec(&vs_global_user_ns);
-       INIT_WORK(&ns->destroyer, free_user_ns_work);
-       schedule_work(&ns->destroyer);
+       kfree(ns);
  }
-diff -NurpP --minimal linux-2.6.31/kernel/utsname.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/utsname.c
---- linux-2.6.31/kernel/utsname.c      2009-09-10 15:26:28.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/utsname.c   2009-09-10 16:44:37.000000000 +0200
-@@ -14,14 +14,17 @@
+ EXPORT_SYMBOL(free_user_ns);
+diff -NurpP --minimal linux-2.6.27.33/kernel/utsname.c linux-2.6.27.33-vs2.3.0.36.6/kernel/utsname.c
+--- linux-2.6.27.33/kernel/utsname.c   2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/utsname.c      2008-10-13 14:54:20.000000000 +0200
+@@ -14,6 +14,7 @@
  #include <linux/utsname.h>
  #include <linux/err.h>
  #include <linux/slab.h>
 +#include <linux/vserver/global.h>
  
- static struct uts_namespace *create_uts_ns(void)
- {
-       struct uts_namespace *uts_ns;
-       uts_ns = kmalloc(sizeof(struct uts_namespace), GFP_KERNEL);
--      if (uts_ns)
-+      if (uts_ns) {
-               kref_init(&uts_ns->kref);
-+              atomic_inc(&vs_global_uts_ns);
-+      }
-       return uts_ns;
+ /*
+  * Clone a new ns copying an original utsname, setting refcount to 1
+@@ -32,6 +33,7 @@ static struct uts_namespace *clone_uts_n
+       memcpy(&ns->name, &old_ns->name, sizeof(ns->name));
+       up_read(&uts_sem);
+       kref_init(&ns->kref);
++      atomic_inc(&vs_global_uts_ns);
+       return ns;
  }
  
-@@ -71,5 +74,6 @@ void free_uts_ns(struct kref *kref)
+@@ -62,5 +64,6 @@ void free_uts_ns(struct kref *kref)
        struct uts_namespace *ns;
  
        ns = container_of(kref, struct uts_namespace, kref);
 +      atomic_dec(&vs_global_uts_ns);
        kfree(ns);
  }
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/cacct.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/cacct.c
---- linux-2.6.31/kernel/vserver/cacct.c        1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/cacct.c     2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/cacct.c linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/cacct.c
+--- linux-2.6.27.33/kernel/vserver/cacct.c     1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/cacct.c        2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,42 @@
 +/*
 + *  linux/kernel/vserver/cacct.c
@@ -18133,9 +17404,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/cacct.c linux-2.6.31-vs2.3.0.3
 +      return 0;
 +}
 +
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/cacct_init.h linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/cacct_init.h
---- linux-2.6.31/kernel/vserver/cacct_init.h   1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/cacct_init.h        2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/cacct_init.h linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/cacct_init.h
+--- linux-2.6.27.33/kernel/vserver/cacct_init.h        1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/cacct_init.h   2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,25 @@
 +
 +
@@ -18162,9 +17433,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/cacct_init.h linux-2.6.31-vs2.
 +      return;
 +}
 +
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/cacct_proc.h linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/cacct_proc.h
---- linux-2.6.31/kernel/vserver/cacct_proc.h   1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/cacct_proc.h        2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/cacct_proc.h linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/cacct_proc.h
+--- linux-2.6.27.33/kernel/vserver/cacct_proc.h        1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/cacct_proc.h   2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,53 @@
 +#ifndef _VX_CACCT_PROC_H
 +#define _VX_CACCT_PROC_H
@@ -18219,10 +17490,10 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/cacct_proc.h linux-2.6.31-vs2.
 +}
 +
 +#endif        /* _VX_CACCT_PROC_H */
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/context.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/context.c
---- linux-2.6.31/kernel/vserver/context.c      1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/context.c   2009-09-10 16:11:43.000000000 +0200
-@@ -0,0 +1,1031 @@
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/context.c linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/context.c
+--- linux-2.6.27.33/kernel/vserver/context.c   1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/context.c      2008-10-31 03:56:55.000000000 +0100
+@@ -0,0 +1,1018 @@
 +/*
 + *  linux/kernel/vserver/context.c
 + *
@@ -18261,8 +17532,6 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/context.c linux-2.6.31-vs2.3.0
 +#include <linux/vserver/limit.h>
 +#include <linux/vserver/limit_int.h>
 +#include <linux/vserver/space.h>
-+#include <linux/init_task.h>
-+#include <linux/fs_struct.h>
 +
 +#include <linux/vs_context.h>
 +#include <linux/vs_limit.h>
@@ -18294,7 +17563,7 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/context.c linux-2.6.31-vs2.3.0
 +static struct vx_info *__alloc_vx_info(xid_t xid)
 +{
 +      struct vx_info *new = NULL;
-+      int cpu, index;
++      int cpu;
 +
 +      vxdprintk(VXD_CBIT(xid, 0), "alloc_vx_info(%d)*", xid);
 +
@@ -18344,14 +17613,6 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/context.c linux-2.6.31-vs2.3.0
 +      new->reboot_cmd = 0;
 +      new->exit_code = 0;
 +
-+      // preconfig fs entries
-+      for (index = 0; index < VX_SPACES; index++) {
-+              write_lock(&init_fs.lock);
-+              init_fs.users++;
-+              write_unlock(&init_fs.lock);
-+              new->vx_fs[index] = &init_fs;
-+      }
-+
 +      vxdprintk(VXD_CBIT(xid, 0),
 +              "alloc_vx_info(%d) = %p", xid, new);
 +      vxh_alloc_vx_info(new);
@@ -18407,7 +17668,7 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/context.c linux-2.6.31-vs2.3.0
 +{
 +      struct nsproxy *nsproxy;
 +      struct fs_struct *fs;
-+      int index, kill;
++      int index;
 +
 +      might_sleep();
 +
@@ -18420,11 +17681,8 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/context.c linux-2.6.31-vs2.3.0
 +                      put_nsproxy(nsproxy);
 +
 +              fs = xchg(&vxi->vx_fs[index], NULL);
-+              write_lock(&fs->lock);
-+              kill = !--fs->users;
-+              write_unlock(&fs->lock);
-+              if (kill)
-+                      free_fs_struct(fs);
++              if (fs)
++                      put_fs_struct(fs);
 +      }
 +}
 +
@@ -19254,9 +18512,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/context.c linux-2.6.31-vs2.3.0
 +
 +EXPORT_SYMBOL_GPL(free_vx_info);
 +
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/cvirt.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/cvirt.c
---- linux-2.6.31/kernel/vserver/cvirt.c        1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/cvirt.c     2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/cvirt.c linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/cvirt.c
+--- linux-2.6.27.33/kernel/vserver/cvirt.c     1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/cvirt.c        2008-10-31 03:49:36.000000000 +0100
 @@ -0,0 +1,300 @@
 +/*
 + *  linux/kernel/vserver/cvirt.c
@@ -19558,9 +18816,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/cvirt.c linux-2.6.31-vs2.3.0.3
 +
 +#endif
 +
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/cvirt_init.h linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/cvirt_init.h
---- linux-2.6.31/kernel/vserver/cvirt_init.h   1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/cvirt_init.h        2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/cvirt_init.h linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/cvirt_init.h
+--- linux-2.6.27.33/kernel/vserver/cvirt_init.h        1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/cvirt_init.h   2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,69 @@
 +
 +
@@ -19631,9 +18889,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/cvirt_init.h linux-2.6.31-vs2.
 +      return;
 +}
 +
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/cvirt_proc.h linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/cvirt_proc.h
---- linux-2.6.31/kernel/vserver/cvirt_proc.h   1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/cvirt_proc.h        2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/cvirt_proc.h linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/cvirt_proc.h
+--- linux-2.6.27.33/kernel/vserver/cvirt_proc.h        1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/cvirt_proc.h   2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,135 @@
 +#ifndef _VX_CVIRT_PROC_H
 +#define _VX_CVIRT_PROC_H
@@ -19770,9 +19028,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/cvirt_proc.h linux-2.6.31-vs2.
 +}
 +
 +#endif        /* _VX_CVIRT_PROC_H */
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/debug.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/debug.c
---- linux-2.6.31/kernel/vserver/debug.c        1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/debug.c     2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/debug.c linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/debug.c
+--- linux-2.6.27.33/kernel/vserver/debug.c     1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/debug.c        2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,32 @@
 +/*
 + *  kernel/vserver/debug.c
@@ -19806,9 +19064,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/debug.c linux-2.6.31-vs2.3.0.3
 +
 +EXPORT_SYMBOL_GPL(dump_vx_info);
 +
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/device.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/device.c
---- linux-2.6.31/kernel/vserver/device.c       1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/device.c    2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/device.c linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/device.c
+--- linux-2.6.27.33/kernel/vserver/device.c    1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/device.c       2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,443 @@
 +/*
 + *  linux/kernel/vserver/device.c
@@ -20253,9 +19511,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/device.c linux-2.6.31-vs2.3.0.
 +#endif        /* CONFIG_COMPAT */
 +
 +
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/dlimit.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/dlimit.c
---- linux-2.6.31/kernel/vserver/dlimit.c       1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/dlimit.c    2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/dlimit.c linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/dlimit.c
+--- linux-2.6.27.33/kernel/vserver/dlimit.c    1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/dlimit.c       2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,522 @@
 +/*
 + *  linux/kernel/vserver/dlimit.c
@@ -20779,9 +20037,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/dlimit.c linux-2.6.31-vs2.3.0.
 +EXPORT_SYMBOL_GPL(locate_dl_info);
 +EXPORT_SYMBOL_GPL(rcu_free_dl_info);
 +
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/helper.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/helper.c
---- linux-2.6.31/kernel/vserver/helper.c       1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/helper.c    2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/helper.c linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/helper.c
+--- linux-2.6.27.33/kernel/vserver/helper.c    1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/helper.c       2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,199 @@
 +/*
 + *  linux/kernel/vserver/helper.c
@@ -20850,7 +20108,7 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/helper.c linux-2.6.31-vs2.3.0.
 +      snprintf(id_buf, sizeof(id_buf)-1, "%d", vxi->vx_id);
 +
 +      snprintf(cmd_buf, sizeof(cmd_buf)-1, "VS_CMD=%08x", cmd);
-+      snprintf(uid_buf, sizeof(uid_buf)-1, "VS_UID=%d", current_uid());
++      snprintf(uid_buf, sizeof(uid_buf)-1, "VS_UID=%d", current->uid);
 +      snprintf(pid_buf, sizeof(pid_buf)-1, "VS_PID=%d", current->pid);
 +
 +      switch (cmd) {
@@ -20982,9 +20240,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/helper.c linux-2.6.31-vs2.3.0.
 +      return do_vshelper(vshelper_path, argv, envp, 1);
 +}
 +
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/history.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/history.c
---- linux-2.6.31/kernel/vserver/history.c      1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/history.c   2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/history.c linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/history.c
+--- linux-2.6.27.33/kernel/vserver/history.c   1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/history.c      2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,258 @@
 +/*
 + *  kernel/vserver/history.c
@@ -21244,9 +20502,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/history.c linux-2.6.31-vs2.3.0
 +
 +#endif        /* CONFIG_COMPAT */
 +
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/inet.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/inet.c
---- linux-2.6.31/kernel/vserver/inet.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/inet.c      2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/inet.c linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/inet.c
+--- linux-2.6.27.33/kernel/vserver/inet.c      1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/inet.c 2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,225 @@
 +
 +#include <linux/in.h>
@@ -21473,9 +20731,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/inet.c linux-2.6.31-vs2.3.0.36
 +
 +EXPORT_SYMBOL_GPL(ip_v4_find_src);
 +
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/init.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/init.c
---- linux-2.6.31/kernel/vserver/init.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/init.c      2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/init.c linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/init.c
+--- linux-2.6.27.33/kernel/vserver/init.c      1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/init.c 2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,45 @@
 +/*
 + *  linux/kernel/init.c
@@ -21522,9 +20780,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/init.c linux-2.6.31-vs2.3.0.36
 +module_init(init_vserver);
 +module_exit(exit_vserver);
 +
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/inode.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/inode.c
---- linux-2.6.31/kernel/vserver/inode.c        1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/inode.c     2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/inode.c linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/inode.c
+--- linux-2.6.27.33/kernel/vserver/inode.c     1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/inode.c        2008-10-24 03:34:52.000000000 +0200
 @@ -0,0 +1,422 @@
 +/*
 + *  linux/kernel/vserver/inode.c
@@ -21948,9 +21206,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/inode.c linux-2.6.31-vs2.3.0.3
 +
 +#endif        /* CONFIG_PROPAGATE */
 +
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/Kconfig linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/Kconfig
---- linux-2.6.31/kernel/vserver/Kconfig        1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/Kconfig     2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/Kconfig linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/Kconfig
+--- linux-2.6.27.33/kernel/vserver/Kconfig     1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/Kconfig        2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,251 @@
 +#
 +# Linux VServer configuration
@@ -22203,10 +21461,10 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/Kconfig linux-2.6.31-vs2.3.0.3
 +      default y
 +      select SECURITY_CAPABILITIES
 +
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/limit.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/limit.c
---- linux-2.6.31/kernel/vserver/limit.c        1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/limit.c     2009-09-10 16:11:43.000000000 +0200
-@@ -0,0 +1,333 @@
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/limit.c linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/limit.c
+--- linux-2.6.27.33/kernel/vserver/limit.c     1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/limit.c        2008-10-13 14:54:20.000000000 +0200
+@@ -0,0 +1,319 @@
 +/*
 + *  linux/kernel/vserver/limit.c
 + *
@@ -22401,32 +21659,17 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/limit.c linux-2.6.31-vs2.3.0.3
 +      return 0;
 +}
 +
-+#endif        /* CONFIG_IA32_EMULATION */
-+
-+
-+int vc_get_rlimit_mask(uint32_t id, void __user *data)
-+{
-+      if (copy_to_user(data, &vlimit_mask, sizeof(vlimit_mask)))
-+              return -EFAULT;
-+      return 0;
-+}
-+
-+
-+static inline void vx_reset_hits(struct _vx_limit *limit)
-+{
-+      int lim;
-+
-+      for (lim = 0; lim < NUM_LIMITS; lim++) {
-+              atomic_set(&__rlim_lhit(limit, lim), 0);
-+      }
-+}
-+
-+int vc_reset_hits(struct vx_info *vxi, void __user *data)
++#endif        /* CONFIG_IA32_EMULATION */
++
++
++int vc_get_rlimit_mask(uint32_t id, void __user *data)
 +{
-+      vx_reset_hits(&vxi->limit);
++      if (copy_to_user(data, &vlimit_mask, sizeof(vlimit_mask)))
++              return -EFAULT;
 +      return 0;
 +}
 +
++
 +static inline void vx_reset_minmax(struct _vx_limit *limit)
 +{
 +      rlim_t value;
@@ -22439,6 +21682,7 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/limit.c linux-2.6.31-vs2.3.0.3
 +      }
 +}
 +
++
 +int vc_reset_minmax(struct vx_info *vxi, void __user *data)
 +{
 +      vx_reset_minmax(&vxi->limit);
@@ -22540,9 +21784,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/limit.c linux-2.6.31-vs2.3.0.3
 +      return points;
 +}
 +
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/limit_init.h linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/limit_init.h
---- linux-2.6.31/kernel/vserver/limit_init.h   1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/limit_init.h        2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/limit_init.h linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/limit_init.h
+--- linux-2.6.27.33/kernel/vserver/limit_init.h        1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/limit_init.h   2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,31 @@
 +
 +
@@ -22575,9 +21819,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/limit_init.h linux-2.6.31-vs2.
 +      }
 +}
 +
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/limit_proc.h linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/limit_proc.h
---- linux-2.6.31/kernel/vserver/limit_proc.h   1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/limit_proc.h        2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/limit_proc.h linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/limit_proc.h
+--- linux-2.6.27.33/kernel/vserver/limit_proc.h        1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/limit_proc.h   2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,57 @@
 +#ifndef _VX_LIMIT_PROC_H
 +#define _VX_LIMIT_PROC_H
@@ -22636,9 +21880,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/limit_proc.h linux-2.6.31-vs2.
 +#endif        /* _VX_LIMIT_PROC_H */
 +
 +
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/Makefile linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/Makefile
---- linux-2.6.31/kernel/vserver/Makefile       1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/Makefile    2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/Makefile linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/Makefile
+--- linux-2.6.27.33/kernel/vserver/Makefile    1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/Makefile       2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,18 @@
 +#
 +# Makefile for the Linux vserver routines.
@@ -22658,9 +21902,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/Makefile linux-2.6.31-vs2.3.0.
 +vserver-$(CONFIG_VSERVER_MONITOR) += monitor.o
 +vserver-$(CONFIG_VSERVER_DEVICE) += device.o
 +
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/monitor.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/monitor.c
---- linux-2.6.31/kernel/vserver/monitor.c      1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/monitor.c   2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/monitor.c linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/monitor.c
+--- linux-2.6.27.33/kernel/vserver/monitor.c   1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/monitor.c      2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,138 @@
 +/*
 + *  kernel/vserver/monitor.c
@@ -22800,9 +22044,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/monitor.c linux-2.6.31-vs2.3.0
 +
 +#endif        /* CONFIG_COMPAT */
 +
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/network.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/network.c
---- linux-2.6.31/kernel/vserver/network.c      1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/network.c   2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/network.c linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/network.c
+--- linux-2.6.27.33/kernel/vserver/network.c   1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/network.c      2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,864 @@
 +/*
 + *  linux/kernel/vserver/network.c
@@ -23668,10 +22912,10 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/network.c linux-2.6.31-vs2.3.0
 +EXPORT_SYMBOL_GPL(free_nx_info);
 +EXPORT_SYMBOL_GPL(unhash_nx_info);
 +
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/proc.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/proc.c
---- linux-2.6.31/kernel/vserver/proc.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/proc.c      2009-09-10 17:45:54.000000000 +0200
-@@ -0,0 +1,1098 @@
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/proc.c linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/proc.c
+--- linux-2.6.27.33/kernel/vserver/proc.c      1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/proc.c 2008-10-31 18:15:28.000000000 +0100
+@@ -0,0 +1,1092 @@
 +/*
 + *  linux/kernel/vserver/proc.c
 + *
@@ -23691,8 +22935,6 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/proc.c linux-2.6.31-vs2.3.0.36
 + */
 +
 +#include <linux/proc_fs.h>
-+#include <linux/fs_struct.h>
-+#include <linux/mount.h>
 +#include <asm/unistd.h>
 +
 +#include <linux/vs_context.h>
@@ -23755,20 +22997,16 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/proc.c linux-2.6.31-vs2.3.0.36
 +      return sprintf(buffer,
 +              "#CTotal:\t%d\n"
 +              "#CActive:\t%d\n"
-+              "#NSProxy:\t%d\t%d %d %d %d %d %d\n"
-+              "#InitTask:\t%d\t%d %d\n",
++              "#NSProxy:\t%d\t%d %d %d %d %d %d\n",
 +              atomic_read(&vx_global_ctotal),
 +              atomic_read(&vx_global_cactive),
 +              atomic_read(&vs_global_nsproxy),
 +              atomic_read(&vs_global_fs),
 +              atomic_read(&vs_global_mnt_ns),
 +              atomic_read(&vs_global_uts_ns),
-+              atomic_read(&nr_ipc_ns),
++              atomic_read(&vs_global_ipc_ns),
 +              atomic_read(&vs_global_user_ns),
-+              atomic_read(&vs_global_pid_ns),
-+              atomic_read(&init_task.usage),
-+              atomic_read(&init_task.nsproxy->count),
-+              init_task.fs->users);
++              atomic_read(&vs_global_pid_ns));
 +}
 +
 +
@@ -24770,9 +24008,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/proc.c linux-2.6.31-vs2.3.0.36
 +      return buffer - orig;
 +}
 +
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/sched.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/sched.c
---- linux-2.6.31/kernel/vserver/sched.c        1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/sched.c     2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/sched.c linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/sched.c
+--- linux-2.6.27.33/kernel/vserver/sched.c     1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/sched.c        2009-03-09 15:36:36.000000000 +0100
 @@ -0,0 +1,414 @@
 +/*
 + *  linux/kernel/vserver/sched.c
@@ -25188,9 +24426,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/sched.c linux-2.6.31-vs2.3.0.3
 +      return 0;
 +}
 +
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/sched_init.h linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/sched_init.h
---- linux-2.6.31/kernel/vserver/sched_init.h   1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/sched_init.h        2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/sched_init.h linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/sched_init.h
+--- linux-2.6.27.33/kernel/vserver/sched_init.h        1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/sched_init.h   2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,50 @@
 +
 +static inline void vx_info_init_sched(struct _vx_sched *sched)
@@ -25242,9 +24480,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/sched_init.h linux-2.6.31-vs2.
 +{
 +      return;
 +}
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/sched_proc.h linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/sched_proc.h
---- linux-2.6.31/kernel/vserver/sched_proc.h   1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/sched_proc.h        2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/sched_proc.h linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/sched_proc.h
+--- linux-2.6.27.33/kernel/vserver/sched_proc.h        1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/sched_proc.h   2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,57 @@
 +#ifndef _VX_SCHED_PROC_H
 +#define _VX_SCHED_PROC_H
@@ -25303,9 +24541,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/sched_proc.h linux-2.6.31-vs2.
 +}
 +
 +#endif        /* _VX_SCHED_PROC_H */
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/signal.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/signal.c
---- linux-2.6.31/kernel/vserver/signal.c       1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/signal.c    2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/signal.c linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/signal.c
+--- linux-2.6.27.33/kernel/vserver/signal.c    1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/signal.c       2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,132 @@
 +/*
 + *  linux/kernel/vserver/signal.c
@@ -25439,10 +24677,10 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/signal.c linux-2.6.31-vs2.3.0.
 +      return ret;
 +}
 +
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/space.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/space.c
---- linux-2.6.31/kernel/vserver/space.c        1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/space.c     2009-09-10 16:11:43.000000000 +0200
-@@ -0,0 +1,375 @@
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/space.c linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/space.c
+--- linux-2.6.27.33/kernel/vserver/space.c     1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/space.c        2008-10-31 18:15:28.000000000 +0100
+@@ -0,0 +1,398 @@
 +/*
 + *  linux/kernel/vserver/space.c
 + *
@@ -25460,7 +24698,6 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/space.c linux-2.6.31-vs2.3.0.3
 +#include <linux/utsname.h>
 +#include <linux/nsproxy.h>
 +#include <linux/err.h>
-+#include <linux/fs_struct.h>
 +#include <asm/uaccess.h>
 +
 +#include <linux/vs_context.h>
@@ -25471,6 +24708,7 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/space.c linux-2.6.31-vs2.3.0.3
 +atomic_t vs_global_fs         = ATOMIC_INIT(0);
 +atomic_t vs_global_mnt_ns     = ATOMIC_INIT(0);
 +atomic_t vs_global_uts_ns     = ATOMIC_INIT(0);
++atomic_t vs_global_ipc_ns     = ATOMIC_INIT(0);
 +atomic_t vs_global_user_ns    = ATOMIC_INIT(0);
 +atomic_t vs_global_pid_ns     = ATOMIC_INIT(0);
 +
@@ -25533,6 +24771,7 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/space.c linux-2.6.31-vs2.3.0.3
 +      struct mnt_namespace *old_ns;
 +      struct uts_namespace *old_uts;
 +      struct ipc_namespace *old_ipc;
++      struct user_namespace *old_user;
 +#ifdef        CONFIG_PID_NS
 +      struct pid_namespace *old_pid;
 +#endif
@@ -25569,6 +24808,14 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/space.c linux-2.6.31-vs2.3.0.3
 +      } else
 +              old_ipc = NULL;
 +
++      if (mask & CLONE_NEWUSER) {
++              old_user = nsproxy->user_ns;
++              nsproxy->user_ns = new_nsproxy->user_ns;
++              if (nsproxy->user_ns)
++                      get_user_ns(nsproxy->user_ns);
++      } else
++              old_user = NULL;
++
 +#ifdef        CONFIG_PID_NS
 +      if (mask & CLONE_NEWPID) {
 +              old_pid = nsproxy->pid_ns;
@@ -25593,6 +24840,8 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/space.c linux-2.6.31-vs2.3.0.3
 +              put_uts_ns(old_uts);
 +      if (old_ipc)
 +              put_ipc_ns(old_ipc);
++      if (old_user)
++              put_user_ns(old_user);
 +#ifdef        CONFIG_PID_NS
 +      if (old_pid)
 +              put_pid_ns(old_pid);
@@ -25629,12 +24878,33 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/space.c linux-2.6.31-vs2.3.0.3
 +      return proxy;
 +}
 +
++/*
++ *    merge two fs structs into a new one.
++ *    will take a reference on the result.
++ */
++
++static inline
++struct fs_struct *__vs_merge_fs(struct fs_struct *old,
++      struct fs_struct *fs, unsigned long mask)
++{
++      if (!(mask & CLONE_FS)) {
++              if (old)
++                      atomic_inc(&old->count);
++              return old;
++      }
++
++      if (!fs)
++              return NULL;
++
++      return copy_fs_struct(fs);
++}
++
 +
 +int vx_enter_space(struct vx_info *vxi, unsigned long mask, unsigned index)
 +{
 +      struct nsproxy *proxy, *proxy_cur, *proxy_new;
-+      struct fs_struct *fs_cur, *fs = NULL;
-+      int ret, kill = 0;
++      struct fs_struct *fs, *fs_cur, *fs_new;
++      int ret;
 +
 +      vxdprintk(VXD_CBIT(space, 8), "vx_enter_space(%p[#%u],0x%08lx,%d)",
 +              vxi, vxi->vx_id, mask, index);
@@ -25648,48 +24918,42 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/space.c linux-2.6.31-vs2.3.0.3
 +      if ((mask & vxi->vx_nsmask[index]) != mask)
 +              return -EINVAL;
 +
-+      if (mask & CLONE_FS) {
-+              fs = copy_fs_struct(vxi->vx_fs[index]);
-+              if (!fs)
-+                      return -ENOMEM;
-+      }
 +      proxy = vxi->vx_nsproxy[index];
-+
-+      vxdprintk(VXD_CBIT(space, 9),
-+              "vx_enter_space(%p[#%u],0x%08lx,%d) -> (%p,%p)",
-+              vxi, vxi->vx_id, mask, index, proxy, fs);
++      fs = vxi->vx_fs[index];
 +
 +      task_lock(current);
 +      fs_cur = current->fs;
-+
-+      if (mask & CLONE_FS) {
-+              write_lock(&fs_cur->lock);
-+              current->fs = fs;
-+              kill = !--fs_cur->users;
-+              write_unlock(&fs_cur->lock);
-+      }
-+
++      atomic_inc(&fs_cur->count);
 +      proxy_cur = current->nsproxy;
 +      get_nsproxy(proxy_cur);
 +      task_unlock(current);
 +
-+      if (kill)
-+              free_fs_struct(fs_cur);
++      fs_new = __vs_merge_fs(fs_cur, fs, mask);
++      if (IS_ERR(fs_new)) {
++              ret = PTR_ERR(fs_new);
++              goto out_put;
++      }
 +
 +      proxy_new = __vs_merge_nsproxy(proxy_cur, proxy, mask);
 +      if (IS_ERR(proxy_new)) {
 +              ret = PTR_ERR(proxy_new);
-+              goto out_put;
++              goto out_put_fs;
 +      }
 +
++      fs_new = xchg(&current->fs, fs_new);
 +      proxy_new = xchg(&current->nsproxy, proxy_new);
 +      ret = 0;
 +
 +      if (proxy_new)
 +              put_nsproxy(proxy_new);
++out_put_fs:
++      if (fs_new)
++              put_fs_struct(fs_new);
 +out_put:
 +      if (proxy_cur)
 +              put_nsproxy(proxy_cur);
++      if (fs_cur)
++              put_fs_struct(fs_cur);
 +      return ret;
 +}
 +
@@ -25697,8 +24961,8 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/space.c linux-2.6.31-vs2.3.0.3
 +int vx_set_space(struct vx_info *vxi, unsigned long mask, unsigned index)
 +{
 +      struct nsproxy *proxy_vxi, *proxy_cur, *proxy_new;
-+      struct fs_struct *fs_vxi, *fs;
-+      int ret, kill = 0;
++      struct fs_struct *fs_vxi, *fs_cur, *fs_new;
++      int ret;
 +
 +      vxdprintk(VXD_CBIT(space, 8), "vx_set_space(%p[#%u],0x%08lx,%d)",
 +              vxi, vxi->vx_id, mask, index);
@@ -25712,43 +24976,40 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/space.c linux-2.6.31-vs2.3.0.3
 +      proxy_vxi = vxi->vx_nsproxy[index];
 +      fs_vxi = vxi->vx_fs[index];
 +
-+      if (mask & CLONE_FS) {
-+              fs = copy_fs_struct(current->fs);
-+              if (!fs)
-+                      return -ENOMEM;
-+      }
-+
 +      task_lock(current);
-+
-+      if (mask & CLONE_FS) {
-+              write_lock(&fs_vxi->lock);
-+              vxi->vx_fs[index] = fs;
-+              kill = !--fs_vxi->users;
-+              write_unlock(&fs_vxi->lock);
-+      }
-+
++      fs_cur = current->fs;
++      atomic_inc(&fs_cur->count);
 +      proxy_cur = current->nsproxy;
 +      get_nsproxy(proxy_cur);
 +      task_unlock(current);
 +
-+      if (kill)
-+              free_fs_struct(fs_vxi);
++      fs_new = __vs_merge_fs(fs_vxi, fs_cur, mask);
++      if (IS_ERR(fs_new)) {
++              ret = PTR_ERR(fs_new);
++              goto out_put;
++      }
 +
 +      proxy_new = __vs_merge_nsproxy(proxy_vxi, proxy_cur, mask);
 +      if (IS_ERR(proxy_new)) {
 +              ret = PTR_ERR(proxy_new);
-+              goto out_put;
++              goto out_put_fs;
 +      }
 +
++      fs_new = xchg(&vxi->vx_fs[index], fs_new);
 +      proxy_new = xchg(&vxi->vx_nsproxy[index], proxy_new);
 +      vxi->vx_nsmask[index] |= mask;
 +      ret = 0;
 +
 +      if (proxy_new)
 +              put_nsproxy(proxy_new);
++out_put_fs:
++      if (fs_new)
++              put_fs_struct(fs_new);
 +out_put:
 +      if (proxy_cur)
 +              put_nsproxy(proxy_cur);
++      if (fs_cur)
++              put_fs_struct(fs_cur);
 +      return ret;
 +}
 +
@@ -25818,10 +25079,10 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/space.c linux-2.6.31-vs2.3.0.3
 +      return 0;
 +}
 +
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/switch.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/switch.c
---- linux-2.6.31/kernel/vserver/switch.c       1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/switch.c    2009-09-10 16:11:43.000000000 +0200
-@@ -0,0 +1,546 @@
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/switch.c linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/switch.c
+--- linux-2.6.27.33/kernel/vserver/switch.c    1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/switch.c       2008-10-31 04:42:36.000000000 +0100
+@@ -0,0 +1,543 @@
 +/*
 + *  linux/kernel/vserver/switch.c
 + *
@@ -25946,8 +25207,6 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/switch.c linux-2.6.31-vs2.3.0.
 +#endif
 +      case VCMD_get_rlimit_mask:
 +              return vc_get_rlimit_mask(id, data);
-+      case VCMD_reset_hits:
-+              return vc_reset_hits(vxi, data);
 +      case VCMD_reset_minmax:
 +              return vc_reset_minmax(vxi, data);
 +
@@ -26146,7 +25405,6 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/switch.c linux-2.6.31-vs2.3.0.
 +
 +      /* info commands */
 +      __VCMD(task_xid,         2, VCA_NONE,   0);
-+      __VCMD(reset_hits,       2, VCA_VXI,    0);
 +      __VCMD(reset_minmax,     2, VCA_VXI,    0);
 +      __VCMD(vx_info,          3, VCA_VXI,    VCF_INFO);
 +      __VCMD(get_bcaps,        3, VCA_VXI,    VCF_INFO);
@@ -26368,9 +25626,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/switch.c linux-2.6.31-vs2.3.0.
 +}
 +
 +#endif        /* CONFIG_COMPAT */
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/sysctl.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/sysctl.c
---- linux-2.6.31/kernel/vserver/sysctl.c       1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/sysctl.c    2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/sysctl.c linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/sysctl.c
+--- linux-2.6.27.33/kernel/vserver/sysctl.c    1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/sysctl.c       2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,244 @@
 +/*
 + *  kernel/vserver/sysctl.c
@@ -26616,9 +25874,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/sysctl.c linux-2.6.31-vs2.3.0.
 +EXPORT_SYMBOL_GPL(vx_debug_space);
 +EXPORT_SYMBOL_GPL(vx_debug_misc);
 +
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/tag.c linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/tag.c
---- linux-2.6.31/kernel/vserver/tag.c  1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/tag.c       2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/tag.c linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/tag.c
+--- linux-2.6.27.33/kernel/vserver/tag.c       1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/tag.c  2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,63 @@
 +/*
 + *  linux/kernel/vserver/tag.c
@@ -26683,9 +25941,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/tag.c linux-2.6.31-vs2.3.0.36.
 +}
 +
 +
-diff -NurpP --minimal linux-2.6.31/kernel/vserver/vci_config.h linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/vci_config.h
---- linux-2.6.31/kernel/vserver/vci_config.h   1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/kernel/vserver/vci_config.h        2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/kernel/vserver/vci_config.h linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/vci_config.h
+--- linux-2.6.27.33/kernel/vserver/vci_config.h        1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/kernel/vserver/vci_config.h   2008-10-31 18:16:04.000000000 +0100
 @@ -0,0 +1,81 @@
 +
 +/*  interface version */
@@ -26768,9 +26026,9 @@ diff -NurpP --minimal linux-2.6.31/kernel/vserver/vci_config.h linux-2.6.31-vs2.
 +      0;
 +}
 +
-diff -NurpP --minimal linux-2.6.31/mm/filemap_xip.c linux-2.6.31-vs2.3.0.36.14-pre8/mm/filemap_xip.c
---- linux-2.6.31/mm/filemap_xip.c      2009-06-11 17:13:27.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/mm/filemap_xip.c   2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/mm/filemap_xip.c linux-2.6.27.33-vs2.3.0.36.6/mm/filemap_xip.c
+--- linux-2.6.27.33/mm/filemap_xip.c   2009-09-13 16:17:01.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/mm/filemap_xip.c      2009-05-15 22:57:04.000000000 +0200
 @@ -17,6 +17,7 @@
  #include <linux/sched.h>
  #include <linux/seqlock.h>
@@ -26779,9 +26037,9 @@ diff -NurpP --minimal linux-2.6.31/mm/filemap_xip.c linux-2.6.31-vs2.3.0.36.14-p
  #include <asm/tlbflush.h>
  #include <asm/io.h>
  
-diff -NurpP --minimal linux-2.6.31/mm/fremap.c linux-2.6.31-vs2.3.0.36.14-pre8/mm/fremap.c
---- linux-2.6.31/mm/fremap.c   2009-03-24 14:22:45.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/mm/fremap.c        2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/mm/fremap.c linux-2.6.27.33-vs2.3.0.36.6/mm/fremap.c
+--- linux-2.6.27.33/mm/fremap.c        2009-09-13 16:17:01.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/mm/fremap.c   2009-02-03 17:59:04.000000000 +0100
 @@ -16,6 +16,7 @@
  #include <linux/module.h>
  #include <linux/syscalls.h>
@@ -26790,10 +26048,10 @@ diff -NurpP --minimal linux-2.6.31/mm/fremap.c linux-2.6.31-vs2.3.0.36.14-pre8/m
  
  #include <asm/mmu_context.h>
  #include <asm/cacheflush.h>
-diff -NurpP --minimal linux-2.6.31/mm/hugetlb.c linux-2.6.31-vs2.3.0.36.14-pre8/mm/hugetlb.c
---- linux-2.6.31/mm/hugetlb.c  2009-09-10 15:26:28.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/mm/hugetlb.c       2009-09-10 16:11:43.000000000 +0200
-@@ -24,6 +24,7 @@
+diff -NurpP --minimal linux-2.6.27.33/mm/hugetlb.c linux-2.6.27.33-vs2.3.0.36.6/mm/hugetlb.c
+--- linux-2.6.27.33/mm/hugetlb.c       2009-09-13 16:17:01.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/mm/hugetlb.c  2009-08-17 19:07:36.000000000 +0200
+@@ -23,6 +23,7 @@
  #include <asm/io.h>
  
  #include <linux/hugetlb.h>
@@ -26801,18 +26059,10 @@ diff -NurpP --minimal linux-2.6.31/mm/hugetlb.c linux-2.6.31-vs2.3.0.36.14-pre8/
  #include "internal.h"
  
  const unsigned long hugetlb_zero = 0, hugetlb_infinity = ~0UL;
-diff -NurpP --minimal linux-2.6.31/mm/memory.c linux-2.6.31-vs2.3.0.36.14-pre8/mm/memory.c
---- linux-2.6.31/mm/memory.c   2009-09-10 15:26:28.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/mm/memory.c        2009-09-10 16:26:26.000000000 +0200
-@@ -55,6 +55,7 @@
- #include <linux/kallsyms.h>
- #include <linux/swapops.h>
- #include <linux/elf.h>
-+// #include <linux/vs_memory.h>
- #include <asm/pgalloc.h>
- #include <asm/uaccess.h>
-@@ -613,6 +614,9 @@ static int copy_pte_range(struct mm_stru
+diff -NurpP --minimal linux-2.6.27.33/mm/memory.c linux-2.6.27.33-vs2.3.0.36.6/mm/memory.c
+--- linux-2.6.27.33/mm/memory.c        2009-09-13 16:17:01.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/mm/memory.c   2009-05-22 00:47:40.000000000 +0200
+@@ -562,6 +562,9 @@ static int copy_pte_range(struct mm_stru
        int progress = 0;
        int rss[2];
  
@@ -26822,7 +26072,19 @@ diff -NurpP --minimal linux-2.6.31/mm/memory.c linux-2.6.31-vs2.3.0.36.14-pre8/m
  again:
        rss[1] = rss[0] = 0;
        dst_pte = pte_alloc_map_lock(dst_mm, dst_pmd, addr, &dst_ptl);
-@@ -2627,6 +2631,8 @@ static int do_anonymous_page(struct mm_s
+@@ -2340,6 +2343,11 @@ static int do_swap_page(struct mm_struct
+               goto out;
+       }
++      if (!vx_rss_avail(mm, 1)) {
++              ret = VM_FAULT_OOM;
++              goto out;
++      }
++
+       mark_page_accessed(page);
+       lock_page(page);
+       delayacct_clear_flag(DELAYACCT_PF_SWAPIN);
+@@ -2411,6 +2419,8 @@ static int do_anonymous_page(struct mm_s
        /* Allocate our own private page. */
        pte_unmap(page_table);
  
@@ -26831,7 +26093,7 @@ diff -NurpP --minimal linux-2.6.31/mm/memory.c linux-2.6.31-vs2.3.0.36.14-pre8/m
        if (unlikely(anon_vma_prepare(vma)))
                goto oom;
        page = alloc_zeroed_user_highpage_movable(vma, address);
-@@ -2909,6 +2915,7 @@ static inline int handle_pte_fault(struc
+@@ -2688,6 +2698,7 @@ static inline int handle_pte_fault(struc
  {
        pte_t entry;
        spinlock_t *ptl;
@@ -26839,10 +26101,10 @@ diff -NurpP --minimal linux-2.6.31/mm/memory.c linux-2.6.31-vs2.3.0.36.14-pre8/m
  
        entry = *pte;
        if (!pte_present(entry)) {
-@@ -2933,9 +2940,12 @@ static inline int handle_pte_fault(struc
+@@ -2712,9 +2723,12 @@ static inline int handle_pte_fault(struc
        if (unlikely(!pte_same(*pte, entry)))
                goto unlock;
-       if (flags & FAULT_FLAG_WRITE) {
+       if (write_access) {
 -              if (!pte_write(entry))
 -                      return do_wp_page(mm, vma, address,
 +              if (!pte_write(entry)) {
@@ -26854,7 +26116,7 @@ diff -NurpP --minimal linux-2.6.31/mm/memory.c linux-2.6.31-vs2.3.0.36.14-pre8/m
                entry = pte_mkdirty(entry);
        }
        entry = pte_mkyoung(entry);
-@@ -2953,7 +2963,10 @@ static inline int handle_pte_fault(struc
+@@ -2732,7 +2746,10 @@ static inline int handle_pte_fault(struc
        }
  unlock:
        pte_unmap_unlock(pte, ptl);
@@ -26866,27 +26128,27 @@ diff -NurpP --minimal linux-2.6.31/mm/memory.c linux-2.6.31-vs2.3.0.36.14-pre8/m
  }
  
  /*
-diff -NurpP --minimal linux-2.6.31/mm/mlock.c linux-2.6.31-vs2.3.0.36.14-pre8/mm/mlock.c
---- linux-2.6.31/mm/mlock.c    2009-09-10 15:26:28.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/mm/mlock.c 2009-09-10 16:29:21.000000000 +0200
-@@ -18,6 +18,7 @@
- #include <linux/rmap.h>
- #include <linux/mmzone.h>
- #include <linux/hugetlb.h>
+diff -NurpP --minimal linux-2.6.27.33/mm/mlock.c linux-2.6.27.33-vs2.3.0.36.6/mm/mlock.c
+--- linux-2.6.27.33/mm/mlock.c 2009-09-13 16:17:01.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/mm/mlock.c    2009-02-03 17:59:04.000000000 +0100
+@@ -12,6 +12,7 @@
+ #include <linux/syscalls.h>
+ #include <linux/sched.h>
+ #include <linux/module.h>
 +#include <linux/vs_memory.h>
  
- #include "internal.h"
-@@ -393,7 +394,7 @@ success:
-       nr_pages = (end - start) >> PAGE_SHIFT;
-       if (!lock)
-               nr_pages = -nr_pages;
--      mm->locked_vm += nr_pages;
-+      vx_vmlocked_add(mm, nr_pages);
+ int can_do_mlock(void)
+ {
+@@ -76,7 +77,7 @@ success:
+                       ret = make_pages_present(start, end);
+       }
  
-       /*
-        * vm_flags is protected by the mmap_sem held in write mode.
-@@ -470,7 +471,7 @@ static int do_mlock(unsigned long start,
+-      mm->locked_vm -= pages;
++      vx_vmlocked_sub(mm, pages);
+ out:
+       return ret;
+ }
+@@ -132,7 +133,7 @@ static int do_mlock(unsigned long start,
  
  SYSCALL_DEFINE2(mlock, unsigned long, start, size_t, len)
  {
@@ -26895,7 +26157,7 @@ diff -NurpP --minimal linux-2.6.31/mm/mlock.c linux-2.6.31-vs2.3.0.36.14-pre8/mm
        unsigned long lock_limit;
        int error = -ENOMEM;
  
-@@ -483,8 +484,10 @@ SYSCALL_DEFINE2(mlock, unsigned long, st
+@@ -143,8 +144,10 @@ SYSCALL_DEFINE2(mlock, unsigned long, st
        len = PAGE_ALIGN(len + (start & ~PAGE_MASK));
        start &= PAGE_MASK;
  
@@ -26908,7 +26170,7 @@ diff -NurpP --minimal linux-2.6.31/mm/mlock.c linux-2.6.31-vs2.3.0.36.14-pre8/mm
  
        lock_limit = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur;
        lock_limit >>= PAGE_SHIFT;
-@@ -492,6 +495,7 @@ SYSCALL_DEFINE2(mlock, unsigned long, st
+@@ -152,6 +155,7 @@ SYSCALL_DEFINE2(mlock, unsigned long, st
        /* check against resource limits */
        if ((locked <= lock_limit) || capable(CAP_IPC_LOCK))
                error = do_mlock(start, len, 1);
@@ -26916,7 +26178,7 @@ diff -NurpP --minimal linux-2.6.31/mm/mlock.c linux-2.6.31-vs2.3.0.36.14-pre8/mm
        up_write(&current->mm->mmap_sem);
        return error;
  }
-@@ -553,6 +557,8 @@ SYSCALL_DEFINE1(mlockall, int, flags)
+@@ -211,6 +215,8 @@ SYSCALL_DEFINE1(mlockall, int, flags)
        lock_limit >>= PAGE_SHIFT;
  
        ret = -ENOMEM;
@@ -26925,56 +26187,23 @@ diff -NurpP --minimal linux-2.6.31/mm/mlock.c linux-2.6.31-vs2.3.0.36.14-pre8/mm
        if (!(flags & MCL_CURRENT) || (current->mm->total_vm <= lock_limit) ||
            capable(CAP_IPC_LOCK))
                ret = do_mlockall(flags);
-@@ -627,8 +633,10 @@ int account_locked_memory(struct mm_stru
-       if (lim < vm)
-               goto out;
--      mm->total_vm  += pgsz;
--      mm->locked_vm += pgsz;
-+      // mm->total_vm  += pgsz;
-+      vx_vmpages_add(mm, pgsz);
-+      // mm->locked_vm += pgsz;
-+      vx_vmlocked_add(mm, pgsz);
-       error = 0;
-  out:
-@@ -642,8 +650,10 @@ void refund_locked_memory(struct mm_stru
-       down_write(&mm->mmap_sem);
--      mm->total_vm  -= pgsz;
--      mm->locked_vm -= pgsz;
-+      // mm->total_vm  -= pgsz;
-+      vx_vmpages_sub(mm, pgsz);
-+      // mm->locked_vm -= pgsz;
-+      vx_vmlocked_sub(mm, pgsz);
-       up_write(&mm->mmap_sem);
- }
-diff -NurpP --minimal linux-2.6.31/mm/mmap.c linux-2.6.31-vs2.3.0.36.14-pre8/mm/mmap.c
---- linux-2.6.31/mm/mmap.c     2009-09-10 15:26:28.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/mm/mmap.c  2009-09-10 16:30:48.000000000 +0200
-@@ -1222,7 +1222,8 @@ munmap_back:
+diff -NurpP --minimal linux-2.6.27.33/mm/mmap.c linux-2.6.27.33-vs2.3.0.36.6/mm/mmap.c
+--- linux-2.6.27.33/mm/mmap.c  2009-09-13 16:17:01.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/mm/mmap.c     2009-07-21 15:54:27.000000000 +0200
+@@ -1224,10 +1224,10 @@ munmap_back:
+       if (correct_wcount)
+               atomic_inc(&inode->i_writecount);
  out:
-       perf_counter_mmap(vma);
 -      mm->total_vm += len >> PAGE_SHIFT;
-+      // mm->total_vm += len >> PAGE_SHIFT;
 +      vx_vmpages_add(mm, len >> PAGE_SHIFT);
        vm_stat_account(mm, vm_flags, file, len >> PAGE_SHIFT);
        if (vm_flags & VM_LOCKED) {
-               /*
-@@ -1231,7 +1232,8 @@ out:
-               long nr_pages = mlock_vma_pages_range(vma, addr, addr + len);
-               if (nr_pages < 0)
-                       return nr_pages;        /* vma gone! */
--              mm->locked_vm += (len >> PAGE_SHIFT) - nr_pages;
-+              // mm->locked_vm += (len >> PAGE_SHIFT) - nr_pages;
-+              vx_vmlocked_add(mm, (len >> PAGE_SHIFT) - nr_pages);
-       } else if ((flags & MAP_POPULATE) && !(flags & MAP_NONBLOCK))
+-              mm->locked_vm += len >> PAGE_SHIFT;
++              vx_vmlocked_add(mm, len >> PAGE_SHIFT);
                make_pages_present(addr, addr + len);
-       return addr;
-@@ -1578,9 +1580,9 @@ static int acct_stack_growth(struct vm_a
+       }
+       if ((flags & MAP_POPULATE) && !(flags & MAP_NONBLOCK))
+@@ -1576,9 +1576,9 @@ static int acct_stack_growth(struct vm_a
                return -ENOMEM;
  
        /* Ok, everything looks good - let it rip */
@@ -26986,27 +26215,19 @@ diff -NurpP --minimal linux-2.6.31/mm/mmap.c linux-2.6.31-vs2.3.0.36.14-pre8/mm/
        vm_stat_account(mm, vma->vm_flags, vma->vm_file, grow);
        return 0;
  }
-@@ -1755,7 +1757,8 @@ static void remove_vma_list(struct mm_st
+@@ -1749,9 +1749,9 @@ static void remove_vma_list(struct mm_st
        do {
                long nrpages = vma_pages(vma);
  
 -              mm->total_vm -= nrpages;
-+              // mm->total_vm -= nrpages;
 +              vx_vmpages_sub(mm, nrpages);
+               if (vma->vm_flags & VM_LOCKED)
+-                      mm->locked_vm -= nrpages;
++                      vx_vmlocked_sub(mm, nrpages);
                vm_stat_account(mm, vma->vm_flags, vma->vm_file, -nrpages);
                vma = remove_vma(vma);
        } while (vma);
-@@ -1927,7 +1930,8 @@ int do_munmap(struct mm_struct *mm, unsi
-               struct vm_area_struct *tmp = vma;
-               while (tmp && tmp->vm_start < end) {
-                       if (tmp->vm_flags & VM_LOCKED) {
--                              mm->locked_vm -= vma_pages(tmp);
-+                              // mm->locked_vm -= vma_pages(tmp);
-+                              vx_vmlocked_sub(mm, vma_pages(tmp));
-                               munlock_vma_pages_all(tmp);
-                       }
-                       tmp = tmp->vm_next;
-@@ -2016,6 +2020,8 @@ unsigned long do_brk(unsigned long addr,
+@@ -1998,6 +1998,8 @@ unsigned long do_brk(unsigned long addr,
                lock_limit >>= PAGE_SHIFT;
                if (locked > lock_limit && !capable(CAP_IPC_LOCK))
                        return -EAGAIN;
@@ -27015,7 +26236,7 @@ diff -NurpP --minimal linux-2.6.31/mm/mmap.c linux-2.6.31-vs2.3.0.36.14-pre8/mm/
        }
  
        /*
-@@ -2042,7 +2048,8 @@ unsigned long do_brk(unsigned long addr,
+@@ -2024,7 +2026,8 @@ unsigned long do_brk(unsigned long addr,
        if (mm->map_count > sysctl_max_map_count)
                return -ENOMEM;
  
@@ -27025,23 +26246,19 @@ diff -NurpP --minimal linux-2.6.31/mm/mmap.c linux-2.6.31-vs2.3.0.36.14-pre8/mm/
                return -ENOMEM;
  
        /* Can we just expand an old private anonymous mapping? */
-@@ -2068,10 +2075,13 @@ unsigned long do_brk(unsigned long addr,
+@@ -2049,9 +2052,9 @@ unsigned long do_brk(unsigned long addr,
        vma->vm_page_prot = vm_get_page_prot(flags);
        vma_link(mm, vma, prev, rb_link, rb_parent);
  out:
 -      mm->total_vm += len >> PAGE_SHIFT;
-+      // mm->total_vm += len >> PAGE_SHIFT;
 +      vx_vmpages_add(mm, len >> PAGE_SHIFT);
-+
        if (flags & VM_LOCKED) {
-               if (!mlock_vma_pages_range(vma, addr, addr + len))
--                      mm->locked_vm += (len >> PAGE_SHIFT);
-+                      // mm->locked_vm += (len >> PAGE_SHIFT);
-+                      vx_vmlocked_add(mm, len >> PAGE_SHIFT);
+-              mm->locked_vm += len >> PAGE_SHIFT;
++              vx_vmlocked_add(mm, len >> PAGE_SHIFT);
+               make_pages_present(addr, addr + len);
        }
        return addr;
- }
-@@ -2114,6 +2124,11 @@ void exit_mmap(struct mm_struct *mm)
+@@ -2084,6 +2087,11 @@ void exit_mmap(struct mm_struct *mm)
        free_pgtables(tlb, vma, FIRST_USER_ADDRESS, 0);
        tlb_finish_mmu(tlb, 0, end);
  
@@ -27053,7 +26270,7 @@ diff -NurpP --minimal linux-2.6.31/mm/mmap.c linux-2.6.31-vs2.3.0.36.14-pre8/mm/
        /*
         * Walk the list again, actually closing and freeing it,
         * with preemption enabled, without holding any MM locks.
-@@ -2153,7 +2168,8 @@ int insert_vm_struct(struct mm_struct * 
+@@ -2123,7 +2131,8 @@ int insert_vm_struct(struct mm_struct * 
        if (__vma && __vma->vm_start < vma->vm_end)
                return -ENOMEM;
        if ((vma->vm_flags & VM_ACCOUNT) &&
@@ -27063,7 +26280,7 @@ diff -NurpP --minimal linux-2.6.31/mm/mmap.c linux-2.6.31-vs2.3.0.36.14-pre8/mm/
                return -ENOMEM;
        vma_link(mm, vma, prev, rb_link, rb_parent);
        return 0;
-@@ -2229,6 +2245,8 @@ int may_expand_vm(struct mm_struct *mm, 
+@@ -2199,6 +2208,8 @@ int may_expand_vm(struct mm_struct *mm, 
  
        if (cur + npages > lim)
                return 0;
@@ -27072,18 +26289,19 @@ diff -NurpP --minimal linux-2.6.31/mm/mmap.c linux-2.6.31-vs2.3.0.36.14-pre8/mm/
        return 1;
  }
  
-@@ -2306,7 +2324,7 @@ int install_special_mapping(struct mm_st
+@@ -2276,8 +2287,7 @@ int install_special_mapping(struct mm_st
                return -ENOMEM;
        }
  
 -      mm->total_vm += len >> PAGE_SHIFT;
+-
 +      vx_vmpages_add(mm, len >> PAGE_SHIFT);
+       return 0;
+ }
  
-       perf_counter_mmap(vma);
-diff -NurpP --minimal linux-2.6.31/mm/mremap.c linux-2.6.31-vs2.3.0.36.14-pre8/mm/mremap.c
---- linux-2.6.31/mm/mremap.c   2009-03-24 14:22:45.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/mm/mremap.c        2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/mm/mremap.c linux-2.6.27.33-vs2.3.0.36.6/mm/mremap.c
+--- linux-2.6.27.33/mm/mremap.c        2009-09-13 16:17:01.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/mm/mremap.c   2009-02-03 17:59:04.000000000 +0100
 @@ -19,6 +19,7 @@
  #include <linux/security.h>
  #include <linux/syscalls.h>
@@ -27092,7 +26310,7 @@ diff -NurpP --minimal linux-2.6.31/mm/mremap.c linux-2.6.31-vs2.3.0.36.14-pre8/m
  
  #include <asm/uaccess.h>
  #include <asm/cacheflush.h>
-@@ -220,7 +221,7 @@ static unsigned long move_vma(struct vm_
+@@ -218,7 +219,7 @@ static unsigned long move_vma(struct vm_
         * If this were a serious issue, we'd add a flag to do_munmap().
         */
        hiwater_vm = mm->hiwater_vm;
@@ -27101,16 +26319,16 @@ diff -NurpP --minimal linux-2.6.31/mm/mremap.c linux-2.6.31-vs2.3.0.36.14-pre8/m
        vm_stat_account(mm, vma->vm_flags, vma->vm_file, new_len>>PAGE_SHIFT);
  
        if (do_munmap(mm, old_addr, old_len) < 0) {
-@@ -238,7 +239,7 @@ static unsigned long move_vma(struct vm_
+@@ -236,7 +237,7 @@ static unsigned long move_vma(struct vm_
        }
  
        if (vm_flags & VM_LOCKED) {
 -              mm->locked_vm += new_len >> PAGE_SHIFT;
 +              vx_vmlocked_add(mm, new_len >> PAGE_SHIFT);
                if (new_len > old_len)
-                       mlock_vma_pages_range(new_vma, new_addr + old_len,
-                                                      new_addr + new_len);
-@@ -349,6 +350,9 @@ unsigned long do_mremap(unsigned long ad
+                       make_pages_present(new_addr + old_len,
+                                          new_addr + new_len);
+@@ -347,6 +348,9 @@ unsigned long do_mremap(unsigned long ad
                ret = -EAGAIN;
                if (locked > lock_limit && !capable(CAP_IPC_LOCK))
                        goto out;
@@ -27120,45 +26338,52 @@ diff -NurpP --minimal linux-2.6.31/mm/mremap.c linux-2.6.31-vs2.3.0.36.14-pre8/m
        }
        if (!may_expand_vm(mm, (new_len - old_len) >> PAGE_SHIFT)) {
                ret = -ENOMEM;
-@@ -377,10 +381,12 @@ unsigned long do_mremap(unsigned long ad
+@@ -375,10 +379,10 @@ unsigned long do_mremap(unsigned long ad
                        vma_adjust(vma, vma->vm_start,
                                addr + new_len, vma->vm_pgoff, NULL);
  
 -                      mm->total_vm += pages;
-+                      // mm->total_vm += pages;
 +                      vx_vmpages_add(mm, pages);
                        vm_stat_account(mm, vma->vm_flags, vma->vm_file, pages);
                        if (vma->vm_flags & VM_LOCKED) {
 -                              mm->locked_vm += pages;
-+                              // mm->locked_vm += pages;
 +                              vx_vmlocked_add(mm, pages);
-                               mlock_vma_pages_range(vma, addr + old_len,
+                               make_pages_present(addr + old_len,
                                                   addr + new_len);
                        }
-diff -NurpP --minimal linux-2.6.31/mm/nommu.c linux-2.6.31-vs2.3.0.36.14-pre8/mm/nommu.c
---- linux-2.6.31/mm/nommu.c    2009-09-10 15:26:28.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/mm/nommu.c 2009-09-10 16:11:43.000000000 +0200
-@@ -1365,7 +1365,7 @@ unsigned long do_mmap_pgoff(struct file 
-       /* okay... we have a mapping; now we have to register it */
-       result = vma->vm_start;
+diff -NurpP --minimal linux-2.6.27.33/mm/nommu.c linux-2.6.27.33-vs2.3.0.36.6/mm/nommu.c
+--- linux-2.6.27.33/mm/nommu.c 2009-09-13 16:17:01.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/mm/nommu.c    2009-02-03 17:59:04.000000000 +0100
+@@ -1028,7 +1028,7 @@ unsigned long do_mmap_pgoff(struct file 
+       realalloc += kobjsize(vma);
+       askedalloc += sizeof(*vma);
  
 -      current->mm->total_vm += len >> PAGE_SHIFT;
 +      vx_vmpages_add(current->mm, len >> PAGE_SHIFT);
  
- share:
-       add_vma_to_mm(current->mm, vma);
-@@ -1636,7 +1636,7 @@ void exit_mmap(struct mm_struct *mm)
+       add_nommu_vma(vma);
  
-       kenter("");
+@@ -1160,7 +1160,7 @@ int do_munmap(struct mm_struct *mm, unsi
+       kfree(vml);
  
--      mm->total_vm = 0;
-+      vx_vmpages_sub(mm, mm->total_vm);
+       update_hiwater_vm(mm);
+-      mm->total_vm -= len >> PAGE_SHIFT;
++      vx_vmpages_sub(mm, len >> PAGE_SHIFT);
+ #ifdef DEBUG
+       show_process_blocks();
+@@ -1193,7 +1193,7 @@ void exit_mmap(struct mm_struct * mm)
+               printk("Exit_mmap:\n");
+ #endif
+-              mm->total_vm = 0;
++              vx_vmpages_sub(mm, mm->total_vm);
  
-       while ((vma = mm->mmap)) {
-               mm->mmap = vma->vm_next;
-diff -NurpP --minimal linux-2.6.31/mm/oom_kill.c linux-2.6.31-vs2.3.0.36.14-pre8/mm/oom_kill.c
---- linux-2.6.31/mm/oom_kill.c 2009-06-11 17:13:27.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/mm/oom_kill.c      2009-09-10 16:11:43.000000000 +0200
+               while ((tmp = mm->context.vmlist)) {
+                       mm->context.vmlist = tmp->next;
+diff -NurpP --minimal linux-2.6.27.33/mm/oom_kill.c linux-2.6.27.33-vs2.3.0.36.6/mm/oom_kill.c
+--- linux-2.6.27.33/mm/oom_kill.c      2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/mm/oom_kill.c 2008-10-13 14:54:20.000000000 +0200
 @@ -27,6 +27,7 @@
  #include <linux/notifier.h>
  #include <linux/memcontrol.h>
@@ -27167,7 +26392,7 @@ diff -NurpP --minimal linux-2.6.31/mm/oom_kill.c linux-2.6.31-vs2.3.0.36.14-pre8
  
  int sysctl_panic_on_oom;
  int sysctl_oom_kill_allocating_task;
-@@ -72,6 +73,12 @@ unsigned long badness(struct task_struct
+@@ -73,6 +74,12 @@ unsigned long badness(struct task_struct
        points = mm->total_vm;
  
        /*
@@ -27180,7 +26405,7 @@ diff -NurpP --minimal linux-2.6.31/mm/oom_kill.c linux-2.6.31-vs2.3.0.36.14-pre8
         * After this unlock we can no longer dereference local variable `mm'
         */
        task_unlock(p);
-@@ -160,8 +167,8 @@ unsigned long badness(struct task_struct
+@@ -163,8 +170,8 @@ unsigned long badness(struct task_struct
        }
  
  #ifdef DEBUG
@@ -27191,7 +26416,7 @@ diff -NurpP --minimal linux-2.6.31/mm/oom_kill.c linux-2.6.31-vs2.3.0.36.14-pre8
  #endif
        return points;
  }
-@@ -330,8 +337,8 @@ static void __oom_kill_task(struct task_
+@@ -325,8 +332,8 @@ static void __oom_kill_task(struct task_
        }
  
        if (verbose)
@@ -27202,7 +26427,7 @@ diff -NurpP --minimal linux-2.6.31/mm/oom_kill.c linux-2.6.31-vs2.3.0.36.14-pre8
  
        /*
         * We give our sacrificial lamb high priority and access to
-@@ -415,8 +422,8 @@ static int oom_kill_process(struct task_
+@@ -406,8 +413,8 @@ static int oom_kill_process(struct task_
                return 0;
        }
  
@@ -27213,19 +26438,19 @@ diff -NurpP --minimal linux-2.6.31/mm/oom_kill.c linux-2.6.31-vs2.3.0.36.14-pre8
  
        /* Try to kill a child first */
        list_for_each_entry(c, &p->children, sibling) {
-diff -NurpP --minimal linux-2.6.31/mm/page_alloc.c linux-2.6.31-vs2.3.0.36.14-pre8/mm/page_alloc.c
---- linux-2.6.31/mm/page_alloc.c       2009-09-10 15:26:28.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/mm/page_alloc.c    2009-09-10 16:26:46.000000000 +0200
-@@ -48,6 +48,8 @@
- #include <linux/page_cgroup.h>
+diff -NurpP --minimal linux-2.6.27.33/mm/page_alloc.c linux-2.6.27.33-vs2.3.0.36.6/mm/page_alloc.c
+--- linux-2.6.27.33/mm/page_alloc.c    2009-09-13 16:17:01.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/mm/page_alloc.c       2009-08-17 19:07:36.000000000 +0200
+@@ -46,6 +46,8 @@
+ #include <linux/page-isolation.h>
+ #include <linux/memcontrol.h>
  #include <linux/debugobjects.h>
- #include <linux/kmemleak.h>
 +#include <linux/vs_base.h>
 +#include <linux/vs_limit.h>
  
  #include <asm/tlbflush.h>
  #include <asm/div64.h>
-@@ -2078,6 +2080,9 @@ void si_meminfo(struct sysinfo *val)
+@@ -1828,6 +1830,9 @@ void si_meminfo(struct sysinfo *val)
        val->totalhigh = totalhigh_pages;
        val->freehigh = nr_free_highpages();
        val->mem_unit = PAGE_SIZE;
@@ -27235,7 +26460,7 @@ diff -NurpP --minimal linux-2.6.31/mm/page_alloc.c linux-2.6.31-vs2.3.0.36.14-pr
  }
  
  EXPORT_SYMBOL(si_meminfo);
-@@ -2098,6 +2103,9 @@ void si_meminfo_node(struct sysinfo *val
+@@ -1848,6 +1853,9 @@ void si_meminfo_node(struct sysinfo *val
        val->freehigh = 0;
  #endif
        val->mem_unit = PAGE_SIZE;
@@ -27245,21 +26470,29 @@ diff -NurpP --minimal linux-2.6.31/mm/page_alloc.c linux-2.6.31-vs2.3.0.36.14-pr
  }
  #endif
  
-diff -NurpP --minimal linux-2.6.31/mm/rmap.c linux-2.6.31-vs2.3.0.36.14-pre8/mm/rmap.c
---- linux-2.6.31/mm/rmap.c     2009-09-10 15:26:28.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/mm/rmap.c  2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/mm/rmap.c linux-2.6.27.33-vs2.3.0.36.6/mm/rmap.c
+--- linux-2.6.27.33/mm/rmap.c  2009-09-13 16:17:01.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/mm/rmap.c     2009-02-03 17:59:04.000000000 +0100
 @@ -50,6 +50,7 @@
+ #include <linux/kallsyms.h>
  #include <linux/memcontrol.h>
  #include <linux/mmu_notifier.h>
- #include <linux/migrate.h>
 +#include <linux/vs_memory.h>
  
  #include <asm/tlbflush.h>
  
-diff -NurpP --minimal linux-2.6.31/mm/shmem.c linux-2.6.31-vs2.3.0.36.14-pre8/mm/shmem.c
---- linux-2.6.31/mm/shmem.c    2009-09-10 15:26:28.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/mm/shmem.c 2009-09-10 16:11:43.000000000 +0200
-@@ -1777,7 +1777,7 @@ static int shmem_statfs(struct dentry *d
+diff -NurpP --minimal linux-2.6.27.33/mm/shmem.c linux-2.6.27.33-vs2.3.0.36.6/mm/shmem.c
+--- linux-2.6.27.33/mm/shmem.c 2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/mm/shmem.c    2008-10-13 14:54:20.000000000 +0200
+@@ -56,7 +56,6 @@
+ #include <asm/pgtable.h>
+ /* This magic number is used in glibc for posix shared memory */
+-#define TMPFS_MAGIC   0x01021994
+ #define ENTRIES_PER_PAGE (PAGE_CACHE_SIZE/sizeof(unsigned long))
+ #define ENTRIES_PER_PAGEPAGE (ENTRIES_PER_PAGE*ENTRIES_PER_PAGE)
+@@ -1738,7 +1737,7 @@ static int shmem_statfs(struct dentry *d
  {
        struct shmem_sb_info *sbinfo = SHMEM_SB(dentry->d_sb);
  
@@ -27268,7 +26501,7 @@ diff -NurpP --minimal linux-2.6.31/mm/shmem.c linux-2.6.31-vs2.3.0.36.14-pre8/mm
        buf->f_bsize = PAGE_CACHE_SIZE;
        buf->f_namelen = NAME_MAX;
        spin_lock(&sbinfo->stat_lock);
-@@ -2346,7 +2346,7 @@ static int shmem_fill_super(struct super
+@@ -2306,7 +2305,7 @@ static int shmem_fill_super(struct super
        sb->s_maxbytes = SHMEM_MAX_BYTES;
        sb->s_blocksize = PAGE_CACHE_SIZE;
        sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
@@ -27277,10 +26510,10 @@ diff -NurpP --minimal linux-2.6.31/mm/shmem.c linux-2.6.31-vs2.3.0.36.14-pre8/mm
        sb->s_op = &shmem_ops;
        sb->s_time_gran = 1;
  #ifdef CONFIG_TMPFS_POSIX_ACL
-diff -NurpP --minimal linux-2.6.31/mm/slab.c linux-2.6.31-vs2.3.0.36.14-pre8/mm/slab.c
---- linux-2.6.31/mm/slab.c     2009-09-10 15:26:28.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/mm/slab.c  2009-09-10 16:11:43.000000000 +0200
-@@ -431,6 +431,8 @@ static void kmem_list3_init(struct kmem_
+diff -NurpP --minimal linux-2.6.27.33/mm/slab.c linux-2.6.27.33-vs2.3.0.36.6/mm/slab.c
+--- linux-2.6.27.33/mm/slab.c  2009-09-13 16:17:01.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/mm/slab.c     2009-08-01 01:45:51.000000000 +0200
+@@ -508,6 +508,8 @@ struct kmem_cache {
  #define STATS_INC_FREEMISS(x) do { } while (0)
  #endif
  
@@ -27289,7 +26522,7 @@ diff -NurpP --minimal linux-2.6.31/mm/slab.c linux-2.6.31-vs2.3.0.36.14-pre8/mm/
  #if DEBUG
  
  /*
-@@ -3253,6 +3255,7 @@ retry:
+@@ -3337,6 +3339,7 @@ retry:
  
        obj = slab_get_obj(cachep, slabp, nodeid);
        check_slabp(cachep, slabp);
@@ -27297,25 +26530,25 @@ diff -NurpP --minimal linux-2.6.31/mm/slab.c linux-2.6.31-vs2.3.0.36.14-pre8/mm/
        l3->free_objects--;
        /* move slabp to correct slabp list: */
        list_del(&slabp->list);
-@@ -3329,6 +3332,7 @@ __cache_alloc_node(struct kmem_cache *ca
+@@ -3409,6 +3412,7 @@ __cache_alloc_node(struct kmem_cache *ca
        /* ___cache_alloc_node can fall back to other nodes */
        ptr = ____cache_alloc_node(cachep, flags, nodeid);
    out:
 +      vx_slab_alloc(cachep, flags);
        local_irq_restore(save_flags);
        ptr = cache_alloc_debugcheck_after(cachep, flags, ptr, caller);
-       kmemleak_alloc_recursive(ptr, obj_size(cachep), 1, cachep->flags,
-@@ -3515,6 +3519,7 @@ static inline void __cache_free(struct k
+@@ -3580,6 +3584,7 @@ static inline void __cache_free(struct k
        check_irq_off();
-       kmemleak_free_recursive(objp, cachep->flags);
        objp = cache_free_debugcheck(cachep, objp, __builtin_return_address(0));
 +      vx_slab_free(cachep);
  
-       kmemcheck_slab_free(cachep, objp, obj_size(cachep));
-diff -NurpP --minimal linux-2.6.31/mm/slab_vs.h linux-2.6.31-vs2.3.0.36.14-pre8/mm/slab_vs.h
---- linux-2.6.31/mm/slab_vs.h  1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/mm/slab_vs.h       2009-09-10 16:11:43.000000000 +0200
+       /*
+        * Skip calling cache_free_alien() when the platform is not numa.
+diff -NurpP --minimal linux-2.6.27.33/mm/slab_vs.h linux-2.6.27.33-vs2.3.0.36.6/mm/slab_vs.h
+--- linux-2.6.27.33/mm/slab_vs.h       1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27.33-vs2.3.0.36.6/mm/slab_vs.h  2008-10-13 14:54:20.000000000 +0200
 @@ -0,0 +1,27 @@
 +
 +#include <linux/vserver/context.h>
@@ -27344,19 +26577,19 @@ diff -NurpP --minimal linux-2.6.31/mm/slab_vs.h linux-2.6.31-vs2.3.0.36.14-pre8/
 +      atomic_sub(cachep->buffer_size, &current->vx_info->cacct.slab[what]);
 +}
 +
-diff -NurpP --minimal linux-2.6.31/mm/swapfile.c linux-2.6.31-vs2.3.0.36.14-pre8/mm/swapfile.c
---- linux-2.6.31/mm/swapfile.c 2009-09-10 15:26:28.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/mm/swapfile.c      2009-09-10 16:11:43.000000000 +0200
-@@ -34,6 +34,8 @@
+diff -NurpP --minimal linux-2.6.27.33/mm/swapfile.c linux-2.6.27.33-vs2.3.0.36.6/mm/swapfile.c
+--- linux-2.6.27.33/mm/swapfile.c      2009-09-13 16:17:01.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/mm/swapfile.c 2009-02-03 17:59:04.000000000 +0100
+@@ -32,6 +32,8 @@
+ #include <asm/pgtable.h>
  #include <asm/tlbflush.h>
  #include <linux/swapops.h>
- #include <linux/page_cgroup.h>
 +#include <linux/vs_base.h>
 +#include <linux/vs_memory.h>
  
  static DEFINE_SPINLOCK(swap_lock);
  static unsigned int nr_swapfiles;
-@@ -2061,6 +2063,8 @@ void si_swapinfo(struct sysinfo *val)
+@@ -1748,6 +1750,8 @@ void si_swapinfo(struct sysinfo *val)
        val->freeswap = nr_swap_pages + nr_to_be_unused;
        val->totalswap = total_swap_pages + nr_to_be_unused;
        spin_unlock(&swap_lock);
@@ -27365,18 +26598,38 @@ diff -NurpP --minimal linux-2.6.31/mm/swapfile.c linux-2.6.31-vs2.3.0.36.14-pre8
  }
  
  /*
-diff -NurpP --minimal linux-2.6.31/net/core/dev.c linux-2.6.31-vs2.3.0.36.14-pre8/net/core/dev.c
---- linux-2.6.31/net/core/dev.c        2009-09-10 15:26:29.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/core/dev.c     2009-09-10 17:16:15.000000000 +0200
-@@ -126,6 +126,7 @@
+diff -NurpP --minimal linux-2.6.27.33/net/core/dev.c linux-2.6.27.33-vs2.3.0.36.6/net/core/dev.c
+--- linux-2.6.27.33/net/core/dev.c     2009-09-13 16:17:01.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/core/dev.c        2009-02-22 22:58:33.000000000 +0100
+@@ -127,6 +127,7 @@
  #include <linux/in.h>
  #include <linux/jhash.h>
  #include <linux/random.h>
 +#include <linux/vs_inet.h>
- #include <trace/events/napi.h>
  
  #include "net-sysfs.h"
-@@ -2941,6 +2942,8 @@ static int dev_ifconf(struct net *net, c
+@@ -925,10 +926,15 @@ int dev_change_name(struct net_device *d
+               strlcpy(dev->name, newname, IFNAMSIZ);
+ rollback:
+-      err = device_rename(&dev->dev, dev->name);
+-      if (err) {
+-              memcpy(dev->name, oldname, IFNAMSIZ);
+-              return err;
++      /* For now only devices in the initial network namespace
++       * are in sysfs.
++       */
++      if (net == &init_net) {
++              ret = device_rename(&dev->dev, dev->name);
++              if (ret) {
++                      memcpy(dev->name, oldname, IFNAMSIZ);
++                      return ret;
++              }
+       }
+       write_lock_bh(&dev_base_lock);
+@@ -2518,6 +2524,8 @@ static int dev_ifconf(struct net *net, c
  
        total = 0;
        for_each_netdev(net, dev) {
@@ -27385,9 +26638,9 @@ diff -NurpP --minimal linux-2.6.31/net/core/dev.c linux-2.6.31-vs2.3.0.36.14-pre
                for (i = 0; i < NPROTO; i++) {
                        if (gifconf_list[i]) {
                                int done;
-@@ -3009,6 +3012,9 @@ static void dev_seq_printf_stats(struct 
+@@ -2586,6 +2594,9 @@ static void dev_seq_printf_stats(struct 
  {
-       const struct net_device_stats *stats = dev_get_stats(dev);
+       struct net_device_stats *stats = dev->get_stats(dev);
  
 +      if (!nx_dev_visible(current->nx_info, dev))
 +              return;
@@ -27395,9 +26648,9 @@ diff -NurpP --minimal linux-2.6.31/net/core/dev.c linux-2.6.31-vs2.3.0.36.14-pre
        seq_printf(seq, "%6s:%8lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu "
                   "%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n",
                   dev->name, stats->rx_bytes, stats->rx_packets,
-@@ -5257,6 +5263,15 @@ int dev_change_net_namespace(struct net_
+@@ -4388,6 +4399,15 @@ int dev_change_net_namespace(struct net_
+       if (dev->features & NETIF_F_NETNS_LOCAL)
                goto out;
- #endif
  
 +#ifdef CONFIG_SYSFS
 +      /* Don't allow real devices to be moved when sysfs
@@ -27411,21 +26664,40 @@ diff -NurpP --minimal linux-2.6.31/net/core/dev.c linux-2.6.31-vs2.3.0.36.14-pre
        /* Ensure the device has been registrered */
        err = -EINVAL;
        if (dev->reg_state != NETREG_REGISTERED)
-@@ -5317,6 +5332,8 @@ int dev_change_net_namespace(struct net_
-       netdev_unregister_kobject(dev);
+@@ -4445,6 +4465,8 @@ int dev_change_net_namespace(struct net_
+        */
+       dev_addr_discard(dev);
  
 +      netdev_unregister_kobject(dev);
 +
        /* Actually switch the network namespace */
        dev_net_set(dev, net);
  
-diff -NurpP --minimal linux-2.6.31/net/core/net-sysfs.c linux-2.6.31-vs2.3.0.36.14-pre8/net/core/net-sysfs.c
---- linux-2.6.31/net/core/net-sysfs.c  2009-09-10 15:26:29.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/core/net-sysfs.c       2009-09-10 16:11:43.000000000 +0200
-@@ -513,6 +513,9 @@ int netdev_register_kobject(struct net_d
-       if (dev_net(net) != &init_net)
-               return 0;
+@@ -4461,7 +4483,6 @@ int dev_change_net_namespace(struct net_
+       }
+       /* Fixup kobjects */
+-      netdev_unregister_kobject(dev);
+       err = netdev_register_kobject(dev);
+       WARN_ON(err);
+diff -NurpP --minimal linux-2.6.27.33/net/core/net-sysfs.c linux-2.6.27.33-vs2.3.0.36.6/net/core/net-sysfs.c
+--- linux-2.6.27.33/net/core/net-sysfs.c       2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/core/net-sysfs.c  2008-11-20 15:21:32.000000000 +0100
+@@ -440,6 +440,10 @@ void netdev_unregister_kobject(struct ne
+       struct device *dev = &(net->dev);
+       kobject_get(&dev->kobj);
++
++      if (dev_net(net) != &init_net)
++              return;
++
+       device_del(dev);
+ }
+@@ -465,6 +469,9 @@ int netdev_register_kobject(struct net_d
+ #endif
+ #endif /* CONFIG_SYSFS */
  
 +      if (dev_net(net) != &init_net)
 +              return 0;
@@ -27433,10 +26705,10 @@ diff -NurpP --minimal linux-2.6.31/net/core/net-sysfs.c linux-2.6.31-vs2.3.0.36.
        return device_add(dev);
  }
  
-diff -NurpP --minimal linux-2.6.31/net/core/rtnetlink.c linux-2.6.31-vs2.3.0.36.14-pre8/net/core/rtnetlink.c
---- linux-2.6.31/net/core/rtnetlink.c  2009-06-11 17:13:29.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/core/rtnetlink.c       2009-09-10 16:11:43.000000000 +0200
-@@ -690,6 +690,8 @@ static int rtnl_dump_ifinfo(struct sk_bu
+diff -NurpP --minimal linux-2.6.27.33/net/core/rtnetlink.c linux-2.6.27.33-vs2.3.0.36.6/net/core/rtnetlink.c
+--- linux-2.6.27.33/net/core/rtnetlink.c       2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/core/rtnetlink.c  2008-10-13 14:54:20.000000000 +0200
+@@ -686,6 +686,8 @@ static int rtnl_dump_ifinfo(struct sk_bu
  
        idx = 0;
        for_each_netdev(net, dev) {
@@ -27445,7 +26717,7 @@ diff -NurpP --minimal linux-2.6.31/net/core/rtnetlink.c linux-2.6.31-vs2.3.0.36.
                if (idx < s_idx)
                        goto cont;
                if (rtnl_fill_ifinfo(skb, dev, RTM_NEWLINK,
-@@ -1235,6 +1237,9 @@ void rtmsg_ifinfo(int type, struct net_d
+@@ -1219,6 +1221,9 @@ void rtmsg_ifinfo(int type, struct net_d
        struct sk_buff *skb;
        int err = -ENOBUFS;
  
@@ -27455,10 +26727,10 @@ diff -NurpP --minimal linux-2.6.31/net/core/rtnetlink.c linux-2.6.31-vs2.3.0.36.
        skb = nlmsg_new(if_nlmsg_size(dev), GFP_KERNEL);
        if (skb == NULL)
                goto errout;
-diff -NurpP --minimal linux-2.6.31/net/core/sock.c linux-2.6.31-vs2.3.0.36.14-pre8/net/core/sock.c
---- linux-2.6.31/net/core/sock.c       2009-09-10 15:26:29.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/core/sock.c    2009-09-10 16:11:43.000000000 +0200
-@@ -125,6 +125,10 @@
+diff -NurpP --minimal linux-2.6.27.33/net/core/sock.c linux-2.6.27.33-vs2.3.0.36.6/net/core/sock.c
+--- linux-2.6.27.33/net/core/sock.c    2009-09-13 16:17:01.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/core/sock.c       2009-03-25 14:32:29.000000000 +0100
+@@ -124,6 +124,10 @@
  #include <linux/ipsec.h>
  
  #include <linux/filter.h>
@@ -27469,7 +26741,7 @@ diff -NurpP --minimal linux-2.6.31/net/core/sock.c linux-2.6.31-vs2.3.0.36.14-pr
  
  #ifdef CONFIG_INET
  #include <net/tcp.h>
-@@ -974,6 +978,8 @@ static struct sock *sk_prot_alloc(struct
+@@ -899,6 +903,8 @@ static struct sock *sk_prot_alloc(struct
                if (!try_module_get(prot->owner))
                        goto out_free_sec;
        }
@@ -27478,7 +26750,7 @@ diff -NurpP --minimal linux-2.6.31/net/core/sock.c linux-2.6.31-vs2.3.0.36.14-pr
  
        return sk;
  
-@@ -1053,6 +1059,11 @@ static void __sk_free(struct sock *sk)
+@@ -975,6 +981,11 @@ void sk_free(struct sock *sk)
                       __func__, atomic_read(&sk->sk_omem_alloc));
  
        put_net(sock_net(sk));
@@ -27490,7 +26762,7 @@ diff -NurpP --minimal linux-2.6.31/net/core/sock.c linux-2.6.31-vs2.3.0.36.14-pr
        sk_prot_free(sk->sk_prot_creator, sk);
  }
  
-@@ -1100,6 +1111,8 @@ struct sock *sk_clone(const struct sock 
+@@ -1010,6 +1021,8 @@ struct sock *sk_clone(const struct sock 
  
                /* SANITY */
                get_net(sock_net(newsk));
@@ -27499,8 +26771,8 @@ diff -NurpP --minimal linux-2.6.31/net/core/sock.c linux-2.6.31-vs2.3.0.36.14-pr
                sk_node_init(&newsk->sk_node);
                sock_lock_init(newsk);
                bh_lock_sock(newsk);
-@@ -1154,6 +1167,12 @@ struct sock *sk_clone(const struct sock 
-               smp_wmb();
+@@ -1056,6 +1069,12 @@ struct sock *sk_clone(const struct sock 
+               newsk->sk_priority = 0;
                atomic_set(&newsk->sk_refcnt, 2);
  
 +              set_vx_info(&newsk->sk_vx_info, sk->sk_vx_info);
@@ -27512,7 +26784,7 @@ diff -NurpP --minimal linux-2.6.31/net/core/sock.c linux-2.6.31-vs2.3.0.36.14-pr
                /*
                 * Increment the counter in the same struct proto as the master
                 * sock (sk_refcnt_debug_inc uses newsk->sk_prot->socks, that
-@@ -1867,6 +1886,12 @@ void sock_init_data(struct socket *sock,
+@@ -1739,6 +1758,11 @@ void sock_init_data(struct socket *sock,
  
        sk->sk_stamp = ktime_set(-1L, 0);
  
@@ -27521,22 +26793,21 @@ diff -NurpP --minimal linux-2.6.31/net/core/sock.c linux-2.6.31-vs2.3.0.36.14-pr
 +      vx_sock_inc(sk);
 +      set_nx_info(&sk->sk_nx_info, current->nx_info);
 +      sk->sk_nid = nx_current_nid();
-+
-       /*
-        * Before updating sk_refcnt, we must commit prior changes to memory
-        * (Documentation/RCU/rculist_nulls.txt for details)
-diff -NurpP --minimal linux-2.6.31/net/ipv4/af_inet.c linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv4/af_inet.c
---- linux-2.6.31/net/ipv4/af_inet.c    2009-09-10 15:26:29.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv4/af_inet.c 2009-09-10 16:11:43.000000000 +0200
-@@ -115,6 +115,7 @@
+       atomic_set(&sk->sk_refcnt, 1);
+       atomic_set(&sk->sk_drops, 0);
+ }
+diff -NurpP --minimal linux-2.6.27.33/net/ipv4/af_inet.c linux-2.6.27.33-vs2.3.0.36.6/net/ipv4/af_inet.c
+--- linux-2.6.27.33/net/ipv4/af_inet.c 2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/ipv4/af_inet.c    2008-10-13 14:54:20.000000000 +0200
+@@ -114,6 +114,7 @@
  #ifdef CONFIG_IP_MROUTE
  #include <linux/mroute.h>
  #endif
 +#include <linux/vs_limit.h>
  
+ extern void ip_mc_drop_socket(struct sock *sk);
  
- /* The inetsw table contains everything that inet_create needs to
-@@ -324,9 +325,12 @@ lookup_protocol:
+@@ -325,9 +326,12 @@ lookup_protocol:
        }
  
        err = -EPERM;
@@ -27550,7 +26821,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/af_inet.c linux-2.6.31-vs2.3.0.36.14
        err = -EAFNOSUPPORT;
        if (!inet_netns_ok(net, protocol))
                goto out_rcu_unlock;
-@@ -444,6 +448,7 @@ int inet_bind(struct socket *sock, struc
+@@ -445,6 +449,7 @@ int inet_bind(struct socket *sock, struc
        struct sockaddr_in *addr = (struct sockaddr_in *)uaddr;
        struct sock *sk = sock->sk;
        struct inet_sock *inet = inet_sk(sk);
@@ -27558,7 +26829,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/af_inet.c linux-2.6.31-vs2.3.0.36.14
        unsigned short snum;
        int chk_addr_ret;
        int err;
-@@ -457,7 +462,11 @@ int inet_bind(struct socket *sock, struc
+@@ -458,7 +463,11 @@ int inet_bind(struct socket *sock, struc
        if (addr_len < sizeof(struct sockaddr_in))
                goto out;
  
@@ -27571,16 +26842,16 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/af_inet.c linux-2.6.31-vs2.3.0.36.14
  
        /* Not specified by any standard per-se, however it breaks too
         * many applications when removed.  It is unfortunate since
-@@ -469,7 +478,7 @@ int inet_bind(struct socket *sock, struc
+@@ -470,7 +479,7 @@ int inet_bind(struct socket *sock, struc
        err = -EADDRNOTAVAIL;
        if (!sysctl_ip_nonlocal_bind &&
-           !(inet->freebind || inet->transparent) &&
+           !inet->freebind &&
 -          addr->sin_addr.s_addr != htonl(INADDR_ANY) &&
 +          nsa.saddr != htonl(INADDR_ANY) &&
            chk_addr_ret != RTN_LOCAL &&
            chk_addr_ret != RTN_MULTICAST &&
            chk_addr_ret != RTN_BROADCAST)
-@@ -494,7 +503,7 @@ int inet_bind(struct socket *sock, struc
+@@ -495,7 +504,7 @@ int inet_bind(struct socket *sock, struc
        if (sk->sk_state != TCP_CLOSE || inet->num)
                goto out_release_sock;
  
@@ -27589,7 +26860,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/af_inet.c linux-2.6.31-vs2.3.0.36.14
        if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST)
                inet->saddr = 0;  /* Use device */
  
-@@ -687,11 +696,13 @@ int inet_getname(struct socket *sock, st
+@@ -688,11 +697,13 @@ int inet_getname(struct socket *sock, st
                     peer == 1))
                        return -ENOTCONN;
                sin->sin_port = inet->dport;
@@ -27604,10 +26875,10 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/af_inet.c linux-2.6.31-vs2.3.0.36.14
                sin->sin_port = inet->sport;
                sin->sin_addr.s_addr = addr;
        }
-diff -NurpP --minimal linux-2.6.31/net/ipv4/devinet.c linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv4/devinet.c
---- linux-2.6.31/net/ipv4/devinet.c    2009-09-10 15:26:29.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv4/devinet.c 2009-09-10 16:11:43.000000000 +0200
-@@ -413,6 +413,7 @@ struct in_device *inetdev_by_index(struc
+diff -NurpP --minimal linux-2.6.27.33/net/ipv4/devinet.c linux-2.6.27.33-vs2.3.0.36.6/net/ipv4/devinet.c
+--- linux-2.6.27.33/net/ipv4/devinet.c 2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/ipv4/devinet.c    2008-10-13 14:54:20.000000000 +0200
+@@ -420,6 +420,7 @@ struct in_device *inetdev_by_index(struc
        return in_dev;
  }
  
@@ -27615,7 +26886,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/devinet.c linux-2.6.31-vs2.3.0.36.14
  /* Called only from RTNL semaphored context. No locks. */
  
  struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix,
-@@ -653,6 +654,8 @@ int devinet_ioctl(struct net *net, unsig
+@@ -662,6 +663,8 @@ int devinet_ioctl(struct net *net, unsig
                *colon = ':';
  
        if ((in_dev = __in_dev_get_rtnl(dev)) != NULL) {
@@ -27624,7 +26895,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/devinet.c linux-2.6.31-vs2.3.0.36.14
                if (tryaddrmatch) {
                        /* Matthias Andree */
                        /* compare label and address (4.4BSD style) */
-@@ -661,6 +664,8 @@ int devinet_ioctl(struct net *net, unsig
+@@ -670,6 +673,8 @@ int devinet_ioctl(struct net *net, unsig
                           This is checked above. */
                        for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL;
                             ifap = &ifa->ifa_next) {
@@ -27633,7 +26904,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/devinet.c linux-2.6.31-vs2.3.0.36.14
                                if (!strcmp(ifr.ifr_name, ifa->ifa_label) &&
                                    sin_orig.sin_addr.s_addr ==
                                                        ifa->ifa_address) {
-@@ -673,9 +678,12 @@ int devinet_ioctl(struct net *net, unsig
+@@ -682,9 +687,12 @@ int devinet_ioctl(struct net *net, unsig
                   comparing just the label */
                if (!ifa) {
                        for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL;
@@ -27647,7 +26918,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/devinet.c linux-2.6.31-vs2.3.0.36.14
                }
        }
  
-@@ -826,6 +834,8 @@ static int inet_gifconf(struct net_devic
+@@ -835,6 +843,8 @@ static int inet_gifconf(struct net_devic
                goto out;
  
        for (; ifa; ifa = ifa->ifa_next) {
@@ -27656,7 +26927,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/devinet.c linux-2.6.31-vs2.3.0.36.14
                if (!buf) {
                        done += sizeof(ifr);
                        continue;
-@@ -1164,6 +1174,7 @@ static int inet_dump_ifaddr(struct sk_bu
+@@ -1165,6 +1175,7 @@ static int inet_dump_ifaddr(struct sk_bu
        struct net_device *dev;
        struct in_device *in_dev;
        struct in_ifaddr *ifa;
@@ -27664,7 +26935,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/devinet.c linux-2.6.31-vs2.3.0.36.14
        int s_ip_idx, s_idx = cb->args[0];
  
        s_ip_idx = ip_idx = cb->args[1];
-@@ -1178,6 +1189,8 @@ static int inet_dump_ifaddr(struct sk_bu
+@@ -1179,6 +1190,8 @@ static int inet_dump_ifaddr(struct sk_bu
  
                for (ifa = in_dev->ifa_list, ip_idx = 0; ifa;
                     ifa = ifa->ifa_next, ip_idx++) {
@@ -27673,10 +26944,10 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/devinet.c linux-2.6.31-vs2.3.0.36.14
                        if (ip_idx < s_ip_idx)
                                continue;
                        if (inet_fill_ifaddr(skb, ifa, NETLINK_CB(cb->skb).pid,
-diff -NurpP --minimal linux-2.6.31/net/ipv4/fib_hash.c linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv4/fib_hash.c
---- linux-2.6.31/net/ipv4/fib_hash.c   2009-09-10 15:26:29.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv4/fib_hash.c        2009-09-10 16:11:43.000000000 +0200
-@@ -1021,7 +1021,7 @@ static int fib_seq_show(struct seq_file 
+diff -NurpP --minimal linux-2.6.27.33/net/ipv4/fib_hash.c linux-2.6.27.33-vs2.3.0.36.6/net/ipv4/fib_hash.c
+--- linux-2.6.27.33/net/ipv4/fib_hash.c        2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/ipv4/fib_hash.c   2008-10-13 14:54:20.000000000 +0200
+@@ -1022,7 +1022,7 @@ static int fib_seq_show(struct seq_file 
        prefix  = f->fn_key;
        mask    = FZ_MASK(iter->zone);
        flags   = fib_flag_trans(fa->fa_type, mask, fi);
@@ -27685,10 +26956,10 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/fib_hash.c linux-2.6.31-vs2.3.0.36.1
                seq_printf(seq,
                         "%s\t%08X\t%08X\t%04X\t%d\t%u\t%d\t%08X\t%d\t%u\t%u%n",
                         fi->fib_dev ? fi->fib_dev->name : "*", prefix,
-diff -NurpP --minimal linux-2.6.31/net/ipv4/inet_connection_sock.c linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv4/inet_connection_sock.c
---- linux-2.6.31/net/ipv4/inet_connection_sock.c       2009-06-11 17:13:29.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv4/inet_connection_sock.c    2009-09-10 16:11:43.000000000 +0200
-@@ -49,10 +49,40 @@ void inet_get_local_port_range(int *low,
+diff -NurpP --minimal linux-2.6.27.33/net/ipv4/inet_connection_sock.c linux-2.6.27.33-vs2.3.0.36.6/net/ipv4/inet_connection_sock.c
+--- linux-2.6.27.33/net/ipv4/inet_connection_sock.c    2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/ipv4/inet_connection_sock.c       2008-10-13 14:54:20.000000000 +0200
+@@ -47,10 +47,40 @@ void inet_get_local_port_range(int *low,
  }
  EXPORT_SYMBOL(inet_get_local_port_range);
  
@@ -27730,7 +27001,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/inet_connection_sock.c linux-2.6.31-
        struct sock *sk2;
        struct hlist_node *node;
        int reuse = sk->sk_reuse;
-@@ -72,9 +102,7 @@ int inet_csk_bind_conflict(const struct 
+@@ -70,9 +100,7 @@ int inet_csk_bind_conflict(const struct 
                     sk->sk_bound_dev_if == sk2->sk_bound_dev_if)) {
                        if (!reuse || !sk2->sk_reuse ||
                            sk2->sk_state == TCP_LISTEN) {
@@ -27741,9 +27012,9 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/inet_connection_sock.c linux-2.6.31-
                                        break;
                        }
                }
-diff -NurpP --minimal linux-2.6.31/net/ipv4/inet_diag.c linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv4/inet_diag.c
---- linux-2.6.31/net/ipv4/inet_diag.c  2009-09-10 15:26:29.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv4/inet_diag.c       2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/net/ipv4/inet_diag.c linux-2.6.27.33-vs2.3.0.36.6/net/ipv4/inet_diag.c
+--- linux-2.6.27.33/net/ipv4/inet_diag.c       2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/ipv4/inet_diag.c  2008-10-13 14:54:20.000000000 +0200
 @@ -32,6 +32,8 @@
  #include <linux/stddef.h>
  
@@ -27753,7 +27024,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/inet_diag.c linux-2.6.31-vs2.3.0.36.
  
  static const struct inet_diag_handler **inet_diag_table;
  
-@@ -118,8 +120,8 @@ static int inet_csk_diag_fill(struct soc
+@@ -120,8 +122,8 @@ static int inet_csk_diag_fill(struct soc
  
        r->id.idiag_sport = inet->sport;
        r->id.idiag_dport = inet->dport;
@@ -27764,7 +27035,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/inet_diag.c linux-2.6.31-vs2.3.0.36.
  
  #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
        if (r->idiag_family == AF_INET6) {
-@@ -204,8 +206,8 @@ static int inet_twsk_diag_fill(struct in
+@@ -208,8 +210,8 @@ static int inet_twsk_diag_fill(struct in
        r->id.idiag_cookie[1] = (u32)(((unsigned long)tw >> 31) >> 1);
        r->id.idiag_sport     = tw->tw_sport;
        r->id.idiag_dport     = tw->tw_dport;
@@ -27775,7 +27046,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/inet_diag.c linux-2.6.31-vs2.3.0.36.
        r->idiag_state        = tw->tw_substate;
        r->idiag_timer        = 3;
        r->idiag_expires      = DIV_ROUND_UP(tmo * 1000, HZ);
-@@ -262,6 +264,7 @@ static int inet_diag_get_exact(struct sk
+@@ -266,6 +268,7 @@ static int inet_diag_get_exact(struct sk
        err = -EINVAL;
  
        if (req->idiag_family == AF_INET) {
@@ -27783,7 +27054,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/inet_diag.c linux-2.6.31-vs2.3.0.36.
                sk = inet_lookup(&init_net, hashinfo, req->id.idiag_dst[0],
                                 req->id.idiag_dport, req->id.idiag_src[0],
                                 req->id.idiag_sport, req->id.idiag_if);
-@@ -504,6 +507,7 @@ static int inet_csk_diag_dump(struct soc
+@@ -508,6 +511,7 @@ static int inet_csk_diag_dump(struct soc
                } else
  #endif
                {
@@ -27791,7 +27062,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/inet_diag.c linux-2.6.31-vs2.3.0.36.
                        entry.saddr = &inet->rcv_saddr;
                        entry.daddr = &inet->daddr;
                }
-@@ -540,6 +544,7 @@ static int inet_twsk_diag_dump(struct in
+@@ -544,6 +548,7 @@ static int inet_twsk_diag_dump(struct in
                } else
  #endif
                {
@@ -27799,7 +27070,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/inet_diag.c linux-2.6.31-vs2.3.0.36.
                        entry.saddr = &tw->tw_rcv_saddr;
                        entry.daddr = &tw->tw_daddr;
                }
-@@ -586,8 +591,8 @@ static int inet_diag_fill_req(struct sk_
+@@ -590,8 +595,8 @@ static int inet_diag_fill_req(struct sk_
  
        r->id.idiag_sport = inet->sport;
        r->id.idiag_dport = ireq->rmt_port;
@@ -27810,7 +27081,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/inet_diag.c linux-2.6.31-vs2.3.0.36.
        r->idiag_expires = jiffies_to_msecs(tmo);
        r->idiag_rqueue = 0;
        r->idiag_wqueue = 0;
-@@ -657,6 +662,7 @@ static int inet_diag_dump_reqs(struct sk
+@@ -661,6 +666,7 @@ static int inet_diag_dump_reqs(struct sk
                                continue;
  
                        if (bc) {
@@ -27818,8 +27089,8 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/inet_diag.c linux-2.6.31-vs2.3.0.36.
                                entry.saddr =
  #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
                                        (entry.family == AF_INET6) ?
-@@ -727,6 +733,8 @@ static int inet_diag_dump(struct sk_buff
-                       sk_nulls_for_each(sk, node, &ilb->head) {
+@@ -729,6 +735,8 @@ static int inet_diag_dump(struct sk_buff
+                       sk_for_each(sk, node, &hashinfo->listening_hash[i]) {
                                struct inet_sock *inet = inet_sk(sk);
  
 +                              if (!nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
@@ -27827,8 +27098,8 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/inet_diag.c linux-2.6.31-vs2.3.0.36.
                                if (num < s_num) {
                                        num++;
                                        continue;
-@@ -793,6 +801,8 @@ skip_listen_ht:
-               sk_nulls_for_each(sk, node, &head->chain) {
+@@ -790,6 +798,8 @@ skip_listen_ht:
+               sk_for_each(sk, node, &head->chain) {
                        struct inet_sock *inet = inet_sk(sk);
  
 +                      if (!nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
@@ -27836,7 +27107,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/inet_diag.c linux-2.6.31-vs2.3.0.36.
                        if (num < s_num)
                                goto next_normal;
                        if (!(r->idiag_states & (1 << sk->sk_state)))
-@@ -817,6 +827,8 @@ next_normal:
+@@ -814,6 +824,8 @@ next_normal:
                        inet_twsk_for_each(tw, node,
                                    &head->twchain) {
  
@@ -27845,9 +27116,9 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/inet_diag.c linux-2.6.31-vs2.3.0.36.
                                if (num < s_num)
                                        goto next_dying;
                                if (r->id.idiag_sport != tw->tw_sport &&
-diff -NurpP --minimal linux-2.6.31/net/ipv4/inet_hashtables.c linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv4/inet_hashtables.c
---- linux-2.6.31/net/ipv4/inet_hashtables.c    2009-06-11 17:13:29.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv4/inet_hashtables.c 2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/net/ipv4/inet_hashtables.c linux-2.6.27.33-vs2.3.0.36.6/net/ipv4/inet_hashtables.c
+--- linux-2.6.27.33/net/ipv4/inet_hashtables.c 2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/ipv4/inet_hashtables.c    2008-10-13 14:54:20.000000000 +0200
 @@ -21,6 +21,7 @@
  
  #include <net/inet_connection_sock.h>
@@ -27856,48 +27127,44 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/inet_hashtables.c linux-2.6.31-vs2.3
  #include <net/ip.h>
  
  /*
-@@ -134,6 +135,11 @@ static inline int compute_score(struct s
-                       if (rcv_saddr != daddr)
-                               return -1;
-                       score += 2;
-+              } else {
-+                      /* block non nx_info ips */
-+                      if (!v4_addr_in_nx_info(sk->sk_nx_info,
-+                              daddr, NXA_MASK_BIND))
-+                              return -1;
-               }
-               if (sk->sk_bound_dev_if) {
-                       if (sk->sk_bound_dev_if != dif)
-@@ -151,7 +157,6 @@ static inline int compute_score(struct s
-  * wildcarded during the search since they can never be otherwise.
-  */
--
- struct sock *__inet_lookup_listener(struct net *net,
-                                   struct inet_hashinfo *hashinfo,
-                                   const __be32 daddr, const unsigned short hnum,
-@@ -174,6 +179,7 @@ begin:
-                       hiscore = score;
-               }
-       }
-+
-       /*
-        * if the nulls value we got at the end of this lookup is
-        * not the expected one, we must restart lookup.
-diff -NurpP --minimal linux-2.6.31/net/ipv4/netfilter/nf_nat_helper.c linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv4/netfilter/nf_nat_helper.c
---- linux-2.6.31/net/ipv4/netfilter/nf_nat_helper.c    2009-09-10 15:26:29.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv4/netfilter/nf_nat_helper.c 2009-09-10 16:11:43.000000000 +0200
-@@ -19,6 +19,7 @@
- #include <net/route.h>
+@@ -163,11 +164,10 @@ static struct sock *inet_lookup_listener
+                       const __be32 rcv_saddr = inet->rcv_saddr;
+                       int score = sk->sk_family == PF_INET ? 1 : 0;
+-                      if (rcv_saddr) {
+-                              if (rcv_saddr != daddr)
+-                                      continue;
++                      if (v4_inet_addr_match(sk->sk_nx_info, daddr, rcv_saddr))
+                               score += 2;
+-                      }
++                      else
++                              continue;
+                       if (sk->sk_bound_dev_if) {
+                               if (sk->sk_bound_dev_if != dif)
+                                       continue;
+@@ -199,7 +199,7 @@ struct sock *__inet_lookup_listener(stru
+               const struct inet_sock *inet = inet_sk((sk = __sk_head(head)));
+               if (inet->num == hnum && !sk->sk_node.next &&
+-                  (!inet->rcv_saddr || inet->rcv_saddr == daddr) &&
++                  v4_inet_addr_match(sk->sk_nx_info, daddr, inet->rcv_saddr) &&
+                   (sk->sk_family == PF_INET || !ipv6_only_sock(sk)) &&
+                   !sk->sk_bound_dev_if && net_eq(sock_net(sk), net))
+                       goto sherry_cache;
+diff -NurpP --minimal linux-2.6.27.33/net/ipv4/netfilter/nf_nat_helper.c linux-2.6.27.33-vs2.3.0.36.6/net/ipv4/netfilter/nf_nat_helper.c
+--- linux-2.6.27.33/net/ipv4/netfilter/nf_nat_helper.c 2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/ipv4/netfilter/nf_nat_helper.c    2008-10-13 14:54:20.000000000 +0200
+@@ -18,6 +18,7 @@
+ #include <net/tcp.h>
  
  #include <linux/netfilter_ipv4.h>
 +#include <net/route.h>
  #include <net/netfilter/nf_conntrack.h>
  #include <net/netfilter/nf_conntrack_helper.h>
  #include <net/netfilter/nf_conntrack_ecache.h>
-diff -NurpP --minimal linux-2.6.31/net/ipv4/netfilter.c linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv4/netfilter.c
---- linux-2.6.31/net/ipv4/netfilter.c  2009-09-10 15:26:29.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv4/netfilter.c       2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/net/ipv4/netfilter.c linux-2.6.27.33-vs2.3.0.36.6/net/ipv4/netfilter.c
+--- linux-2.6.27.33/net/ipv4/netfilter.c       2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/ipv4/netfilter.c  2008-10-13 14:54:20.000000000 +0200
 @@ -4,7 +4,7 @@
  #include <linux/netfilter_ipv4.h>
  #include <linux/ip.h>
@@ -27907,9 +27174,9 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/netfilter.c linux-2.6.31-vs2.3.0.36.
  #include <net/xfrm.h>
  #include <net/ip.h>
  #include <net/netfilter/nf_queue.h>
-diff -NurpP --minimal linux-2.6.31/net/ipv4/raw.c linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv4/raw.c
---- linux-2.6.31/net/ipv4/raw.c        2009-09-10 15:26:29.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv4/raw.c     2009-09-10 17:17:12.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/net/ipv4/raw.c linux-2.6.27.33-vs2.3.0.36.6/net/ipv4/raw.c
+--- linux-2.6.27.33/net/ipv4/raw.c     2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/ipv4/raw.c        2008-10-13 14:54:20.000000000 +0200
 @@ -117,7 +117,7 @@ static struct sock *__raw_v4_lookup(stru
  
                if (net_eq(sock_net(sk), net) && inet->num == num       &&
@@ -27940,7 +27207,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/raw.c linux-2.6.31-vs2.3.0.36.14-pre
        kfree_skb(skb);
  error:
        IP_INC_STATS(net, IPSTATS_MIB_OUTDISCARDS);
-@@ -551,6 +558,13 @@ static int raw_sendmsg(struct kiocb *ioc
+@@ -550,6 +557,13 @@ static int raw_sendmsg(struct kiocb *ioc
                }
  
                security_sk_classify_flow(sk, &fl);
@@ -27954,7 +27221,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/raw.c linux-2.6.31-vs2.3.0.36.14-pre
                err = ip_route_output_flow(sock_net(sk), &rt, &fl, sk, 1);
        }
        if (err)
-@@ -620,17 +634,19 @@ static int raw_bind(struct sock *sk, str
+@@ -619,17 +633,19 @@ static int raw_bind(struct sock *sk, str
  {
        struct inet_sock *inet = inet_sk(sk);
        struct sockaddr_in *addr = (struct sockaddr_in *) uaddr;
@@ -27977,7 +27244,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/raw.c linux-2.6.31-vs2.3.0.36.14-pre
        if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST)
                inet->saddr = 0;  /* Use device */
        sk_dst_reset(sk);
-@@ -682,7 +698,8 @@ static int raw_recvmsg(struct kiocb *ioc
+@@ -681,7 +697,8 @@ static int raw_recvmsg(struct kiocb *ioc
        /* Copy the address. */
        if (sin) {
                sin->sin_family = AF_INET;
@@ -27987,7 +27254,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/raw.c linux-2.6.31-vs2.3.0.36.14-pre
                sin->sin_port = 0;
                memset(&sin->sin_zero, 0, sizeof(sin->sin_zero));
        }
-@@ -860,7 +877,8 @@ static struct sock *raw_get_first(struct
+@@ -858,7 +875,8 @@ static struct sock *raw_get_first(struct
                struct hlist_node *node;
  
                sk_for_each(sk, node, &state->h->ht[state->bucket])
@@ -27997,7 +27264,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/raw.c linux-2.6.31-vs2.3.0.36.14-pre
                                goto found;
        }
        sk = NULL;
-@@ -876,7 +894,8 @@ static struct sock *raw_get_next(struct 
+@@ -874,7 +892,8 @@ static struct sock *raw_get_next(struct 
                sk = sk_next(sk);
  try_again:
                ;
@@ -28007,7 +27274,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/raw.c linux-2.6.31-vs2.3.0.36.14-pre
  
        if (!sk && ++state->bucket < RAW_HTABLE_SIZE) {
                sk = sk_head(&state->h->ht[state->bucket]);
-@@ -935,7 +954,10 @@ static void raw_sock_seq_show(struct seq
+@@ -933,7 +952,10 @@ static void raw_sock_seq_show(struct seq
  
        seq_printf(seq, "%4d: %08X:%04X %08X:%04X"
                " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d\n",
@@ -28016,12 +27283,23 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/raw.c linux-2.6.31-vs2.3.0.36.14-pre
 +              nx_map_sock_lback(current_nx_info(), src), srcp,
 +              nx_map_sock_lback(current_nx_info(), dest), destp,
 +              sp->sk_state,
-               sk_wmem_alloc_get(sp),
-               sk_rmem_alloc_get(sp),
+               atomic_read(&sp->sk_wmem_alloc),
+               atomic_read(&sp->sk_rmem_alloc),
                0, 0L, 0, sock_i_uid(sp), 0, sock_i_ino(sp),
-diff -NurpP --minimal linux-2.6.31/net/ipv4/tcp.c linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv4/tcp.c
---- linux-2.6.31/net/ipv4/tcp.c        2009-09-10 15:26:29.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv4/tcp.c     2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/net/ipv4/syncookies.c linux-2.6.27.33-vs2.3.0.36.6/net/ipv4/syncookies.c
+--- linux-2.6.27.33/net/ipv4/syncookies.c      2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/ipv4/syncookies.c 2008-10-13 14:54:20.000000000 +0200
+@@ -16,6 +16,7 @@
+ #include <linux/cryptohash.h>
+ #include <linux/kernel.h>
+ #include <net/tcp.h>
++#include <net/route.h>
+ /* Timestamps: lowest 9 bits store TCP options */
+ #define TSBITS 9
+diff -NurpP --minimal linux-2.6.27.33/net/ipv4/tcp.c linux-2.6.27.33-vs2.3.0.36.6/net/ipv4/tcp.c
+--- linux-2.6.27.33/net/ipv4/tcp.c     2009-09-13 16:17:01.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/ipv4/tcp.c        2009-02-22 22:58:33.000000000 +0100
 @@ -264,6 +264,7 @@
  #include <linux/cache.h>
  #include <linux/err.h>
@@ -28030,10 +27308,10 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/tcp.c linux-2.6.31-vs2.3.0.36.14-pre
  
  #include <net/icmp.h>
  #include <net/tcp.h>
-diff -NurpP --minimal linux-2.6.31/net/ipv4/tcp_ipv4.c linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv4/tcp_ipv4.c
---- linux-2.6.31/net/ipv4/tcp_ipv4.c   2009-09-10 15:26:29.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv4/tcp_ipv4.c        2009-09-10 16:11:43.000000000 +0200
-@@ -1887,6 +1887,12 @@ static void *listening_get_next(struct s
+diff -NurpP --minimal linux-2.6.27.33/net/ipv4/tcp_ipv4.c linux-2.6.27.33-vs2.3.0.36.6/net/ipv4/tcp_ipv4.c
+--- linux-2.6.27.33/net/ipv4/tcp_ipv4.c        2009-09-13 16:17:01.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/ipv4/tcp_ipv4.c   2009-07-15 00:21:24.000000000 +0200
+@@ -1890,6 +1890,12 @@ static void *listening_get_next(struct s
                req = req->dl_next;
                while (1) {
                        while (req) {
@@ -28046,10 +27324,10 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/tcp_ipv4.c linux-2.6.31-vs2.3.0.36.1
                                if (req->rsk_ops->family == st->family) {
                                        cur = req;
                                        goto out;
-@@ -1911,6 +1917,10 @@ get_req:
+@@ -1914,6 +1920,10 @@ get_req:
        }
  get_sk:
-       sk_nulls_for_each_from(sk, node) {
+       sk_for_each_from(sk, node) {
 +              vxdprintk(VXD_CBIT(net, 6), "sk: %p [#%d] (from %d)",
 +                      sk, sk->sk_nid, nx_current_nid());
 +              if (!nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
@@ -28057,10 +27335,10 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/tcp_ipv4.c linux-2.6.31-vs2.3.0.36.1
                if (sk->sk_family == st->family && net_eq(sock_net(sk), net)) {
                        cur = sk;
                        goto out;
-@@ -1974,6 +1984,11 @@ static void *established_get_first(struc
+@@ -1964,6 +1974,11 @@ static void *established_get_first(struc
  
-               spin_lock_bh(lock);
-               sk_nulls_for_each(sk, node, &tcp_hashinfo.ehash[st->bucket].chain) {
+               read_lock_bh(lock);
+               sk_for_each(sk, node, &tcp_hashinfo.ehash[st->bucket].chain) {
 +                      vxdprintk(VXD_CBIT(net, 6),
 +                              "sk,egf: %p [#%d] (from %d)",
 +                              sk, sk->sk_nid, nx_current_nid());
@@ -28069,7 +27347,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/tcp_ipv4.c linux-2.6.31-vs2.3.0.36.1
                        if (sk->sk_family != st->family ||
                            !net_eq(sock_net(sk), net)) {
                                continue;
-@@ -1984,6 +1999,11 @@ static void *established_get_first(struc
+@@ -1974,6 +1989,11 @@ static void *established_get_first(struc
                st->state = TCP_SEQ_STATE_TIME_WAIT;
                inet_twsk_for_each(tw, node,
                                   &tcp_hashinfo.ehash[st->bucket].twchain) {
@@ -28081,7 +27359,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/tcp_ipv4.c linux-2.6.31-vs2.3.0.36.1
                        if (tw->tw_family != st->family ||
                            !net_eq(twsk_net(tw), net)) {
                                continue;
-@@ -2012,7 +2032,9 @@ static void *established_get_next(struct
+@@ -2002,7 +2022,9 @@ static void *established_get_next(struct
                tw = cur;
                tw = tw_next(tw);
  get_tw:
@@ -28092,10 +27370,10 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/tcp_ipv4.c linux-2.6.31-vs2.3.0.36.1
                        tw = tw_next(tw);
                }
                if (tw) {
-@@ -2035,6 +2057,11 @@ get_tw:
-               sk = sk_nulls_next(sk);
+@@ -2023,6 +2045,11 @@ get_tw:
+               sk = sk_next(sk);
  
-       sk_nulls_for_each_from(sk, node) {
+       sk_for_each_from(sk, node) {
 +              vxdprintk(VXD_CBIT(net, 6),
 +                      "sk,egn: %p [#%d] (from %d)",
 +                      sk, sk->sk_nid, nx_current_nid());
@@ -28104,7 +27382,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/tcp_ipv4.c linux-2.6.31-vs2.3.0.36.1
                if (sk->sk_family == st->family && net_eq(sock_net(sk), net))
                        goto found;
        }
-@@ -2186,9 +2213,9 @@ static void get_openreq4(struct sock *sk
+@@ -2177,9 +2204,9 @@ static void get_openreq4(struct sock *sk
        seq_printf(f, "%4d: %08X:%04X %08X:%04X"
                " %02X %08X:%08X %02X:%08lX %08X %5d %8d %u %d %p%n",
                i,
@@ -28116,7 +27394,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/tcp_ipv4.c linux-2.6.31-vs2.3.0.36.1
                ntohs(ireq->rmt_port),
                TCP_SYN_RECV,
                0, 0, /* could print option size, but that is af dependent. */
-@@ -2231,7 +2258,10 @@ static void get_tcp4_sock(struct sock *s
+@@ -2222,7 +2249,10 @@ static void get_tcp4_sock(struct sock *s
  
        seq_printf(f, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX "
                        "%08X %5d %8d %lu %d %p %lu %lu %u %u %d%n",
@@ -28128,7 +27406,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/tcp_ipv4.c linux-2.6.31-vs2.3.0.36.1
                tp->write_seq - tp->snd_una,
                sk->sk_state == TCP_LISTEN ? sk->sk_ack_backlog :
                                             (tp->rcv_nxt - tp->copied_seq),
-@@ -2267,7 +2297,10 @@ static void get_timewait4_sock(struct in
+@@ -2258,7 +2288,10 @@ static void get_timewait4_sock(struct in
  
        seq_printf(f, "%4d: %08X:%04X %08X:%04X"
                " %02X %08X:%08X %02X:%08lX %08X %5d %8d %d %d %p%n",
@@ -28140,9 +27418,9 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/tcp_ipv4.c linux-2.6.31-vs2.3.0.36.1
                3, jiffies_to_clock_t(ttd), 0, 0, 0, 0,
                atomic_read(&tw->tw_refcnt), tw, len);
  }
-diff -NurpP --minimal linux-2.6.31/net/ipv4/tcp_minisocks.c linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv4/tcp_minisocks.c
---- linux-2.6.31/net/ipv4/tcp_minisocks.c      2009-09-10 15:26:29.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv4/tcp_minisocks.c   2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/net/ipv4/tcp_minisocks.c linux-2.6.27.33-vs2.3.0.36.6/net/ipv4/tcp_minisocks.c
+--- linux-2.6.27.33/net/ipv4/tcp_minisocks.c   2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/ipv4/tcp_minisocks.c      2008-10-13 14:54:20.000000000 +0200
 @@ -26,6 +26,10 @@
  #include <net/inet_common.h>
  #include <net/xfrm.h>
@@ -28154,7 +27432,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/tcp_minisocks.c linux-2.6.31-vs2.3.0
  #ifdef CONFIG_SYSCTL
  #define SYNC_INIT 0 /* let the user enable it */
  #else
-@@ -294,6 +298,11 @@ void tcp_time_wait(struct sock *sk, int 
+@@ -293,6 +297,11 @@ void tcp_time_wait(struct sock *sk, int 
                tcptw->tw_ts_recent     = tp->rx_opt.ts_recent;
                tcptw->tw_ts_recent_stamp = tp->rx_opt.ts_recent_stamp;
  
@@ -28166,10 +27444,10 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/tcp_minisocks.c linux-2.6.31-vs2.3.0
  #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
                if (tw->tw_family == PF_INET6) {
                        struct ipv6_pinfo *np = inet6_sk(sk);
-diff -NurpP --minimal linux-2.6.31/net/ipv4/udp.c linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv4/udp.c
---- linux-2.6.31/net/ipv4/udp.c        2009-09-10 15:26:30.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv4/udp.c     2009-09-10 17:17:40.000000000 +0200
-@@ -222,14 +222,7 @@ fail:
+diff -NurpP --minimal linux-2.6.27.33/net/ipv4/udp.c linux-2.6.27.33-vs2.3.0.36.6/net/ipv4/udp.c
+--- linux-2.6.27.33/net/ipv4/udp.c     2009-09-13 16:17:01.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/ipv4/udp.c        2009-02-22 22:58:33.000000000 +0100
+@@ -234,20 +234,14 @@ fail:
        return error;
  }
  
@@ -28185,55 +27463,39 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/udp.c linux-2.6.31-vs2.3.0.36.14-pre
  
  int udp_v4_get_port(struct sock *sk, unsigned short snum)
  {
-@@ -251,6 +244,11 @@ static inline int compute_score(struct s
-                       if (inet->rcv_saddr != daddr)
-                               return -1;
-                       score += 2;
-+              } else {
-+                      /* block non nx_info ips */
-+                      if (!v4_addr_in_nx_info(sk->sk_nx_info,
-+                              daddr, NXA_MASK_BIND))
-+                              return -1;
-               }
-               if (inet->daddr) {
-                       if (inet->daddr != saddr)
-@@ -271,6 +269,7 @@ static inline int compute_score(struct s
-       return score;
+       return udp_lib_get_port(sk, snum, ipv4_rcv_saddr_equal);
  }
  
 +
  /* UDP is nearly always wildcards out the wazoo, it makes no sense to try
   * harder than this. -DaveM
   */
-@@ -292,6 +291,11 @@ begin:
-       sk_nulls_for_each_rcu(sk, node, &hslot->head) {
-               score = compute_score(sk, net, saddr, hnum, sport,
-                                     daddr, dport, dif);
-+              /* FIXME: disabled?
-+              if (score == 9) {
-+                      result = sk;
-+                      break;
-+              } else */
-               if (score > badness) {
-                       result = sk;
-                       badness = score;
-@@ -305,6 +309,7 @@ begin:
-       if (get_nulls_value(node) != hash)
-               goto begin;
-+
-       if (result) {
-               if (unlikely(!atomic_inc_not_zero(&result->sk_refcnt)))
-                       result = NULL;
-@@ -314,6 +319,7 @@ begin:
-                       goto begin;
+@@ -267,10 +261,16 @@ static struct sock *__udp4_lib_lookup(st
+               if (net_eq(sock_net(sk), net) && sk->sk_hash == hnum &&
+                               !ipv6_only_sock(sk)) {
+                       int score = (sk->sk_family == PF_INET ? 1 : 0);
++
+                       if (inet->rcv_saddr) {
+                               if (inet->rcv_saddr != daddr)
+                                       continue;
+                               score+=2;
++                      } else {
++                              /* block non nx_info ips */
++                              if (!v4_addr_in_nx_info(sk->sk_nx_info,
++                                      daddr, NXA_MASK_BIND))
++                                      continue;
+                       }
+                       if (inet->daddr) {
+                               if (inet->daddr != saddr)
+@@ -296,6 +296,7 @@ static struct sock *__udp4_lib_lookup(st
+                       }
                }
        }
 +
-       rcu_read_unlock();
-       return result;
- }
-@@ -356,7 +362,7 @@ static inline struct sock *udp_v4_mcast_
+       if (result)
+               sock_hold(result);
+       read_unlock(&udp_hash_lock);
+@@ -318,7 +319,7 @@ static inline struct sock *udp_v4_mcast_
                    s->sk_hash != hnum                                  ||
                    (inet->daddr && inet->daddr != rmt_addr)            ||
                    (inet->dport != rmt_port && inet->dport)            ||
@@ -28242,7 +27504,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/udp.c linux-2.6.31-vs2.3.0.36.14-pre
                    ipv6_only_sock(s)                                   ||
                    (s->sk_bound_dev_if && s->sk_bound_dev_if != dif))
                        continue;
-@@ -698,8 +704,13 @@ int udp_sendmsg(struct kiocb *iocb, stru
+@@ -655,8 +656,13 @@ int udp_sendmsg(struct kiocb *iocb, stru
                                               { .sport = inet->sport,
                                                 .dport = dport } } };
                struct net *net = sock_net(sk);
@@ -28256,7 +27518,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/udp.c linux-2.6.31-vs2.3.0.36.14-pre
                err = ip_route_output_flow(net, &rt, &fl, sk, 1);
                if (err) {
                        if (err == -ENETUNREACH)
-@@ -945,7 +956,8 @@ try_again:
+@@ -901,7 +907,8 @@ try_again:
        {
                sin->sin_family = AF_INET;
                sin->sin_port = udp_hdr(skb)->source;
@@ -28266,8 +27528,8 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/udp.c linux-2.6.31-vs2.3.0.36.14-pre
                memset(sin->sin_zero, 0, sizeof(sin->sin_zero));
        }
        if (inet->cmsg_flags)
-@@ -1599,6 +1611,8 @@ static struct sock *udp_get_first(struct
-               sk_nulls_for_each(sk, node, &hslot->head) {
+@@ -1533,6 +1540,8 @@ static struct sock *udp_get_first(struct
+               sk_for_each(sk, node, state->hashtable + state->bucket) {
                        if (!net_eq(sock_net(sk), net))
                                continue;
 +                      if (!nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
@@ -28275,18 +27537,18 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/udp.c linux-2.6.31-vs2.3.0.36.14-pre
                        if (sk->sk_family == state->family)
                                goto found;
                }
-@@ -1616,7 +1630,9 @@ static struct sock *udp_get_next(struct 
-       do {
-               sk = sk_nulls_next(sk);
+@@ -1551,7 +1560,9 @@ static struct sock *udp_get_next(struct 
+               sk = sk_next(sk);
+ try_again:
+               ;
 -      } while (sk && (!net_eq(sock_net(sk), net) || sk->sk_family != state->family));
 +      } while (sk && (!net_eq(sock_net(sk), net) ||
 +              sk->sk_family != state->family ||
 +              !nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT)));
  
-       if (!sk) {
-               if (state->bucket < UDP_HTABLE_SIZE)
-@@ -1721,7 +1737,10 @@ static void udp4_format_sock(struct sock
+       if (!sk && ++state->bucket < UDP_HTABLE_SIZE) {
+               sk = sk_head(state->hashtable + state->bucket);
+@@ -1652,7 +1663,10 @@ static void udp4_format_sock(struct sock
  
        seq_printf(f, "%4d: %08X:%04X %08X:%04X"
                " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d%n",
@@ -28295,13 +27557,13 @@ diff -NurpP --minimal linux-2.6.31/net/ipv4/udp.c linux-2.6.31-vs2.3.0.36.14-pre
 +              nx_map_sock_lback(current_nx_info(), src), srcp,
 +              nx_map_sock_lback(current_nx_info(), dest), destp,
 +              sp->sk_state,
-               sk_wmem_alloc_get(sp),
-               sk_rmem_alloc_get(sp),
+               atomic_read(&sp->sk_wmem_alloc),
+               atomic_read(&sp->sk_rmem_alloc),
                0, 0L, 0, sock_i_uid(sp), 0, sock_i_ino(sp),
-diff -NurpP --minimal linux-2.6.31/net/ipv6/addrconf.c linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv6/addrconf.c
---- linux-2.6.31/net/ipv6/addrconf.c   2009-09-10 15:26:30.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv6/addrconf.c        2009-09-10 16:11:43.000000000 +0200
-@@ -86,6 +86,8 @@
+diff -NurpP --minimal linux-2.6.27.33/net/ipv6/addrconf.c linux-2.6.27.33-vs2.3.0.36.6/net/ipv6/addrconf.c
+--- linux-2.6.27.33/net/ipv6/addrconf.c        2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/ipv6/addrconf.c   2008-11-21 13:32:00.000000000 +0100
+@@ -85,6 +85,8 @@
  
  #include <linux/proc_fs.h>
  #include <linux/seq_file.h>
@@ -28310,7 +27572,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv6/addrconf.c linux-2.6.31-vs2.3.0.36.1
  
  /* Set to 3 to get tracing... */
  #define ACONF_DEBUG 2
-@@ -1117,7 +1119,7 @@ out:
+@@ -1108,7 +1110,7 @@ out:
  
  int ipv6_dev_get_saddr(struct net *net, struct net_device *dst_dev,
                       const struct in6_addr *daddr, unsigned int prefs,
@@ -28319,7 +27581,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv6/addrconf.c linux-2.6.31-vs2.3.0.36.1
  {
        struct ipv6_saddr_score scores[2],
                                *score = &scores[0], *hiscore = &scores[1];
-@@ -1190,6 +1192,8 @@ int ipv6_dev_get_saddr(struct net *net, 
+@@ -1181,6 +1183,8 @@ int ipv6_dev_get_saddr(struct net *net, 
                                               dev->name);
                                continue;
                        }
@@ -28328,19 +27590,71 @@ diff -NurpP --minimal linux-2.6.31/net/ipv6/addrconf.c linux-2.6.31-vs2.3.0.36.1
  
                        score->rule = -1;
                        bitmap_zero(score->scorebits, IPV6_SADDR_RULE_MAX);
-@@ -2979,7 +2983,10 @@ static void if6_seq_stop(struct seq_file
+@@ -1364,35 +1368,46 @@ struct inet6_ifaddr *ipv6_get_ifaddr(str
+       return ifp;
+ }
++extern int ipv4_rcv_saddr_equal(const struct sock *sk1, const struct sock *sk2);
++
+ int ipv6_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2)
+ {
+       const struct in6_addr *sk_rcv_saddr6 = &inet6_sk(sk)->rcv_saddr;
+       const struct in6_addr *sk2_rcv_saddr6 = inet6_rcv_saddr(sk2);
+-      __be32 sk_rcv_saddr = inet_sk(sk)->rcv_saddr;
+       __be32 sk2_rcv_saddr = inet_rcv_saddr(sk2);
+       int sk_ipv6only = ipv6_only_sock(sk);
+       int sk2_ipv6only = inet_v6_ipv6only(sk2);
+       int addr_type = ipv6_addr_type(sk_rcv_saddr6);
+       int addr_type2 = sk2_rcv_saddr6 ? ipv6_addr_type(sk2_rcv_saddr6) : IPV6_ADDR_MAPPED;
+-      if (!sk2_rcv_saddr && !sk_ipv6only)
++      /* FIXME: needs handling for v4 ANY */
++      if (!sk2_rcv_saddr && !sk_ipv6only && !sk2->sk_nx_info)
+               return 1;
+       if (addr_type2 == IPV6_ADDR_ANY &&
+-          !(sk2_ipv6only && addr_type == IPV6_ADDR_MAPPED))
++          !(sk2_ipv6only && addr_type == IPV6_ADDR_MAPPED) &&
++          v6_addr_in_nx_info(sk2->sk_nx_info, sk_rcv_saddr6, -1))
+               return 1;
+       if (addr_type == IPV6_ADDR_ANY &&
+-          !(sk_ipv6only && addr_type2 == IPV6_ADDR_MAPPED))
++          !(sk_ipv6only && addr_type2 == IPV6_ADDR_MAPPED) &&
++          (sk2_rcv_saddr6 && v6_addr_in_nx_info(sk->sk_nx_info, sk2_rcv_saddr6, -1)))
++              return 1;
++
++      if (addr_type == IPV6_ADDR_ANY &&
++          addr_type2 == IPV6_ADDR_ANY &&
++          nx_v6_addr_conflict(sk->sk_nx_info, sk2->sk_nx_info))
+               return 1;
+       if (sk2_rcv_saddr6 &&
++          addr_type != IPV6_ADDR_ANY &&
++          addr_type != IPV6_ADDR_ANY &&
+           ipv6_addr_equal(sk_rcv_saddr6, sk2_rcv_saddr6))
+               return 1;
+       if (addr_type == IPV6_ADDR_MAPPED &&
+           !sk2_ipv6only &&
+-          (!sk2_rcv_saddr || !sk_rcv_saddr || sk_rcv_saddr == sk2_rcv_saddr))
++          ipv4_rcv_saddr_equal(sk, sk2))
+               return 1;
+       return 0;
+@@ -2986,7 +3001,10 @@ static void if6_seq_stop(struct seq_file
  static int if6_seq_show(struct seq_file *seq, void *v)
  {
        struct inet6_ifaddr *ifp = (struct inet6_ifaddr *)v;
--      seq_printf(seq, "%pi6 %02x %02x %02x %02x %8s\n",
+-      seq_printf(seq,
 +
 +      if (nx_check(0, VS_ADMIN|VS_WATCH) ||
 +          v6_addr_in_nx_info(current_nx_info(), &ifp->addr, -1))
-+              seq_printf(seq, "%pi6 %02x %02x %02x %02x %8s\n",
-                  &ifp->addr,
++              seq_printf(seq,
+                  NIP6_SEQFMT " %02x %02x %02x %02x %8s\n",
+                  NIP6(ifp->addr),
                   ifp->idev->dev->ifindex,
-                  ifp->prefix_len,
-@@ -3476,6 +3483,12 @@ static int inet6_dump_addr(struct sk_buf
+@@ -3481,6 +3499,12 @@ static int inet6_dump_addr(struct sk_buf
        struct ifmcaddr6 *ifmca;
        struct ifacaddr6 *ifaca;
        struct net *net = sock_net(skb->sk);
@@ -28353,7 +27667,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv6/addrconf.c linux-2.6.31-vs2.3.0.36.1
  
        s_idx = cb->args[0];
        s_ip_idx = ip_idx = cb->args[1];
-@@ -3497,6 +3510,8 @@ static int inet6_dump_addr(struct sk_buf
+@@ -3502,6 +3526,8 @@ static int inet6_dump_addr(struct sk_buf
                             ifa = ifa->if_next, ip_idx++) {
                                if (ip_idx < s_ip_idx)
                                        continue;
@@ -28362,7 +27676,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv6/addrconf.c linux-2.6.31-vs2.3.0.36.1
                                err = inet6_fill_ifaddr(skb, ifa,
                                                        NETLINK_CB(cb->skb).pid,
                                                        cb->nlh->nlmsg_seq,
-@@ -3510,6 +3525,8 @@ static int inet6_dump_addr(struct sk_buf
+@@ -3515,6 +3541,8 @@ static int inet6_dump_addr(struct sk_buf
                             ifmca = ifmca->next, ip_idx++) {
                                if (ip_idx < s_ip_idx)
                                        continue;
@@ -28371,7 +27685,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv6/addrconf.c linux-2.6.31-vs2.3.0.36.1
                                err = inet6_fill_ifmcaddr(skb, ifmca,
                                                          NETLINK_CB(cb->skb).pid,
                                                          cb->nlh->nlmsg_seq,
-@@ -3523,6 +3540,8 @@ static int inet6_dump_addr(struct sk_buf
+@@ -3528,6 +3556,8 @@ static int inet6_dump_addr(struct sk_buf
                             ifaca = ifaca->aca_next, ip_idx++) {
                                if (ip_idx < s_ip_idx)
                                        continue;
@@ -28380,7 +27694,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv6/addrconf.c linux-2.6.31-vs2.3.0.36.1
                                err = inet6_fill_ifacaddr(skb, ifaca,
                                                          NETLINK_CB(cb->skb).pid,
                                                          cb->nlh->nlmsg_seq,
-@@ -3809,12 +3828,19 @@ static int inet6_dump_ifinfo(struct sk_b
+@@ -3813,12 +3843,19 @@ static int inet6_dump_ifinfo(struct sk_b
        int s_idx = cb->args[0];
        struct net_device *dev;
        struct inet6_dev *idev;
@@ -28400,9 +27714,9 @@ diff -NurpP --minimal linux-2.6.31/net/ipv6/addrconf.c linux-2.6.31-vs2.3.0.36.1
                if ((idev = in6_dev_get(dev)) == NULL)
                        goto cont;
                err = inet6_fill_ifinfo(skb, idev, NETLINK_CB(cb->skb).pid,
-diff -NurpP --minimal linux-2.6.31/net/ipv6/af_inet6.c linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv6/af_inet6.c
---- linux-2.6.31/net/ipv6/af_inet6.c   2009-09-10 15:26:30.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv6/af_inet6.c        2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/net/ipv6/af_inet6.c linux-2.6.27.33-vs2.3.0.36.6/net/ipv6/af_inet6.c
+--- linux-2.6.27.33/net/ipv6/af_inet6.c        2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/ipv6/af_inet6.c   2008-10-13 14:54:20.000000000 +0200
 @@ -41,6 +41,8 @@
  #include <linux/netdevice.h>
  #include <linux/icmpv6.h>
@@ -28412,7 +27726,15 @@ diff -NurpP --minimal linux-2.6.31/net/ipv6/af_inet6.c linux-2.6.31-vs2.3.0.36.1
  
  #include <net/ip.h>
  #include <net/ipv6.h>
-@@ -158,9 +160,12 @@ lookup_protocol:
+@@ -49,6 +51,7 @@
+ #include <net/tcp.h>
+ #include <net/ipip.h>
+ #include <net/protocol.h>
++#include <net/route.h>
+ #include <net/inet_common.h>
+ #include <net/transp_v6.h>
+ #include <net/ip6_route.h>
+@@ -141,9 +144,12 @@ lookup_protocol:
        }
  
        err = -EPERM;
@@ -28426,7 +27748,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv6/af_inet6.c linux-2.6.31-vs2.3.0.36.1
        sock->ops = answer->ops;
        answer_prot = answer->prot;
        answer_no_check = answer->no_check;
-@@ -259,6 +264,7 @@ int inet6_bind(struct socket *sock, stru
+@@ -242,6 +248,7 @@ int inet6_bind(struct socket *sock, stru
        struct inet_sock *inet = inet_sk(sk);
        struct ipv6_pinfo *np = inet6_sk(sk);
        struct net *net = sock_net(sk);
@@ -28434,7 +27756,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv6/af_inet6.c linux-2.6.31-vs2.3.0.36.1
        __be32 v4addr = 0;
        unsigned short snum;
        int addr_type = 0;
-@@ -270,6 +276,11 @@ int inet6_bind(struct socket *sock, stru
+@@ -253,6 +260,11 @@ int inet6_bind(struct socket *sock, stru
  
        if (addr_len < SIN6_LEN_RFC2133)
                return -EINVAL;
@@ -28446,15 +27768,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv6/af_inet6.c linux-2.6.31-vs2.3.0.36.1
        addr_type = ipv6_addr_type(&addr->sin6_addr);
        if ((addr_type & IPV6_ADDR_MULTICAST) && sock->type == SOCK_STREAM)
                return -EINVAL;
-@@ -301,6 +312,7 @@ int inet6_bind(struct socket *sock, stru
-               /* Reproduce AF_INET checks to make the bindings consitant */
-               v4addr = addr->sin6_addr.s6_addr32[3];
-               chk_addr_ret = inet_addr_type(net, v4addr);
-+
-               if (!sysctl_ip_nonlocal_bind &&
-                   !(inet->freebind || inet->transparent) &&
-                   v4addr != htonl(INADDR_ANY) &&
-@@ -310,6 +322,10 @@ int inet6_bind(struct socket *sock, stru
+@@ -276,6 +288,10 @@ int inet6_bind(struct socket *sock, stru
                        err = -EADDRNOTAVAIL;
                        goto out;
                }
@@ -28465,7 +27779,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv6/af_inet6.c linux-2.6.31-vs2.3.0.36.1
        } else {
                if (addr_type != IPV6_ADDR_ANY) {
                        struct net_device *dev = NULL;
-@@ -335,6 +351,11 @@ int inet6_bind(struct socket *sock, stru
+@@ -301,6 +317,11 @@ int inet6_bind(struct socket *sock, stru
                                }
                        }
  
@@ -28477,7 +27791,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv6/af_inet6.c linux-2.6.31-vs2.3.0.36.1
                        /* ipv4 addr of the socket is invalid.  Only the
                         * unspecified and mapped address have a v4 equivalent.
                         */
-@@ -353,6 +374,8 @@ int inet6_bind(struct socket *sock, stru
+@@ -319,6 +340,8 @@ int inet6_bind(struct socket *sock, stru
                }
        }
  
@@ -28486,7 +27800,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv6/af_inet6.c linux-2.6.31-vs2.3.0.36.1
        inet->rcv_saddr = v4addr;
        inet->saddr = v4addr;
  
-@@ -448,9 +471,11 @@ int inet6_getname(struct socket *sock, s
+@@ -411,9 +434,11 @@ int inet6_getname(struct socket *sock, s
                        return -ENOTCONN;
                sin->sin6_port = inet->dport;
                ipv6_addr_copy(&sin->sin6_addr, &np->daddr);
@@ -28498,9 +27812,9 @@ diff -NurpP --minimal linux-2.6.31/net/ipv6/af_inet6.c linux-2.6.31-vs2.3.0.36.1
                if (ipv6_addr_any(&np->rcv_saddr))
                        ipv6_addr_copy(&sin->sin6_addr, &np->saddr);
                else
-diff -NurpP --minimal linux-2.6.31/net/ipv6/fib6_rules.c linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv6/fib6_rules.c
---- linux-2.6.31/net/ipv6/fib6_rules.c 2009-09-10 15:26:30.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv6/fib6_rules.c      2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/net/ipv6/fib6_rules.c linux-2.6.27.33-vs2.3.0.36.6/net/ipv6/fib6_rules.c
+--- linux-2.6.27.33/net/ipv6/fib6_rules.c      2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/ipv6/fib6_rules.c 2008-10-13 14:54:20.000000000 +0200
 @@ -96,7 +96,7 @@ static int fib6_rule_action(struct fib_r
                        if (ipv6_dev_get_saddr(net,
                                               ip6_dst_idev(&rt->u.dst)->dev,
@@ -28510,9 +27824,9 @@ diff -NurpP --minimal linux-2.6.31/net/ipv6/fib6_rules.c linux-2.6.31-vs2.3.0.36
                                goto again;
                        if (!ipv6_prefix_equal(&saddr, &r->src.addr,
                                               r->src.plen))
-diff -NurpP --minimal linux-2.6.31/net/ipv6/inet6_hashtables.c linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv6/inet6_hashtables.c
---- linux-2.6.31/net/ipv6/inet6_hashtables.c   2009-03-24 14:22:46.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv6/inet6_hashtables.c        2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/net/ipv6/inet6_hashtables.c linux-2.6.27.33-vs2.3.0.36.6/net/ipv6/inet6_hashtables.c
+--- linux-2.6.27.33/net/ipv6/inet6_hashtables.c        2009-09-13 16:17:01.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/ipv6/inet6_hashtables.c   2009-05-15 22:57:04.000000000 +0200
 @@ -16,6 +16,7 @@
  
  #include <linux/module.h>
@@ -28521,37 +27835,20 @@ diff -NurpP --minimal linux-2.6.31/net/ipv6/inet6_hashtables.c linux-2.6.31-vs2.
  
  #include <net/inet_connection_sock.h>
  #include <net/inet_hashtables.h>
-@@ -76,7 +77,6 @@ struct sock *__inet6_lookup_established(
-       unsigned int slot = hash & (hashinfo->ehash_size - 1);
-       struct inet_ehash_bucket *head = &hashinfo->ehash[slot];
--
-       rcu_read_lock();
- begin:
-       sk_nulls_for_each_rcu(sk, node, &head->chain) {
-@@ -88,7 +88,7 @@ begin:
-                               sock_put(sk);
-                               goto begin;
+@@ -115,6 +116,9 @@ struct sock *inet6_lookup_listener(struc
+                               if (!ipv6_addr_equal(&np->rcv_saddr, daddr))
+                                       continue;
+                               score++;
++                      } else {
++                              if (!v6_addr_in_nx_info(sk->sk_nx_info, daddr, -1))
++                                      continue;
                        }
--              goto out;
-+                      goto out;
-               }
-       }
-       if (get_nulls_value(node) != slot)
-@@ -134,6 +134,9 @@ static int inline compute_score(struct s
-                       if (!ipv6_addr_equal(&np->rcv_saddr, daddr))
-                               return -1;
-                       score++;
-+              } else {
-+                      if (!v6_addr_in_nx_info(sk->sk_nx_info, daddr, -1))
-+                              return -1;
-               }
-               if (sk->sk_bound_dev_if) {
-                       if (sk->sk_bound_dev_if != dif)
-diff -NurpP --minimal linux-2.6.31/net/ipv6/ip6_output.c linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv6/ip6_output.c
---- linux-2.6.31/net/ipv6/ip6_output.c 2009-09-10 15:26:30.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv6/ip6_output.c      2009-09-10 16:11:43.000000000 +0200
-@@ -951,7 +951,7 @@ static int ip6_dst_lookup_tail(struct so
+                       if (sk->sk_bound_dev_if) {
+                               if (sk->sk_bound_dev_if != dif)
+diff -NurpP --minimal linux-2.6.27.33/net/ipv6/ip6_output.c linux-2.6.27.33-vs2.3.0.36.6/net/ipv6/ip6_output.c
+--- linux-2.6.27.33/net/ipv6/ip6_output.c      2009-09-13 16:17:01.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/ipv6/ip6_output.c 2009-02-22 22:58:33.000000000 +0100
+@@ -937,7 +937,7 @@ static int ip6_dst_lookup_tail(struct so
                err = ipv6_dev_get_saddr(net, ip6_dst_idev(*dst)->dev,
                                         &fl->fl6_dst,
                                         sk ? inet6_sk(sk)->srcprefs : 0,
@@ -28560,9 +27857,9 @@ diff -NurpP --minimal linux-2.6.31/net/ipv6/ip6_output.c linux-2.6.31-vs2.3.0.36
                if (err)
                        goto out_err_release;
        }
-diff -NurpP --minimal linux-2.6.31/net/ipv6/Kconfig linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv6/Kconfig
---- linux-2.6.31/net/ipv6/Kconfig      2009-09-10 15:26:30.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv6/Kconfig   2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/net/ipv6/Kconfig linux-2.6.27.33-vs2.3.0.36.6/net/ipv6/Kconfig
+--- linux-2.6.27.33/net/ipv6/Kconfig   2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/ipv6/Kconfig      2008-10-13 14:54:20.000000000 +0200
 @@ -4,8 +4,8 @@
  
  #   IPv6 as module will cause a CRASH if you try to unload it
@@ -28574,10 +27871,10 @@ diff -NurpP --minimal linux-2.6.31/net/ipv6/Kconfig linux-2.6.31-vs2.3.0.36.14-p
        ---help---
          This is complemental support for the IP version 6.
          You will still be able to do traditional IPv4 networking as well.
-diff -NurpP --minimal linux-2.6.31/net/ipv6/ndisc.c linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv6/ndisc.c
---- linux-2.6.31/net/ipv6/ndisc.c      2009-09-10 15:26:30.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv6/ndisc.c   2009-09-10 16:11:43.000000000 +0200
-@@ -589,7 +589,7 @@ static void ndisc_send_na(struct net_dev
+diff -NurpP --minimal linux-2.6.27.33/net/ipv6/ndisc.c linux-2.6.27.33-vs2.3.0.36.6/net/ipv6/ndisc.c
+--- linux-2.6.27.33/net/ipv6/ndisc.c   2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/ipv6/ndisc.c      2008-10-13 14:54:20.000000000 +0200
+@@ -551,7 +551,7 @@ static void ndisc_send_na(struct net_dev
        } else {
                if (ipv6_dev_get_saddr(dev_net(dev), dev, daddr,
                                       inet6_sk(dev_net(dev)->ipv6.ndisc_sk)->srcprefs,
@@ -28586,9 +27883,9 @@ diff -NurpP --minimal linux-2.6.31/net/ipv6/ndisc.c linux-2.6.31-vs2.3.0.36.14-p
                        return;
                src_addr = &tmpaddr;
        }
-diff -NurpP --minimal linux-2.6.31/net/ipv6/raw.c linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv6/raw.c
---- linux-2.6.31/net/ipv6/raw.c        2009-09-10 15:26:30.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv6/raw.c     2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/net/ipv6/raw.c linux-2.6.27.33-vs2.3.0.36.6/net/ipv6/raw.c
+--- linux-2.6.27.33/net/ipv6/raw.c     2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/ipv6/raw.c        2008-11-21 13:32:00.000000000 +0100
 @@ -29,6 +29,7 @@
  #include <linux/icmpv6.h>
  #include <linux/netfilter.h>
@@ -28611,10 +27908,10 @@ diff -NurpP --minimal linux-2.6.31/net/ipv6/raw.c linux-2.6.31-vs2.3.0.36.14-pre
                /* ipv4 addr of the socket is invalid.  Only the
                 * unspecified and mapped address have a v4 equivalent.
                 */
-diff -NurpP --minimal linux-2.6.31/net/ipv6/route.c linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv6/route.c
---- linux-2.6.31/net/ipv6/route.c      2009-09-10 15:26:30.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv6/route.c   2009-09-10 16:11:43.000000000 +0200
-@@ -2257,7 +2257,8 @@ static int rt6_fill_node(struct net *net
+diff -NurpP --minimal linux-2.6.27.33/net/ipv6/route.c linux-2.6.27.33-vs2.3.0.36.6/net/ipv6/route.c
+--- linux-2.6.27.33/net/ipv6/route.c   2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/ipv6/route.c      2008-10-13 14:54:20.000000000 +0200
+@@ -2191,7 +2191,8 @@ static int rt6_fill_node(struct net *net
                struct inet6_dev *idev = ip6_dst_idev(&rt->u.dst);
                struct in6_addr saddr_buf;
                if (ipv6_dev_get_saddr(net, idev ? idev->dev : NULL,
@@ -28624,10 +27921,10 @@ diff -NurpP --minimal linux-2.6.31/net/ipv6/route.c linux-2.6.31-vs2.3.0.36.14-p
                        NLA_PUT(skb, RTA_PREFSRC, 16, &saddr_buf);
        }
  
-diff -NurpP --minimal linux-2.6.31/net/ipv6/tcp_ipv6.c linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv6/tcp_ipv6.c
---- linux-2.6.31/net/ipv6/tcp_ipv6.c   2009-09-10 15:26:30.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv6/tcp_ipv6.c        2009-09-10 16:11:43.000000000 +0200
-@@ -68,6 +68,7 @@
+diff -NurpP --minimal linux-2.6.27.33/net/ipv6/tcp_ipv6.c linux-2.6.27.33-vs2.3.0.36.6/net/ipv6/tcp_ipv6.c
+--- linux-2.6.27.33/net/ipv6/tcp_ipv6.c        2009-09-13 16:17:01.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/ipv6/tcp_ipv6.c   2009-02-03 17:59:04.000000000 +0100
+@@ -67,6 +67,7 @@
  
  #include <linux/crypto.h>
  #include <linux/scatterlist.h>
@@ -28635,7 +27932,7 @@ diff -NurpP --minimal linux-2.6.31/net/ipv6/tcp_ipv6.c linux-2.6.31-vs2.3.0.36.1
  
  static void   tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb);
  static void   tcp_v6_reqsk_send_ack(struct sock *sk, struct sk_buff *skb,
-@@ -156,8 +157,15 @@ static int tcp_v6_connect(struct sock *s
+@@ -155,8 +156,15 @@ static int tcp_v6_connect(struct sock *s
         *      connect() to INADDR_ANY means loopback (BSD'ism).
         */
  
@@ -28653,9 +27950,9 @@ diff -NurpP --minimal linux-2.6.31/net/ipv6/tcp_ipv6.c linux-2.6.31-vs2.3.0.36.1
  
        addr_type = ipv6_addr_type(&usin->sin6_addr);
  
-diff -NurpP --minimal linux-2.6.31/net/ipv6/udp.c linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv6/udp.c
---- linux-2.6.31/net/ipv6/udp.c        2009-09-10 15:26:30.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv6/udp.c     2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/net/ipv6/udp.c linux-2.6.27.33-vs2.3.0.36.6/net/ipv6/udp.c
+--- linux-2.6.27.33/net/ipv6/udp.c     2009-09-13 16:17:01.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/ipv6/udp.c        2009-02-03 17:59:04.000000000 +0100
 @@ -47,6 +47,7 @@
  
  #include <linux/proc_fs.h>
@@ -28663,79 +27960,22 @@ diff -NurpP --minimal linux-2.6.31/net/ipv6/udp.c linux-2.6.31-vs2.3.0.36.14-pre
 +#include <linux/vs_inet6.h>
  #include "udp_impl.h"
  
- int ipv6_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2)
-@@ -60,25 +61,41 @@ int ipv6_rcv_saddr_equal(const struct so
-       int addr_type = ipv6_addr_type(sk_rcv_saddr6);
-       int addr_type2 = sk2_rcv_saddr6 ? ipv6_addr_type(sk2_rcv_saddr6) : IPV6_ADDR_MAPPED;
--      /* if both are mapped, treat as IPv4 */
--      if (addr_type == IPV6_ADDR_MAPPED && addr_type2 == IPV6_ADDR_MAPPED)
--              return (!sk2_ipv6only &&
--                      (!sk_rcv_saddr || !sk2_rcv_saddr ||
--                        sk_rcv_saddr == sk2_rcv_saddr));
-+      if (sk2_ipv6only && !sk2_rcv_saddr6)
-+              addr_type2 = IPV6_ADDR_ANY;
--      if (addr_type2 == IPV6_ADDR_ANY &&
--          !(sk2_ipv6only && addr_type == IPV6_ADDR_MAPPED))
--              return 1;
-+      /* if both are mapped or any, treat as IPv4 */
-+      if ((addr_type == IPV6_ADDR_MAPPED || (addr_type == IPV6_ADDR_ANY && !sk_ipv6only)) &&
-+          (addr_type2 == IPV6_ADDR_MAPPED || (addr_type2 == IPV6_ADDR_ANY && !sk2_ipv6only))) {
-+              if (!sk_rcv_saddr && !sk2_rcv_saddr) {
-+                      if (nx_v4_addr_conflict(sk->sk_nx_info, sk2->sk_nx_info))
-+                              return 1;
-+                      else if (addr_type != IPV6_ADDR_ANY && sk2_rcv_saddr6)
-+                              return 0;
-+                      /* remaining cases are at least one ANY */
-+              } else if (!sk_rcv_saddr)
-+                      return v4_addr_in_nx_info(sk->sk_nx_info, sk2_rcv_saddr, -1);
-+              else if (!sk2_rcv_saddr)
-+                      return v4_addr_in_nx_info(sk2->sk_nx_info, sk_rcv_saddr, -1);
-+              else
-+                      return (sk_rcv_saddr == sk2_rcv_saddr);
-+      }
--      if (addr_type == IPV6_ADDR_ANY &&
--          !(sk_ipv6only && addr_type2 == IPV6_ADDR_MAPPED))
--              return 1;
-+      if (!sk2_rcv_saddr6)
-+              addr_type2 = IPV6_ADDR_ANY;
--      if (sk2_rcv_saddr6 &&
--          ipv6_addr_equal(sk_rcv_saddr6, sk2_rcv_saddr6))
--              return 1;
-+      /* both are IPv6 */
-+      if (addr_type == IPV6_ADDR_ANY && addr_type2 == IPV6_ADDR_ANY)
-+              return nx_v6_addr_conflict(sk->sk_nx_info, sk2->sk_nx_info);
--      return 0;
-+      if (addr_type == IPV6_ADDR_ANY)
-+              return v6_addr_in_nx_info(sk->sk_nx_info,
-+                      sk2_rcv_saddr6 ? sk2_rcv_saddr6 : &in6addr_any, -1);
-+
-+      if (addr_type2 == IPV6_ADDR_ANY)
-+              return v6_addr_in_nx_info(sk2->sk_nx_info, sk_rcv_saddr6, -1);
-+
-+      return ipv6_addr_equal(sk_rcv_saddr6, sk2_rcv_saddr6);
- }
  int udp_v6_get_port(struct sock *sk, unsigned short snum)
-@@ -109,6 +126,10 @@ static inline int compute_score(struct s
-                       if (!ipv6_addr_equal(&np->rcv_saddr, daddr))
-                               return -1;
-                       score++;
-+              } else {
-+                      /* block non nx_info ips */
-+                      if (!v6_addr_in_nx_info(sk->sk_nx_info, daddr, -1))
-+                              return -1;
-               }
-               if (!ipv6_addr_any(&np->daddr)) {
-                       if (!ipv6_addr_equal(&np->daddr, saddr))
-diff -NurpP --minimal linux-2.6.31/net/ipv6/xfrm6_policy.c linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv6/xfrm6_policy.c
---- linux-2.6.31/net/ipv6/xfrm6_policy.c       2009-09-10 15:26:30.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/ipv6/xfrm6_policy.c    2009-09-10 16:11:43.000000000 +0200
-@@ -63,7 +63,7 @@ static int xfrm6_get_saddr(struct net *n
+@@ -81,6 +82,10 @@ static struct sock *__udp6_lib_lookup(st
+                               if (!ipv6_addr_equal(&np->rcv_saddr, daddr))
+                                       continue;
+                               score++;
++                      } else {
++                              /* block non nx_info ips */
++                              if (!v6_addr_in_nx_info(sk->sk_nx_info, daddr, -1))
++                                      continue;
+                       }
+                       if (!ipv6_addr_any(&np->daddr)) {
+                               if (!ipv6_addr_equal(&np->daddr, saddr))
+diff -NurpP --minimal linux-2.6.27.33/net/ipv6/xfrm6_policy.c linux-2.6.27.33-vs2.3.0.36.6/net/ipv6/xfrm6_policy.c
+--- linux-2.6.27.33/net/ipv6/xfrm6_policy.c    2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/ipv6/xfrm6_policy.c       2008-10-13 14:54:20.000000000 +0200
+@@ -61,7 +61,7 @@ static int xfrm6_get_saddr(xfrm_address_
        dev = ip6_dst_idev(dst)->dev;
        ipv6_dev_get_saddr(dev_net(dev), dev,
                           (struct in6_addr *)&daddr->a6, 0,
@@ -28744,9 +27984,21 @@ diff -NurpP --minimal linux-2.6.31/net/ipv6/xfrm6_policy.c linux-2.6.31-vs2.3.0.
        dst_release(dst);
        return 0;
  }
-diff -NurpP --minimal linux-2.6.31/net/netlink/af_netlink.c linux-2.6.31-vs2.3.0.36.14-pre8/net/netlink/af_netlink.c
---- linux-2.6.31/net/netlink/af_netlink.c      2009-09-10 15:26:30.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/netlink/af_netlink.c   2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/net/Kconfig linux-2.6.27.33-vs2.3.0.36.6/net/Kconfig
+--- linux-2.6.27.33/net/Kconfig        2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/Kconfig   2008-11-20 15:21:32.000000000 +0100
+@@ -27,7 +27,7 @@ menu "Networking options"
+ config NET_NS
+       bool "Network namespace support"
+       default n
+-      depends on EXPERIMENTAL && !SYSFS && NAMESPACES
++      depends on EXPERIMENTAL && NAMESPACES
+       help
+         Allow user space to create what appear to be multiple instances
+         of the network stack.
+diff -NurpP --minimal linux-2.6.27.33/net/netlink/af_netlink.c linux-2.6.27.33-vs2.3.0.36.6/net/netlink/af_netlink.c
+--- linux-2.6.27.33/net/netlink/af_netlink.c   2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/netlink/af_netlink.c      2008-10-13 14:54:20.000000000 +0200
 @@ -55,6 +55,9 @@
  #include <linux/types.h>
  #include <linux/audit.h>
@@ -28757,7 +28009,7 @@ diff -NurpP --minimal linux-2.6.31/net/netlink/af_netlink.c linux-2.6.31-vs2.3.0
  
  #include <net/net_namespace.h>
  #include <net/sock.h>
-@@ -1831,6 +1834,8 @@ static struct sock *netlink_seq_socket_i
+@@ -1761,6 +1764,8 @@ static struct sock *netlink_seq_socket_i
                        sk_for_each(s, node, &hash->table[j]) {
                                if (sock_net(s) != seq_file_net(seq))
                                        continue;
@@ -28766,7 +28018,7 @@ diff -NurpP --minimal linux-2.6.31/net/netlink/af_netlink.c linux-2.6.31-vs2.3.0
                                if (off == pos) {
                                        iter->link = i;
                                        iter->hash_idx = j;
-@@ -1865,7 +1870,8 @@ static void *netlink_seq_next(struct seq
+@@ -1795,7 +1800,8 @@ static void *netlink_seq_next(struct seq
        s = v;
        do {
                s = sk_next(s);
@@ -28776,7 +28028,7 @@ diff -NurpP --minimal linux-2.6.31/net/netlink/af_netlink.c linux-2.6.31-vs2.3.0
        if (s)
                return s;
  
-@@ -1877,7 +1883,8 @@ static void *netlink_seq_next(struct seq
+@@ -1807,7 +1813,8 @@ static void *netlink_seq_next(struct seq
  
                for (; j <= hash->mask; j++) {
                        s = sk_head(&hash->table[j]);
@@ -28786,23 +28038,23 @@ diff -NurpP --minimal linux-2.6.31/net/netlink/af_netlink.c linux-2.6.31-vs2.3.0
                                s = sk_next(s);
                        if (s) {
                                iter->link = i;
-diff -NurpP --minimal linux-2.6.31/net/sctp/ipv6.c linux-2.6.31-vs2.3.0.36.14-pre8/net/sctp/ipv6.c
---- linux-2.6.31/net/sctp/ipv6.c       2009-09-10 15:26:31.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/sctp/ipv6.c    2009-09-10 16:11:43.000000000 +0200
-@@ -316,7 +316,8 @@ static void sctp_v6_get_saddr(struct sct
+diff -NurpP --minimal linux-2.6.27.33/net/sctp/ipv6.c linux-2.6.27.33-vs2.3.0.36.6/net/sctp/ipv6.c
+--- linux-2.6.27.33/net/sctp/ipv6.c    2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/sctp/ipv6.c       2008-10-13 14:54:20.000000000 +0200
+@@ -323,7 +323,8 @@ static void sctp_v6_get_saddr(struct sct
                                   dst ? ip6_dst_idev(dst)->dev : NULL,
                                   &daddr->v6.sin6_addr,
                                   inet6_sk(&sk->inet.sk)->srcprefs,
 -                                 &saddr->v6.sin6_addr);
 +                                 &saddr->v6.sin6_addr,
 +                                 asoc->base.sk->sk_nx_info);
-               SCTP_DEBUG_PRINTK("saddr from ipv6_get_saddr: %pI6\n",
-                                 &saddr->v6.sin6_addr);
+               SCTP_DEBUG_PRINTK("saddr from ipv6_get_saddr: " NIP6_FMT "\n",
+                                 NIP6(saddr->v6.sin6_addr));
                return;
-diff -NurpP --minimal linux-2.6.31/net/socket.c linux-2.6.31-vs2.3.0.36.14-pre8/net/socket.c
---- linux-2.6.31/net/socket.c  2009-09-10 15:26:31.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/socket.c       2009-09-10 16:11:43.000000000 +0200
-@@ -95,6 +95,10 @@
+diff -NurpP --minimal linux-2.6.27.33/net/socket.c linux-2.6.27.33-vs2.3.0.36.6/net/socket.c
+--- linux-2.6.27.33/net/socket.c       2009-09-13 16:17:02.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/socket.c  2009-08-17 19:07:36.000000000 +0200
+@@ -96,6 +96,10 @@
  
  #include <net/sock.h>
  #include <linux/netfilter.h>
@@ -28813,7 +28065,7 @@ diff -NurpP --minimal linux-2.6.31/net/socket.c linux-2.6.31-vs2.3.0.36.14-pre8/
  
  static int sock_no_open(struct inode *irrelevant, struct file *dontcare);
  static ssize_t sock_aio_read(struct kiocb *iocb, const struct iovec *iov,
-@@ -559,7 +563,7 @@ static inline int __sock_sendmsg(struct 
+@@ -550,7 +554,7 @@ static inline int __sock_sendmsg(struct 
                                 struct msghdr *msg, size_t size)
  {
        struct sock_iocb *si = kiocb_to_siocb(iocb);
@@ -28822,7 +28074,7 @@ diff -NurpP --minimal linux-2.6.31/net/socket.c linux-2.6.31-vs2.3.0.36.14-pre8/
  
        si->sock = sock;
        si->scm = NULL;
-@@ -570,7 +574,22 @@ static inline int __sock_sendmsg(struct 
+@@ -561,7 +565,22 @@ static inline int __sock_sendmsg(struct 
        if (err)
                return err;
  
@@ -28846,7 +28098,7 @@ diff -NurpP --minimal linux-2.6.31/net/socket.c linux-2.6.31-vs2.3.0.36.14-pre8/
  }
  
  int sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
-@@ -671,7 +690,7 @@ EXPORT_SYMBOL_GPL(__sock_recv_timestamp)
+@@ -630,7 +649,7 @@ EXPORT_SYMBOL_GPL(__sock_recv_timestamp)
  static inline int __sock_recvmsg(struct kiocb *iocb, struct socket *sock,
                                 struct msghdr *msg, size_t size, int flags)
  {
@@ -28855,7 +28107,7 @@ diff -NurpP --minimal linux-2.6.31/net/socket.c linux-2.6.31-vs2.3.0.36.14-pre8/
        struct sock_iocb *si = kiocb_to_siocb(iocb);
  
        si->sock = sock;
-@@ -684,7 +703,18 @@ static inline int __sock_recvmsg(struct 
+@@ -643,7 +662,18 @@ static inline int __sock_recvmsg(struct 
        if (err)
                return err;
  
@@ -28875,7 +28127,7 @@ diff -NurpP --minimal linux-2.6.31/net/socket.c linux-2.6.31-vs2.3.0.36.14-pre8/
  }
  
  int sock_recvmsg(struct socket *sock, struct msghdr *msg,
-@@ -1155,6 +1185,13 @@ static int __sock_create(struct net *net
+@@ -1108,6 +1138,13 @@ static int __sock_create(struct net *net
        if (type < 0 || type >= SOCK_MAX)
                return -EINVAL;
  
@@ -28889,7 +28141,7 @@ diff -NurpP --minimal linux-2.6.31/net/socket.c linux-2.6.31-vs2.3.0.36.14-pre8/
        /* Compatibility.
  
           This uglymoron is moved from INET layer to here to avoid
-@@ -1287,6 +1324,7 @@ SYSCALL_DEFINE3(socket, int, family, int
+@@ -1240,6 +1277,7 @@ SYSCALL_DEFINE3(socket, int, family, int
        if (retval < 0)
                goto out;
  
@@ -28897,7 +28149,7 @@ diff -NurpP --minimal linux-2.6.31/net/socket.c linux-2.6.31-vs2.3.0.36.14-pre8/
        retval = sock_map_fd(sock, flags & (O_CLOEXEC | O_NONBLOCK));
        if (retval < 0)
                goto out_release;
-@@ -1328,10 +1366,12 @@ SYSCALL_DEFINE4(socketpair, int, family,
+@@ -1281,10 +1319,12 @@ SYSCALL_DEFINE4(socketpair, int, family,
        err = sock_create(family, type, protocol, &sock1);
        if (err < 0)
                goto out;
@@ -28910,9 +28162,9 @@ diff -NurpP --minimal linux-2.6.31/net/socket.c linux-2.6.31-vs2.3.0.36.14-pre8/
  
        err = sock1->ops->socketpair(sock1, sock2);
        if (err < 0)
-diff -NurpP --minimal linux-2.6.31/net/sunrpc/auth.c linux-2.6.31-vs2.3.0.36.14-pre8/net/sunrpc/auth.c
---- linux-2.6.31/net/sunrpc/auth.c     2009-03-24 14:22:48.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/sunrpc/auth.c  2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/net/sunrpc/auth.c linux-2.6.27.33-vs2.3.0.36.6/net/sunrpc/auth.c
+--- linux-2.6.27.33/net/sunrpc/auth.c  2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/sunrpc/auth.c     2008-10-13 14:54:20.000000000 +0200
 @@ -14,6 +14,7 @@
  #include <linux/hash.h>
  #include <linux/sunrpc/clnt.h>
@@ -28921,15 +28173,15 @@ diff -NurpP --minimal linux-2.6.31/net/sunrpc/auth.c linux-2.6.31-vs2.3.0.36.14-
  
  #ifdef RPC_DEBUG
  # define RPCDBG_FACILITY      RPCDBG_AUTH
-@@ -360,6 +361,7 @@ rpcauth_lookupcred(struct rpc_auth *auth
-       memset(&acred, 0, sizeof(acred));
-       acred.uid = cred->fsuid;
-       acred.gid = cred->fsgid;
-+      acred.tag = dx_current_tag();
-       acred.group_info = get_group_info(((struct cred *)cred)->group_info);
-       ret = auth->au_ops->lookup_cred(auth, &acred, flags);
-@@ -400,6 +402,7 @@ rpcauth_bind_root_cred(struct rpc_task *
+@@ -353,6 +354,7 @@ rpcauth_lookupcred(struct rpc_auth *auth
+       struct auth_cred acred = {
+               .uid = current->fsuid,
+               .gid = current->fsgid,
++              .tag = dx_current_tag(),
+               .group_info = current->group_info,
+       };
+       struct rpc_cred *ret;
+@@ -398,6 +400,7 @@ rpcauth_bind_root_cred(struct rpc_task *
        struct auth_cred acred = {
                .uid = 0,
                .gid = 0,
@@ -28937,9 +28189,9 @@ diff -NurpP --minimal linux-2.6.31/net/sunrpc/auth.c linux-2.6.31-vs2.3.0.36.14-
        };
        struct rpc_cred *ret;
  
-diff -NurpP --minimal linux-2.6.31/net/sunrpc/auth_unix.c linux-2.6.31-vs2.3.0.36.14-pre8/net/sunrpc/auth_unix.c
---- linux-2.6.31/net/sunrpc/auth_unix.c        2008-12-25 00:26:37.000000000 +0100
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/sunrpc/auth_unix.c     2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/net/sunrpc/auth_unix.c linux-2.6.27.33-vs2.3.0.36.6/net/sunrpc/auth_unix.c
+--- linux-2.6.27.33/net/sunrpc/auth_unix.c     2008-10-13 14:52:09.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/sunrpc/auth_unix.c        2008-10-13 14:54:20.000000000 +0200
 @@ -11,12 +11,14 @@
  #include <linux/module.h>
  #include <linux/sunrpc/clnt.h>
@@ -28998,10 +28250,10 @@ diff -NurpP --minimal linux-2.6.31/net/sunrpc/auth_unix.c linux-2.6.31-vs2.3.0.3
        hold = p++;
        for (i = 0; i < 16 && cred->uc_gids[i] != (gid_t) NOGROUP; i++)
                *p++ = htonl((u32) cred->uc_gids[i]);
-diff -NurpP --minimal linux-2.6.31/net/sunrpc/clnt.c linux-2.6.31-vs2.3.0.36.14-pre8/net/sunrpc/clnt.c
---- linux-2.6.31/net/sunrpc/clnt.c     2009-09-10 15:26:31.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/sunrpc/clnt.c  2009-09-10 16:11:43.000000000 +0200
-@@ -31,6 +31,7 @@
+diff -NurpP --minimal linux-2.6.27.33/net/sunrpc/clnt.c linux-2.6.27.33-vs2.3.0.36.6/net/sunrpc/clnt.c
+--- linux-2.6.27.33/net/sunrpc/clnt.c  2009-09-13 16:17:02.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/sunrpc/clnt.c     2009-09-13 16:19:24.000000000 +0200
+@@ -32,6 +32,7 @@
  #include <linux/utsname.h>
  #include <linux/workqueue.h>
  #include <linux/in6.h>
@@ -29009,7 +28261,7 @@ diff -NurpP --minimal linux-2.6.31/net/sunrpc/clnt.c linux-2.6.31-vs2.3.0.36.14-
  
  #include <linux/sunrpc/clnt.h>
  #include <linux/sunrpc/rpc_pipe_fs.h>
-@@ -339,6 +340,9 @@ struct rpc_clnt *rpc_create(struct rpc_c
+@@ -327,6 +328,9 @@ struct rpc_clnt *rpc_create(struct rpc_c
        if (!(args->flags & RPC_CLNT_CREATE_QUIET))
                clnt->cl_chatty = 1;
  
@@ -29019,9 +28271,9 @@ diff -NurpP --minimal linux-2.6.31/net/sunrpc/clnt.c linux-2.6.31-vs2.3.0.36.14-
        return clnt;
  }
  EXPORT_SYMBOL_GPL(rpc_create);
-diff -NurpP --minimal linux-2.6.31/net/unix/af_unix.c linux-2.6.31-vs2.3.0.36.14-pre8/net/unix/af_unix.c
---- linux-2.6.31/net/unix/af_unix.c    2009-09-10 15:26:31.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/unix/af_unix.c 2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/net/unix/af_unix.c linux-2.6.27.33-vs2.3.0.36.6/net/unix/af_unix.c
+--- linux-2.6.27.33/net/unix/af_unix.c 2009-09-13 16:17:02.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/unix/af_unix.c    2009-02-03 17:59:04.000000000 +0100
 @@ -114,6 +114,8 @@
  #include <linux/mount.h>
  #include <net/checksum.h>
@@ -29040,7 +28292,7 @@ diff -NurpP --minimal linux-2.6.31/net/unix/af_unix.c linux-2.6.31-vs2.3.0.36.14
                if (u->addr->len == len &&
                    !memcmp(u->addr->name, sunname, len))
                        goto found;
-@@ -2109,6 +2113,8 @@ static struct sock *unix_seq_idx(struct 
+@@ -2103,6 +2107,8 @@ static struct sock *unix_seq_idx(struct 
        for (s = first_unix_socket(&iter->i); s; s = next_unix_socket(&iter->i, s)) {
                if (sock_net(s) != seq_file_net(seq))
                        continue;
@@ -29049,7 +28301,7 @@ diff -NurpP --minimal linux-2.6.31/net/unix/af_unix.c linux-2.6.31-vs2.3.0.36.14
                if (off == pos)
                        return s;
                ++off;
-@@ -2133,7 +2139,8 @@ static void *unix_seq_next(struct seq_fi
+@@ -2128,7 +2134,8 @@ static void *unix_seq_next(struct seq_fi
                sk = first_unix_socket(&iter->i);
        else
                sk = next_unix_socket(&iter->i, sk);
@@ -29059,9 +28311,9 @@ diff -NurpP --minimal linux-2.6.31/net/unix/af_unix.c linux-2.6.31-vs2.3.0.36.14
                sk = next_unix_socket(&iter->i, sk);
        return sk;
  }
-diff -NurpP --minimal linux-2.6.31/net/x25/af_x25.c linux-2.6.31-vs2.3.0.36.14-pre8/net/x25/af_x25.c
---- linux-2.6.31/net/x25/af_x25.c      2009-09-10 15:26:31.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/net/x25/af_x25.c   2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/net/x25/af_x25.c linux-2.6.27.33-vs2.3.0.36.6/net/x25/af_x25.c
+--- linux-2.6.27.33/net/x25/af_x25.c   2009-09-13 16:17:02.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/net/x25/af_x25.c      2009-08-01 01:45:51.000000000 +0200
 @@ -519,7 +519,10 @@ static int x25_create(struct net *net, s
  
        x25 = x25_sk(sk);
@@ -29074,10 +28326,10 @@ diff -NurpP --minimal linux-2.6.31/net/x25/af_x25.c linux-2.6.31-vs2.3.0.36.14-p
  
        x25_init_timers(sk);
  
-diff -NurpP --minimal linux-2.6.31/scripts/checksyscalls.sh linux-2.6.31-vs2.3.0.36.14-pre8/scripts/checksyscalls.sh
---- linux-2.6.31/scripts/checksyscalls.sh      2009-09-10 15:26:31.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/scripts/checksyscalls.sh   2009-09-10 16:11:43.000000000 +0200
-@@ -194,7 +194,6 @@ cat << EOF
+diff -NurpP --minimal linux-2.6.27.33/scripts/checksyscalls.sh linux-2.6.27.33-vs2.3.0.36.6/scripts/checksyscalls.sh
+--- linux-2.6.27.33/scripts/checksyscalls.sh   2008-07-13 23:51:29.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/scripts/checksyscalls.sh      2008-10-13 14:54:20.000000000 +0200
+@@ -108,7 +108,6 @@ cat << EOF
  #define __IGNORE_afs_syscall
  #define __IGNORE_getpmsg
  #define __IGNORE_putpmsg
@@ -29085,39 +28337,26 @@ diff -NurpP --minimal linux-2.6.31/scripts/checksyscalls.sh linux-2.6.31-vs2.3.0
  EOF
  }
  
-diff -NurpP --minimal linux-2.6.31/security/commoncap.c linux-2.6.31-vs2.3.0.36.14-pre8/security/commoncap.c
---- linux-2.6.31/security/commoncap.c  2009-09-10 15:26:32.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/security/commoncap.c       2009-09-10 16:32:54.000000000 +0200
-@@ -27,6 +27,7 @@
+diff -NurpP --minimal linux-2.6.27.33/security/commoncap.c linux-2.6.27.33-vs2.3.0.36.6/security/commoncap.c
+--- linux-2.6.27.33/security/commoncap.c       2009-09-13 16:17:02.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/security/commoncap.c  2009-03-09 15:36:36.000000000 +0100
+@@ -26,10 +26,11 @@
  #include <linux/sched.h>
  #include <linux/prctl.h>
  #include <linux/securebits.h>
 +#include <linux/vs_context.h>
  
- /*
-  * If a non-root user executes a setuid-root binary in
-@@ -52,7 +53,7 @@ static void warn_setuid_and_fcaps_mixed(
  int cap_netlink_send(struct sock *sk, struct sk_buff *skb)
  {
--      NETLINK_CB(skb).eff_cap = current_cap();
-+      NETLINK_CB(skb).eff_cap = vx_mbcaps(current_cap());
-       return 0;
- }
-@@ -62,6 +63,7 @@ int cap_netlink_recv(struct sk_buff *skb
-               return -EPERM;
+-      NETLINK_CB(skb).eff_cap = current->cap_effective;
++      NETLINK_CB(skb).eff_cap = vx_mbcaps(current->cap_effective);
        return 0;
  }
-+
- EXPORT_SYMBOL(cap_netlink_recv);
  
- /**
-@@ -82,7 +84,22 @@ EXPORT_SYMBOL(cap_netlink_recv);
- int cap_capable(struct task_struct *tsk, const struct cred *cred, int cap,
-               int audit)
+@@ -50,9 +51,24 @@ EXPORT_SYMBOL(cap_netlink_recv);
+  */
+ int cap_capable (struct task_struct *tsk, int cap)
  {
--      return cap_raised(cred->cap_effective, cap) ? 0 : -EPERM;
 +      struct vx_info *vxi = tsk->vx_info;
 +
 +#if 0
@@ -29129,26 +28368,29 @@ diff -NurpP --minimal linux-2.6.31/security/commoncap.c linux-2.6.31-vs2.3.0.36.
 +
 +      /* special case SETUP */
 +      if (vx_info_flags(vxi, VXF_STATE_SETUP, 0) &&
-+              /* FIXME: maybe use cred instead? */
-+              cap_raised(tsk->cred->cap_effective, cap))
++              cap_raised(tsk->cap_effective, cap))
 +              return 0;
 +
-+      return vx_cap_raised(vxi, cred->cap_effective, cap) ? 0 : -EPERM;
+       /* Derived from include/linux/sched.h:capable. */
+-      if (cap_raised(tsk->cap_effective, cap))
++      if (vx_cap_raised(vxi, tsk->cap_effective, cap))
+               return 0;
++
+       return -EPERM;
  }
  
- /**
-@@ -618,7 +635,7 @@ int cap_inode_setxattr(struct dentry *de
-       if (!strncmp(name, XATTR_SECURITY_PREFIX,
+@@ -420,7 +436,7 @@ int cap_inode_setxattr(struct dentry *de
+               return 0;
+       } else if (!strncmp(name, XATTR_SECURITY_PREFIX,
                     sizeof(XATTR_SECURITY_PREFIX) - 1)  &&
 -          !capable(CAP_SYS_ADMIN))
 +              !vx_capable(CAP_SYS_ADMIN, VXC_FS_SECURITY))
                return -EPERM;
        return 0;
  }
-@@ -962,7 +979,8 @@ error:
-  */
- int cap_syslog(int type)
+@@ -696,7 +712,8 @@ void cap_task_reparent_to_init (struct t
+ int cap_syslog (int type)
  {
 -      if ((type != 3 && type != 10) && !capable(CAP_SYS_ADMIN))
 +      if ((type != 3 && type != 10) &&
@@ -29156,14 +28398,9 @@ diff -NurpP --minimal linux-2.6.31/security/commoncap.c linux-2.6.31-vs2.3.0.36.
                return -EPERM;
        return 0;
  }
-@@ -1014,3 +1032,4 @@ int cap_file_mmap(struct file *file, uns
-       }
-       return ret;
- }
-+
-diff -NurpP --minimal linux-2.6.31/security/selinux/hooks.c linux-2.6.31-vs2.3.0.36.14-pre8/security/selinux/hooks.c
---- linux-2.6.31/security/selinux/hooks.c      2009-09-10 15:26:32.000000000 +0200
-+++ linux-2.6.31-vs2.3.0.36.14-pre8/security/selinux/hooks.c   2009-09-10 16:11:43.000000000 +0200
+diff -NurpP --minimal linux-2.6.27.33/security/selinux/hooks.c linux-2.6.27.33-vs2.3.0.36.6/security/selinux/hooks.c
+--- linux-2.6.27.33/security/selinux/hooks.c   2009-09-13 16:17:02.000000000 +0200
++++ linux-2.6.27.33-vs2.3.0.36.6/security/selinux/hooks.c      2009-06-15 17:22:10.000000000 +0200
 @@ -64,7 +64,6 @@
  #include <linux/dccp.h>
  #include <linux/quota.h>
This page took 2.63512 seconds and 4 git commands to generate.