/[vps]/vserver-sources/2.0.2_rc13-r1/4910_vs2.0.2-rc13.patch
Gentoo

Diff of /vserver-sources/2.0.2_rc13-r1/4910_vs2.0.2-rc13.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

vserver-sources/2.0.2_rc13/4910_vs2.0.2-rc13.patch Revision 292 vserver-sources/2.0.2_rc13-r1/4910_vs2.0.2-rc13.patch Revision 293
1Index: vserver-sources-2.0.2_2.6.15/Makefile 1Index: linux-2.6.16/Makefile
2=================================================================== 2===================================================================
3--- vserver-sources-2.0.2_2.6.15.orig/Makefile 3--- linux-2.6.16.orig/Makefile
4+++ vserver-sources-2.0.2_2.6.15/Makefile 4+++ linux-2.6.16/Makefile
5@@ -1,7 +1,7 @@ 5@@ -1,7 +1,7 @@
6 VERSION = 2 6 VERSION = 2
7 PATCHLEVEL = 6 7 PATCHLEVEL = 6
8 SUBLEVEL = 15 8 SUBLEVEL = 16
9-EXTRAVERSION = 9-EXTRAVERSION =
10+EXTRAVERSION = -vs2.0.2_rc13-gentoo 10+EXTRAVERSION = -vs2.0.2-rc13-gentoo
11 NAME=Sliding Snow Leopard 11 NAME=Sliding Snow Leopard
12 12
13 # *DOCUMENTATION* 13 # *DOCUMENTATION*
14Index: vserver-sources-2.0.2_2.6.15/arch/alpha/Kconfig 14Index: linux-2.6.16/arch/alpha/Kconfig
15=================================================================== 15===================================================================
16--- vserver-sources-2.0.2_2.6.15.orig/arch/alpha/Kconfig 16--- linux-2.6.16.orig/arch/alpha/Kconfig
17+++ vserver-sources-2.0.2_2.6.15/arch/alpha/Kconfig 17+++ linux-2.6.16/arch/alpha/Kconfig
18@@ -635,6 +635,8 @@ source "arch/alpha/oprofile/Kconfig" 18@@ -645,6 +645,8 @@ source "arch/alpha/oprofile/Kconfig"
19 19
20 source "arch/alpha/Kconfig.debug" 20 source "arch/alpha/Kconfig.debug"
21 21
22+source "kernel/vserver/Kconfig" 22+source "kernel/vserver/Kconfig"
23+ 23+
24 source "security/Kconfig" 24 source "security/Kconfig"
25 25
26 source "crypto/Kconfig" 26 source "crypto/Kconfig"
27Index: vserver-sources-2.0.2_2.6.15/arch/alpha/kernel/entry.S 27Index: linux-2.6.16/arch/alpha/kernel/entry.S
28=================================================================== 28===================================================================
29--- vserver-sources-2.0.2_2.6.15.orig/arch/alpha/kernel/entry.S 29--- linux-2.6.16.orig/arch/alpha/kernel/entry.S
30+++ vserver-sources-2.0.2_2.6.15/arch/alpha/kernel/entry.S 30+++ linux-2.6.16/arch/alpha/kernel/entry.S
31@@ -874,22 +874,15 @@ sys_getxgid: 31@@ -874,24 +874,15 @@ sys_getxgid:
32 .globl sys_getxpid 32 .globl sys_getxpid
33 .ent sys_getxpid 33 .ent sys_getxpid
34 sys_getxpid: 34 sys_getxpid:
35+ lda $sp, -16($sp) 35+ lda $sp, -16($sp)
36+ stq $26, 0($sp) 36+ stq $26, 0($sp)
37 .prologue 0 37 .prologue 0
38- ldq $2, TI_TASK($8) 38- ldq $2, TI_TASK($8)
39 39
40- /* See linux/kernel/timer.c sys_getppid for discussion 40- /* See linux/kernel/timer.c sys_getppid for discussion
41- about this loop. */ 41- about this loop. */
42- ldq $3, TASK_GROUP_LEADER($2)
42- ldq $3, TASK_REAL_PARENT($2) 43- ldq $4, TASK_REAL_PARENT($3)
44- ldl $0, TASK_TGID($2)
43-1: ldl $1, TASK_TGID($3) 45-1: ldl $1, TASK_TGID($4)
44-#ifdef CONFIG_SMP 46-#ifdef CONFIG_SMP
45- mov $3, $4 47- mov $4, $5
46- mb 48- mb
49- ldq $3, TASK_GROUP_LEADER($2)
47- ldq $3, TASK_REAL_PARENT($2) 50- ldq $4, TASK_REAL_PARENT($3)
48- cmpeq $3, $4, $4 51- cmpeq $4, $5, $5
49- beq $4, 1b 52- beq $5, 1b
50-#endif 53-#endif
51- stq $1, 80($sp) 54- stq $1, 80($sp)
52- ldl $0, TASK_TGID($2)
53+ lda $16, 96($sp) 55+ lda $16, 96($sp)
54+ jsr $26, do_getxpid 56+ jsr $26, do_getxpid
55+ ldq $26, 0($sp) 57+ ldq $26, 0($sp)
56+ 58+
57+ lda $sp, 16($sp) 59+ lda $sp, 16($sp)
58 ret 60 ret
59 .end sys_getxpid 61 .end sys_getxpid
60 62
61Index: vserver-sources-2.0.2_2.6.15/arch/alpha/kernel/ptrace.c 63Index: linux-2.6.16/arch/alpha/kernel/ptrace.c
62=================================================================== 64===================================================================
63--- vserver-sources-2.0.2_2.6.15.orig/arch/alpha/kernel/ptrace.c 65--- linux-2.6.16.orig/arch/alpha/kernel/ptrace.c
64+++ vserver-sources-2.0.2_2.6.15/arch/alpha/kernel/ptrace.c 66+++ linux-2.6.16/arch/alpha/kernel/ptrace.c
65@@ -15,6 +15,7 @@ 67@@ -15,6 +15,7 @@
66 #include <linux/slab.h> 68 #include <linux/slab.h>
67 #include <linux/security.h> 69 #include <linux/security.h>
68 #include <linux/signal.h> 70 #include <linux/signal.h>
69+#include <linux/vs_cvirt.h> 71+#include <linux/vs_cvirt.h>
70 72
71 #include <asm/uaccess.h> 73 #include <asm/uaccess.h>
72 #include <asm/pgtable.h> 74 #include <asm/pgtable.h>
73@@ -289,6 +290,8 @@ do_sys_ptrace(long request, long pid, lo 75@@ -283,6 +284,11 @@ do_sys_ptrace(long request, long pid, lo
74 read_unlock(&tasklist_lock);
75 if (!child)
76 goto out_notsk; 76 goto out_notsk;
77 }
78
77+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT)) 79+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT)) {
80+ ret = -EPERM;
78+ goto out; 81+ goto out;
79 82+ }
83+
80 if (request == PTRACE_ATTACH) { 84 if (request == PTRACE_ATTACH) {
81 ret = ptrace_attach(child); 85 ret = ptrace_attach(child);
82Index: vserver-sources-2.0.2_2.6.15/arch/alpha/kernel/systbls.S 86 goto out;
87Index: linux-2.6.16/arch/alpha/kernel/systbls.S
83=================================================================== 88===================================================================
84--- vserver-sources-2.0.2_2.6.15.orig/arch/alpha/kernel/systbls.S 89--- linux-2.6.16.orig/arch/alpha/kernel/systbls.S
85+++ vserver-sources-2.0.2_2.6.15/arch/alpha/kernel/systbls.S 90+++ linux-2.6.16/arch/alpha/kernel/systbls.S
86@@ -447,7 +447,7 @@ sys_call_table: 91@@ -447,7 +447,7 @@ sys_call_table:
87 .quad sys_stat64 /* 425 */ 92 .quad sys_stat64 /* 425 */
88 .quad sys_lstat64 93 .quad sys_lstat64
89 .quad sys_fstat64 94 .quad sys_fstat64
90- .quad sys_ni_syscall /* sys_vserver */ 95- .quad sys_ni_syscall /* sys_vserver */
91+ .quad sys_vserver /* sys_vserver */ 96+ .quad sys_vserver /* sys_vserver */
92 .quad sys_ni_syscall /* sys_mbind */ 97 .quad sys_ni_syscall /* sys_mbind */
93 .quad sys_ni_syscall /* sys_get_mempolicy */ 98 .quad sys_ni_syscall /* sys_get_mempolicy */
94 .quad sys_ni_syscall /* sys_set_mempolicy */ 99 .quad sys_ni_syscall /* sys_set_mempolicy */
95Index: vserver-sources-2.0.2_2.6.15/arch/alpha/mm/init.c 100Index: linux-2.6.16/arch/alpha/mm/init.c
96=================================================================== 101===================================================================
97--- vserver-sources-2.0.2_2.6.15.orig/arch/alpha/mm/init.c 102--- linux-2.6.16.orig/arch/alpha/mm/init.c
98+++ vserver-sources-2.0.2_2.6.15/arch/alpha/mm/init.c 103+++ linux-2.6.16/arch/alpha/mm/init.c
99@@ -20,6 +20,7 @@ 104@@ -21,6 +21,7 @@
100 #include <linux/init.h> 105 #include <linux/init.h>
101 #include <linux/bootmem.h> /* max_low_pfn */ 106 #include <linux/bootmem.h> /* max_low_pfn */
102 #include <linux/vmalloc.h> 107 #include <linux/vmalloc.h>
103+#include <linux/pagemap.h> 108+#include <linux/pagemap.h>
104 109
105 #include <asm/system.h> 110 #include <asm/system.h>
106 #include <asm/uaccess.h> 111 #include <asm/uaccess.h>
107Index: vserver-sources-2.0.2_2.6.15/arch/arm/Kconfig 112Index: linux-2.6.16/arch/arm/Kconfig
108=================================================================== 113===================================================================
109--- vserver-sources-2.0.2_2.6.15.orig/arch/arm/Kconfig 114--- linux-2.6.16.orig/arch/arm/Kconfig
110+++ vserver-sources-2.0.2_2.6.15/arch/arm/Kconfig 115+++ linux-2.6.16/arch/arm/Kconfig
111@@ -757,6 +757,8 @@ source "arch/arm/oprofile/Kconfig" 116@@ -828,6 +828,8 @@ source "arch/arm/oprofile/Kconfig"
112 117
113 source "arch/arm/Kconfig.debug" 118 source "arch/arm/Kconfig.debug"
114 119
115+source "kernel/vserver/Kconfig" 120+source "kernel/vserver/Kconfig"
116+ 121+
117 source "security/Kconfig" 122 source "security/Kconfig"
118 123
119 source "crypto/Kconfig" 124 source "crypto/Kconfig"
120Index: vserver-sources-2.0.2_2.6.15/arch/arm/kernel/calls.S 125Index: linux-2.6.16/arch/arm/kernel/calls.S
121=================================================================== 126===================================================================
122--- vserver-sources-2.0.2_2.6.15.orig/arch/arm/kernel/calls.S 127--- linux-2.6.16.orig/arch/arm/kernel/calls.S
123+++ vserver-sources-2.0.2_2.6.15/arch/arm/kernel/calls.S 128+++ linux-2.6.16/arch/arm/kernel/calls.S
124@@ -327,7 +327,7 @@ __syscall_start: 129@@ -322,7 +322,7 @@
125 /* 310 */ .long sys_request_key 130 /* 310 */ CALL(sys_request_key)
126 .long sys_keyctl 131 CALL(sys_keyctl)
127 .long sys_semtimedop 132 CALL(ABI(sys_semtimedop, sys_oabi_semtimedop))
128-/* vserver */ .long sys_ni_syscall 133-/* vserver */ CALL(sys_ni_syscall)
129+ .long sys_vserver 134+ CALL(sys_vserver)
130 .long sys_ioprio_set 135 CALL(sys_ioprio_set)
131 /* 315 */ .long sys_ioprio_get 136 /* 315 */ CALL(sys_ioprio_get)
132 .long sys_inotify_init 137 CALL(sys_inotify_init)
133Index: vserver-sources-2.0.2_2.6.15/arch/arm26/Kconfig 138Index: linux-2.6.16/arch/arm26/Kconfig
134=================================================================== 139===================================================================
135--- vserver-sources-2.0.2_2.6.15.orig/arch/arm26/Kconfig 140--- linux-2.6.16.orig/arch/arm26/Kconfig
136+++ vserver-sources-2.0.2_2.6.15/arch/arm26/Kconfig 141+++ linux-2.6.16/arch/arm26/Kconfig
137@@ -232,6 +232,8 @@ source "drivers/usb/Kconfig" 142@@ -230,6 +230,8 @@ source "drivers/usb/Kconfig"
138 143
139 source "arch/arm26/Kconfig.debug" 144 source "arch/arm26/Kconfig.debug"
140 145
141+source "kernel/vserver/Kconfig" 146+source "kernel/vserver/Kconfig"
142+ 147+
143 source "security/Kconfig" 148 source "security/Kconfig"
144 149
145 source "crypto/Kconfig" 150 source "crypto/Kconfig"
146Index: vserver-sources-2.0.2_2.6.15/arch/arm26/kernel/calls.S 151Index: linux-2.6.16/arch/arm26/kernel/calls.S
147=================================================================== 152===================================================================
148--- vserver-sources-2.0.2_2.6.15.orig/arch/arm26/kernel/calls.S 153--- linux-2.6.16.orig/arch/arm26/kernel/calls.S
149+++ vserver-sources-2.0.2_2.6.15/arch/arm26/kernel/calls.S 154+++ linux-2.6.16/arch/arm26/kernel/calls.S
150@@ -257,6 +257,11 @@ __syscall_start: 155@@ -257,6 +257,11 @@ __syscall_start:
151 .long sys_lremovexattr 156 .long sys_lremovexattr
152 .long sys_fremovexattr 157 .long sys_fremovexattr
153 .long sys_tkill 158 .long sys_tkill
154+ 159+
157+ .endr 162+ .endr
158+ .long sys_vserver /* 313 */ 163+ .long sys_vserver /* 313 */
159 __syscall_end: 164 __syscall_end:
160 165
161 .rept NR_syscalls - (__syscall_end - __syscall_start) / 4 166 .rept NR_syscalls - (__syscall_end - __syscall_start) / 4
162Index: vserver-sources-2.0.2_2.6.15/arch/cris/Kconfig 167Index: linux-2.6.16/arch/arm26/kernel/traps.c
163=================================================================== 168===================================================================
164--- vserver-sources-2.0.2_2.6.15.orig/arch/cris/Kconfig 169--- linux-2.6.16.orig/arch/arm26/kernel/traps.c
165+++ vserver-sources-2.0.2_2.6.15/arch/cris/Kconfig 170+++ linux-2.6.16/arch/arm26/kernel/traps.c
171@@ -186,8 +186,9 @@ NORET_TYPE void die(const char *str, str
172 printk("Internal error: %s: %x\n", str, err);
173 printk("CPU: %d\n", smp_processor_id());
174 show_regs(regs);
175- printk("Process %s (pid: %d, stack limit = 0x%p)\n",
176- current->comm, current->pid, end_of_stack(tsk));
177+ printk("Process %s (pid: %d[#%u], stack limit = 0x%p)\n",
178+ current->comm, current->pid,
179+ current->xid, end_of_stack(tsk));
180
181 if (!user_mode(regs) || in_interrupt()) {
182 __dump_stack(tsk, (unsigned long)(regs + 1));
183Index: linux-2.6.16/arch/cris/Kconfig
184===================================================================
185--- linux-2.6.16.orig/arch/cris/Kconfig
186+++ linux-2.6.16/arch/cris/Kconfig
166@@ -177,6 +177,8 @@ source "drivers/usb/Kconfig" 187@@ -173,6 +173,8 @@ source "drivers/usb/Kconfig"
167 188
168 source "arch/cris/Kconfig.debug" 189 source "arch/cris/Kconfig.debug"
169 190
170+source "kernel/vserver/Kconfig" 191+source "kernel/vserver/Kconfig"
171+ 192+
172 source "security/Kconfig" 193 source "security/Kconfig"
173 194
174 source "crypto/Kconfig" 195 source "crypto/Kconfig"
175Index: vserver-sources-2.0.2_2.6.15/arch/frv/mm/mmu-context.c 196Index: linux-2.6.16/arch/frv/mm/mmu-context.c
176=================================================================== 197===================================================================
177--- vserver-sources-2.0.2_2.6.15.orig/arch/frv/mm/mmu-context.c 198--- linux-2.6.16.orig/arch/frv/mm/mmu-context.c
178+++ vserver-sources-2.0.2_2.6.15/arch/frv/mm/mmu-context.c 199+++ linux-2.6.16/arch/frv/mm/mmu-context.c
179@@ -11,6 +11,7 @@ 200@@ -11,6 +11,7 @@
180 201
181 #include <linux/sched.h> 202 #include <linux/sched.h>
182 #include <linux/mm.h> 203 #include <linux/mm.h>
183+#include <linux/vs_cvirt.h> 204+#include <linux/vs_cvirt.h>
184 #include <asm/tlbflush.h> 205 #include <asm/tlbflush.h>
185 206
186 #define NR_CXN 4096 207 #define NR_CXN 4096
187Index: vserver-sources-2.0.2_2.6.15/arch/h8300/Kconfig 208Index: linux-2.6.16/arch/h8300/Kconfig
188=================================================================== 209===================================================================
189--- vserver-sources-2.0.2_2.6.15.orig/arch/h8300/Kconfig 210--- linux-2.6.16.orig/arch/h8300/Kconfig
190+++ vserver-sources-2.0.2_2.6.15/arch/h8300/Kconfig 211+++ linux-2.6.16/arch/h8300/Kconfig
191@@ -191,6 +191,8 @@ source "fs/Kconfig" 212@@ -191,6 +191,8 @@ source "fs/Kconfig"
192 213
193 source "arch/h8300/Kconfig.debug" 214 source "arch/h8300/Kconfig.debug"
194 215
195+source "kernel/vserver/Kconfig" 216+source "kernel/vserver/Kconfig"
196+ 217+
197 source "security/Kconfig" 218 source "security/Kconfig"
198 219
199 source "crypto/Kconfig" 220 source "crypto/Kconfig"
200Index: vserver-sources-2.0.2_2.6.15/arch/i386/Kconfig 221Index: linux-2.6.16/arch/i386/Kconfig
201=================================================================== 222===================================================================
202--- vserver-sources-2.0.2_2.6.15.orig/arch/i386/Kconfig 223--- linux-2.6.16.orig/arch/i386/Kconfig
203+++ vserver-sources-2.0.2_2.6.15/arch/i386/Kconfig 224+++ linux-2.6.16/arch/i386/Kconfig
204@@ -448,6 +448,46 @@ config HIGHMEM64G 225@@ -466,23 +466,43 @@ choice
226 will also likely make your kernel incompatible with binary-only
227 kernel modules.
205 228
229- If you are not absolutely sure what you are doing, leave this
230- option alone!
231-
232 config VMSPLIT_3G
233- bool "3G/1G user/kernel split"
234- config VMSPLIT_3G_OPT
235- bool "3G/1G user/kernel split (for full 1G low memory)"
236+ bool "3G/1G user/kernel split (Default)"
237+ help
238+ This is the default split of 3GB userspace to 1GB kernel
239+ space, which will result in about 860MB of lowmem.
240+
241+ config VMSPLIT_25G
242+ bool "2.5G/1.5G user/kernel split"
243+ help
244+ This split provides 2.5GB userspace and 1.5GB kernel
245+ space, which will result in about 1370MB of lowmem.
246+
247 config VMSPLIT_2G
248 bool "2G/2G user/kernel split"
249+ help
250+ This split provides 2GB userspace and 2GB kernel
251+ space, which will result in about 1880MB of lowmem.
252+
253+ config VMSPLIT_15G
254+ bool "1.5G/2.5G user/kernel split"
255+ help
256+ This split provides 1.5GB userspace and 2.5GB kernel
257+ space, which will result in about 2390MB of lowmem.
258+
259 config VMSPLIT_1G
260 bool "1G/3G user/kernel split"
261+ help
262+ This split provides 1GB userspace and 3GB kernel
263+ space, which will result in about 2900MB of lowmem.
264+
206 endchoice 265 endchoice
207 266
208+choice 267 config PAGE_OFFSET
209+ prompt "Memory Split User Space" 268 hex
210+ default SPLIT_3GB 269- default 0xB0000000 if VMSPLIT_3G_OPT
211+ help 270- default 0x78000000 if VMSPLIT_2G
212+ A different Userspace/Kernel split allows you to 271+ default 0xA0000000 if VMSPLIT_25G
213+ utilize up to alsmost 3GB of RAM without the requirement 272+ default 0x80000000 if VMSPLIT_2G
214+ for HIGHMEM. It also increases the available lowmem. 273+ default 0x60000000 if VMSPLIT_15G
215+ 274 default 0x40000000 if VMSPLIT_1G
216+config SPLIT_3GB 275 default 0xC0000000
217+ bool "3.0GB/1.0GB Kernel (Default)" 276
218+ help
219+ This is the default split of 3GB userspace to 1GB kernel
220+ space, which will result in about 860MB of lowmem.
221+
222+config SPLIT_25GB
223+ bool "2.5GB/1.5GB Kernel"
224+ help
225+ This split provides 2.5GB userspace and 1.5GB kernel
226+ space, which will result in about 1370MB of lowmem.
227+
228+config SPLIT_2GB
229+ bool "2.0GB/2.0GB Kernel"
230+ help
231+ This split provides 2GB userspace and 2GB kernel
232+ space, which will result in about 1880MB of lowmem.
233+
234+config SPLIT_15GB
235+ bool "1.5GB/2.5GB Kernel"
236+ help
237+ This split provides 1.5GB userspace and 2.5GB kernel
238+ space, which will result in about 2390MB of lowmem.
239+
240+config SPLIT_1GB
241+ bool "1.0GB/3.0GB Kernel"
242+ help
243+ This split provides 1GB userspace and 3GB kernel
244+ space, which will result in about 2900MB of lowmem.
245+
246+endchoice
247+
248 config HIGHMEM
249 bool
250 depends on HIGHMEM64G || HIGHMEM4G
251@@ -1014,6 +1054,8 @@ endmenu 277@@ -1071,6 +1091,8 @@ endmenu
252 278
253 source "arch/i386/Kconfig.debug" 279 source "arch/i386/Kconfig.debug"
254 280
255+source "kernel/vserver/Kconfig" 281+source "kernel/vserver/Kconfig"
256+ 282+
257 source "security/Kconfig" 283 source "security/Kconfig"
258 284
259 source "crypto/Kconfig" 285 source "crypto/Kconfig"
260Index: vserver-sources-2.0.2_2.6.15/arch/i386/boot/compressed/misc.c 286Index: linux-2.6.16/arch/i386/boot/compressed/misc.c
261=================================================================== 287===================================================================
262--- vserver-sources-2.0.2_2.6.15.orig/arch/i386/boot/compressed/misc.c 288--- linux-2.6.16.orig/arch/i386/boot/compressed/misc.c
263+++ vserver-sources-2.0.2_2.6.15/arch/i386/boot/compressed/misc.c 289+++ linux-2.6.16/arch/i386/boot/compressed/misc.c
264@@ -309,7 +309,7 @@ static void setup_normal_output_buffer(v 290@@ -309,7 +309,7 @@ static void setup_normal_output_buffer(v
265 #else 291 #else
266 if ((RM_ALT_MEM_K > RM_EXT_MEM_K ? RM_ALT_MEM_K : RM_EXT_MEM_K) < 1024) error("Less than 2MB of memory"); 292 if ((RM_ALT_MEM_K > RM_EXT_MEM_K ? RM_ALT_MEM_K : RM_EXT_MEM_K) < 1024) error("Less than 2MB of memory");
267 #endif 293 #endif
268- output_data = (char *)__PHYSICAL_START; /* Normally Points to 1M */ 294- output_data = (char *)__PHYSICAL_START; /* Normally Points to 1M */
279+ if ((PHYSICAL_START + low_buffer_size) > ((ulg)high_buffer_start)) { 305+ if ((PHYSICAL_START + low_buffer_size) > ((ulg)high_buffer_start)) {
280+ high_buffer_start = (uch *)(PHYSICAL_START + low_buffer_size); 306+ high_buffer_start = (uch *)(PHYSICAL_START + low_buffer_size);
281 mv->hcount = 0; /* say: we need not to move high_buffer */ 307 mv->hcount = 0; /* say: we need not to move high_buffer */
282 } 308 }
283 else mv->hcount = -1; 309 else mv->hcount = -1;
284Index: vserver-sources-2.0.2_2.6.15/arch/i386/kernel/setup.c 310Index: linux-2.6.16/arch/i386/kernel/setup.c
285=================================================================== 311===================================================================
286--- vserver-sources-2.0.2_2.6.15.orig/arch/i386/kernel/setup.c 312--- linux-2.6.16.orig/arch/i386/kernel/setup.c
287+++ vserver-sources-2.0.2_2.6.15/arch/i386/kernel/setup.c 313+++ linux-2.6.16/arch/i386/kernel/setup.c
288@@ -1184,8 +1184,8 @@ void __init setup_bootmem_allocator(void 314@@ -1192,8 +1192,8 @@ void __init setup_bootmem_allocator(void
289 * the (very unlikely) case of us accidentally initializing the 315 * the (very unlikely) case of us accidentally initializing the
290 * bootmem allocator with an invalid RAM area. 316 * bootmem allocator with an invalid RAM area.
291 */ 317 */
292- reserve_bootmem(__PHYSICAL_START, (PFN_PHYS(min_low_pfn) + 318- reserve_bootmem(__PHYSICAL_START, (PFN_PHYS(min_low_pfn) +
293- bootmap_size + PAGE_SIZE-1) - (__PHYSICAL_START)); 319- bootmap_size + PAGE_SIZE-1) - (__PHYSICAL_START));
294+ reserve_bootmem(PHYSICAL_START, (PFN_PHYS(min_low_pfn) + 320+ reserve_bootmem(PHYSICAL_START, (PFN_PHYS(min_low_pfn) +
295+ bootmap_size + PAGE_SIZE-1) - (PHYSICAL_START)); 321+ bootmap_size + PAGE_SIZE-1) - (PHYSICAL_START));
296 322
297 /* 323 /*
298 * reserve physical page 0 - it's a special BIOS page on many boxes, 324 * reserve physical page 0 - it's a special BIOS page on many boxes,
299Index: vserver-sources-2.0.2_2.6.15/arch/i386/kernel/sys_i386.c 325Index: linux-2.6.16/arch/i386/kernel/sys_i386.c
300=================================================================== 326===================================================================
301--- vserver-sources-2.0.2_2.6.15.orig/arch/i386/kernel/sys_i386.c 327--- linux-2.6.16.orig/arch/i386/kernel/sys_i386.c
302+++ vserver-sources-2.0.2_2.6.15/arch/i386/kernel/sys_i386.c 328+++ linux-2.6.16/arch/i386/kernel/sys_i386.c
303@@ -19,6 +19,7 @@ 329@@ -19,6 +19,7 @@
304 #include <linux/mman.h> 330 #include <linux/mman.h>
305 #include <linux/file.h> 331 #include <linux/file.h>
306 #include <linux/utsname.h> 332 #include <linux/utsname.h>
307+#include <linux/vs_cvirt.h> 333+#include <linux/vs_cvirt.h>
345- error |= __copy_to_user(&name->machine,&system_utsname.machine,__OLD_UTS_LEN); 371- error |= __copy_to_user(&name->machine,&system_utsname.machine,__OLD_UTS_LEN);
346+ error |= __copy_to_user(&name->machine,ptr->machine,__OLD_UTS_LEN); 372+ error |= __copy_to_user(&name->machine,ptr->machine,__OLD_UTS_LEN);
347 error |= __put_user(0,name->machine+__OLD_UTS_LEN); 373 error |= __put_user(0,name->machine+__OLD_UTS_LEN);
348 374
349 up_read(&uts_sem); 375 up_read(&uts_sem);
350Index: vserver-sources-2.0.2_2.6.15/arch/i386/kernel/syscall_table.S 376Index: linux-2.6.16/arch/i386/kernel/syscall_table.S
351=================================================================== 377===================================================================
352--- vserver-sources-2.0.2_2.6.15.orig/arch/i386/kernel/syscall_table.S 378--- linux-2.6.16.orig/arch/i386/kernel/syscall_table.S
353+++ vserver-sources-2.0.2_2.6.15/arch/i386/kernel/syscall_table.S 379+++ linux-2.6.16/arch/i386/kernel/syscall_table.S
354@@ -273,7 +273,7 @@ ENTRY(sys_call_table) 380@@ -272,7 +272,7 @@ ENTRY(sys_call_table)
355 .long sys_tgkill /* 270 */ 381 .long sys_tgkill /* 270 */
356 .long sys_utimes 382 .long sys_utimes
357 .long sys_fadvise64_64 383 .long sys_fadvise64_64
358- .long sys_ni_syscall /* sys_vserver */ 384- .long sys_ni_syscall /* sys_vserver */
359+ .long sys_vserver 385+ .long sys_vserver
360 .long sys_mbind 386 .long sys_mbind
361 .long sys_get_mempolicy 387 .long sys_get_mempolicy
362 .long sys_set_mempolicy 388 .long sys_set_mempolicy
363Index: vserver-sources-2.0.2_2.6.15/arch/i386/kernel/traps.c 389Index: linux-2.6.16/arch/i386/kernel/traps.c
364=================================================================== 390===================================================================
365--- vserver-sources-2.0.2_2.6.15.orig/arch/i386/kernel/traps.c 391--- linux-2.6.16.orig/arch/i386/kernel/traps.c
366+++ vserver-sources-2.0.2_2.6.15/arch/i386/kernel/traps.c 392+++ linux-2.6.16/arch/i386/kernel/traps.c
367@@ -53,6 +53,7 @@ 393@@ -53,6 +53,7 @@
368 #include <asm/kdebug.h> 394 #include <asm/kdebug.h>
369 395
370 #include <linux/module.h> 396 #include <linux/module.h>
371+#include <linux/vserver/debug.h> 397+#include <linux/vserver/debug.h>
372 398
373 #include "mach_traps.h" 399 #include "mach_traps.h"
374 400
401@@ -252,8 +253,9 @@ void show_registers(struct pt_regs *regs
402 regs->esi, regs->edi, regs->ebp, esp);
403 printk(KERN_EMERG "ds: %04x es: %04x ss: %04x\n",
404 regs->xds & 0xffff, regs->xes & 0xffff, ss);
405- printk(KERN_EMERG "Process %s (pid: %d, threadinfo=%p task=%p)",
406- current->comm, current->pid, current_thread_info(), current);
407+ printk(KERN_EMERG "Process %s (pid: %d[#%u], threadinfo=%p task=%p)",
408+ current->comm, current->pid, current->xid,
409+ current_thread_info(), current);
410 /*
411 * When in-kernel, we also print out the stack and code at the
412 * time of the fault..
375@@ -307,6 +308,8 @@ void die(const char * str, struct pt_reg 413@@ -333,6 +335,8 @@ void die(const char * str, struct pt_reg
376 };
377 static int die_counter; 414 static int die_counter;
415 unsigned long flags;
378 416
379+ vxh_throw_oops(); 417+ vxh_throw_oops();
380+ 418+
381 if (die.lock_owner != raw_smp_processor_id()) { 419 if (die.lock_owner != raw_smp_processor_id()) {
382 console_verbose(); 420 console_verbose();
383 spin_lock_irq(&die.lock); 421 spin_lock_irqsave(&die.lock, flags);
384@@ -333,8 +336,9 @@ void die(const char * str, struct pt_reg 422@@ -365,8 +369,9 @@ void die(const char * str, struct pt_reg
385 #endif 423 #endif
386 if (nl) 424 if (nl)
387 printk("\n"); 425 printk("\n");
388- notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV); 426- notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV);
389+ notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV); 427+ notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV);
390 show_registers(regs); 428 show_registers(regs);
391+ vxh_dump_history(); 429+ vxh_dump_history();
392 } else 430 } else
393 printk(KERN_ERR "Recursive die() failure, output suppressed\n"); 431 printk(KERN_EMERG "Recursive die() failure, output suppressed\n");
394 432
395Index: vserver-sources-2.0.2_2.6.15/arch/ia64/Kconfig 433Index: linux-2.6.16/arch/ia64/Kconfig
396=================================================================== 434===================================================================
397--- vserver-sources-2.0.2_2.6.15.orig/arch/ia64/Kconfig 435--- linux-2.6.16.orig/arch/ia64/Kconfig
398+++ vserver-sources-2.0.2_2.6.15/arch/ia64/Kconfig 436+++ linux-2.6.16/arch/ia64/Kconfig
399@@ -461,6 +461,8 @@ endmenu 437@@ -464,6 +464,8 @@ endmenu
400 438
401 source "arch/ia64/Kconfig.debug" 439 source "arch/ia64/Kconfig.debug"
402 440
403+source "kernel/vserver/Kconfig" 441+source "kernel/vserver/Kconfig"
404+ 442+
405 source "security/Kconfig" 443 source "security/Kconfig"
406 444
407 source "crypto/Kconfig" 445 source "crypto/Kconfig"
408Index: vserver-sources-2.0.2_2.6.15/arch/ia64/ia32/binfmt_elf32.c 446Index: linux-2.6.16/arch/ia64/ia32/binfmt_elf32.c
409=================================================================== 447===================================================================
410--- vserver-sources-2.0.2_2.6.15.orig/arch/ia64/ia32/binfmt_elf32.c 448--- linux-2.6.16.orig/arch/ia64/ia32/binfmt_elf32.c
411+++ vserver-sources-2.0.2_2.6.15/arch/ia64/ia32/binfmt_elf32.c 449+++ linux-2.6.16/arch/ia64/ia32/binfmt_elf32.c
412@@ -236,7 +236,8 @@ ia32_setup_arg_pages (struct linux_binpr 450@@ -236,7 +236,8 @@ ia32_setup_arg_pages (struct linux_binpr
413 kmem_cache_free(vm_area_cachep, mpnt); 451 kmem_cache_free(vm_area_cachep, mpnt);
414 return ret; 452 return ret;
415 } 453 }
416- current->mm->stack_vm = current->mm->total_vm = vma_pages(mpnt); 454- current->mm->stack_vm = current->mm->total_vm = vma_pages(mpnt);
417+ vx_vmpages_sub(current->mm, current->mm->total_vm - vma_pages(mpnt)); 455+ vx_vmpages_sub(current->mm, current->mm->total_vm - vma_pages(mpnt));
418+ current->mm->stack_vm = current->mm->total_vm; 456+ current->mm->stack_vm = current->mm->total_vm;
419 } 457 }
420 458
421 for (i = 0 ; i < MAX_ARG_PAGES ; i++) { 459 for (i = 0 ; i < MAX_ARG_PAGES ; i++) {
422Index: vserver-sources-2.0.2_2.6.15/arch/ia64/ia32/ia32_entry.S 460Index: linux-2.6.16/arch/ia64/ia32/ia32_entry.S
423=================================================================== 461===================================================================
424--- vserver-sources-2.0.2_2.6.15.orig/arch/ia64/ia32/ia32_entry.S 462--- linux-2.6.16.orig/arch/ia64/ia32/ia32_entry.S
425+++ vserver-sources-2.0.2_2.6.15/arch/ia64/ia32/ia32_entry.S 463+++ linux-2.6.16/arch/ia64/ia32/ia32_entry.S
426@@ -483,7 +483,7 @@ ia32_syscall_table: 464@@ -483,7 +483,7 @@ ia32_syscall_table:
427 data8 sys_tgkill /* 270 */ 465 data8 sys_tgkill /* 270 */
428 data8 compat_sys_utimes 466 data8 compat_sys_utimes
429 data8 sys32_fadvise64_64 467 data8 sys32_fadvise64_64
430- data8 sys_ni_syscall 468- data8 sys_ni_syscall
431+ data8 sys32_vserver 469+ data8 sys32_vserver
432 data8 sys_ni_syscall 470 data8 sys_ni_syscall
433 data8 sys_ni_syscall /* 275 */ 471 data8 sys_ni_syscall /* 275 */
434 data8 sys_ni_syscall 472 data8 sys_ni_syscall
435Index: vserver-sources-2.0.2_2.6.15/arch/ia64/ia32/sys_ia32.c 473Index: linux-2.6.16/arch/ia64/kernel/entry.S
436=================================================================== 474===================================================================
437--- vserver-sources-2.0.2_2.6.15.orig/arch/ia64/ia32/sys_ia32.c 475--- linux-2.6.16.orig/arch/ia64/kernel/entry.S
438+++ vserver-sources-2.0.2_2.6.15/arch/ia64/ia32/sys_ia32.c 476+++ linux-2.6.16/arch/ia64/kernel/entry.S
439@@ -51,6 +51,7 @@
440 #include <linux/compat.h>
441 #include <linux/vfs.h>
442 #include <linux/mman.h>
443+#include <linux/vs_cvirt.h>
444
445 #include <asm/intrinsics.h>
446 #include <asm/semaphore.h>
447Index: vserver-sources-2.0.2_2.6.15/arch/ia64/kernel/entry.S
448===================================================================
449--- vserver-sources-2.0.2_2.6.15.orig/arch/ia64/kernel/entry.S
450+++ vserver-sources-2.0.2_2.6.15/arch/ia64/kernel/entry.S
451@@ -1589,7 +1589,7 @@ sys_call_table: 477@@ -1591,7 +1591,7 @@ sys_call_table:
452 data8 sys_mq_notify 478 data8 sys_mq_notify
453 data8 sys_mq_getsetattr 479 data8 sys_mq_getsetattr
454 data8 sys_ni_syscall // reserved for kexec_load 480 data8 sys_ni_syscall // reserved for kexec_load
455- data8 sys_ni_syscall // reserved for vserver 481- data8 sys_ni_syscall // reserved for vserver
456+ data8 sys_vserver 482+ data8 sys_vserver
457 data8 sys_waitid // 1270 483 data8 sys_waitid // 1270
458 data8 sys_add_key 484 data8 sys_add_key
459 data8 sys_request_key 485 data8 sys_request_key
460Index: vserver-sources-2.0.2_2.6.15/arch/ia64/kernel/perfmon.c 486Index: linux-2.6.16/arch/ia64/kernel/perfmon.c
461=================================================================== 487===================================================================
462--- vserver-sources-2.0.2_2.6.15.orig/arch/ia64/kernel/perfmon.c 488--- linux-2.6.16.orig/arch/ia64/kernel/perfmon.c
463+++ vserver-sources-2.0.2_2.6.15/arch/ia64/kernel/perfmon.c 489+++ linux-2.6.16/arch/ia64/kernel/perfmon.c
464@@ -39,6 +39,8 @@ 490@@ -41,6 +41,8 @@
465 #include <linux/mount.h>
466 #include <linux/bitops.h> 491 #include <linux/capability.h>
467 #include <linux/rcupdate.h> 492 #include <linux/rcupdate.h>
493 #include <linux/completion.h>
468+#include <linux/vs_memory.h> 494+#include <linux/vs_memory.h>
469+#include <linux/vs_cvirt.h> 495+#include <linux/vs_cvirt.h>
470 496
471 #include <asm/errno.h> 497 #include <asm/errno.h>
472 #include <asm/intrinsics.h> 498 #include <asm/intrinsics.h>
473@@ -2351,7 +2353,7 @@ pfm_smpl_buffer_alloc(struct task_struct 499@@ -2355,7 +2357,7 @@ pfm_smpl_buffer_alloc(struct task_struct
474 */ 500 */
475 insert_vm_struct(mm, vma); 501 insert_vm_struct(mm, vma);
476 502
477- mm->total_vm += size >> PAGE_SHIFT; 503- mm->total_vm += size >> PAGE_SHIFT;
478+ vx_vmpages_add(mm, size >> PAGE_SHIFT); 504+ vx_vmpages_add(mm, size >> PAGE_SHIFT);
479 vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file, 505 vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file,
480 vma_pages(vma)); 506 vma_pages(vma));
481 up_write(&task->mm->mmap_sem); 507 up_write(&task->mm->mmap_sem);
482Index: vserver-sources-2.0.2_2.6.15/arch/ia64/kernel/ptrace.c 508Index: linux-2.6.16/arch/ia64/kernel/ptrace.c
483=================================================================== 509===================================================================
484--- vserver-sources-2.0.2_2.6.15.orig/arch/ia64/kernel/ptrace.c 510--- linux-2.6.16.orig/arch/ia64/kernel/ptrace.c
485+++ vserver-sources-2.0.2_2.6.15/arch/ia64/kernel/ptrace.c 511+++ linux-2.6.16/arch/ia64/kernel/ptrace.c
486@@ -18,6 +18,7 @@ 512@@ -18,6 +18,7 @@
487 #include <linux/security.h> 513 #include <linux/security.h>
488 #include <linux/audit.h> 514 #include <linux/audit.h>
489 #include <linux/signal.h> 515 #include <linux/signal.h>
490+#include <linux/vs_cvirt.h> 516+#include <linux/vs_cvirt.h>
491 517
492 #include <asm/pgtable.h> 518 #include <asm/pgtable.h>
493 #include <asm/processor.h> 519 #include <asm/processor.h>
494@@ -1450,6 +1451,9 @@ sys_ptrace (long request, pid_t pid, uns 520@@ -1443,6 +1444,9 @@ sys_ptrace (long request, pid_t pid, uns
495 read_unlock(&tasklist_lock); 521 read_unlock(&tasklist_lock);
496 if (!child) 522 if (!child)
497 goto out; 523 goto out;
498+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT)) 524+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT))
499+ goto out_tsk; 525+ goto out_tsk;
500+ 526+
501 ret = -EPERM; 527 ret = -EPERM;
502 if (pid == 1) /* no messing around with init! */ 528 if (pid == 1) /* no messing around with init! */
503 goto out_tsk; 529 goto out_tsk;
504Index: vserver-sources-2.0.2_2.6.15/arch/ia64/kernel/signal.c 530Index: linux-2.6.16/arch/ia64/kernel/signal.c
505=================================================================== 531===================================================================
506--- vserver-sources-2.0.2_2.6.15.orig/arch/ia64/kernel/signal.c 532--- linux-2.6.16.orig/arch/ia64/kernel/signal.c
507+++ vserver-sources-2.0.2_2.6.15/arch/ia64/kernel/signal.c 533+++ linux-2.6.16/arch/ia64/kernel/signal.c
508@@ -21,6 +21,7 @@ 534@@ -21,6 +21,7 @@
509 #include <linux/binfmts.h> 535 #include <linux/binfmts.h>
510 #include <linux/unistd.h> 536 #include <linux/unistd.h>
511 #include <linux/wait.h> 537 #include <linux/wait.h>
512+#include <linux/vs_cvirt.h> 538+#include <linux/vs_cvirt.h>
513 539
514 #include <asm/ia32.h> 540 #include <asm/ia32.h>
515 #include <asm/intrinsics.h> 541 #include <asm/intrinsics.h>
516Index: vserver-sources-2.0.2_2.6.15/arch/ia64/mm/fault.c 542Index: linux-2.6.16/arch/ia64/mm/fault.c
517=================================================================== 543===================================================================
518--- vserver-sources-2.0.2_2.6.15.orig/arch/ia64/mm/fault.c 544--- linux-2.6.16.orig/arch/ia64/mm/fault.c
519+++ vserver-sources-2.0.2_2.6.15/arch/ia64/mm/fault.c 545+++ linux-2.6.16/arch/ia64/mm/fault.c
520@@ -10,6 +10,7 @@ 546@@ -10,6 +10,7 @@
521 #include <linux/smp_lock.h> 547 #include <linux/smp_lock.h>
522 #include <linux/interrupt.h> 548 #include <linux/interrupt.h>
523 #include <linux/kprobes.h> 549 #include <linux/kprobes.h>
524+#include <linux/vs_memory.h> 550+#include <linux/vs_memory.h>
525 551
526 #include <asm/pgtable.h> 552 #include <asm/pgtable.h>
527 #include <asm/processor.h> 553 #include <asm/processor.h>
528Index: vserver-sources-2.0.2_2.6.15/arch/ia64/sn/kernel/xpc_main.c 554Index: linux-2.6.16/arch/ia64/sn/kernel/xpc_main.c
529=================================================================== 555===================================================================
530--- vserver-sources-2.0.2_2.6.15.orig/arch/ia64/sn/kernel/xpc_main.c 556--- linux-2.6.16.orig/arch/ia64/sn/kernel/xpc_main.c
531+++ vserver-sources-2.0.2_2.6.15/arch/ia64/sn/kernel/xpc_main.c 557+++ linux-2.6.16/arch/ia64/sn/kernel/xpc_main.c
532@@ -105,6 +105,7 @@ static ctl_table xpc_sys_xpc_hb_dir[] = 558@@ -109,6 +109,7 @@ static ctl_table xpc_sys_xpc_hb_dir[] =
533 0644, 559 0644,
534 NULL, 560 NULL,
535 &proc_dointvec_minmax, 561 &proc_dointvec_minmax,
536+ NULL, 562+ NULL,
537 &sysctl_intvec, 563 &sysctl_intvec,
538 NULL, 564 NULL,
539 &xpc_hb_min_interval, 565 &xpc_hb_min_interval,
540@@ -118,6 +119,7 @@ static ctl_table xpc_sys_xpc_hb_dir[] = 566@@ -122,6 +123,7 @@ static ctl_table xpc_sys_xpc_hb_dir[] =
541 0644, 567 0644,
542 NULL, 568 NULL,
543 &proc_dointvec_minmax, 569 &proc_dointvec_minmax,
544+ NULL, 570+ NULL,
545 &sysctl_intvec, 571 &sysctl_intvec,
546 NULL, 572 NULL,
547 &xpc_hb_check_min_interval, 573 &xpc_hb_check_min_interval,
548@@ -142,6 +144,7 @@ static ctl_table xpc_sys_xpc_dir[] = { 574@@ -146,6 +148,7 @@ static ctl_table xpc_sys_xpc_dir[] = {
549 0644, 575 0644,
550 NULL, 576 NULL,
551 &proc_dointvec_minmax, 577 &proc_dointvec_minmax,
552+ NULL, 578+ NULL,
553 &sysctl_intvec, 579 &sysctl_intvec,
554 NULL, 580 NULL,
555 &xpc_disengage_request_min_timelimit, 581 &xpc_disengage_request_min_timelimit,
556Index: vserver-sources-2.0.2_2.6.15/arch/m32r/kernel/ptrace.c 582Index: linux-2.6.16/arch/m32r/kernel/ptrace.c
557=================================================================== 583===================================================================
558--- vserver-sources-2.0.2_2.6.15.orig/arch/m32r/kernel/ptrace.c 584--- linux-2.6.16.orig/arch/m32r/kernel/ptrace.c
559+++ vserver-sources-2.0.2_2.6.15/arch/m32r/kernel/ptrace.c 585+++ linux-2.6.16/arch/m32r/kernel/ptrace.c
560@@ -25,6 +25,7 @@ 586@@ -25,6 +25,7 @@
561 #include <linux/user.h> 587 #include <linux/user.h>
562 #include <linux/string.h> 588 #include <linux/string.h>
563 #include <linux/signal.h> 589 #include <linux/signal.h>
564+#include <linux/vs_cvirt.h> 590+#include <linux/vs_cvirt.h>
565 591
566 #include <asm/cacheflush.h> 592 #include <asm/cacheflush.h>
567 #include <asm/io.h> 593 #include <asm/io.h>
568Index: vserver-sources-2.0.2_2.6.15/arch/m68k/Kconfig 594Index: linux-2.6.16/arch/m68k/Kconfig
569=================================================================== 595===================================================================
570--- vserver-sources-2.0.2_2.6.15.orig/arch/m68k/Kconfig 596--- linux-2.6.16.orig/arch/m68k/Kconfig
571+++ vserver-sources-2.0.2_2.6.15/arch/m68k/Kconfig 597+++ linux-2.6.16/arch/m68k/Kconfig
572@@ -650,6 +650,8 @@ source "fs/Kconfig" 598@@ -650,6 +650,8 @@ source "fs/Kconfig"
573 599
574 source "arch/m68k/Kconfig.debug" 600 source "arch/m68k/Kconfig.debug"
575 601
576+source "kernel/vserver/Kconfig" 602+source "kernel/vserver/Kconfig"
577+ 603+
578 source "security/Kconfig" 604 source "security/Kconfig"
579 605
580 source "crypto/Kconfig" 606 source "crypto/Kconfig"
581Index: vserver-sources-2.0.2_2.6.15/arch/m68k/kernel/ptrace.c 607Index: linux-2.6.16/arch/m68k/kernel/ptrace.c
582=================================================================== 608===================================================================
583--- vserver-sources-2.0.2_2.6.15.orig/arch/m68k/kernel/ptrace.c 609--- linux-2.6.16.orig/arch/m68k/kernel/ptrace.c
584+++ vserver-sources-2.0.2_2.6.15/arch/m68k/kernel/ptrace.c 610+++ linux-2.6.16/arch/m68k/kernel/ptrace.c
585@@ -280,6 +280,8 @@ long arch_ptrace(struct task_struct *chi 611@@ -280,6 +280,8 @@ long arch_ptrace(struct task_struct *chi
586 ret = ptrace_request(child, request, addr, data); 612 ret = ptrace_request(child, request, addr, data);
587 break; 613 break;
588 } 614 }
589+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT)) 615+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT))
590+ goto out_tsk; 616+ goto out_tsk;
591 617
592 return ret; 618 return ret;
593 out_eio: 619 out_eio:
594Index: vserver-sources-2.0.2_2.6.15/arch/m68knommu/Kconfig 620Index: linux-2.6.16/arch/m68knommu/Kconfig
595=================================================================== 621===================================================================
596--- vserver-sources-2.0.2_2.6.15.orig/arch/m68knommu/Kconfig 622--- linux-2.6.16.orig/arch/m68knommu/Kconfig
597+++ vserver-sources-2.0.2_2.6.15/arch/m68knommu/Kconfig 623+++ linux-2.6.16/arch/m68knommu/Kconfig
598@@ -646,6 +646,8 @@ source "fs/Kconfig" 624@@ -646,6 +646,8 @@ source "fs/Kconfig"
599 625
600 source "arch/m68knommu/Kconfig.debug" 626 source "arch/m68knommu/Kconfig.debug"
601 627
602+source "kernel/vserver/Kconfig" 628+source "kernel/vserver/Kconfig"
603+ 629+
604 source "security/Kconfig" 630 source "security/Kconfig"
605 631
606 source "crypto/Kconfig" 632 source "crypto/Kconfig"
607Index: vserver-sources-2.0.2_2.6.15/arch/mips/Kconfig 633Index: linux-2.6.16/arch/mips/Kconfig
608=================================================================== 634===================================================================
609--- vserver-sources-2.0.2_2.6.15.orig/arch/mips/Kconfig 635--- linux-2.6.16.orig/arch/mips/Kconfig
610+++ vserver-sources-2.0.2_2.6.15/arch/mips/Kconfig 636+++ linux-2.6.16/arch/mips/Kconfig
611@@ -1817,6 +1817,8 @@ source "arch/mips/oprofile/Kconfig" 637@@ -1814,6 +1814,8 @@ source "arch/mips/oprofile/Kconfig"
612 638
613 source "arch/mips/Kconfig.debug" 639 source "arch/mips/Kconfig.debug"
614 640
615+source "kernel/vserver/Kconfig" 641+source "kernel/vserver/Kconfig"
616+ 642+
617 source "security/Kconfig" 643 source "security/Kconfig"
618 644
619 source "crypto/Kconfig" 645 source "crypto/Kconfig"
620Index: vserver-sources-2.0.2_2.6.15/arch/mips/kernel/linux32.c 646Index: linux-2.6.16/arch/mips/kernel/linux32.c
621=================================================================== 647===================================================================
622--- vserver-sources-2.0.2_2.6.15.orig/arch/mips/kernel/linux32.c 648--- linux-2.6.16.orig/arch/mips/kernel/linux32.c
623+++ vserver-sources-2.0.2_2.6.15/arch/mips/kernel/linux32.c 649+++ linux-2.6.16/arch/mips/kernel/linux32.c
624@@ -37,6 +37,7 @@ 650@@ -37,6 +37,7 @@
625 #include <linux/security.h> 651 #include <linux/security.h>
626 #include <linux/compat.h> 652 #include <linux/compat.h>
627 #include <linux/vfs.h> 653 #include <linux/vfs.h>
628+#include <linux/vs_cvirt.h> 654+#include <linux/vs_cvirt.h>
629 655
630 #include <net/sock.h> 656 #include <net/sock.h>
631 #include <net/scm.h> 657 #include <net/scm.h>
632@@ -1150,7 +1151,7 @@ asmlinkage long sys32_newuname(struct ne 658@@ -1099,7 +1100,7 @@ asmlinkage long sys32_newuname(struct ne
633 int ret = 0; 659 int ret = 0;
634 660
635 down_read(&uts_sem); 661 down_read(&uts_sem);
636- if (copy_to_user(name,&system_utsname,sizeof *name)) 662- if (copy_to_user(name,&system_utsname,sizeof *name))
637+ if (copy_to_user(name, vx_new_utsname(), sizeof *name)) 663+ if (copy_to_user(name, vx_new_utsname(), sizeof *name))
638 ret = -EFAULT; 664 ret = -EFAULT;
639 up_read(&uts_sem); 665 up_read(&uts_sem);
640 666
641Index: vserver-sources-2.0.2_2.6.15/arch/mips/kernel/ptrace.c 667Index: linux-2.6.16/arch/mips/kernel/ptrace.c
642=================================================================== 668===================================================================
643--- vserver-sources-2.0.2_2.6.15.orig/arch/mips/kernel/ptrace.c 669--- linux-2.6.16.orig/arch/mips/kernel/ptrace.c
644+++ vserver-sources-2.0.2_2.6.15/arch/mips/kernel/ptrace.c 670+++ linux-2.6.16/arch/mips/kernel/ptrace.c
645@@ -484,6 +484,8 @@ asmlinkage void do_syscall_trace(struct 671@@ -476,6 +476,8 @@ asmlinkage void do_syscall_trace(struct
646 goto out; 672 goto out;
647 if (!test_thread_flag(TIF_SYSCALL_TRACE)) 673 if (!test_thread_flag(TIF_SYSCALL_TRACE))
648 goto out; 674 goto out;
649+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT)) 675+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT))
650+ goto out_tsk; 676+ goto out_tsk;
651 677
652 /* The 0x80 provides a way for the tracing parent to distinguish 678 /* The 0x80 provides a way for the tracing parent to distinguish
653 between a syscall stop and SIGTRAP delivery */ 679 between a syscall stop and SIGTRAP delivery */
654Index: vserver-sources-2.0.2_2.6.15/arch/mips/kernel/ptrace32.c 680Index: linux-2.6.16/arch/mips/kernel/ptrace32.c
655=================================================================== 681===================================================================
656--- vserver-sources-2.0.2_2.6.15.orig/arch/mips/kernel/ptrace32.c 682--- linux-2.6.16.orig/arch/mips/kernel/ptrace32.c
657+++ vserver-sources-2.0.2_2.6.15/arch/mips/kernel/ptrace32.c 683+++ linux-2.6.16/arch/mips/kernel/ptrace32.c
658@@ -24,6 +24,7 @@ 684@@ -24,6 +24,7 @@
659 #include <linux/smp_lock.h> 685 #include <linux/smp_lock.h>
660 #include <linux/user.h> 686 #include <linux/user.h>
661 #include <linux/security.h> 687 #include <linux/security.h>
662+#include <linux/vs_cvirt.h> 688+#include <linux/vs_cvirt.h>
663 689
664 #include <asm/cpu.h> 690 #include <asm/cpu.h>
665 #include <asm/dsp.h> 691 #include <asm/dsp.h>
666Index: vserver-sources-2.0.2_2.6.15/arch/mips/kernel/scall32-o32.S 692Index: linux-2.6.16/arch/mips/kernel/scall32-o32.S
667=================================================================== 693===================================================================
668--- vserver-sources-2.0.2_2.6.15.orig/arch/mips/kernel/scall32-o32.S 694--- linux-2.6.16.orig/arch/mips/kernel/scall32-o32.S
669+++ vserver-sources-2.0.2_2.6.15/arch/mips/kernel/scall32-o32.S 695+++ linux-2.6.16/arch/mips/kernel/scall32-o32.S
670@@ -607,7 +607,7 @@ einval: li v0, -EINVAL 696@@ -607,7 +607,7 @@ einval: li v0, -EINVAL
671 sys sys_mq_timedreceive 5 697 sys sys_mq_timedreceive 5
672 sys sys_mq_notify 2 /* 4275 */ 698 sys sys_mq_notify 2 /* 4275 */
673 sys sys_mq_getsetattr 3 699 sys sys_mq_getsetattr 3
674- sys sys_ni_syscall 0 /* sys_vserver */ 700- sys sys_ni_syscall 0 /* sys_vserver */
675+ sys sys_vserver 3 701+ sys sys_vserver 3
676 sys sys_waitid 5 702 sys sys_waitid 5
677 sys sys_ni_syscall 0 /* available, was setaltroot */ 703 sys sys_ni_syscall 0 /* available, was setaltroot */
678 sys sys_add_key 5 /* 4280 */ 704 sys sys_add_key 5 /* 4280 */
679Index: vserver-sources-2.0.2_2.6.15/arch/mips/kernel/scall64-64.S 705Index: linux-2.6.16/arch/mips/kernel/scall64-64.S
680=================================================================== 706===================================================================
681--- vserver-sources-2.0.2_2.6.15.orig/arch/mips/kernel/scall64-64.S 707--- linux-2.6.16.orig/arch/mips/kernel/scall64-64.S
682+++ vserver-sources-2.0.2_2.6.15/arch/mips/kernel/scall64-64.S 708+++ linux-2.6.16/arch/mips/kernel/scall64-64.S
683@@ -433,7 +433,7 @@ sys_call_table: 709@@ -433,7 +433,7 @@ sys_call_table:
684 PTR sys_mq_timedreceive 710 PTR sys_mq_timedreceive
685 PTR sys_mq_notify 711 PTR sys_mq_notify
686 PTR sys_mq_getsetattr /* 5235 */ 712 PTR sys_mq_getsetattr /* 5235 */
687- PTR sys_ni_syscall /* sys_vserver */ 713- PTR sys_ni_syscall /* sys_vserver */
688+ PTR sys_vserver 714+ PTR sys_vserver
689 PTR sys_waitid 715 PTR sys_waitid
690 PTR sys_ni_syscall /* available, was setaltroot */ 716 PTR sys_ni_syscall /* available, was setaltroot */
691 PTR sys_add_key 717 PTR sys_add_key
692Index: vserver-sources-2.0.2_2.6.15/arch/mips/kernel/scall64-n32.S 718Index: linux-2.6.16/arch/mips/kernel/scall64-n32.S
693=================================================================== 719===================================================================
694--- vserver-sources-2.0.2_2.6.15.orig/arch/mips/kernel/scall64-n32.S 720--- linux-2.6.16.orig/arch/mips/kernel/scall64-n32.S
695+++ vserver-sources-2.0.2_2.6.15/arch/mips/kernel/scall64-n32.S 721+++ linux-2.6.16/arch/mips/kernel/scall64-n32.S
696@@ -359,7 +359,7 @@ EXPORT(sysn32_call_table) 722@@ -359,7 +359,7 @@ EXPORT(sysn32_call_table)
697 PTR compat_sys_mq_timedreceive 723 PTR compat_sys_mq_timedreceive
698 PTR compat_sys_mq_notify 724 PTR compat_sys_mq_notify
699 PTR compat_sys_mq_getsetattr 725 PTR compat_sys_mq_getsetattr
700- PTR sys_ni_syscall /* 6240, sys_vserver */ 726- PTR sys_ni_syscall /* 6240, sys_vserver */
701+ PTR sys32_vserver /* 6240 */ 727+ PTR sys32_vserver /* 6240 */
702 PTR sysn32_waitid 728 PTR sysn32_waitid
703 PTR sys_ni_syscall /* available, was setaltroot */ 729 PTR sys_ni_syscall /* available, was setaltroot */
704 PTR sys_add_key 730 PTR sys_add_key
705Index: vserver-sources-2.0.2_2.6.15/arch/mips/kernel/scall64-o32.S 731Index: linux-2.6.16/arch/mips/kernel/scall64-o32.S
706=================================================================== 732===================================================================
707--- vserver-sources-2.0.2_2.6.15.orig/arch/mips/kernel/scall64-o32.S 733--- linux-2.6.16.orig/arch/mips/kernel/scall64-o32.S
708+++ vserver-sources-2.0.2_2.6.15/arch/mips/kernel/scall64-o32.S 734+++ linux-2.6.16/arch/mips/kernel/scall64-o32.S
709@@ -481,7 +481,7 @@ sys_call_table: 735@@ -481,7 +481,7 @@ sys_call_table:
710 PTR compat_sys_mq_timedreceive 736 PTR compat_sys_mq_timedreceive
711 PTR compat_sys_mq_notify /* 4275 */ 737 PTR compat_sys_mq_notify /* 4275 */
712 PTR compat_sys_mq_getsetattr 738 PTR compat_sys_mq_getsetattr
713- PTR sys_ni_syscall /* sys_vserver */ 739- PTR sys_ni_syscall /* sys_vserver */
714+ PTR sys32_vserver 740+ PTR sys32_vserver
715 PTR sys32_waitid 741 PTR sys32_waitid
716 PTR sys_ni_syscall /* available, was setaltroot */ 742 PTR sys_ni_syscall /* available, was setaltroot */
717 PTR sys_add_key /* 4280 */ 743 PTR sys_add_key /* 4280 */
718Index: vserver-sources-2.0.2_2.6.15/arch/mips/kernel/syscall.c 744Index: linux-2.6.16/arch/mips/kernel/syscall.c
719=================================================================== 745===================================================================
720--- vserver-sources-2.0.2_2.6.15.orig/arch/mips/kernel/syscall.c 746--- linux-2.6.16.orig/arch/mips/kernel/syscall.c
721+++ vserver-sources-2.0.2_2.6.15/arch/mips/kernel/syscall.c 747+++ linux-2.6.16/arch/mips/kernel/syscall.c
722@@ -28,6 +28,7 @@ 748@@ -29,6 +29,7 @@
723 #include <linux/shm.h> 749 #include <linux/shm.h>
724 #include <linux/compiler.h> 750 #include <linux/compiler.h>
725 #include <linux/module.h> 751 #include <linux/module.h>
726+#include <linux/vs_cvirt.h> 752+#include <linux/vs_cvirt.h>
727 753
728 #include <asm/branch.h> 754 #include <asm/branch.h>
729 #include <asm/cachectl.h> 755 #include <asm/cachectl.h>
730@@ -228,7 +229,7 @@ out: 756@@ -229,7 +230,7 @@ out:
731 */ 757 */
732 asmlinkage int sys_uname(struct old_utsname * name) 758 asmlinkage int sys_uname(struct old_utsname __user * name)
733 { 759 {
734- if (name && !copy_to_user(name, &system_utsname, sizeof (*name))) 760- if (name && !copy_to_user(name, &system_utsname, sizeof (*name)))
735+ if (name && !copy_to_user(name, vx_new_utsname(), sizeof (*name))) 761+ if (name && !copy_to_user(name, vx_new_utsname(), sizeof (*name)))
736 return 0; 762 return 0;
737 return -EFAULT; 763 return -EFAULT;
738 } 764 }
739@@ -239,21 +240,23 @@ asmlinkage int sys_uname(struct old_utsn 765@@ -240,21 +241,23 @@ asmlinkage int sys_uname(struct old_utsn
740 asmlinkage int sys_olduname(struct oldold_utsname * name) 766 asmlinkage int sys_olduname(struct oldold_utsname __user * name)
741 { 767 {
742 int error; 768 int error;
743+ struct new_utsname *ptr; 769+ struct new_utsname *ptr;
744 770
745 if (!name) 771 if (!name)
763- error -= __copy_to_user(&name->machine,&system_utsname.machine,__OLD_UTS_LEN); 789- error -= __copy_to_user(&name->machine,&system_utsname.machine,__OLD_UTS_LEN);
764+ error -= __copy_to_user(&name->machine,ptr->machine,__OLD_UTS_LEN); 790+ error -= __copy_to_user(&name->machine,ptr->machine,__OLD_UTS_LEN);
765 error = __put_user(0,name->machine+__OLD_UTS_LEN); 791 error = __put_user(0,name->machine+__OLD_UTS_LEN);
766 error = error ? -EFAULT : 0; 792 error = error ? -EFAULT : 0;
767 793
768@@ -289,10 +292,10 @@ asmlinkage int _sys_sysmips(int cmd, lon 794@@ -290,10 +293,10 @@ asmlinkage int _sys_sysmips(int cmd, lon
769 return -EFAULT; 795 return -EFAULT;
770 796
771 down_write(&uts_sem); 797 down_write(&uts_sem);
772- strncpy(system_utsname.nodename, nodename, len); 798- strncpy(system_utsname.nodename, nodename, len);
773+ strncpy(vx_new_uts(nodename), nodename, len); 799+ strncpy(vx_new_uts(nodename), nodename, len);
777+ strlcpy(vx_new_uts(nodename), nodename, 803+ strlcpy(vx_new_uts(nodename), nodename,
778+ sizeof(vx_new_uts(nodename))); 804+ sizeof(vx_new_uts(nodename)));
779 up_write(&uts_sem); 805 up_write(&uts_sem);
780 return 0; 806 return 0;
781 } 807 }
782Index: vserver-sources-2.0.2_2.6.15/arch/mips/kernel/sysirix.c 808Index: linux-2.6.16/arch/mips/kernel/sysirix.c
783=================================================================== 809===================================================================
784--- vserver-sources-2.0.2_2.6.15.orig/arch/mips/kernel/sysirix.c 810--- linux-2.6.16.orig/arch/mips/kernel/sysirix.c
785+++ vserver-sources-2.0.2_2.6.15/arch/mips/kernel/sysirix.c 811+++ linux-2.6.16/arch/mips/kernel/sysirix.c
786@@ -30,6 +30,7 @@ 812@@ -31,6 +31,7 @@
787 #include <linux/socket.h> 813 #include <linux/socket.h>
788 #include <linux/security.h> 814 #include <linux/security.h>
789 #include <linux/syscalls.h> 815 #include <linux/syscalls.h>
790+#include <linux/vs_cvirt.h> 816+#include <linux/vs_cvirt.h>
791 817
792 #include <asm/ptrace.h> 818 #include <asm/ptrace.h>
793 #include <asm/page.h> 819 #include <asm/page.h>
794Index: vserver-sources-2.0.2_2.6.15/arch/parisc/Kconfig 820Index: linux-2.6.16/arch/parisc/Kconfig
795=================================================================== 821===================================================================
796--- vserver-sources-2.0.2_2.6.15.orig/arch/parisc/Kconfig 822--- linux-2.6.16.orig/arch/parisc/Kconfig
797+++ vserver-sources-2.0.2_2.6.15/arch/parisc/Kconfig 823+++ linux-2.6.16/arch/parisc/Kconfig
798@@ -205,6 +205,8 @@ source "arch/parisc/oprofile/Kconfig" 824@@ -213,6 +213,8 @@ source "arch/parisc/oprofile/Kconfig"
799 825
800 source "arch/parisc/Kconfig.debug" 826 source "arch/parisc/Kconfig.debug"
801 827
802+source "kernel/vserver/Kconfig" 828+source "kernel/vserver/Kconfig"
803+ 829+
804 source "security/Kconfig" 830 source "security/Kconfig"
805 831
806 source "crypto/Kconfig" 832 source "crypto/Kconfig"
807Index: vserver-sources-2.0.2_2.6.15/arch/parisc/kernel/sys_parisc32.c 833Index: linux-2.6.16/arch/parisc/kernel/sys_parisc32.c
808=================================================================== 834===================================================================
809--- vserver-sources-2.0.2_2.6.15.orig/arch/parisc/kernel/sys_parisc32.c 835--- linux-2.6.16.orig/arch/parisc/kernel/sys_parisc32.c
810+++ vserver-sources-2.0.2_2.6.15/arch/parisc/kernel/sys_parisc32.c 836+++ linux-2.6.16/arch/parisc/kernel/sys_parisc32.c
811@@ -657,6 +657,7 @@ asmlinkage int sys32_sysinfo(struct sysi 837@@ -657,6 +657,7 @@ asmlinkage int sys32_sysinfo(struct sysi
812 838
813 do { 839 do {
814 seq = read_seqbegin(&xtime_lock); 840 seq = read_seqbegin(&xtime_lock);
815+ /* FIXME: requires vx virtualization */ 841+ /* FIXME: requires vx virtualization */
816 val.uptime = jiffies / HZ; 842 val.uptime = jiffies / HZ;
817 843
818 val.loads[0] = avenrun[0] << (SI_LOAD_SHIFT - FSHIFT); 844 val.loads[0] = avenrun[0] << (SI_LOAD_SHIFT - FSHIFT);
819Index: vserver-sources-2.0.2_2.6.15/arch/parisc/kernel/syscall_table.S 845Index: linux-2.6.16/arch/parisc/kernel/syscall_table.S
820=================================================================== 846===================================================================
821--- vserver-sources-2.0.2_2.6.15.orig/arch/parisc/kernel/syscall_table.S 847--- linux-2.6.16.orig/arch/parisc/kernel/syscall_table.S
822+++ vserver-sources-2.0.2_2.6.15/arch/parisc/kernel/syscall_table.S 848+++ linux-2.6.16/arch/parisc/kernel/syscall_table.S
823@@ -368,7 +368,7 @@ 849@@ -368,7 +368,7 @@
824 ENTRY_COMP(mbind) /* 260 */ 850 ENTRY_COMP(mbind) /* 260 */
825 ENTRY_COMP(get_mempolicy) 851 ENTRY_COMP(get_mempolicy)
826 ENTRY_COMP(set_mempolicy) 852 ENTRY_COMP(set_mempolicy)
827- ENTRY_SAME(ni_syscall) /* 263: reserved for vserver */ 853- ENTRY_SAME(ni_syscall) /* 263: reserved for vserver */
828+ ENTRY_DIFF(vserver) 854+ ENTRY_DIFF(vserver)
829 ENTRY_SAME(add_key) 855 ENTRY_SAME(add_key)
830 ENTRY_SAME(request_key) /* 265 */ 856 ENTRY_SAME(request_key) /* 265 */
831 ENTRY_SAME(keyctl) 857 ENTRY_SAME(keyctl)
832Index: vserver-sources-2.0.2_2.6.15/arch/powerpc/Kconfig 858Index: linux-2.6.16/arch/powerpc/Kconfig
833=================================================================== 859===================================================================
834--- vserver-sources-2.0.2_2.6.15.orig/arch/powerpc/Kconfig 860--- linux-2.6.16.orig/arch/powerpc/Kconfig
835+++ vserver-sources-2.0.2_2.6.15/arch/powerpc/Kconfig 861+++ linux-2.6.16/arch/powerpc/Kconfig
836@@ -930,6 +930,8 @@ endmenu 862@@ -974,6 +974,8 @@ endmenu
837 863
838 source "arch/powerpc/Kconfig.debug" 864 source "arch/powerpc/Kconfig.debug"
839 865
840+source "kernel/vserver/Kconfig" 866+source "kernel/vserver/Kconfig"
841+ 867+
842 source "security/Kconfig" 868 source "security/Kconfig"
843 869
844 config KEYS_COMPAT 870 config KEYS_COMPAT
871Index: linux-2.6.16/arch/powerpc/kernel/process.c
872===================================================================
873--- linux-2.6.16.orig/arch/powerpc/kernel/process.c
874+++ linux-2.6.16/arch/powerpc/kernel/process.c
875@@ -425,8 +425,9 @@ void show_regs(struct pt_regs * regs)
876 trap = TRAP(regs);
877 if (trap == 0x300 || trap == 0x600)
878 printk("DAR: "REG", DSISR: "REG"\n", regs->dar, regs->dsisr);
879- printk("TASK = %p[%d] '%s' THREAD: %p",
880- current, current->pid, current->comm, task_thread_info(current));
881+ printk("TASK = %p[%d,#%u] '%s' THREAD: %p",
882+ current, current->pid, current->xid,
883+ current->comm, task_thread_info(current));
884
885 #ifdef CONFIG_SMP
886 printk(" CPU: %d", smp_processor_id());
845Index: vserver-sources-2.0.2_2.6.15/arch/powerpc/kernel/ptrace32.c 887Index: linux-2.6.16/arch/powerpc/kernel/ptrace32.c
846=================================================================== 888===================================================================
847--- vserver-sources-2.0.2_2.6.15.orig/arch/powerpc/kernel/ptrace32.c 889--- linux-2.6.16.orig/arch/powerpc/kernel/ptrace32.c
848+++ vserver-sources-2.0.2_2.6.15/arch/powerpc/kernel/ptrace32.c 890+++ linux-2.6.16/arch/powerpc/kernel/ptrace32.c
849@@ -28,6 +28,7 @@ 891@@ -28,6 +28,7 @@
850 #include <linux/user.h> 892 #include <linux/user.h>
851 #include <linux/security.h> 893 #include <linux/security.h>
852 #include <linux/signal.h> 894 #include <linux/signal.h>
853+#include <linux/vs_cvirt.h> 895+#include <linux/vs_cvirt.h>
854 896
855 #include <asm/uaccess.h> 897 #include <asm/uaccess.h>
856 #include <asm/page.h> 898 #include <asm/page.h>
857Index: vserver-sources-2.0.2_2.6.15/arch/powerpc/kernel/syscalls.c 899Index: linux-2.6.16/arch/powerpc/kernel/syscalls.c
858=================================================================== 900===================================================================
859--- vserver-sources-2.0.2_2.6.15.orig/arch/powerpc/kernel/syscalls.c 901--- linux-2.6.16.orig/arch/powerpc/kernel/syscalls.c
860+++ vserver-sources-2.0.2_2.6.15/arch/powerpc/kernel/syscalls.c 902+++ linux-2.6.16/arch/powerpc/kernel/syscalls.c
861@@ -36,6 +36,7 @@ 903@@ -36,6 +36,7 @@
862 #include <linux/file.h> 904 #include <linux/file.h>
863 #include <linux/init.h> 905 #include <linux/init.h>
864 #include <linux/personality.h> 906 #include <linux/personality.h>
865+#include <linux/vs_cvirt.h> 907+#include <linux/vs_cvirt.h>
866 908
867 #include <asm/uaccess.h> 909 #include <asm/uaccess.h>
868 #include <asm/ipc.h> 910 #include <asm/ipc.h>
869@@ -262,7 +263,7 @@ long ppc_newuname(struct new_utsname __u 911@@ -259,7 +260,7 @@ long ppc_newuname(struct new_utsname __u
870 int err = 0; 912 int err = 0;
871 913
872 down_read(&uts_sem); 914 down_read(&uts_sem);
873- if (copy_to_user(name, &system_utsname, sizeof(*name))) 915- if (copy_to_user(name, &system_utsname, sizeof(*name)))
874+ if (copy_to_user(name, vx_new_utsname(), sizeof(*name))) 916+ if (copy_to_user(name, vx_new_utsname(), sizeof(*name)))
875 err = -EFAULT; 917 err = -EFAULT;
876 up_read(&uts_sem); 918 up_read(&uts_sem);
877 if (!err) 919 if (!err)
878@@ -275,7 +276,7 @@ int sys_uname(struct old_utsname __user 920@@ -272,7 +273,7 @@ int sys_uname(struct old_utsname __user
879 int err = 0; 921 int err = 0;
880 922
881 down_read(&uts_sem); 923 down_read(&uts_sem);
882- if (copy_to_user(name, &system_utsname, sizeof(*name))) 924- if (copy_to_user(name, &system_utsname, sizeof(*name)))
883+ if (copy_to_user(name, vx_new_utsname(), sizeof(*name))) 925+ if (copy_to_user(name, vx_new_utsname(), sizeof(*name)))
884 err = -EFAULT; 926 err = -EFAULT;
885 up_read(&uts_sem); 927 up_read(&uts_sem);
886 if (!err) 928 if (!err)
887@@ -286,25 +287,22 @@ int sys_uname(struct old_utsname __user 929@@ -283,25 +284,22 @@ int sys_uname(struct old_utsname __user
888 int sys_olduname(struct oldold_utsname __user *name) 930 int sys_olduname(struct oldold_utsname __user *name)
889 { 931 {
890 int error; 932 int error;
891+ struct new_utsname *ptr; 933+ struct new_utsname *ptr;
892 934
915- __OLD_UTS_LEN); 957- __OLD_UTS_LEN);
916+ error |= __copy_to_user(&name->machine, ptr->machine, __OLD_UTS_LEN); 958+ error |= __copy_to_user(&name->machine, ptr->machine, __OLD_UTS_LEN);
917 error |= override_machine(name->machine); 959 error |= override_machine(name->machine);
918 up_read(&uts_sem); 960 up_read(&uts_sem);
919 961
920Index: vserver-sources-2.0.2_2.6.15/arch/powerpc/kernel/systbl.S 962Index: linux-2.6.16/arch/powerpc/kernel/systbl.S
921=================================================================== 963===================================================================
922--- vserver-sources-2.0.2_2.6.15.orig/arch/powerpc/kernel/systbl.S 964--- linux-2.6.16.orig/arch/powerpc/kernel/systbl.S
923+++ vserver-sources-2.0.2_2.6.15/arch/powerpc/kernel/systbl.S 965+++ linux-2.6.16/arch/powerpc/kernel/systbl.S
924@@ -298,7 +298,7 @@ COMPAT_SYS(fstatfs64) 966@@ -296,7 +296,7 @@ COMPAT_SYS(fstatfs64)
925 SYSX(sys_ni_syscall, ppc_fadvise64_64, ppc_fadvise64_64) 967 SYSX(sys_ni_syscall, ppc_fadvise64_64, ppc_fadvise64_64)
926 PPC_SYS(rtas) 968 PPC_SYS(rtas)
927 OLDSYS(debug_setcontext) 969 OLDSYS(debug_setcontext)
928-SYSCALL(ni_syscall) 970-SYSCALL(ni_syscall)
929+SYSX(sys_vserver, sys32_vserver, sys_vserver) 971+SYSX(sys_vserver, sys32_vserver, sys_vserver)
930 SYSCALL(ni_syscall) 972 SYSCALL(ni_syscall)
931 COMPAT_SYS(mbind) 973 COMPAT_SYS(mbind)
932 COMPAT_SYS(get_mempolicy) 974 COMPAT_SYS(get_mempolicy)
933Index: vserver-sources-2.0.2_2.6.15/arch/powerpc/kernel/vdso.c 975Index: linux-2.6.16/arch/powerpc/kernel/vdso.c
934=================================================================== 976===================================================================
935--- vserver-sources-2.0.2_2.6.15.orig/arch/powerpc/kernel/vdso.c 977--- linux-2.6.16.orig/arch/powerpc/kernel/vdso.c
936+++ vserver-sources-2.0.2_2.6.15/arch/powerpc/kernel/vdso.c 978+++ linux-2.6.16/arch/powerpc/kernel/vdso.c
937@@ -25,6 +25,7 @@ 979@@ -25,6 +25,7 @@
938 #include <linux/elf.h> 980 #include <linux/elf.h>
939 #include <linux/security.h> 981 #include <linux/security.h>
940 #include <linux/bootmem.h> 982 #include <linux/bootmem.h>
941+#include <linux/vs_memory.h> 983+#include <linux/vs_memory.h>
949- mm->total_vm += (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; 991- mm->total_vm += (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
950+ vx_vmpages_add(mm, (vma->vm_end - vma->vm_start) >> PAGE_SHIFT); 992+ vx_vmpages_add(mm, (vma->vm_end - vma->vm_start) >> PAGE_SHIFT);
951 up_write(&mm->mmap_sem); 993 up_write(&mm->mmap_sem);
952 994
953 return 0; 995 return 0;
954Index: vserver-sources-2.0.2_2.6.15/arch/ppc/Kconfig 996Index: linux-2.6.16/arch/ppc/Kconfig
955=================================================================== 997===================================================================
956--- vserver-sources-2.0.2_2.6.15.orig/arch/ppc/Kconfig 998--- linux-2.6.16.orig/arch/ppc/Kconfig
957+++ vserver-sources-2.0.2_2.6.15/arch/ppc/Kconfig 999+++ linux-2.6.16/arch/ppc/Kconfig
958@@ -1422,6 +1422,8 @@ source "arch/powerpc/oprofile/Kconfig" 1000@@ -1394,6 +1394,8 @@ source "arch/powerpc/oprofile/Kconfig"
959 1001
960 source "arch/ppc/Kconfig.debug" 1002 source "arch/ppc/Kconfig.debug"
961 1003
962+source "kernel/vserver/Kconfig" 1004+source "kernel/vserver/Kconfig"
963+ 1005+
964 source "security/Kconfig" 1006 source "security/Kconfig"
965 1007
966 source "crypto/Kconfig" 1008 source "crypto/Kconfig"
967Index: vserver-sources-2.0.2_2.6.15/arch/ppc/kernel/misc.S 1009Index: linux-2.6.16/arch/s390/Kconfig
968=================================================================== 1010===================================================================
969--- vserver-sources-2.0.2_2.6.15.orig/arch/ppc/kernel/misc.S 1011--- linux-2.6.16.orig/arch/s390/Kconfig
970+++ vserver-sources-2.0.2_2.6.15/arch/ppc/kernel/misc.S 1012+++ linux-2.6.16/arch/s390/Kconfig
971@@ -1382,7 +1382,7 @@ _GLOBAL(sys_call_table)
972 .long ppc_fadvise64_64
973 .long sys_ni_syscall /* 255 - rtas (used on ppc64) */
974 .long sys_debug_setcontext
975- .long sys_ni_syscall /* 257 reserved for vserver */
976+ .long sys_vserver
977 .long sys_ni_syscall /* 258 reserved for new sys_remap_file_pages */
978 .long sys_ni_syscall /* 259 reserved for new sys_mbind */
979 .long sys_ni_syscall /* 260 reserved for new sys_get_mempolicy */
980Index: vserver-sources-2.0.2_2.6.15/arch/s390/Kconfig
981===================================================================
982--- vserver-sources-2.0.2_2.6.15.orig/arch/s390/Kconfig
983+++ vserver-sources-2.0.2_2.6.15/arch/s390/Kconfig
984@@ -485,6 +485,8 @@ source "arch/s390/oprofile/Kconfig" 1013@@ -472,6 +472,8 @@ source "arch/s390/oprofile/Kconfig"
985 1014
986 source "arch/s390/Kconfig.debug" 1015 source "arch/s390/Kconfig.debug"
987 1016
988+source "kernel/vserver/Kconfig" 1017+source "kernel/vserver/Kconfig"
989+ 1018+
990 source "security/Kconfig" 1019 source "security/Kconfig"
991 1020
992 source "crypto/Kconfig" 1021 source "crypto/Kconfig"
993Index: vserver-sources-2.0.2_2.6.15/arch/s390/kernel/ptrace.c 1022Index: linux-2.6.16/arch/s390/kernel/process.c
994=================================================================== 1023===================================================================
995--- vserver-sources-2.0.2_2.6.15.orig/arch/s390/kernel/ptrace.c 1024--- linux-2.6.16.orig/arch/s390/kernel/process.c
996+++ vserver-sources-2.0.2_2.6.15/arch/s390/kernel/ptrace.c 1025+++ linux-2.6.16/arch/s390/kernel/process.c
1026@@ -164,9 +164,9 @@ void show_regs(struct pt_regs *regs)
1027 struct task_struct *tsk = current;
1028
1029 printk("CPU: %d %s\n", task_thread_info(tsk)->cpu, print_tainted());
1030- printk("Process %s (pid: %d, task: %p, ksp: %p)\n",
1031- current->comm, current->pid, (void *) tsk,
1032- (void *) tsk->thread.ksp);
1033+ printk("Process %s (pid: %d[#%u], task: %p, ksp: %p)\n",
1034+ current->comm, current->pid, current->xid,
1035+ (void *) tsk, (void *) tsk->thread.ksp);
1036
1037 show_registers(regs);
1038 /* Show stack backtrace if pt_regs is from kernel mode */
1039Index: linux-2.6.16/arch/s390/kernel/ptrace.c
1040===================================================================
1041--- linux-2.6.16.orig/arch/s390/kernel/ptrace.c
1042+++ linux-2.6.16/arch/s390/kernel/ptrace.c
997@@ -33,6 +33,7 @@ 1043@@ -33,6 +33,7 @@
998 #include <linux/security.h> 1044 #include <linux/security.h>
999 #include <linux/audit.h> 1045 #include <linux/audit.h>
1000 #include <linux/signal.h> 1046 #include <linux/signal.h>
1001+#include <linux/vs_cvirt.h> 1047+#include <linux/vs_cvirt.h>
1002 1048
1003 #include <asm/segment.h> 1049 #include <asm/segment.h>
1004 #include <asm/page.h> 1050 #include <asm/page.h>
1005@@ -738,9 +739,11 @@ sys_ptrace(long request, long pid, long 1051@@ -723,7 +724,13 @@ sys_ptrace(long request, long pid, long
1006 read_unlock(&tasklist_lock);
1007 if (!child)
1008 goto out; 1052 goto out;
1053 }
1054
1009+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT)) 1055+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT)) {
1056+ ret = -EPERM;
1010+ goto out_tsk; 1057+ goto out_tsk;
1011 1058+ }
1059+
1012 ret = do_ptrace(child, request, addr, data); 1060 ret = do_ptrace(child, request, addr, data);
1013-
1014+out_tsk: 1061+out_tsk:
1015 put_task_struct(child); 1062 put_task_struct(child);
1016 out: 1063 out:
1017 unlock_kernel(); 1064 unlock_kernel();
1018Index: vserver-sources-2.0.2_2.6.15/arch/s390/kernel/syscalls.S 1065Index: linux-2.6.16/arch/s390/kernel/syscalls.S
1019=================================================================== 1066===================================================================
1020--- vserver-sources-2.0.2_2.6.15.orig/arch/s390/kernel/syscalls.S 1067--- linux-2.6.16.orig/arch/s390/kernel/syscalls.S
1021+++ vserver-sources-2.0.2_2.6.15/arch/s390/kernel/syscalls.S 1068+++ linux-2.6.16/arch/s390/kernel/syscalls.S
1022@@ -271,7 +271,7 @@ SYSCALL(sys_clock_settime,sys_clock_sett 1069@@ -271,7 +271,7 @@ SYSCALL(sys_clock_settime,sys_clock_sett
1023 SYSCALL(sys_clock_gettime,sys_clock_gettime,sys32_clock_gettime_wrapper) /* 260 */ 1070 SYSCALL(sys_clock_gettime,sys_clock_gettime,sys32_clock_gettime_wrapper) /* 260 */
1024 SYSCALL(sys_clock_getres,sys_clock_getres,sys32_clock_getres_wrapper) 1071 SYSCALL(sys_clock_getres,sys_clock_getres,sys32_clock_getres_wrapper)
1025 SYSCALL(sys_clock_nanosleep,sys_clock_nanosleep,sys32_clock_nanosleep_wrapper) 1072 SYSCALL(sys_clock_nanosleep,sys_clock_nanosleep,sys32_clock_nanosleep_wrapper)
1026-NI_SYSCALL /* reserved for vserver */ 1073-NI_SYSCALL /* reserved for vserver */
1027+SYSCALL(sys_vserver,sys_vserver,sys32_vserver) 1074+SYSCALL(sys_vserver,sys_vserver,sys32_vserver)
1028 SYSCALL(s390_fadvise64_64,sys_ni_syscall,sys32_fadvise64_64_wrapper) 1075 SYSCALL(s390_fadvise64_64,sys_ni_syscall,sys32_fadvise64_64_wrapper)
1029 SYSCALL(sys_statfs64,sys_statfs64,compat_sys_statfs64_wrapper) 1076 SYSCALL(sys_statfs64,sys_statfs64,compat_sys_statfs64_wrapper)
1030 SYSCALL(sys_fstatfs64,sys_fstatfs64,compat_sys_fstatfs64_wrapper) 1077 SYSCALL(sys_fstatfs64,sys_fstatfs64,compat_sys_fstatfs64_wrapper)
1031Index: vserver-sources-2.0.2_2.6.15/arch/sh/Kconfig 1078Index: linux-2.6.16/arch/sh/Kconfig
1032=================================================================== 1079===================================================================
1033--- vserver-sources-2.0.2_2.6.15.orig/arch/sh/Kconfig 1080--- linux-2.6.16.orig/arch/sh/Kconfig
1034+++ vserver-sources-2.0.2_2.6.15/arch/sh/Kconfig 1081+++ linux-2.6.16/arch/sh/Kconfig
1035@@ -770,6 +770,8 @@ source "arch/sh/oprofile/Kconfig" 1082@@ -633,6 +633,8 @@ source "arch/sh/oprofile/Kconfig"
1036 1083
1037 source "arch/sh/Kconfig.debug" 1084 source "arch/sh/Kconfig.debug"
1038 1085
1039+source "kernel/vserver/Kconfig" 1086+source "kernel/vserver/Kconfig"
1040+ 1087+
1041 source "security/Kconfig" 1088 source "security/Kconfig"
1042 1089
1043 source "crypto/Kconfig" 1090 source "crypto/Kconfig"
1044Index: vserver-sources-2.0.2_2.6.15/arch/sh/kernel/kgdb_stub.c 1091Index: linux-2.6.16/arch/sh/kernel/kgdb_stub.c
1045=================================================================== 1092===================================================================
1046--- vserver-sources-2.0.2_2.6.15.orig/arch/sh/kernel/kgdb_stub.c 1093--- linux-2.6.16.orig/arch/sh/kernel/kgdb_stub.c
1047+++ vserver-sources-2.0.2_2.6.15/arch/sh/kernel/kgdb_stub.c 1094+++ linux-2.6.16/arch/sh/kernel/kgdb_stub.c
1048@@ -412,7 +412,7 @@ static struct task_struct *get_thread(in 1095@@ -412,7 +412,7 @@ static struct task_struct *get_thread(in
1049 if (pid == PID_MAX) pid = 0; 1096 if (pid == PID_MAX) pid = 0;
1050 1097
1051 /* First check via PID */ 1098 /* First check via PID */
1052- thread = find_task_by_pid(pid); 1099- thread = find_task_by_pid(pid);
1053+ thread = find_task_by_real_pid(pid); 1100+ thread = find_task_by_real_pid(pid);
1054 1101
1055 if (thread) 1102 if (thread)
1056 return thread; 1103 return thread;
1057Index: vserver-sources-2.0.2_2.6.15/arch/sparc/Kconfig 1104Index: linux-2.6.16/arch/sparc/Kconfig
1058=================================================================== 1105===================================================================
1059--- vserver-sources-2.0.2_2.6.15.orig/arch/sparc/Kconfig 1106--- linux-2.6.16.orig/arch/sparc/Kconfig
1060+++ vserver-sources-2.0.2_2.6.15/arch/sparc/Kconfig 1107+++ linux-2.6.16/arch/sparc/Kconfig
1061@@ -288,6 +288,8 @@ source "fs/Kconfig" 1108@@ -284,6 +284,8 @@ source "fs/Kconfig"
1062 1109
1063 source "arch/sparc/Kconfig.debug" 1110 source "arch/sparc/Kconfig.debug"
1064 1111
1065+source "kernel/vserver/Kconfig" 1112+source "kernel/vserver/Kconfig"
1066+ 1113+
1067 source "security/Kconfig" 1114 source "security/Kconfig"
1068 1115
1069 source "crypto/Kconfig" 1116 source "crypto/Kconfig"
1070Index: vserver-sources-2.0.2_2.6.15/arch/sparc/kernel/ptrace.c 1117Index: linux-2.6.16/arch/sparc/kernel/ptrace.c
1071=================================================================== 1118===================================================================
1072--- vserver-sources-2.0.2_2.6.15.orig/arch/sparc/kernel/ptrace.c 1119--- linux-2.6.16.orig/arch/sparc/kernel/ptrace.c
1073+++ vserver-sources-2.0.2_2.6.15/arch/sparc/kernel/ptrace.c 1120+++ linux-2.6.16/arch/sparc/kernel/ptrace.c
1074@@ -19,6 +19,7 @@ 1121@@ -19,6 +19,7 @@
1075 #include <linux/smp_lock.h> 1122 #include <linux/smp_lock.h>
1076 #include <linux/security.h> 1123 #include <linux/security.h>
1077 #include <linux/signal.h> 1124 #include <linux/signal.h>
1078+#include <linux/vs_cvirt.h> 1125+#include <linux/vs_cvirt.h>
1079 1126
1080 #include <asm/pgtable.h> 1127 #include <asm/pgtable.h>
1081 #include <asm/system.h> 1128 #include <asm/system.h>
1082@@ -322,6 +323,10 @@ asmlinkage void do_ptrace(struct pt_regs 1129@@ -299,6 +300,10 @@ asmlinkage void do_ptrace(struct pt_regs
1083 pt_error_return(regs, ESRCH); 1130 pt_error_return(regs, -ret);
1084 goto out; 1131 goto out;
1085 } 1132 }
1086+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT)) { 1133+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT)) {
1087+ pt_error_return(regs, ESRCH); 1134+ pt_error_return(regs, ESRCH);
1088+ goto out_tsk; 1135+ goto out_tsk;
1089+ } 1136+ }
1090 1137
1091 if ((current->personality == PER_SUNOS && request == PTRACE_SUNATTACH) 1138 if ((current->personality == PER_SUNOS && request == PTRACE_SUNATTACH)
1092 || (current->personality != PER_SUNOS && request == PTRACE_ATTACH)) { 1139 || (current->personality != PER_SUNOS && request == PTRACE_ATTACH)) {
1093Index: vserver-sources-2.0.2_2.6.15/arch/sparc/kernel/sys_sparc.c 1140Index: linux-2.6.16/arch/sparc/kernel/sys_sparc.c
1094=================================================================== 1141===================================================================
1095--- vserver-sources-2.0.2_2.6.15.orig/arch/sparc/kernel/sys_sparc.c 1142--- linux-2.6.16.orig/arch/sparc/kernel/sys_sparc.c
1096+++ vserver-sources-2.0.2_2.6.15/arch/sparc/kernel/sys_sparc.c 1143+++ linux-2.6.16/arch/sparc/kernel/sys_sparc.c
1097@@ -21,6 +21,7 @@ 1144@@ -21,6 +21,7 @@
1098 #include <linux/utsname.h> 1145 #include <linux/utsname.h>
1099 #include <linux/smp.h> 1146 #include <linux/smp.h>
1100 #include <linux/smp_lock.h> 1147 #include <linux/smp_lock.h>
1101+#include <linux/vs_cvirt.h> 1148+#include <linux/vs_cvirt.h>
1116- if (copy_to_user(name, system_utsname.domainname, len)) 1163- if (copy_to_user(name, system_utsname.domainname, len))
1117+ if (copy_to_user(name, vx_new_uts(domainname), len)) 1164+ if (copy_to_user(name, vx_new_uts(domainname), len))
1118 goto done; 1165 goto done;
1119 err = 0; 1166 err = 0;
1120 done: 1167 done:
1121Index: vserver-sources-2.0.2_2.6.15/arch/sparc/kernel/systbls.S 1168Index: linux-2.6.16/arch/sparc/kernel/systbls.S
1122=================================================================== 1169===================================================================
1123--- vserver-sources-2.0.2_2.6.15.orig/arch/sparc/kernel/systbls.S 1170--- linux-2.6.16.orig/arch/sparc/kernel/systbls.S
1124+++ vserver-sources-2.0.2_2.6.15/arch/sparc/kernel/systbls.S 1171+++ linux-2.6.16/arch/sparc/kernel/systbls.S
1125@@ -72,7 +72,7 @@ sys_call_table: 1172@@ -72,7 +72,7 @@ sys_call_table:
1126 /*250*/ .long sparc_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl 1173 /*250*/ .long sparc_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl
1127 /*255*/ .long sys_nis_syscall, sys_clock_settime, sys_clock_gettime, sys_clock_getres, sys_clock_nanosleep 1174 /*255*/ .long sys_nis_syscall, sys_clock_settime, sys_clock_gettime, sys_clock_getres, sys_clock_nanosleep
1128 /*260*/ .long sys_sched_getaffinity, sys_sched_setaffinity, sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun 1175 /*260*/ .long sys_sched_getaffinity, sys_sched_setaffinity, sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun
1129-/*265*/ .long sys_timer_delete, sys_timer_create, sys_nis_syscall, sys_io_setup, sys_io_destroy 1176-/*265*/ .long sys_timer_delete, sys_timer_create, sys_nis_syscall, sys_io_setup, sys_io_destroy
1130+/*265*/ .long sys_timer_delete, sys_timer_create, sys_vserver, sys_io_setup, sys_io_destroy 1177+/*265*/ .long sys_timer_delete, sys_timer_create, sys_vserver, sys_io_setup, sys_io_destroy
1131 /*270*/ .long sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink 1178 /*270*/ .long sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink
1132 /*275*/ .long sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid 1179 /*275*/ .long sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid
1133 /*280*/ .long sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl 1180 /*280*/ .long sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl, sys_openat
1134Index: vserver-sources-2.0.2_2.6.15/arch/sparc64/Kconfig 1181Index: linux-2.6.16/arch/sparc64/Kconfig
1135=================================================================== 1182===================================================================
1136--- vserver-sources-2.0.2_2.6.15.orig/arch/sparc64/Kconfig 1183--- linux-2.6.16.orig/arch/sparc64/Kconfig
1137+++ vserver-sources-2.0.2_2.6.15/arch/sparc64/Kconfig 1184+++ linux-2.6.16/arch/sparc64/Kconfig
1138@@ -398,6 +398,8 @@ endmenu 1185@@ -394,6 +394,8 @@ endmenu
1139 1186
1140 source "arch/sparc64/Kconfig.debug" 1187 source "arch/sparc64/Kconfig.debug"
1141 1188
1142+source "kernel/vserver/Kconfig" 1189+source "kernel/vserver/Kconfig"
1143+ 1190+
1144 source "security/Kconfig" 1191 source "security/Kconfig"
1145 1192
1146 source "crypto/Kconfig" 1193 source "crypto/Kconfig"
1147Index: vserver-sources-2.0.2_2.6.15/arch/sparc64/kernel/binfmt_aout32.c 1194Index: linux-2.6.16/arch/sparc64/kernel/binfmt_aout32.c
1148=================================================================== 1195===================================================================
1149--- vserver-sources-2.0.2_2.6.15.orig/arch/sparc64/kernel/binfmt_aout32.c 1196--- linux-2.6.16.orig/arch/sparc64/kernel/binfmt_aout32.c
1150+++ vserver-sources-2.0.2_2.6.15/arch/sparc64/kernel/binfmt_aout32.c 1197+++ linux-2.6.16/arch/sparc64/kernel/binfmt_aout32.c
1151@@ -27,6 +27,7 @@ 1198@@ -27,6 +27,7 @@
1152 #include <linux/binfmts.h> 1199 #include <linux/binfmts.h>
1153 #include <linux/personality.h> 1200 #include <linux/personality.h>
1154 #include <linux/init.h> 1201 #include <linux/init.h>
1155+#include <linux/vs_memory.h> 1202+#include <linux/vs_memory.h>
1156 1203
1157 #include <asm/system.h> 1204 #include <asm/system.h>
1158 #include <asm/uaccess.h> 1205 #include <asm/uaccess.h>
1159Index: vserver-sources-2.0.2_2.6.15/arch/sparc64/kernel/ptrace.c 1206Index: linux-2.6.16/arch/sparc64/kernel/ptrace.c
1160=================================================================== 1207===================================================================
1161--- vserver-sources-2.0.2_2.6.15.orig/arch/sparc64/kernel/ptrace.c 1208--- linux-2.6.16.orig/arch/sparc64/kernel/ptrace.c
1162+++ vserver-sources-2.0.2_2.6.15/arch/sparc64/kernel/ptrace.c 1209+++ linux-2.6.16/arch/sparc64/kernel/ptrace.c
1163@@ -22,6 +22,7 @@ 1210@@ -22,6 +22,7 @@
1164 #include <linux/seccomp.h> 1211 #include <linux/seccomp.h>
1165 #include <linux/audit.h> 1212 #include <linux/audit.h>
1166 #include <linux/signal.h> 1213 #include <linux/signal.h>
1167+#include <linux/vs_cvirt.h> 1214+#include <linux/vs_cvirt.h>
1168 1215
1169 #include <asm/asi.h> 1216 #include <asm/asi.h>
1170 #include <asm/pgtable.h> 1217 #include <asm/pgtable.h>
1171@@ -233,6 +234,10 @@ asmlinkage void do_ptrace(struct pt_regs 1218@@ -209,6 +210,10 @@ asmlinkage void do_ptrace(struct pt_regs
1172 pt_error_return(regs, ESRCH); 1219 pt_error_return(regs, -ret);
1173 goto out; 1220 goto out;
1174 } 1221 }
1175+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT)) { 1222+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT)) {
1176+ pt_error_return(regs, ESRCH); 1223+ pt_error_return(regs, ESRCH);
1177+ goto out_tsk; 1224+ goto out_tsk;
1178+ } 1225+ }
1179 1226
1180 if ((current->personality == PER_SUNOS && request == PTRACE_SUNATTACH) 1227 if ((current->personality == PER_SUNOS && request == PTRACE_SUNATTACH)
1181 || (current->personality != PER_SUNOS && request == PTRACE_ATTACH)) { 1228 || (current->personality != PER_SUNOS && request == PTRACE_ATTACH)) {
1182Index: vserver-sources-2.0.2_2.6.15/arch/sparc64/kernel/sys_sparc.c 1229Index: linux-2.6.16/arch/sparc64/kernel/sys_sparc.c
1183=================================================================== 1230===================================================================
1184--- vserver-sources-2.0.2_2.6.15.orig/arch/sparc64/kernel/sys_sparc.c 1231--- linux-2.6.16.orig/arch/sparc64/kernel/sys_sparc.c
1185+++ vserver-sources-2.0.2_2.6.15/arch/sparc64/kernel/sys_sparc.c 1232+++ linux-2.6.16/arch/sparc64/kernel/sys_sparc.c
1186@@ -25,6 +25,7 @@ 1233@@ -25,6 +25,7 @@
1187 #include <linux/syscalls.h> 1234 #include <linux/syscalls.h>
1188 #include <linux/ipc.h> 1235 #include <linux/ipc.h>
1189 #include <linux/personality.h> 1236 #include <linux/personality.h>
1190+#include <linux/vs_cvirt.h> 1237+#include <linux/vs_cvirt.h>
1205- if (copy_to_user(name, system_utsname.domainname, len)) 1252- if (copy_to_user(name, system_utsname.domainname, len))
1206+ if (copy_to_user(name, vx_new_uts(domainname), len)) 1253+ if (copy_to_user(name, vx_new_uts(domainname), len))
1207 goto done; 1254 goto done;
1208 err = 0; 1255 err = 0;
1209 done: 1256 done:
1210Index: vserver-sources-2.0.2_2.6.15/arch/sparc64/kernel/systbls.S 1257Index: linux-2.6.16/arch/sparc64/kernel/systbls.S
1211=================================================================== 1258===================================================================
1212--- vserver-sources-2.0.2_2.6.15.orig/arch/sparc64/kernel/systbls.S 1259--- linux-2.6.16.orig/arch/sparc64/kernel/systbls.S
1213+++ vserver-sources-2.0.2_2.6.15/arch/sparc64/kernel/systbls.S 1260+++ linux-2.6.16/arch/sparc64/kernel/systbls.S
1214@@ -73,7 +73,7 @@ sys_call_table32: 1261@@ -73,7 +73,7 @@ sys_call_table32:
1215 /*250*/ .word sys32_mremap, sys32_sysctl, sys32_getsid, sys_fdatasync, sys32_nfsservctl 1262 /*250*/ .word sys32_mremap, sys32_sysctl, sys32_getsid, sys_fdatasync, sys32_nfsservctl
1216 .word sys_ni_syscall, compat_sys_clock_settime, compat_sys_clock_gettime, compat_sys_clock_getres, sys32_clock_nanosleep 1263 .word sys_ni_syscall, compat_sys_clock_settime, compat_sys_clock_gettime, compat_sys_clock_getres, sys32_clock_nanosleep
1217 /*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_sys_timer_gettime, sys_timer_getoverrun 1264 /*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_sys_timer_gettime, sys_timer_getoverrun
1218- .word sys_timer_delete, sys32_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy 1265- .word sys_timer_delete, compat_sys_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy
1219+ .word sys_timer_delete, sys32_timer_create, sys32_vserver, compat_sys_io_setup, sys_io_destroy 1266+ .word sys_timer_delete, compat_sys_timer_create, sys32_vserver, compat_sys_io_setup, sys_io_destroy
1220 /*270*/ .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink 1267 /*270*/ .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink
1221 .word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid 1268 .word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid
1222 /*280*/ .word sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl 1269 /*280*/ .word sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl, compat_sys_openat
1223@@ -139,7 +139,7 @@ sys_call_table: 1270@@ -142,7 +142,7 @@ sys_call_table:
1224 /*250*/ .word sys64_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl 1271 /*250*/ .word sys64_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl
1225 .word sys_ni_syscall, sys_clock_settime, sys_clock_gettime, sys_clock_getres, sys_clock_nanosleep 1272 .word sys_ni_syscall, sys_clock_settime, sys_clock_gettime, sys_clock_getres, sys_clock_nanosleep
1226 /*260*/ .word sys_sched_getaffinity, sys_sched_setaffinity, sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun 1273 /*260*/ .word sys_sched_getaffinity, sys_sched_setaffinity, sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun
1227- .word sys_timer_delete, sys_timer_create, sys_ni_syscall, sys_io_setup, sys_io_destroy 1274- .word sys_timer_delete, sys_timer_create, sys_ni_syscall, sys_io_setup, sys_io_destroy
1228+ .word sys_timer_delete, sys_timer_create, sys_vserver, sys_io_setup, sys_io_destroy 1275+ .word sys_timer_delete, sys_timer_create, sys_vserver, sys_io_setup, sys_io_destroy
1229 /*270*/ .word sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink 1276 /*270*/ .word sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink
1230 .word sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid 1277 .word sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid
1231 /*280*/ .word sys_nis_syscall, sys_add_key, sys_request_key, sys_keyctl 1278 /*280*/ .word sys_nis_syscall, sys_add_key, sys_request_key, sys_keyctl, sys_openat
1232Index: vserver-sources-2.0.2_2.6.15/arch/sparc64/solaris/fs.c 1279Index: linux-2.6.16/arch/sparc64/solaris/fs.c
1233=================================================================== 1280===================================================================
1234--- vserver-sources-2.0.2_2.6.15.orig/arch/sparc64/solaris/fs.c 1281--- linux-2.6.16.orig/arch/sparc64/solaris/fs.c
1235+++ vserver-sources-2.0.2_2.6.15/arch/sparc64/solaris/fs.c 1282+++ linux-2.6.16/arch/sparc64/solaris/fs.c
1236@@ -362,7 +362,7 @@ static int report_statvfs(struct vfsmoun 1283@@ -363,7 +363,7 @@ static int report_statvfs(struct vfsmoun
1237 int j = strlen (p); 1284 int j = strlen (p);
1238 1285
1239 if (j > 15) j = 15; 1286 if (j > 15) j = 15;
1240- if (IS_RDONLY(inode)) i = 1; 1287- if (IS_RDONLY(inode)) i = 1;
1241+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(mnt)) i = 1; 1288+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(mnt)) i = 1;
1242 if (mnt->mnt_flags & MNT_NOSUID) i |= 2; 1289 if (mnt->mnt_flags & MNT_NOSUID) i |= 2;
1243 if (!sysv_valid_dev(inode->i_sb->s_dev)) 1290 if (!sysv_valid_dev(inode->i_sb->s_dev))
1244 return -EOVERFLOW; 1291 return -EOVERFLOW;
1245@@ -398,7 +398,7 @@ static int report_statvfs64(struct vfsmo 1292@@ -399,7 +399,7 @@ static int report_statvfs64(struct vfsmo
1246 int j = strlen (p); 1293 int j = strlen (p);
1247 1294
1248 if (j > 15) j = 15; 1295 if (j > 15) j = 15;
1249- if (IS_RDONLY(inode)) i = 1; 1296- if (IS_RDONLY(inode)) i = 1;
1250+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(mnt)) i = 1; 1297+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(mnt)) i = 1;
1251 if (mnt->mnt_flags & MNT_NOSUID) i |= 2; 1298 if (mnt->mnt_flags & MNT_NOSUID) i |= 2;
1252 if (!sysv_valid_dev(inode->i_sb->s_dev)) 1299 if (!sysv_valid_dev(inode->i_sb->s_dev))
1253 return -EOVERFLOW; 1300 return -EOVERFLOW;
1254Index: vserver-sources-2.0.2_2.6.15/arch/um/Kconfig 1301Index: linux-2.6.16/arch/um/Kconfig
1255=================================================================== 1302===================================================================
1256--- vserver-sources-2.0.2_2.6.15.orig/arch/um/Kconfig 1303--- linux-2.6.16.orig/arch/um/Kconfig
1257+++ vserver-sources-2.0.2_2.6.15/arch/um/Kconfig 1304+++ linux-2.6.16/arch/um/Kconfig
1258@@ -293,6 +293,8 @@ source "drivers/connector/Kconfig" 1305@@ -290,6 +290,8 @@ source "drivers/connector/Kconfig"
1259 1306
1260 source "fs/Kconfig" 1307 source "fs/Kconfig"
1261 1308
1262+source "kernel/vserver/Kconfig" 1309+source "kernel/vserver/Kconfig"
1263+ 1310+
1264 source "security/Kconfig" 1311 source "security/Kconfig"
1265 1312
1266 source "crypto/Kconfig" 1313 source "crypto/Kconfig"
1267Index: vserver-sources-2.0.2_2.6.15/arch/um/drivers/mconsole_kern.c 1314Index: linux-2.6.16/arch/um/drivers/mconsole_kern.c
1268=================================================================== 1315===================================================================
1269--- vserver-sources-2.0.2_2.6.15.orig/arch/um/drivers/mconsole_kern.c 1316--- linux-2.6.16.orig/arch/um/drivers/mconsole_kern.c
1270+++ vserver-sources-2.0.2_2.6.15/arch/um/drivers/mconsole_kern.c 1317+++ linux-2.6.16/arch/um/drivers/mconsole_kern.c
1271@@ -20,6 +20,7 @@ 1318@@ -21,6 +21,7 @@
1272 #include "linux/namei.h"
1273 #include "linux/proc_fs.h" 1319 #include "linux/proc_fs.h"
1274 #include "linux/syscalls.h" 1320 #include "linux/syscalls.h"
1321 #include "linux/console.h"
1275+#include "linux/vs_cvirt.h" 1322+#include "linux/vs_cvirt.h"
1276 #include "asm/irq.h" 1323 #include "asm/irq.h"
1277 #include "asm/uaccess.h" 1324 #include "asm/uaccess.h"
1278 #include "user_util.h" 1325 #include "user_util.h"
1279Index: vserver-sources-2.0.2_2.6.15/arch/um/kernel/process_kern.c 1326Index: linux-2.6.16/arch/um/kernel/process_kern.c
1280=================================================================== 1327===================================================================
1281--- vserver-sources-2.0.2_2.6.15.orig/arch/um/kernel/process_kern.c 1328--- linux-2.6.16.orig/arch/um/kernel/process_kern.c
1282+++ vserver-sources-2.0.2_2.6.15/arch/um/kernel/process_kern.c 1329+++ linux-2.6.16/arch/um/kernel/process_kern.c
1283@@ -23,6 +23,8 @@ 1330@@ -23,6 +23,8 @@
1284 #include "linux/proc_fs.h" 1331 #include "linux/proc_fs.h"
1285 #include "linux/ptrace.h" 1332 #include "linux/ptrace.h"
1286 #include "linux/random.h" 1333 #include "linux/random.h"
1287+#include "linux/vs_cvirt.h" 1334+#include "linux/vs_cvirt.h"
1288+ 1335+
1289 #include "asm/unistd.h" 1336 #include "asm/unistd.h"
1290 #include "asm/mman.h" 1337 #include "asm/mman.h"
1291 #include "asm/segment.h" 1338 #include "asm/segment.h"
1292Index: vserver-sources-2.0.2_2.6.15/arch/um/kernel/syscall_kern.c 1339Index: linux-2.6.16/arch/um/kernel/syscall_kern.c
1293=================================================================== 1340===================================================================
1294--- vserver-sources-2.0.2_2.6.15.orig/arch/um/kernel/syscall_kern.c 1341--- linux-2.6.16.orig/arch/um/kernel/syscall_kern.c
1295+++ vserver-sources-2.0.2_2.6.15/arch/um/kernel/syscall_kern.c 1342+++ linux-2.6.16/arch/um/kernel/syscall_kern.c
1296@@ -15,6 +15,8 @@ 1343@@ -15,6 +15,8 @@
1297 #include "linux/unistd.h" 1344 #include "linux/unistd.h"
1298 #include "linux/slab.h" 1345 #include "linux/slab.h"
1299 #include "linux/utime.h" 1346 #include "linux/utime.h"
1300+#include <linux/vs_cvirt.h> 1347+#include <linux/vs_cvirt.h>
1343- error |= __copy_to_user(&name->machine,&system_utsname.machine, 1390- error |= __copy_to_user(&name->machine,&system_utsname.machine,
1344+ error |= __copy_to_user(&name->machine,ptr->machine, 1391+ error |= __copy_to_user(&name->machine,ptr->machine,
1345 __OLD_UTS_LEN); 1392 __OLD_UTS_LEN);
1346 error |= __put_user(0,name->machine+__OLD_UTS_LEN); 1393 error |= __put_user(0,name->machine+__OLD_UTS_LEN);
1347 1394
1348Index: vserver-sources-2.0.2_2.6.15/arch/v850/Kconfig 1395Index: linux-2.6.16/arch/v850/Kconfig
1349=================================================================== 1396===================================================================
1350--- vserver-sources-2.0.2_2.6.15.orig/arch/v850/Kconfig 1397--- linux-2.6.16.orig/arch/v850/Kconfig
1351+++ vserver-sources-2.0.2_2.6.15/arch/v850/Kconfig 1398+++ linux-2.6.16/arch/v850/Kconfig
1352@@ -319,6 +319,8 @@ source "drivers/usb/Kconfig" 1399@@ -320,6 +320,8 @@ source "drivers/usb/Kconfig"
1353 1400
1354 source "arch/v850/Kconfig.debug" 1401 source "arch/v850/Kconfig.debug"
1355 1402
1356+source "kernel/vserver/Kconfig" 1403+source "kernel/vserver/Kconfig"
1357+ 1404+
1358 source "security/Kconfig" 1405 source "security/Kconfig"
1359 1406
1360 source "crypto/Kconfig" 1407 source "crypto/Kconfig"
1361Index: vserver-sources-2.0.2_2.6.15/arch/v850/kernel/ptrace.c 1408Index: linux-2.6.16/arch/v850/kernel/ptrace.c
1362=================================================================== 1409===================================================================
1363--- vserver-sources-2.0.2_2.6.15.orig/arch/v850/kernel/ptrace.c 1410--- linux-2.6.16.orig/arch/v850/kernel/ptrace.c
1364+++ vserver-sources-2.0.2_2.6.15/arch/v850/kernel/ptrace.c 1411+++ linux-2.6.16/arch/v850/kernel/ptrace.c
1365@@ -137,6 +137,8 @@ long arch_ptrace(struct task_struct *chi 1412@@ -137,6 +137,8 @@ long arch_ptrace(struct task_struct *chi
1366 break; 1413 break;
1367 rval = -EIO; 1414 rval = -EIO;
1368 goto out; 1415 goto out;
1369+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT)) 1416+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT))
1370+ goto out_tsk; 1417+ goto out_tsk;
1371 1418
1372 /* Read/write the word at location ADDR in the registers. */ 1419 /* Read/write the word at location ADDR in the registers. */
1373 case PTRACE_PEEKUSR: 1420 case PTRACE_PEEKUSR:
1374Index: vserver-sources-2.0.2_2.6.15/arch/x86_64/Kconfig 1421Index: linux-2.6.16/arch/x86_64/Kconfig
1375=================================================================== 1422===================================================================
1376--- vserver-sources-2.0.2_2.6.15.orig/arch/x86_64/Kconfig 1423--- linux-2.6.16.orig/arch/x86_64/Kconfig
1377+++ vserver-sources-2.0.2_2.6.15/arch/x86_64/Kconfig 1424+++ linux-2.6.16/arch/x86_64/Kconfig
1378@@ -574,6 +574,8 @@ endmenu 1425@@ -588,6 +588,8 @@ endmenu
1379 1426
1380 source "arch/x86_64/Kconfig.debug" 1427 source "arch/x86_64/Kconfig.debug"
1381 1428
1382+source "kernel/vserver/Kconfig" 1429+source "kernel/vserver/Kconfig"
1383+ 1430+
1384 source "security/Kconfig" 1431 source "security/Kconfig"
1385 1432
1386 source "crypto/Kconfig" 1433 source "crypto/Kconfig"
1387Index: vserver-sources-2.0.2_2.6.15/arch/x86_64/ia32/ia32_aout.c 1434Index: linux-2.6.16/arch/x86_64/ia32/ia32_aout.c
1388=================================================================== 1435===================================================================
1389--- vserver-sources-2.0.2_2.6.15.orig/arch/x86_64/ia32/ia32_aout.c 1436--- linux-2.6.16.orig/arch/x86_64/ia32/ia32_aout.c
1390+++ vserver-sources-2.0.2_2.6.15/arch/x86_64/ia32/ia32_aout.c 1437+++ linux-2.6.16/arch/x86_64/ia32/ia32_aout.c
1391@@ -25,6 +25,7 @@ 1438@@ -25,6 +25,7 @@
1392 #include <linux/binfmts.h> 1439 #include <linux/binfmts.h>
1393 #include <linux/personality.h> 1440 #include <linux/personality.h>
1394 #include <linux/init.h> 1441 #include <linux/init.h>
1395+#include <linux/vs_memory.h> 1442+#include <linux/vs_memory.h>
1396 1443
1397 #include <asm/system.h> 1444 #include <asm/system.h>
1398 #include <asm/uaccess.h> 1445 #include <asm/uaccess.h>
1399Index: vserver-sources-2.0.2_2.6.15/arch/x86_64/ia32/ia32_binfmt.c 1446Index: linux-2.6.16/arch/x86_64/ia32/ia32_binfmt.c
1400=================================================================== 1447===================================================================
1401--- vserver-sources-2.0.2_2.6.15.orig/arch/x86_64/ia32/ia32_binfmt.c 1448--- linux-2.6.16.orig/arch/x86_64/ia32/ia32_binfmt.c
1402+++ vserver-sources-2.0.2_2.6.15/arch/x86_64/ia32/ia32_binfmt.c 1449+++ linux-2.6.16/arch/x86_64/ia32/ia32_binfmt.c
1403@@ -374,7 +374,8 @@ int ia32_setup_arg_pages(struct linux_bi 1450@@ -371,7 +371,8 @@ int ia32_setup_arg_pages(struct linux_bi
1404 kmem_cache_free(vm_area_cachep, mpnt); 1451 kmem_cache_free(vm_area_cachep, mpnt);
1405 return ret; 1452 return ret;
1406 } 1453 }
1407- mm->stack_vm = mm->total_vm = vma_pages(mpnt); 1454- mm->stack_vm = mm->total_vm = vma_pages(mpnt);
1408+ vx_vmpages_sub(mm, mm->total_vm - vma_pages(mpnt)); 1455+ vx_vmpages_sub(mm, mm->total_vm - vma_pages(mpnt));
1409+ mm->stack_vm = mm->total_vm; 1456+ mm->stack_vm = mm->total_vm;
1410 } 1457 }
1411 1458
1412 for (i = 0 ; i < MAX_ARG_PAGES ; i++) { 1459 for (i = 0 ; i < MAX_ARG_PAGES ; i++) {
1413Index: vserver-sources-2.0.2_2.6.15/arch/x86_64/ia32/ia32entry.S 1460Index: linux-2.6.16/arch/x86_64/ia32/ia32entry.S
1414=================================================================== 1461===================================================================
1415--- vserver-sources-2.0.2_2.6.15.orig/arch/x86_64/ia32/ia32entry.S 1462--- linux-2.6.16.orig/arch/x86_64/ia32/ia32entry.S
1416+++ vserver-sources-2.0.2_2.6.15/arch/x86_64/ia32/ia32entry.S 1463+++ linux-2.6.16/arch/x86_64/ia32/ia32entry.S
1417@@ -622,7 +622,7 @@ ia32_sys_call_table: 1464@@ -650,7 +650,7 @@ ia32_sys_call_table:
1418 .quad sys_tgkill /* 270 */ 1465 .quad sys_tgkill /* 270 */
1419 .quad compat_sys_utimes 1466 .quad compat_sys_utimes
1420 .quad sys32_fadvise64_64 1467 .quad sys32_fadvise64_64
1421- .quad quiet_ni_syscall /* sys_vserver */ 1468- .quad quiet_ni_syscall /* sys_vserver */
1422+ .quad sys32_vserver 1469+ .quad sys32_vserver
1423 .quad sys_mbind 1470 .quad sys_mbind
1424 .quad compat_sys_get_mempolicy /* 275 */ 1471 .quad compat_sys_get_mempolicy /* 275 */
1425 .quad sys_set_mempolicy 1472 .quad sys_set_mempolicy
1426Index: vserver-sources-2.0.2_2.6.15/arch/x86_64/ia32/ptrace32.c 1473Index: linux-2.6.16/arch/x86_64/ia32/ptrace32.c
1427=================================================================== 1474===================================================================
1428--- vserver-sources-2.0.2_2.6.15.orig/arch/x86_64/ia32/ptrace32.c 1475--- linux-2.6.16.orig/arch/x86_64/ia32/ptrace32.c
1429+++ vserver-sources-2.0.2_2.6.15/arch/x86_64/ia32/ptrace32.c 1476+++ linux-2.6.16/arch/x86_64/ia32/ptrace32.c
1430@@ -18,6 +18,7 @@ 1477@@ -18,6 +18,7 @@
1431 #include <linux/unistd.h> 1478 #include <linux/unistd.h>
1432 #include <linux/mm.h> 1479 #include <linux/mm.h>
1433 #include <linux/ptrace.h> 1480 #include <linux/ptrace.h>
1434+#include <linux/vs_cvirt.h> 1481+#include <linux/vs_cvirt.h>
1435 #include <asm/ptrace.h> 1482 #include <asm/ptrace.h>
1436 #include <asm/compat.h> 1483 #include <asm/compat.h>
1437 #include <asm/uaccess.h> 1484 #include <asm/uaccess.h>
1438Index: vserver-sources-2.0.2_2.6.15/arch/x86_64/ia32/sys_ia32.c 1485Index: linux-2.6.16/arch/x86_64/ia32/sys_ia32.c
1439=================================================================== 1486===================================================================
1440--- vserver-sources-2.0.2_2.6.15.orig/arch/x86_64/ia32/sys_ia32.c 1487--- linux-2.6.16.orig/arch/x86_64/ia32/sys_ia32.c
1441+++ vserver-sources-2.0.2_2.6.15/arch/x86_64/ia32/sys_ia32.c 1488+++ linux-2.6.16/arch/x86_64/ia32/sys_ia32.c
1442@@ -62,6 +62,7 @@ 1489@@ -62,6 +62,7 @@
1443 #include <linux/highuid.h> 1490 #include <linux/highuid.h>
1444 #include <linux/vmalloc.h> 1491 #include <linux/vmalloc.h>
1445 #include <linux/fsnotify.h> 1492 #include <linux/fsnotify.h>
1446+#include <linux/vs_cvirt.h> 1493+#include <linux/vs_cvirt.h>
1447 #include <asm/mman.h> 1494 #include <asm/mman.h>
1448 #include <asm/types.h> 1495 #include <asm/types.h>
1449 #include <asm/uaccess.h> 1496 #include <asm/uaccess.h>
1450@@ -860,6 +861,7 @@ asmlinkage long sys32_mmap2(unsigned lon 1497@@ -882,6 +883,7 @@ asmlinkage long sys32_mmap2(unsigned lon
1451 asmlinkage long sys32_olduname(struct oldold_utsname __user * name) 1498 asmlinkage long sys32_olduname(struct oldold_utsname __user * name)
1452 { 1499 {
1453 int error; 1500 int error;
1454+ struct new_utsname *ptr; 1501+ struct new_utsname *ptr;
1455 1502
1456 if (!name) 1503 if (!name)
1457 return -EFAULT; 1504 return -EFAULT;
1458@@ -868,13 +870,14 @@ asmlinkage long sys32_olduname(struct ol 1505@@ -890,13 +892,14 @@ asmlinkage long sys32_olduname(struct ol
1459 1506
1460 down_read(&uts_sem); 1507 down_read(&uts_sem);
1461 1508
1462- error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN); 1509- error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN);
1463+ ptr = vx_new_utsname(); 1510+ ptr = vx_new_utsname();
1472- __copy_to_user(&name->version,&system_utsname.version,__OLD_UTS_LEN); 1519- __copy_to_user(&name->version,&system_utsname.version,__OLD_UTS_LEN);
1473+ __copy_to_user(&name->version,ptr->version,__OLD_UTS_LEN); 1520+ __copy_to_user(&name->version,ptr->version,__OLD_UTS_LEN);
1474 __put_user(0,name->version+__OLD_UTS_LEN); 1521 __put_user(0,name->version+__OLD_UTS_LEN);
1475 { 1522 {
1476 char *arch = "x86_64"; 1523 char *arch = "x86_64";
1477@@ -897,7 +900,7 @@ long sys32_uname(struct old_utsname __us 1524@@ -919,7 +922,7 @@ long sys32_uname(struct old_utsname __us
1478 if (!name) 1525 if (!name)
1479 return -EFAULT; 1526 return -EFAULT;
1480 down_read(&uts_sem); 1527 down_read(&uts_sem);
1481- err=copy_to_user(name, &system_utsname, sizeof (*name)); 1528- err=copy_to_user(name, &system_utsname, sizeof (*name));
1482+ err=copy_to_user(name, vx_new_utsname(), sizeof (*name)); 1529+ err=copy_to_user(name, vx_new_utsname(), sizeof (*name));
1483 up_read(&uts_sem); 1530 up_read(&uts_sem);
1484 if (personality(current->personality) == PER_LINUX32) 1531 if (personality(current->personality) == PER_LINUX32)
1485 err |= copy_to_user(&name->machine, "i686", 5); 1532 err |= copy_to_user(&name->machine, "i686", 5);
1486Index: vserver-sources-2.0.2_2.6.15/arch/x86_64/ia32/syscall32.c 1533Index: linux-2.6.16/arch/x86_64/ia32/syscall32.c
1487=================================================================== 1534===================================================================
1488--- vserver-sources-2.0.2_2.6.15.orig/arch/x86_64/ia32/syscall32.c 1535--- linux-2.6.16.orig/arch/x86_64/ia32/syscall32.c
1489+++ vserver-sources-2.0.2_2.6.15/arch/x86_64/ia32/syscall32.c 1536+++ linux-2.6.16/arch/x86_64/ia32/syscall32.c
1490@@ -10,6 +10,7 @@ 1537@@ -10,6 +10,7 @@
1491 #include <linux/init.h> 1538 #include <linux/init.h>
1492 #include <linux/stringify.h> 1539 #include <linux/stringify.h>
1493 #include <linux/security.h> 1540 #include <linux/security.h>
1494+#include <linux/vs_memory.h> 1541+#include <linux/vs_memory.h>
1502- mm->total_vm += npages; 1549- mm->total_vm += npages;
1503+ vx_vmpages_add(mm, npages); 1550+ vx_vmpages_add(mm, npages);
1504 up_write(&mm->mmap_sem); 1551 up_write(&mm->mmap_sem);
1505 return 0; 1552 return 0;
1506 } 1553 }
1507Index: vserver-sources-2.0.2_2.6.15/arch/x86_64/kernel/sys_x86_64.c 1554Index: linux-2.6.16/arch/x86_64/kernel/sys_x86_64.c
1508=================================================================== 1555===================================================================
1509--- vserver-sources-2.0.2_2.6.15.orig/arch/x86_64/kernel/sys_x86_64.c 1556--- linux-2.6.16.orig/arch/x86_64/kernel/sys_x86_64.c
1510+++ vserver-sources-2.0.2_2.6.15/arch/x86_64/kernel/sys_x86_64.c 1557+++ linux-2.6.16/arch/x86_64/kernel/sys_x86_64.c
1511@@ -16,6 +16,7 @@ 1558@@ -16,6 +16,7 @@
1512 #include <linux/file.h> 1559 #include <linux/file.h>
1513 #include <linux/utsname.h> 1560 #include <linux/utsname.h>
1514 #include <linux/personality.h> 1561 #include <linux/personality.h>
1515+#include <linux/vs_cvirt.h> 1562+#include <linux/vs_cvirt.h>
1523- err = copy_to_user(name, &system_utsname, sizeof (*name)); 1570- err = copy_to_user(name, &system_utsname, sizeof (*name));
1524+ err = copy_to_user(name, vx_new_utsname(), sizeof (*name)); 1571+ err = copy_to_user(name, vx_new_utsname(), sizeof (*name));
1525 up_read(&uts_sem); 1572 up_read(&uts_sem);
1526 if (personality(current->personality) == PER_LINUX32) 1573 if (personality(current->personality) == PER_LINUX32)
1527 err |= copy_to_user(&name->machine, "i686", 5); 1574 err |= copy_to_user(&name->machine, "i686", 5);
1528Index: vserver-sources-2.0.2_2.6.15/drivers/block/Kconfig 1575Index: linux-2.6.16/arch/x86_64/kernel/traps.c
1529=================================================================== 1576===================================================================
1530--- vserver-sources-2.0.2_2.6.15.orig/drivers/block/Kconfig 1577--- linux-2.6.16.orig/arch/x86_64/kernel/traps.c
1531+++ vserver-sources-2.0.2_2.6.15/drivers/block/Kconfig 1578+++ linux-2.6.16/arch/x86_64/kernel/traps.c
1579@@ -321,8 +321,9 @@ void show_registers(struct pt_regs *regs
1580
1581 printk("CPU %d ", cpu);
1582 __show_regs(regs);
1583- printk("Process %s (pid: %d, threadinfo %p, task %p)\n",
1584- cur->comm, cur->pid, task_thread_info(cur), cur);
1585+ printk("Process %s (pid: %d[#%u], threadinfo %p, task %p)\n",
1586+ cur->comm, cur->pid, cur->xid,
1587+ task_thread_info(cur), cur);
1588
1589 /*
1590 * When in-kernel, we also print out the stack and code at the
1591Index: linux-2.6.16/drivers/block/Kconfig
1592===================================================================
1593--- linux-2.6.16.orig/drivers/block/Kconfig
1594+++ linux-2.6.16/drivers/block/Kconfig
1532@@ -315,6 +315,13 @@ config BLK_DEV_CRYPTOLOOP 1595@@ -315,6 +315,13 @@ config BLK_DEV_CRYPTOLOOP
1533 instead, which can be configured to be on-disk compatible with the 1596 instead, which can be configured to be on-disk compatible with the
1534 cryptoloop device. 1597 cryptoloop device.
1535 1598
1536+config BLK_DEV_VROOT 1599+config BLK_DEV_VROOT
1541+ partition within a virtual server without compromising security. 1604+ partition within a virtual server without compromising security.
1542+ 1605+
1543 config BLK_DEV_NBD 1606 config BLK_DEV_NBD
1544 tristate "Network block device support" 1607 tristate "Network block device support"
1545 depends on NET 1608 depends on NET
1546Index: vserver-sources-2.0.2_2.6.15/drivers/block/Makefile 1609Index: linux-2.6.16/drivers/block/Makefile
1547=================================================================== 1610===================================================================
1548--- vserver-sources-2.0.2_2.6.15.orig/drivers/block/Makefile 1611--- linux-2.6.16.orig/drivers/block/Makefile
1549+++ vserver-sources-2.0.2_2.6.15/drivers/block/Makefile 1612+++ linux-2.6.16/drivers/block/Makefile
1550@@ -30,4 +30,5 @@ obj-$(CONFIG_BLK_DEV_CRYPTOLOOP) += cryp 1613@@ -30,4 +30,5 @@ obj-$(CONFIG_BLK_DEV_CRYPTOLOOP) += cryp
1551 obj-$(CONFIG_VIODASD) += viodasd.o 1614 obj-$(CONFIG_VIODASD) += viodasd.o
1552 obj-$(CONFIG_BLK_DEV_SX8) += sx8.o 1615 obj-$(CONFIG_BLK_DEV_SX8) += sx8.o
1553 obj-$(CONFIG_BLK_DEV_UB) += ub.o 1616 obj-$(CONFIG_BLK_DEV_UB) += ub.o
1554+obj-$(CONFIG_BLK_DEV_VROOT) += vroot.o 1617+obj-$(CONFIG_BLK_DEV_VROOT) += vroot.o
1555 1618
1556Index: vserver-sources-2.0.2_2.6.15/drivers/block/vroot.c 1619Index: linux-2.6.16/drivers/block/vroot.c
1557=================================================================== 1620===================================================================
1558--- /dev/null 1621--- /dev/null
1559+++ vserver-sources-2.0.2_2.6.15/drivers/block/vroot.c 1622+++ linux-2.6.16/drivers/block/vroot.c
1560@@ -0,0 +1,289 @@ 1623@@ -0,0 +1,289 @@
1561+/* 1624+/*
1562+ * linux/drivers/block/vroot.c 1625+ * linux/drivers/block/vroot.c
1563+ * 1626+ *
1564+ * written by Herbert P÷tzl, 9/11/2002 1627+ * written by Herbert P÷tzl, 9/11/2002
1845+ 1908+
1846+__setup("max_vroot=", max_vroot_setup); 1909+__setup("max_vroot=", max_vroot_setup);
1847+ 1910+
1848+#endif 1911+#endif
1849+ 1912+
1850Index: vserver-sources-2.0.2_2.6.15/drivers/char/random.c 1913Index: linux-2.6.16/drivers/char/random.c
1851=================================================================== 1914===================================================================
1852--- vserver-sources-2.0.2_2.6.15.orig/drivers/char/random.c 1915--- linux-2.6.16.orig/drivers/char/random.c
1853+++ vserver-sources-2.0.2_2.6.15/drivers/char/random.c 1916+++ linux-2.6.16/drivers/char/random.c
1854@@ -1174,7 +1174,7 @@ static char sysctl_bootid[16]; 1917@@ -1174,7 +1174,7 @@ static char sysctl_bootid[16];
1855 static int proc_do_uuid(ctl_table *table, int write, struct file *filp, 1918 static int proc_do_uuid(ctl_table *table, int write, struct file *filp,
1856 void __user *buffer, size_t *lenp, loff_t *ppos) 1919 void __user *buffer, size_t *lenp, loff_t *ppos)
1857 { 1920 {
1858- ctl_table fake_table; 1921- ctl_table fake_table;
1859+ ctl_table fake_table = {0}; 1922+ ctl_table fake_table = {0};
1860 unsigned char buf[64], tmp_uuid[16], *uuid; 1923 unsigned char buf[64], tmp_uuid[16], *uuid;
1861 1924
1862 uuid = table->data; 1925 uuid = table->data;
1863Index: vserver-sources-2.0.2_2.6.15/drivers/char/tty_io.c 1926Index: linux-2.6.16/drivers/char/tty_io.c
1864=================================================================== 1927===================================================================
1865--- vserver-sources-2.0.2_2.6.15.orig/drivers/char/tty_io.c 1928--- linux-2.6.16.orig/drivers/char/tty_io.c
1866+++ vserver-sources-2.0.2_2.6.15/drivers/char/tty_io.c 1929+++ linux-2.6.16/drivers/char/tty_io.c
1867@@ -103,6 +103,7 @@ 1930@@ -103,6 +103,7 @@
1868 #include <linux/vt_kern.h> 1931 #include <linux/vt_kern.h>
1869 #include <linux/selection.h> 1932 #include <linux/selection.h>
1870 #include <linux/devfs_fs_kernel.h> 1933 #include <linux/devfs_fs_kernel.h>
1871+#include <linux/vs_cvirt.h> 1934+#include <linux/vs_cvirt.h>
1872 1935
1873 #include <linux/kmod.h> 1936 #include <linux/kmod.h>
1874 1937
1875@@ -2152,13 +2153,16 @@ static int tiocsctty(struct tty_struct * 1938@@ -2381,13 +2382,16 @@ static int tiocsctty(struct tty_struct *
1876 1939
1877 static int tiocgpgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p) 1940 static int tiocgpgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p)
1878 { 1941 {
1879+ pid_t pgrp; 1942+ pid_t pgrp;
1880 /* 1943 /*
1888+ pgrp = vx_map_pid(real_tty->pgrp); 1951+ pgrp = vx_map_pid(real_tty->pgrp);
1889+ return put_user(pgrp, p); 1952+ return put_user(pgrp, p);
1890 } 1953 }
1891 1954
1892 static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p) 1955 static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p)
1893@@ -2176,6 +2180,8 @@ static int tiocspgrp(struct tty_struct * 1956@@ -2405,6 +2409,8 @@ static int tiocspgrp(struct tty_struct *
1894 return -ENOTTY; 1957 return -ENOTTY;
1895 if (get_user(pgrp, p)) 1958 if (get_user(pgrp, p))
1896 return -EFAULT; 1959 return -EFAULT;
1897+ 1960+
1898+ pgrp = vx_rmap_pid(pgrp); 1961+ pgrp = vx_rmap_pid(pgrp);
1899 if (pgrp < 0) 1962 if (pgrp < 0)
1900 return -EINVAL; 1963 return -EINVAL;
1901 if (session_of_pgrp(pgrp) != current->signal->session) 1964 if (session_of_pgrp(pgrp) != current->signal->session)
1902Index: vserver-sources-2.0.2_2.6.15/drivers/infiniband/core/uverbs_mem.c 1965Index: linux-2.6.16/drivers/infiniband/core/uverbs_mem.c
1903=================================================================== 1966===================================================================
1904--- vserver-sources-2.0.2_2.6.15.orig/drivers/infiniband/core/uverbs_mem.c 1967--- linux-2.6.16.orig/drivers/infiniband/core/uverbs_mem.c
1905+++ vserver-sources-2.0.2_2.6.15/drivers/infiniband/core/uverbs_mem.c 1968+++ linux-2.6.16/drivers/infiniband/core/uverbs_mem.c
1906@@ -36,6 +36,7 @@ 1969@@ -36,6 +36,7 @@
1907 1970
1908 #include <linux/mm.h> 1971 #include <linux/mm.h>
1909 #include <linux/dma-mapping.h> 1972 #include <linux/dma-mapping.h>
1910+#include <linux/vs_memory.h> 1973+#include <linux/vs_memory.h>
1938- work->mm->locked_vm -= work->diff; 2001- work->mm->locked_vm -= work->diff;
1939+ vx_vmlocked_sub(work->mm, work->diff); 2002+ vx_vmlocked_sub(work->mm, work->diff);
1940 up_write(&work->mm->mmap_sem); 2003 up_write(&work->mm->mmap_sem);
1941 mmput(work->mm); 2004 mmput(work->mm);
1942 kfree(work); 2005 kfree(work);
1943Index: vserver-sources-2.0.2_2.6.15/fs/attr.c 2006Index: linux-2.6.16/fs/attr.c
1944=================================================================== 2007===================================================================
1945--- vserver-sources-2.0.2_2.6.15.orig/fs/attr.c 2008--- linux-2.6.16.orig/fs/attr.c
1946+++ vserver-sources-2.0.2_2.6.15/fs/attr.c 2009+++ linux-2.6.16/fs/attr.c
1947@@ -15,6 +15,9 @@ 2010@@ -15,6 +15,9 @@
2011 #include <linux/fcntl.h>
1948 #include <linux/quotaops.h> 2012 #include <linux/quotaops.h>
1949 #include <linux/security.h> 2013 #include <linux/security.h>
1950 #include <linux/time.h>
1951+#include <linux/proc_fs.h> 2014+#include <linux/proc_fs.h>
1952+#include <linux/devpts_fs.h> 2015+#include <linux/devpts_fs.h>
1953+#include <linux/vserver/debug.h> 2016+#include <linux/vserver/debug.h>
1954 2017
1955 /* Taken over from the old code... */ 2018 /* Taken over from the old code... */
1981+ goto error; 2044+ goto error;
1982+ } 2045+ }
1983 fine: 2046 fine:
1984 retval = 0; 2047 retval = 0;
1985 error: 2048 error:
1986@@ -87,6 +112,8 @@ int inode_setattr(struct inode * inode, 2049@@ -79,6 +104,8 @@ int inode_setattr(struct inode * inode,
1987 inode->i_uid = attr->ia_uid; 2050 inode->i_uid = attr->ia_uid;
1988 if (ia_valid & ATTR_GID) 2051 if (ia_valid & ATTR_GID)
1989 inode->i_gid = attr->ia_gid; 2052 inode->i_gid = attr->ia_gid;
1990+ if ((ia_valid & ATTR_XID) && IS_TAGXID(inode)) 2053+ if ((ia_valid & ATTR_XID) && IS_TAGXID(inode))
1991+ inode->i_xid = attr->ia_xid; 2054+ inode->i_xid = attr->ia_xid;
1992 if (ia_valid & ATTR_ATIME) 2055 if (ia_valid & ATTR_ATIME)
1993 inode->i_atime = timespec_trunc(attr->ia_atime, 2056 inode->i_atime = timespec_trunc(attr->ia_atime,
1994 inode->i_sb->s_time_gran); 2057 inode->i_sb->s_time_gran);
1995@@ -161,7 +188,8 @@ int notify_change(struct dentry * dentry 2058@@ -153,7 +180,8 @@ int notify_change(struct dentry * dentry
1996 error = security_inode_setattr(dentry, attr); 2059 error = security_inode_setattr(dentry, attr);
1997 if (!error) { 2060 if (!error) {
1998 if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || 2061 if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
1999- (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) 2062- (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid))
2000+ (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid) || 2063+ (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid) ||
2001+ (ia_valid & ATTR_XID && attr->ia_xid != inode->i_xid)) 2064+ (ia_valid & ATTR_XID && attr->ia_xid != inode->i_xid))
2002 error = DQUOT_TRANSFER(inode, attr) ? -EDQUOT : 0; 2065 error = DQUOT_TRANSFER(inode, attr) ? -EDQUOT : 0;
2003 if (!error) 2066 if (!error)
2004 error = inode_setattr(inode, attr); 2067 error = inode_setattr(inode, attr);
2005Index: vserver-sources-2.0.2_2.6.15/fs/binfmt_aout.c 2068Index: linux-2.6.16/fs/binfmt_aout.c
2006=================================================================== 2069===================================================================
2007--- vserver-sources-2.0.2_2.6.15.orig/fs/binfmt_aout.c 2070--- linux-2.6.16.orig/fs/binfmt_aout.c
2008+++ vserver-sources-2.0.2_2.6.15/fs/binfmt_aout.c 2071+++ linux-2.6.16/fs/binfmt_aout.c
2009@@ -24,6 +24,7 @@ 2072@@ -24,6 +24,7 @@
2010 #include <linux/binfmts.h> 2073 #include <linux/binfmts.h>
2011 #include <linux/personality.h> 2074 #include <linux/personality.h>
2012 #include <linux/init.h> 2075 #include <linux/init.h>
2013+#include <linux/vs_memory.h> 2076+#include <linux/vs_memory.h>
2014 2077
2015 #include <asm/system.h> 2078 #include <asm/system.h>
2016 #include <asm/uaccess.h> 2079 #include <asm/uaccess.h>
2017Index: vserver-sources-2.0.2_2.6.15/fs/binfmt_elf.c 2080Index: linux-2.6.16/fs/binfmt_elf.c
2018=================================================================== 2081===================================================================
2019--- vserver-sources-2.0.2_2.6.15.orig/fs/binfmt_elf.c 2082--- linux-2.6.16.orig/fs/binfmt_elf.c
2020+++ vserver-sources-2.0.2_2.6.15/fs/binfmt_elf.c 2083+++ linux-2.6.16/fs/binfmt_elf.c
2021@@ -38,6 +38,7 @@ 2084@@ -38,6 +38,7 @@
2022 #include <linux/security.h> 2085 #include <linux/security.h>
2023 #include <linux/syscalls.h> 2086 #include <linux/syscalls.h>
2024 #include <linux/random.h> 2087 #include <linux/random.h>
2025+#include <linux/vs_memory.h> 2088+#include <linux/vs_memory.h>
2026 2089
2027 #include <asm/uaccess.h> 2090 #include <asm/uaccess.h>
2028 #include <asm/param.h> 2091 #include <asm/param.h>
2029Index: vserver-sources-2.0.2_2.6.15/fs/binfmt_flat.c 2092Index: linux-2.6.16/fs/binfmt_flat.c
2030=================================================================== 2093===================================================================
2031--- vserver-sources-2.0.2_2.6.15.orig/fs/binfmt_flat.c 2094--- linux-2.6.16.orig/fs/binfmt_flat.c
2032+++ vserver-sources-2.0.2_2.6.15/fs/binfmt_flat.c 2095+++ linux-2.6.16/fs/binfmt_flat.c
2033@@ -36,6 +36,7 @@ 2096@@ -36,6 +36,7 @@
2034 #include <linux/personality.h> 2097 #include <linux/personality.h>
2035 #include <linux/init.h> 2098 #include <linux/init.h>
2036 #include <linux/flat.h> 2099 #include <linux/flat.h>
2037+#include <linux/vs_memory.h> 2100+#include <linux/vs_memory.h>
2038 2101
2039 #include <asm/byteorder.h> 2102 #include <asm/byteorder.h>
2040 #include <asm/system.h> 2103 #include <asm/system.h>
2041Index: vserver-sources-2.0.2_2.6.15/fs/binfmt_som.c 2104Index: linux-2.6.16/fs/binfmt_som.c
2042=================================================================== 2105===================================================================
2043--- vserver-sources-2.0.2_2.6.15.orig/fs/binfmt_som.c 2106--- linux-2.6.16.orig/fs/binfmt_som.c
2044+++ vserver-sources-2.0.2_2.6.15/fs/binfmt_som.c 2107+++ linux-2.6.16/fs/binfmt_som.c
2045@@ -28,6 +28,7 @@ 2108@@ -28,6 +28,7 @@
2046 #include <linux/shm.h> 2109 #include <linux/shm.h>
2047 #include <linux/personality.h> 2110 #include <linux/personality.h>
2048 #include <linux/init.h> 2111 #include <linux/init.h>
2049+#include <linux/vs_memory.h> 2112+#include <linux/vs_memory.h>
2050 2113
2051 #include <asm/uaccess.h> 2114 #include <asm/uaccess.h>
2052 #include <asm/pgtable.h> 2115 #include <asm/pgtable.h>
2053Index: vserver-sources-2.0.2_2.6.15/fs/devpts/inode.c 2116Index: linux-2.6.16/fs/devpts/inode.c
2054=================================================================== 2117===================================================================
2055--- vserver-sources-2.0.2_2.6.15.orig/fs/devpts/inode.c 2118--- linux-2.6.16.orig/fs/devpts/inode.c
2056+++ vserver-sources-2.0.2_2.6.15/fs/devpts/inode.c 2119+++ linux-2.6.16/fs/devpts/inode.c
2057@@ -19,7 +19,19 @@ 2120@@ -19,7 +19,19 @@
2058 #include <linux/tty.h> 2121 #include <linux/tty.h>
2059 #include <linux/devpts_fs.h> 2122 #include <linux/devpts_fs.h>
2060 2123
2061-#define DEVPTS_SUPER_MAGIC 0x1cd1 2124-#define DEVPTS_SUPER_MAGIC 0x1cd1
2118+ inode->i_xid = vx_current_xid(); 2181+ inode->i_xid = vx_current_xid();
2119+ inode->i_op = &devpts_file_inode_operations; 2182+ inode->i_op = &devpts_file_inode_operations;
2120 inode->u.generic_ip = tty; 2183 inode->u.generic_ip = tty;
2121 2184
2122 dentry = get_node(number); 2185 dentry = get_node(number);
2123Index: vserver-sources-2.0.2_2.6.15/fs/exec.c 2186Index: linux-2.6.16/fs/exec.c
2124=================================================================== 2187===================================================================
2125--- vserver-sources-2.0.2_2.6.15.orig/fs/exec.c 2188--- linux-2.6.16.orig/fs/exec.c
2126+++ vserver-sources-2.0.2_2.6.15/fs/exec.c 2189+++ linux-2.6.16/fs/exec.c
2127@@ -49,6 +49,7 @@ 2190@@ -49,6 +49,7 @@
2128 #include <linux/rmap.h> 2191 #include <linux/rmap.h>
2129 #include <linux/acct.h> 2192 #include <linux/acct.h>
2130 #include <linux/cn_proc.h> 2193 #include <linux/cn_proc.h>
2131+#include <linux/vs_memory.h> 2194+#include <linux/vs_memory.h>
2140+ vx_vmpages_sub(mm, mm->total_vm - vma_pages(mpnt)); 2203+ vx_vmpages_sub(mm, mm->total_vm - vma_pages(mpnt));
2141+ mm->stack_vm = mm->total_vm; 2204+ mm->stack_vm = mm->total_vm;
2142 } 2205 }
2143 2206
2144 for (i = 0 ; i < MAX_ARG_PAGES ; i++) { 2207 for (i = 0 ; i < MAX_ARG_PAGES ; i++) {
2145Index: vserver-sources-2.0.2_2.6.15/fs/ext2/balloc.c 2208Index: linux-2.6.16/fs/ext2/balloc.c
2146=================================================================== 2209===================================================================
2147--- vserver-sources-2.0.2_2.6.15.orig/fs/ext2/balloc.c 2210--- linux-2.6.16.orig/fs/ext2/balloc.c
2148+++ vserver-sources-2.0.2_2.6.15/fs/ext2/balloc.c 2211+++ linux-2.6.16/fs/ext2/balloc.c
2149@@ -16,6 +16,7 @@ 2212@@ -17,6 +17,7 @@
2150 #include <linux/quotaops.h>
2151 #include <linux/sched.h> 2213 #include <linux/sched.h>
2152 #include <linux/buffer_head.h> 2214 #include <linux/buffer_head.h>
2215 #include <linux/capability.h>
2153+#include <linux/vs_dlimit.h> 2216+#include <linux/vs_dlimit.h>
2154 2217
2155 /* 2218 /*
2156 * balloc.c contains the blocks allocation and deallocation routines 2219 * balloc.c contains the blocks allocation and deallocation routines
2157@@ -108,6 +109,8 @@ static int reserve_blocks(struct super_b 2220@@ -109,6 +110,8 @@ static int reserve_blocks(struct super_b
2158 free_blocks = percpu_counter_read_positive(&sbi->s_freeblocks_counter); 2221 free_blocks = percpu_counter_read_positive(&sbi->s_freeblocks_counter);
2159 root_blocks = le32_to_cpu(es->s_r_blocks_count); 2222 root_blocks = le32_to_cpu(es->s_r_blocks_count);
2160 2223
2161+ DLIMIT_ADJUST_BLOCK(sb, vx_current_xid(), &free_blocks, &root_blocks); 2224+ DLIMIT_ADJUST_BLOCK(sb, vx_current_xid(), &free_blocks, &root_blocks);
2162+ 2225+
2163 if (free_blocks < count) 2226 if (free_blocks < count)
2164 count = free_blocks; 2227 count = free_blocks;
2165 2228
2166@@ -258,6 +261,7 @@ do_more: 2229@@ -259,6 +262,7 @@ do_more:
2167 } 2230 }
2168 error_return: 2231 error_return:
2169 brelse(bitmap_bh); 2232 brelse(bitmap_bh);
2170+ DLIMIT_FREE_BLOCK(inode, freed); 2233+ DLIMIT_FREE_BLOCK(inode, freed);
2171 release_blocks(sb, freed); 2234 release_blocks(sb, freed);
2172 DQUOT_FREE_BLOCK(inode, freed); 2235 DQUOT_FREE_BLOCK(inode, freed);
2173 } 2236 }
2174@@ -361,6 +365,10 @@ int ext2_new_block(struct inode *inode, 2237@@ -362,6 +366,10 @@ int ext2_new_block(struct inode *inode,
2175 *err = -ENOSPC; 2238 *err = -ENOSPC;
2176 goto out_dquot; 2239 goto out_dquot;
2177 } 2240 }
2178+ if (DLIMIT_ALLOC_BLOCK(inode, es_alloc)) { 2241+ if (DLIMIT_ALLOC_BLOCK(inode, es_alloc)) {
2179+ *err = -ENOSPC; 2242+ *err = -ENOSPC;
2180+ goto out_dlimit; 2243+ goto out_dlimit;
2181+ } 2244+ }
2182 2245
2183 ext2_debug ("goal=%lu.\n", goal); 2246 ext2_debug ("goal=%lu.\n", goal);
2184 2247
2185@@ -508,6 +516,8 @@ got_block: 2248@@ -509,6 +517,8 @@ got_block:
2186 *err = 0; 2249 *err = 0;
2187 out_release: 2250 out_release:
2188 group_release_blocks(sb, group_no, desc, gdp_bh, group_alloc); 2251 group_release_blocks(sb, group_no, desc, gdp_bh, group_alloc);
2189+ DLIMIT_FREE_BLOCK(inode, es_alloc); 2252+ DLIMIT_FREE_BLOCK(inode, es_alloc);
2190+out_dlimit: 2253+out_dlimit:
2191 release_blocks(sb, es_alloc); 2254 release_blocks(sb, es_alloc);
2192 out_dquot: 2255 out_dquot:
2193 DQUOT_FREE_BLOCK(inode, dq_alloc); 2256 DQUOT_FREE_BLOCK(inode, dq_alloc);
2194Index: vserver-sources-2.0.2_2.6.15/fs/ext2/ext2.h 2257Index: linux-2.6.16/fs/ext2/ext2.h
2195=================================================================== 2258===================================================================
2196--- vserver-sources-2.0.2_2.6.15.orig/fs/ext2/ext2.h 2259--- linux-2.6.16.orig/fs/ext2/ext2.h
2197+++ vserver-sources-2.0.2_2.6.15/fs/ext2/ext2.h 2260+++ linux-2.6.16/fs/ext2/ext2.h
2198@@ -162,6 +162,7 @@ extern struct file_operations ext2_xip_f 2261@@ -162,6 +162,7 @@ extern struct file_operations ext2_xip_f
2199 extern struct address_space_operations ext2_aops; 2262 extern struct address_space_operations ext2_aops;
2200 extern struct address_space_operations ext2_aops_xip; 2263 extern struct address_space_operations ext2_aops_xip;
2201 extern struct address_space_operations ext2_nobh_aops; 2264 extern struct address_space_operations ext2_nobh_aops;
2202+extern int ext2_sync_flags(struct inode *inode); 2265+extern int ext2_sync_flags(struct inode *inode);
2203 2266
2204 /* namei.c */ 2267 /* namei.c */
2205 extern struct inode_operations ext2_dir_inode_operations; 2268 extern struct inode_operations ext2_dir_inode_operations;
2206Index: vserver-sources-2.0.2_2.6.15/fs/ext2/file.c 2269Index: linux-2.6.16/fs/ext2/file.c
2207=================================================================== 2270===================================================================
2208--- vserver-sources-2.0.2_2.6.15.orig/fs/ext2/file.c 2271--- linux-2.6.16.orig/fs/ext2/file.c
2209+++ vserver-sources-2.0.2_2.6.15/fs/ext2/file.c 2272+++ linux-2.6.16/fs/ext2/file.c
2210@@ -79,4 +79,5 @@ struct inode_operations ext2_file_inode_ 2273@@ -79,4 +79,5 @@ struct inode_operations ext2_file_inode_
2211 #endif 2274 #endif
2212 .setattr = ext2_setattr, 2275 .setattr = ext2_setattr,
2213 .permission = ext2_permission, 2276 .permission = ext2_permission,
2214+ .sync_flags = ext2_sync_flags, 2277+ .sync_flags = ext2_sync_flags,
2215 }; 2278 };
2216Index: vserver-sources-2.0.2_2.6.15/fs/ext2/ialloc.c 2279Index: linux-2.6.16/fs/ext2/ialloc.c
2217=================================================================== 2280===================================================================
2218--- vserver-sources-2.0.2_2.6.15.orig/fs/ext2/ialloc.c 2281--- linux-2.6.16.orig/fs/ext2/ialloc.c
2219+++ vserver-sources-2.0.2_2.6.15/fs/ext2/ialloc.c 2282+++ linux-2.6.16/fs/ext2/ialloc.c
2220@@ -18,6 +18,8 @@ 2283@@ -18,6 +18,8 @@
2221 #include <linux/backing-dev.h> 2284 #include <linux/backing-dev.h>
2222 #include <linux/buffer_head.h> 2285 #include <linux/buffer_head.h>
2223 #include <linux/random.h> 2286 #include <linux/random.h>
2224+#include <linux/vs_dlimit.h> 2287+#include <linux/vs_dlimit.h>
2254+ ei->i_flags = EXT2_I(dir)->i_flags & 2317+ ei->i_flags = EXT2_I(dir)->i_flags &
2255+ ~(EXT2_BTREE_FL|EXT2_IUNLINK_FL|EXT2_BARRIER_FL); 2318+ ~(EXT2_BTREE_FL|EXT2_IUNLINK_FL|EXT2_BARRIER_FL);
2256 if (S_ISLNK(mode)) 2319 if (S_ISLNK(mode))
2257 ei->i_flags &= ~(EXT2_IMMUTABLE_FL|EXT2_APPEND_FL); 2320 ei->i_flags &= ~(EXT2_IMMUTABLE_FL|EXT2_APPEND_FL);
2258 /* dirsync is only applied to directories */ 2321 /* dirsync is only applied to directories */
2259@@ -605,7 +614,7 @@ got:
2260 insert_inode_hash(inode);
2261
2262 if (DQUOT_ALLOC_INODE(inode)) {
2263- err = -ENOSPC;
2264+ err = -EDQUOT;
2265 goto fail_drop;
2266 }
2267
2268@@ -627,12 +636,15 @@ fail_free_drop: 2322@@ -627,12 +636,15 @@ fail_free_drop:
2269 2323
2270 fail_drop: 2324 fail_drop:
2271 DQUOT_DROP(inode); 2325 DQUOT_DROP(inode);
2272+ DLIMIT_FREE_INODE(inode); 2326+ DLIMIT_FREE_INODE(inode);
2279+ DLIMIT_FREE_INODE(inode); 2333+ DLIMIT_FREE_INODE(inode);
2280+fail_dlim: 2334+fail_dlim:
2281 make_bad_inode(inode); 2335 make_bad_inode(inode);
2282 iput(inode); 2336 iput(inode);
2283 return ERR_PTR(err); 2337 return ERR_PTR(err);
2284Index: vserver-sources-2.0.2_2.6.15/fs/ext2/inode.c 2338Index: linux-2.6.16/fs/ext2/inode.c
2285=================================================================== 2339===================================================================
2286--- vserver-sources-2.0.2_2.6.15.orig/fs/ext2/inode.c 2340--- linux-2.6.16.orig/fs/ext2/inode.c
2287+++ vserver-sources-2.0.2_2.6.15/fs/ext2/inode.c 2341+++ linux-2.6.16/fs/ext2/inode.c
2288@@ -31,6 +31,7 @@ 2342@@ -31,6 +31,7 @@
2289 #include <linux/writeback.h> 2343 #include <linux/writeback.h>
2290 #include <linux/buffer_head.h> 2344 #include <linux/buffer_head.h>
2291 #include <linux/mpage.h> 2345 #include <linux/mpage.h>
2292+#include <linux/vserver/xid.h> 2346+#include <linux/vserver/xid.h>
2293 #include "ext2.h" 2347 #include "ext2.h"
2294 #include "acl.h" 2348 #include "acl.h"
2295 #include "xip.h" 2349 #include "xip.h"
2296@@ -1052,25 +1053,70 @@ void ext2_set_inode_flags(struct inode * 2350@@ -1054,25 +1055,70 @@ void ext2_set_inode_flags(struct inode *
2297 { 2351 {
2298 unsigned int flags = EXT2_I(inode)->i_flags; 2352 unsigned int flags = EXT2_I(inode)->i_flags;
2299 2353
2300- inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC); 2354- inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC);
2301+ inode->i_flags &= ~(S_IMMUTABLE | S_IUNLINK | S_BARRIER | 2355+ inode->i_flags &= ~(S_IMMUTABLE | S_IUNLINK | S_BARRIER |
2365+ uid_t uid; 2419+ uid_t uid;
2366+ gid_t gid; 2420+ gid_t gid;
2367 int n; 2421 int n;
2368 2422
2369 #ifdef CONFIG_EXT2_FS_POSIX_ACL 2423 #ifdef CONFIG_EXT2_FS_POSIX_ACL
2370@@ -1081,12 +1127,17 @@ void ext2_read_inode (struct inode * ino 2424@@ -1083,12 +1129,17 @@ void ext2_read_inode (struct inode * ino
2371 goto bad_inode; 2425 goto bad_inode;
2372 2426
2373 inode->i_mode = le16_to_cpu(raw_inode->i_mode); 2427 inode->i_mode = le16_to_cpu(raw_inode->i_mode);
2374- inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low); 2428- inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
2375- inode->i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low); 2429- inode->i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
2387+ le16_to_cpu(raw_inode->i_raw_xid)); 2441+ le16_to_cpu(raw_inode->i_raw_xid));
2388+ 2442+
2389 inode->i_nlink = le16_to_cpu(raw_inode->i_links_count); 2443 inode->i_nlink = le16_to_cpu(raw_inode->i_links_count);
2390 inode->i_size = le32_to_cpu(raw_inode->i_size); 2444 inode->i_size = le32_to_cpu(raw_inode->i_size);
2391 inode->i_atime.tv_sec = le32_to_cpu(raw_inode->i_atime); 2445 inode->i_atime.tv_sec = le32_to_cpu(raw_inode->i_atime);
2392@@ -1184,8 +1235,8 @@ static int ext2_update_inode(struct inod 2446@@ -1186,8 +1237,8 @@ static int ext2_update_inode(struct inod
2393 struct ext2_inode_info *ei = EXT2_I(inode); 2447 struct ext2_inode_info *ei = EXT2_I(inode);
2394 struct super_block *sb = inode->i_sb; 2448 struct super_block *sb = inode->i_sb;
2395 ino_t ino = inode->i_ino; 2449 ino_t ino = inode->i_ino;
2396- uid_t uid = inode->i_uid; 2450- uid_t uid = inode->i_uid;
2397- gid_t gid = inode->i_gid; 2451- gid_t gid = inode->i_gid;
2398+ uid_t uid = XIDINO_UID(XID_TAG(inode), inode->i_uid, inode->i_xid); 2452+ uid_t uid = XIDINO_UID(XID_TAG(inode), inode->i_uid, inode->i_xid);
2399+ gid_t gid = XIDINO_GID(XID_TAG(inode), inode->i_gid, inode->i_xid); 2453+ gid_t gid = XIDINO_GID(XID_TAG(inode), inode->i_gid, inode->i_xid);
2400 struct buffer_head * bh; 2454 struct buffer_head * bh;
2401 struct ext2_inode * raw_inode = ext2_get_inode(sb, ino, &bh); 2455 struct ext2_inode * raw_inode = ext2_get_inode(sb, ino, &bh);
2402 int n; 2456 int n;
2403@@ -1220,6 +1271,9 @@ static int ext2_update_inode(struct inod 2457@@ -1222,6 +1273,9 @@ static int ext2_update_inode(struct inod
2404 raw_inode->i_uid_high = 0; 2458 raw_inode->i_uid_high = 0;
2405 raw_inode->i_gid_high = 0; 2459 raw_inode->i_gid_high = 0;
2406 } 2460 }
2407+#ifdef CONFIG_INOXID_INTERN 2461+#ifdef CONFIG_INOXID_INTERN
2408+ raw_inode->i_raw_xid = cpu_to_le16(inode->i_xid); 2462+ raw_inode->i_raw_xid = cpu_to_le16(inode->i_xid);
2409+#endif 2463+#endif
2410 raw_inode->i_links_count = cpu_to_le16(inode->i_nlink); 2464 raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
2411 raw_inode->i_size = cpu_to_le32(inode->i_size); 2465 raw_inode->i_size = cpu_to_le32(inode->i_size);
2412 raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec); 2466 raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec);
2413@@ -1306,11 +1360,13 @@ int ext2_setattr(struct dentry *dentry, 2467@@ -1308,11 +1362,13 @@ int ext2_setattr(struct dentry *dentry,
2414 if (error) 2468 if (error)
2415 return error; 2469 return error;
2416 if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) || 2470 if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
2417- (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) { 2471- (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
2418+ (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid) || 2472+ (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid) ||
2423 } 2477 }
2424+ 2478+
2425 error = inode_setattr(inode, iattr); 2479 error = inode_setattr(inode, iattr);
2426 if (!error && (iattr->ia_valid & ATTR_MODE)) 2480 if (!error && (iattr->ia_valid & ATTR_MODE))
2427 error = ext2_acl_chmod(inode); 2481 error = ext2_acl_chmod(inode);
2428Index: vserver-sources-2.0.2_2.6.15/fs/ext2/ioctl.c 2482Index: linux-2.6.16/fs/ext2/ioctl.c
2429=================================================================== 2483===================================================================
2430--- vserver-sources-2.0.2_2.6.15.orig/fs/ext2/ioctl.c 2484--- linux-2.6.16.orig/fs/ext2/ioctl.c
2431+++ vserver-sources-2.0.2_2.6.15/fs/ext2/ioctl.c 2485+++ linux-2.6.16/fs/ext2/ioctl.c
2432@@ -10,6 +10,7 @@ 2486@@ -11,6 +11,7 @@
2433 #include "ext2.h" 2487 #include <linux/capability.h>
2434 #include <linux/time.h> 2488 #include <linux/time.h>
2435 #include <linux/sched.h> 2489 #include <linux/sched.h>
2436+#include <linux/mount.h> 2490+#include <linux/mount.h>
2437 #include <asm/current.h> 2491 #include <asm/current.h>
2438 #include <asm/uaccess.h> 2492 #include <asm/uaccess.h>
2439 2493
2440@@ -29,7 +30,8 @@ int ext2_ioctl (struct inode * inode, st 2494@@ -30,7 +31,8 @@ int ext2_ioctl (struct inode * inode, st
2441 case EXT2_IOC_SETFLAGS: { 2495 case EXT2_IOC_SETFLAGS: {
2442 unsigned int oldflags; 2496 unsigned int oldflags;
2443 2497
2444- if (IS_RDONLY(inode)) 2498- if (IS_RDONLY(inode))
2445+ if (IS_RDONLY(inode) || 2499+ if (IS_RDONLY(inode) ||
2446+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt))) 2500+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
2447 return -EROFS; 2501 return -EROFS;
2448 2502
2449 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER)) 2503 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
2450@@ -49,7 +51,9 @@ int ext2_ioctl (struct inode * inode, st 2504@@ -50,7 +52,9 @@ int ext2_ioctl (struct inode * inode, st
2451 * 2505 *
2452 * This test looks nicer. Thanks to Pauline Middelink 2506 * This test looks nicer. Thanks to Pauline Middelink
2453 */ 2507 */
2454- if ((flags ^ oldflags) & (EXT2_APPEND_FL | EXT2_IMMUTABLE_FL)) { 2508- if ((flags ^ oldflags) & (EXT2_APPEND_FL | EXT2_IMMUTABLE_FL)) {
2455+ if ((oldflags & EXT2_IMMUTABLE_FL) || 2509+ if ((oldflags & EXT2_IMMUTABLE_FL) ||
2456+ ((flags ^ oldflags) & (EXT2_APPEND_FL | 2510+ ((flags ^ oldflags) & (EXT2_APPEND_FL |
2457+ EXT2_IMMUTABLE_FL | EXT2_IUNLINK_FL))) { 2511+ EXT2_IMMUTABLE_FL | EXT2_IUNLINK_FL))) {
2458 if (!capable(CAP_LINUX_IMMUTABLE)) 2512 if (!capable(CAP_LINUX_IMMUTABLE))
2459 return -EPERM; 2513 return -EPERM;
2460 } 2514 }
2461@@ -68,7 +72,8 @@ int ext2_ioctl (struct inode * inode, st 2515@@ -69,7 +73,8 @@ int ext2_ioctl (struct inode * inode, st
2462 case EXT2_IOC_SETVERSION: 2516 case EXT2_IOC_SETVERSION:
2463 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER)) 2517 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
2464 return -EPERM; 2518 return -EPERM;
2465- if (IS_RDONLY(inode)) 2519- if (IS_RDONLY(inode))
2466+ if (IS_RDONLY(inode) || 2520+ if (IS_RDONLY(inode) ||
2467+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt))) 2521+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
2468 return -EROFS; 2522 return -EROFS;
2469 if (get_user(inode->i_generation, (int __user *) arg)) 2523 if (get_user(inode->i_generation, (int __user *) arg))
2470 return -EFAULT; 2524 return -EFAULT;
2471Index: vserver-sources-2.0.2_2.6.15/fs/ext2/namei.c 2525Index: linux-2.6.16/fs/ext2/namei.c
2472=================================================================== 2526===================================================================
2473--- vserver-sources-2.0.2_2.6.15.orig/fs/ext2/namei.c 2527--- linux-2.6.16.orig/fs/ext2/namei.c
2474+++ vserver-sources-2.0.2_2.6.15/fs/ext2/namei.c 2528+++ linux-2.6.16/fs/ext2/namei.c
2475@@ -31,6 +31,7 @@ 2529@@ -31,6 +31,7 @@
2476 */ 2530 */
2477 2531
2478 #include <linux/pagemap.h> 2532 #include <linux/pagemap.h>
2479+#include <linux/vserver/xid.h> 2533+#include <linux/vserver/xid.h>
2484 inode = iget(dir->i_sb, ino); 2538 inode = iget(dir->i_sb, ino);
2485 if (!inode) 2539 if (!inode)
2486 return ERR_PTR(-EACCES); 2540 return ERR_PTR(-EACCES);
2487+ vx_propagate_xid(nd, inode); 2541+ vx_propagate_xid(nd, inode);
2488 } 2542 }
2489 if (inode)
2490 return d_splice_alias(inode, dentry); 2543 return d_splice_alias(inode, dentry);
2544 }
2491@@ -410,6 +412,7 @@ struct inode_operations ext2_dir_inode_o 2545@@ -407,6 +409,7 @@ struct inode_operations ext2_dir_inode_o
2492 #endif 2546 #endif
2493 .setattr = ext2_setattr, 2547 .setattr = ext2_setattr,
2494 .permission = ext2_permission, 2548 .permission = ext2_permission,
2495+ .sync_flags = ext2_sync_flags, 2549+ .sync_flags = ext2_sync_flags,
2496 }; 2550 };
2497 2551
2498 struct inode_operations ext2_special_inode_operations = { 2552 struct inode_operations ext2_special_inode_operations = {
2499@@ -421,4 +424,5 @@ struct inode_operations ext2_special_ino 2553@@ -418,4 +421,5 @@ struct inode_operations ext2_special_ino
2500 #endif 2554 #endif
2501 .setattr = ext2_setattr, 2555 .setattr = ext2_setattr,
2502 .permission = ext2_permission, 2556 .permission = ext2_permission,
2503+ .sync_flags = ext2_sync_flags, 2557+ .sync_flags = ext2_sync_flags,
2504 }; 2558 };
2505Index: vserver-sources-2.0.2_2.6.15/fs/ext2/super.c 2559Index: linux-2.6.16/fs/ext2/super.c
2506=================================================================== 2560===================================================================
2507--- vserver-sources-2.0.2_2.6.15.orig/fs/ext2/super.c 2561--- linux-2.6.16.orig/fs/ext2/super.c
2508+++ vserver-sources-2.0.2_2.6.15/fs/ext2/super.c 2562+++ linux-2.6.16/fs/ext2/super.c
2509@@ -284,7 +284,7 @@ enum { 2563@@ -289,7 +289,7 @@ enum {
2510 Opt_err_ro, Opt_nouid32, Opt_nocheck, Opt_debug, 2564 Opt_err_ro, Opt_nouid32, Opt_nocheck, Opt_debug,
2511 Opt_oldalloc, Opt_orlov, Opt_nobh, Opt_user_xattr, Opt_nouser_xattr, 2565 Opt_oldalloc, Opt_orlov, Opt_nobh, Opt_user_xattr, Opt_nouser_xattr,
2512 Opt_acl, Opt_noacl, Opt_xip, Opt_ignore, Opt_err, Opt_quota, 2566 Opt_acl, Opt_noacl, Opt_xip, Opt_ignore, Opt_err, Opt_quota,
2513- Opt_usrquota, Opt_grpquota 2567- Opt_usrquota, Opt_grpquota
2514+ Opt_usrquota, Opt_grpquota, Opt_tagxid 2568+ Opt_usrquota, Opt_grpquota, Opt_tagxid
2515 }; 2569 };
2516 2570
2517 static match_table_t tokens = { 2571 static match_table_t tokens = {
2518@@ -312,6 +312,7 @@ static match_table_t tokens = { 2572@@ -317,6 +317,7 @@ static match_table_t tokens = {
2519 {Opt_acl, "acl"}, 2573 {Opt_acl, "acl"},
2520 {Opt_noacl, "noacl"}, 2574 {Opt_noacl, "noacl"},
2521 {Opt_xip, "xip"}, 2575 {Opt_xip, "xip"},
2522+ {Opt_tagxid, "tagxid"}, 2576+ {Opt_tagxid, "tagxid"},
2523 {Opt_grpquota, "grpquota"}, 2577 {Opt_grpquota, "grpquota"},
2524 {Opt_ignore, "noquota"}, 2578 {Opt_ignore, "noquota"},
2525 {Opt_quota, "quota"}, 2579 {Opt_quota, "quota"},
2526@@ -375,6 +376,11 @@ static int parse_options (char * options 2580@@ -380,6 +381,11 @@ static int parse_options (char * options
2527 case Opt_nouid32: 2581 case Opt_nouid32:
2528 set_opt (sbi->s_mount_opt, NO_UID32); 2582 set_opt (sbi->s_mount_opt, NO_UID32);
2529 break; 2583 break;
2530+#ifndef CONFIG_INOXID_NONE 2584+#ifndef CONFIG_INOXID_NONE
2531+ case Opt_tagxid: 2585+ case Opt_tagxid:
2533+ break; 2587+ break;
2534+#endif 2588+#endif
2535 case Opt_nocheck: 2589 case Opt_nocheck:
2536 clear_opt (sbi->s_mount_opt, CHECK); 2590 clear_opt (sbi->s_mount_opt, CHECK);
2537 break; 2591 break;
2538@@ -676,6 +682,8 @@ static int ext2_fill_super(struct super_ 2592@@ -681,6 +687,8 @@ static int ext2_fill_super(struct super_
2539 if (!parse_options ((char *) data, sbi)) 2593 if (!parse_options ((char *) data, sbi))
2540 goto failed_mount; 2594 goto failed_mount;
2541 2595
2542+ if (EXT2_SB(sb)->s_mount_opt & EXT2_MOUNT_TAGXID) 2596+ if (EXT2_SB(sb)->s_mount_opt & EXT2_MOUNT_TAGXID)
2543+ sb->s_flags |= MS_TAGXID; 2597+ sb->s_flags |= MS_TAGXID;
2544 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | 2598 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
2545 ((EXT2_SB(sb)->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? 2599 ((EXT2_SB(sb)->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ?
2546 MS_POSIXACL : 0); 2600 MS_POSIXACL : 0);
2547@@ -985,6 +993,13 @@ static int ext2_remount (struct super_bl 2601@@ -990,6 +998,13 @@ static int ext2_remount (struct super_bl
2548 goto restore_opts; 2602 goto restore_opts;
2549 } 2603 }
2550 2604
2551+ if ((sbi->s_mount_opt & EXT2_MOUNT_TAGXID) && 2605+ if ((sbi->s_mount_opt & EXT2_MOUNT_TAGXID) &&
2552+ !(sb->s_flags & MS_TAGXID)) { 2606+ !(sb->s_flags & MS_TAGXID)) {
2556+ } 2610+ }
2557+ 2611+
2558 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | 2612 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
2559 ((sbi->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); 2613 ((sbi->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0);
2560 2614
2561Index: vserver-sources-2.0.2_2.6.15/fs/ext2/symlink.c 2615Index: linux-2.6.16/fs/ext2/symlink.c
2562=================================================================== 2616===================================================================
2563--- vserver-sources-2.0.2_2.6.15.orig/fs/ext2/symlink.c 2617--- linux-2.6.16.orig/fs/ext2/symlink.c
2564+++ vserver-sources-2.0.2_2.6.15/fs/ext2/symlink.c 2618+++ linux-2.6.16/fs/ext2/symlink.c
2565@@ -38,6 +38,7 @@ struct inode_operations ext2_symlink_ino 2619@@ -38,6 +38,7 @@ struct inode_operations ext2_symlink_ino
2566 .listxattr = ext2_listxattr, 2620 .listxattr = ext2_listxattr,
2567 .removexattr = generic_removexattr, 2621 .removexattr = generic_removexattr,
2568 #endif 2622 #endif
2569+ .sync_flags = ext2_sync_flags, 2623+ .sync_flags = ext2_sync_flags,
2574 .listxattr = ext2_listxattr, 2628 .listxattr = ext2_listxattr,
2575 .removexattr = generic_removexattr, 2629 .removexattr = generic_removexattr,
2576 #endif 2630 #endif
2577+ .sync_flags = ext2_sync_flags, 2631+ .sync_flags = ext2_sync_flags,
2578 }; 2632 };
2579Index: vserver-sources-2.0.2_2.6.15/fs/ext2/xattr.c 2633Index: linux-2.6.16/fs/ext2/xattr.c
2580=================================================================== 2634===================================================================
2581--- vserver-sources-2.0.2_2.6.15.orig/fs/ext2/xattr.c 2635--- linux-2.6.16.orig/fs/ext2/xattr.c
2582+++ vserver-sources-2.0.2_2.6.15/fs/ext2/xattr.c 2636+++ linux-2.6.16/fs/ext2/xattr.c
2583@@ -60,6 +60,7 @@ 2637@@ -60,6 +60,7 @@
2584 #include <linux/mbcache.h> 2638 #include <linux/mbcache.h>
2585 #include <linux/quotaops.h> 2639 #include <linux/quotaops.h>
2586 #include <linux/rwsem.h> 2640 #include <linux/rwsem.h>
2587+#include <linux/vs_dlimit.h> 2641+#include <linux/vs_dlimit.h>
2588 #include "ext2.h" 2642 #include "ext2.h"
2589 #include "xattr.h" 2643 #include "xattr.h"
2590 #include "acl.h" 2644 #include "acl.h"
2591@@ -649,8 +650,12 @@ ext2_xattr_set2(struct inode *inode, str 2645@@ -645,8 +646,12 @@ ext2_xattr_set2(struct inode *inode, str
2592 the inode. */ 2646 the inode. */
2593 ea_bdebug(new_bh, "reusing block"); 2647 ea_bdebug(new_bh, "reusing block");
2594 2648
2595+ error = -ENOSPC; 2649+ error = -ENOSPC;
2596+ if (DLIMIT_ALLOC_BLOCK(inode, 1)) 2650+ if (DLIMIT_ALLOC_BLOCK(inode, 1))
2599 if (DQUOT_ALLOC_BLOCK(inode, 1)) { 2653 if (DQUOT_ALLOC_BLOCK(inode, 1)) {
2600+ DLIMIT_FREE_BLOCK(inode, 1); 2654+ DLIMIT_FREE_BLOCK(inode, 1);
2601 unlock_buffer(new_bh); 2655 unlock_buffer(new_bh);
2602 goto cleanup; 2656 goto cleanup;
2603 } 2657 }
2604@@ -744,6 +749,7 @@ ext2_xattr_set2(struct inode *inode, str 2658@@ -740,6 +745,7 @@ ext2_xattr_set2(struct inode *inode, str
2605 le32_to_cpu(HDR(old_bh)->h_refcount) - 1); 2659 le32_to_cpu(HDR(old_bh)->h_refcount) - 1);
2606 if (ce) 2660 if (ce)
2607 mb_cache_entry_release(ce); 2661 mb_cache_entry_release(ce);
2608+ DLIMIT_FREE_BLOCK(inode, 1); 2662+ DLIMIT_FREE_BLOCK(inode, 1);
2609 DQUOT_FREE_BLOCK(inode, 1); 2663 DQUOT_FREE_BLOCK(inode, 1);
2614 if (IS_SYNC(inode)) 2668 if (IS_SYNC(inode))
2615 sync_dirty_buffer(bh); 2669 sync_dirty_buffer(bh);
2616+ DLIMIT_FREE_BLOCK(inode, 1); 2670+ DLIMIT_FREE_BLOCK(inode, 1);
2617 DQUOT_FREE_BLOCK(inode, 1); 2671 DQUOT_FREE_BLOCK(inode, 1);
2618 } 2672 }
2619 ea_bdebug(bh, "refcount now=%d", le32_to_cpu(HDR(bh)->h_refcount) - 1); 2673 EXT2_I(inode)->i_file_acl = 0;
2620Index: vserver-sources-2.0.2_2.6.15/fs/ext3/balloc.c 2674Index: linux-2.6.16/fs/ext3/balloc.c
2621=================================================================== 2675===================================================================
2622--- vserver-sources-2.0.2_2.6.15.orig/fs/ext3/balloc.c 2676--- linux-2.6.16.orig/fs/ext3/balloc.c
2623+++ vserver-sources-2.0.2_2.6.15/fs/ext3/balloc.c 2677+++ linux-2.6.16/fs/ext3/balloc.c
2624@@ -19,6 +19,7 @@ 2678@@ -20,6 +20,7 @@
2625 #include <linux/ext3_jbd.h> 2679 #include <linux/ext3_jbd.h>
2626 #include <linux/quotaops.h> 2680 #include <linux/quotaops.h>
2627 #include <linux/buffer_head.h> 2681 #include <linux/buffer_head.h>
2628+#include <linux/vs_dlimit.h> 2682+#include <linux/vs_dlimit.h>
2629 2683
2630 #include "bitmap.h" 2684 /*
2631 2685 * balloc.c contains the blocks allocation and deallocation routines
2632@@ -505,8 +506,10 @@ void ext3_free_blocks(handle_t *handle, 2686@@ -504,8 +505,10 @@ void ext3_free_blocks(handle_t *handle,
2633 return; 2687 return;
2634 } 2688 }
2635 ext3_free_blocks_sb(handle, sb, block, count, &dquot_freed_blocks); 2689 ext3_free_blocks_sb(handle, sb, block, count, &dquot_freed_blocks);
2636- if (dquot_freed_blocks) 2690- if (dquot_freed_blocks)
2637+ if (dquot_freed_blocks) { 2691+ if (dquot_freed_blocks) {
2639 DQUOT_FREE_BLOCK(inode, dquot_freed_blocks); 2693 DQUOT_FREE_BLOCK(inode, dquot_freed_blocks);
2640+ } 2694+ }
2641 return; 2695 return;
2642 } 2696 }
2643 2697
2644@@ -1117,18 +1120,32 @@ out: 2698@@ -1116,18 +1119,32 @@ out:
2645 return ret; 2699 return ret;
2646 } 2700 }
2647 2701
2648-static int ext3_has_free_blocks(struct ext3_sb_info *sbi) 2702-static int ext3_has_free_blocks(struct ext3_sb_info *sbi)
2649+static int ext3_has_free_blocks(struct super_block *sb) 2703+static int ext3_has_free_blocks(struct super_block *sb)
2679+ 2733+
2680+ return (cond ? 0 : 1); 2734+ return (cond ? 0 : 1);
2681 } 2735 }
2682 2736
2683 /* 2737 /*
2684@@ -1139,7 +1156,7 @@ static int ext3_has_free_blocks(struct e 2738@@ -1138,7 +1155,7 @@ static int ext3_has_free_blocks(struct e
2685 */ 2739 */
2686 int ext3_should_retry_alloc(struct super_block *sb, int *retries) 2740 int ext3_should_retry_alloc(struct super_block *sb, int *retries)
2687 { 2741 {
2688- if (!ext3_has_free_blocks(EXT3_SB(sb)) || (*retries)++ > 3) 2742- if (!ext3_has_free_blocks(EXT3_SB(sb)) || (*retries)++ > 3)
2689+ if (!ext3_has_free_blocks(sb) || (*retries)++ > 3) 2743+ if (!ext3_has_free_blocks(sb) || (*retries)++ > 3)
2690 return 0; 2744 return 0;
2691 2745
2692 jbd_debug(1, "%s: retrying operation after ENOSPC\n", sb->s_id); 2746 jbd_debug(1, "%s: retrying operation after ENOSPC\n", sb->s_id);
2693@@ -1194,6 +1211,8 @@ int ext3_new_block(handle_t *handle, str 2747@@ -1193,6 +1210,8 @@ int ext3_new_block(handle_t *handle, str
2694 *errp = -EDQUOT; 2748 *errp = -EDQUOT;
2695 return 0; 2749 return 0;
2696 } 2750 }
2697+ if (DLIMIT_ALLOC_BLOCK(inode, 1)) 2751+ if (DLIMIT_ALLOC_BLOCK(inode, 1))
2698+ goto out_dlimit; 2752+ goto out_dlimit;
2699 2753
2700 sbi = EXT3_SB(sb); 2754 sbi = EXT3_SB(sb);
2701 es = EXT3_SB(sb)->s_es; 2755 es = EXT3_SB(sb)->s_es;
2702@@ -1210,7 +1229,7 @@ int ext3_new_block(handle_t *handle, str 2756@@ -1209,7 +1228,7 @@ int ext3_new_block(handle_t *handle, str
2703 if (block_i && ((windowsz = block_i->rsv_window_node.rsv_goal_size) > 0)) 2757 if (block_i && ((windowsz = block_i->rsv_window_node.rsv_goal_size) > 0))
2704 my_rsv = &block_i->rsv_window_node; 2758 my_rsv = &block_i->rsv_window_node;
2705 2759
2706- if (!ext3_has_free_blocks(sbi)) { 2760- if (!ext3_has_free_blocks(sbi)) {
2707+ if (!ext3_has_free_blocks(sb)) { 2761+ if (!ext3_has_free_blocks(sb)) {
2708 *errp = -ENOSPC; 2762 *errp = -ENOSPC;
2709 goto out; 2763 goto out;
2710 } 2764 }
2711@@ -1394,6 +1413,9 @@ allocated: 2765@@ -1393,6 +1412,9 @@ allocated:
2712 io_error: 2766 io_error:
2713 *errp = -EIO; 2767 *errp = -EIO;
2714 out: 2768 out:
2715+ if (!performed_allocation) 2769+ if (!performed_allocation)
2716+ DLIMIT_FREE_BLOCK(inode, 1); 2770+ DLIMIT_FREE_BLOCK(inode, 1);
2717+out_dlimit: 2771+out_dlimit:
2718 if (fatal) { 2772 if (fatal) {
2719 *errp = fatal; 2773 *errp = fatal;
2720 ext3_std_error(sb, fatal); 2774 ext3_std_error(sb, fatal);
2721Index: vserver-sources-2.0.2_2.6.15/fs/ext3/file.c 2775Index: linux-2.6.16/fs/ext3/file.c
2722=================================================================== 2776===================================================================
2723--- vserver-sources-2.0.2_2.6.15.orig/fs/ext3/file.c 2777--- linux-2.6.16.orig/fs/ext3/file.c
2724+++ vserver-sources-2.0.2_2.6.15/fs/ext3/file.c 2778+++ linux-2.6.16/fs/ext3/file.c
2725@@ -131,5 +131,6 @@ struct inode_operations ext3_file_inode_ 2779@@ -131,5 +131,6 @@ struct inode_operations ext3_file_inode_
2726 .removexattr = generic_removexattr, 2780 .removexattr = generic_removexattr,
2727 #endif 2781 #endif
2728 .permission = ext3_permission, 2782 .permission = ext3_permission,
2729+ .sync_flags = ext3_sync_flags, 2783+ .sync_flags = ext3_sync_flags,
2730 }; 2784 };
2731 2785
2732Index: vserver-sources-2.0.2_2.6.15/fs/ext3/ialloc.c 2786Index: linux-2.6.16/fs/ext3/ialloc.c
2733=================================================================== 2787===================================================================
2734--- vserver-sources-2.0.2_2.6.15.orig/fs/ext3/ialloc.c 2788--- linux-2.6.16.orig/fs/ext3/ialloc.c
2735+++ vserver-sources-2.0.2_2.6.15/fs/ext3/ialloc.c 2789+++ linux-2.6.16/fs/ext3/ialloc.c
2736@@ -23,6 +23,8 @@ 2790@@ -23,6 +23,8 @@
2737 #include <linux/buffer_head.h> 2791 #include <linux/buffer_head.h>
2738 #include <linux/random.h> 2792 #include <linux/random.h>
2739 #include <linux/bitops.h> 2793 #include <linux/bitops.h>
2740+#include <linux/vs_dlimit.h> 2794+#include <linux/vs_dlimit.h>
2741+#include <linux/vserver/xid.h> 2795+#include <linux/vserver/xid.h>
2742 2796
2743 #include <asm/byteorder.h> 2797 #include <asm/byteorder.h>
2744 2798
2745@@ -128,6 +130,7 @@ void ext3_free_inode (handle_t *handle, 2799@@ -127,6 +129,7 @@ void ext3_free_inode (handle_t *handle,
2746 ext3_xattr_delete_inode(handle, inode); 2800 ext3_xattr_delete_inode(handle, inode);
2747 DQUOT_FREE_INODE(inode); 2801 DQUOT_FREE_INODE(inode);
2748 DQUOT_DROP(inode); 2802 DQUOT_DROP(inode);
2749+ DLIMIT_FREE_INODE(inode); 2803+ DLIMIT_FREE_INODE(inode);
2750 2804
2751 is_directory = S_ISDIR(inode->i_mode); 2805 is_directory = S_ISDIR(inode->i_mode);
2752 2806
2753@@ -444,6 +447,12 @@ struct inode *ext3_new_inode(handle_t *h 2807@@ -443,6 +446,12 @@ struct inode *ext3_new_inode(handle_t *h
2754 inode = new_inode(sb); 2808 inode = new_inode(sb);
2755 if (!inode) 2809 if (!inode)
2756 return ERR_PTR(-ENOMEM); 2810 return ERR_PTR(-ENOMEM);
2757+ 2811+
2758+ inode->i_xid = vx_current_fsxid(sb); 2812+ inode->i_xid = vx_current_fsxid(sb);
2761+ goto out_dlimit; 2815+ goto out_dlimit;
2762+ } 2816+ }
2763 ei = EXT3_I(inode); 2817 ei = EXT3_I(inode);
2764 2818
2765 sbi = EXT3_SB(sb); 2819 sbi = EXT3_SB(sb);
2766@@ -566,7 +575,8 @@ got: 2820@@ -565,7 +574,8 @@ got:
2767 ei->i_dir_start_lookup = 0; 2821 ei->i_dir_start_lookup = 0;
2768 ei->i_disksize = 0; 2822 ei->i_disksize = 0;
2769 2823
2770- ei->i_flags = EXT3_I(dir)->i_flags & ~EXT3_INDEX_FL; 2824- ei->i_flags = EXT3_I(dir)->i_flags & ~EXT3_INDEX_FL;
2771+ ei->i_flags = EXT3_I(dir)->i_flags & 2825+ ei->i_flags = EXT3_I(dir)->i_flags &
2772+ ~(EXT3_INDEX_FL|EXT3_IUNLINK_FL|EXT3_BARRIER_FL); 2826+ ~(EXT3_INDEX_FL|EXT3_IUNLINK_FL|EXT3_BARRIER_FL);
2773 if (S_ISLNK(mode)) 2827 if (S_ISLNK(mode))
2774 ei->i_flags &= ~(EXT3_IMMUTABLE_FL|EXT3_APPEND_FL); 2828 ei->i_flags &= ~(EXT3_IMMUTABLE_FL|EXT3_APPEND_FL);
2775 /* dirsync only applies to directories */ 2829 /* dirsync only applies to directories */
2776@@ -621,6 +631,8 @@ got: 2830@@ -620,6 +630,8 @@ got:
2777 fail: 2831 fail:
2778 ext3_std_error(sb, err); 2832 ext3_std_error(sb, err);
2779 out: 2833 out:
2780+ DLIMIT_FREE_INODE(inode); 2834+ DLIMIT_FREE_INODE(inode);
2781+out_dlimit: 2835+out_dlimit:
2782 iput(inode); 2836 iput(inode);
2783 ret = ERR_PTR(err); 2837 ret = ERR_PTR(err);
2784 really_out: 2838 really_out:
2785@@ -632,6 +644,7 @@ fail_free_drop: 2839@@ -631,6 +643,7 @@ fail_free_drop:
2786 2840
2787 fail_drop: 2841 fail_drop:
2788 DQUOT_DROP(inode); 2842 DQUOT_DROP(inode);
2789+ DLIMIT_FREE_INODE(inode); 2843+ DLIMIT_FREE_INODE(inode);
2790 inode->i_flags |= S_NOQUOTA; 2844 inode->i_flags |= S_NOQUOTA;
2791 inode->i_nlink = 0; 2845 inode->i_nlink = 0;
2792 iput(inode); 2846 iput(inode);
2793Index: vserver-sources-2.0.2_2.6.15/fs/ext3/inode.c 2847Index: linux-2.6.16/fs/ext3/inode.c
2794=================================================================== 2848===================================================================
2795--- vserver-sources-2.0.2_2.6.15.orig/fs/ext3/inode.c 2849--- linux-2.6.16.orig/fs/ext3/inode.c
2796+++ vserver-sources-2.0.2_2.6.15/fs/ext3/inode.c 2850+++ linux-2.6.16/fs/ext3/inode.c
2797@@ -36,6 +36,7 @@ 2851@@ -36,6 +36,7 @@
2798 #include <linux/writeback.h> 2852 #include <linux/writeback.h>
2799 #include <linux/mpage.h> 2853 #include <linux/mpage.h>
2800 #include <linux/uio.h> 2854 #include <linux/uio.h>
2801+#include <linux/vserver/xid.h> 2855+#include <linux/vserver/xid.h>
2802 #include "xattr.h" 2856 #include "xattr.h"
2803 #include "acl.h" 2857 #include "acl.h"
2804 2858
2805@@ -2421,19 +2422,77 @@ void ext3_set_inode_flags(struct inode * 2859@@ -2422,19 +2423,77 @@ void ext3_set_inode_flags(struct inode *
2806 { 2860 {
2807 unsigned int flags = EXT3_I(inode)->i_flags; 2861 unsigned int flags = EXT3_I(inode)->i_flags;
2808 2862
2809- inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC); 2863- inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC);
2810+ inode->i_flags &= ~(S_IMMUTABLE | S_IUNLINK | S_BARRIER | 2864+ inode->i_flags &= ~(S_IMMUTABLE | S_IUNLINK | S_BARRIER |
2881+} 2935+}
2882+ 2936+
2883 void ext3_read_inode(struct inode * inode) 2937 void ext3_read_inode(struct inode * inode)
2884 { 2938 {
2885 struct ext3_iloc iloc; 2939 struct ext3_iloc iloc;
2886@@ -2441,6 +2500,8 @@ void ext3_read_inode(struct inode * inod 2940@@ -2442,6 +2501,8 @@ void ext3_read_inode(struct inode * inod
2887 struct ext3_inode_info *ei = EXT3_I(inode); 2941 struct ext3_inode_info *ei = EXT3_I(inode);
2888 struct buffer_head *bh; 2942 struct buffer_head *bh;
2889 int block; 2943 int block;
2890+ uid_t uid; 2944+ uid_t uid;
2891+ gid_t gid; 2945+ gid_t gid;
2892 2946
2893 #ifdef CONFIG_EXT3_FS_POSIX_ACL 2947 #ifdef CONFIG_EXT3_FS_POSIX_ACL
2894 ei->i_acl = EXT3_ACL_NOT_CACHED; 2948 ei->i_acl = EXT3_ACL_NOT_CACHED;
2895@@ -2453,12 +2514,17 @@ void ext3_read_inode(struct inode * inod 2949@@ -2454,12 +2515,17 @@ void ext3_read_inode(struct inode * inod
2896 bh = iloc.bh; 2950 bh = iloc.bh;
2897 raw_inode = ext3_raw_inode(&iloc); 2951 raw_inode = ext3_raw_inode(&iloc);
2898 inode->i_mode = le16_to_cpu(raw_inode->i_mode); 2952 inode->i_mode = le16_to_cpu(raw_inode->i_mode);
2899- inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low); 2953- inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
2900- inode->i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low); 2954- inode->i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
2912+ le16_to_cpu(raw_inode->i_raw_xid)); 2966+ le16_to_cpu(raw_inode->i_raw_xid));
2913+ 2967+
2914 inode->i_nlink = le16_to_cpu(raw_inode->i_links_count); 2968 inode->i_nlink = le16_to_cpu(raw_inode->i_links_count);
2915 inode->i_size = le32_to_cpu(raw_inode->i_size); 2969 inode->i_size = le32_to_cpu(raw_inode->i_size);
2916 inode->i_atime.tv_sec = le32_to_cpu(raw_inode->i_atime); 2970 inode->i_atime.tv_sec = le32_to_cpu(raw_inode->i_atime);
2917@@ -2585,6 +2651,8 @@ static int ext3_do_update_inode(handle_t 2971@@ -2586,6 +2652,8 @@ static int ext3_do_update_inode(handle_t
2918 struct ext3_inode *raw_inode = ext3_raw_inode(iloc); 2972 struct ext3_inode *raw_inode = ext3_raw_inode(iloc);
2919 struct ext3_inode_info *ei = EXT3_I(inode); 2973 struct ext3_inode_info *ei = EXT3_I(inode);
2920 struct buffer_head *bh = iloc->bh; 2974 struct buffer_head *bh = iloc->bh;
2921+ uid_t uid = XIDINO_UID(XID_TAG(inode), inode->i_uid, inode->i_xid); 2975+ uid_t uid = XIDINO_UID(XID_TAG(inode), inode->i_uid, inode->i_xid);
2922+ gid_t gid = XIDINO_GID(XID_TAG(inode), inode->i_gid, inode->i_xid); 2976+ gid_t gid = XIDINO_GID(XID_TAG(inode), inode->i_gid, inode->i_xid);
2923 int err = 0, rc, block; 2977 int err = 0, rc, block;
2924 2978
2925 /* For fields not not tracking in the in-memory inode, 2979 /* For fields not not tracking in the in-memory inode,
2926@@ -2594,29 +2662,32 @@ static int ext3_do_update_inode(handle_t 2980@@ -2595,29 +2663,32 @@ static int ext3_do_update_inode(handle_t
2927 2981
2928 raw_inode->i_mode = cpu_to_le16(inode->i_mode); 2982 raw_inode->i_mode = cpu_to_le16(inode->i_mode);
2929 if(!(test_opt(inode->i_sb, NO_UID32))) { 2983 if(!(test_opt(inode->i_sb, NO_UID32))) {
2930- raw_inode->i_uid_low = cpu_to_le16(low_16_bits(inode->i_uid)); 2984- raw_inode->i_uid_low = cpu_to_le16(low_16_bits(inode->i_uid));
2931- raw_inode->i_gid_low = cpu_to_le16(low_16_bits(inode->i_gid)); 2985- raw_inode->i_gid_low = cpu_to_le16(low_16_bits(inode->i_gid));
2960+ raw_inode->i_raw_xid = cpu_to_le16(inode->i_xid); 3014+ raw_inode->i_raw_xid = cpu_to_le16(inode->i_xid);
2961+#endif 3015+#endif
2962 raw_inode->i_links_count = cpu_to_le16(inode->i_nlink); 3016 raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
2963 raw_inode->i_size = cpu_to_le32(ei->i_disksize); 3017 raw_inode->i_size = cpu_to_le32(ei->i_disksize);
2964 raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec); 3018 raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec);
2965@@ -2769,7 +2840,8 @@ int ext3_setattr(struct dentry *dentry, 3019@@ -2770,7 +2841,8 @@ int ext3_setattr(struct dentry *dentry,
2966 return error; 3020 return error;
2967 3021
2968 if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || 3022 if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
2969- (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) { 3023- (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
2970+ (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid) || 3024+ (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid) ||
2971+ (ia_valid & ATTR_XID && attr->ia_xid != inode->i_xid)) { 3025+ (ia_valid & ATTR_XID && attr->ia_xid != inode->i_xid)) {
2972 handle_t *handle; 3026 handle_t *handle;
2973 3027
2974 /* (user+group)*(old+new) structure, inode write (sb, 3028 /* (user+group)*(old+new) structure, inode write (sb,
2975@@ -2791,6 +2863,8 @@ int ext3_setattr(struct dentry *dentry, 3029@@ -2792,6 +2864,8 @@ int ext3_setattr(struct dentry *dentry,
2976 inode->i_uid = attr->ia_uid; 3030 inode->i_uid = attr->ia_uid;
2977 if (attr->ia_valid & ATTR_GID) 3031 if (attr->ia_valid & ATTR_GID)
2978 inode->i_gid = attr->ia_gid; 3032 inode->i_gid = attr->ia_gid;
2979+ if ((attr->ia_valid & ATTR_XID) && IS_TAGXID(inode)) 3033+ if ((attr->ia_valid & ATTR_XID) && IS_TAGXID(inode))
2980+ inode->i_xid = attr->ia_xid; 3034+ inode->i_xid = attr->ia_xid;
2981 error = ext3_mark_inode_dirty(handle, inode); 3035 error = ext3_mark_inode_dirty(handle, inode);
2982 ext3_journal_stop(handle); 3036 ext3_journal_stop(handle);
2983 } 3037 }
2984Index: vserver-sources-2.0.2_2.6.15/fs/ext3/ioctl.c 3038Index: linux-2.6.16/fs/ext3/ioctl.c
2985=================================================================== 3039===================================================================
2986--- vserver-sources-2.0.2_2.6.15.orig/fs/ext3/ioctl.c 3040--- linux-2.6.16.orig/fs/ext3/ioctl.c
2987+++ vserver-sources-2.0.2_2.6.15/fs/ext3/ioctl.c 3041+++ linux-2.6.16/fs/ext3/ioctl.c
2988@@ -8,10 +8,12 @@ 3042@@ -8,11 +8,13 @@
2989 */ 3043 */
2990 3044
2991 #include <linux/fs.h> 3045 #include <linux/fs.h>
2992+#include <linux/mount.h> 3046+#include <linux/mount.h>
2993 #include <linux/jbd.h> 3047 #include <linux/jbd.h>
3048 #include <linux/capability.h>
2994 #include <linux/ext3_fs.h> 3049 #include <linux/ext3_fs.h>
2995 #include <linux/ext3_jbd.h> 3050 #include <linux/ext3_jbd.h>
2996 #include <linux/time.h> 3051 #include <linux/time.h>
2997+#include <linux/vserver/xid.h> 3052+#include <linux/vserver/xid.h>
2998 #include <asm/uaccess.h> 3053 #include <asm/uaccess.h>
2999 3054
3000 3055
3001@@ -35,7 +37,8 @@ int ext3_ioctl (struct inode * inode, st 3056@@ -36,7 +38,8 @@ int ext3_ioctl (struct inode * inode, st
3002 unsigned int oldflags; 3057 unsigned int oldflags;
3003 unsigned int jflag; 3058 unsigned int jflag;
3004 3059
3005- if (IS_RDONLY(inode)) 3060- if (IS_RDONLY(inode))
3006+ if (IS_RDONLY(inode) || 3061+ if (IS_RDONLY(inode) ||
3007+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt))) 3062+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
3008 return -EROFS; 3063 return -EROFS;
3009 3064
3010 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER)) 3065 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
3011@@ -58,7 +61,9 @@ int ext3_ioctl (struct inode * inode, st 3066@@ -59,7 +62,9 @@ int ext3_ioctl (struct inode * inode, st
3012 * 3067 *
3013 * This test looks nicer. Thanks to Pauline Middelink 3068 * This test looks nicer. Thanks to Pauline Middelink
3014 */ 3069 */
3015- if ((flags ^ oldflags) & (EXT3_APPEND_FL | EXT3_IMMUTABLE_FL)) { 3070- if ((flags ^ oldflags) & (EXT3_APPEND_FL | EXT3_IMMUTABLE_FL)) {
3016+ if ((oldflags & EXT3_IMMUTABLE_FL) || 3071+ if ((oldflags & EXT3_IMMUTABLE_FL) ||
3017+ ((flags ^ oldflags) & (EXT3_APPEND_FL | 3072+ ((flags ^ oldflags) & (EXT3_APPEND_FL |
3018+ EXT3_IMMUTABLE_FL | EXT3_IUNLINK_FL))) { 3073+ EXT3_IMMUTABLE_FL | EXT3_IUNLINK_FL))) {
3019 if (!capable(CAP_LINUX_IMMUTABLE)) 3074 if (!capable(CAP_LINUX_IMMUTABLE))
3020 return -EPERM; 3075 return -EPERM;
3021 } 3076 }
3022@@ -111,7 +116,8 @@ flags_err: 3077@@ -112,7 +117,8 @@ flags_err:
3023 3078
3024 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER)) 3079 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
3025 return -EPERM; 3080 return -EPERM;
3026- if (IS_RDONLY(inode)) 3081- if (IS_RDONLY(inode))
3027+ if (IS_RDONLY(inode) || 3082+ if (IS_RDONLY(inode) ||
3028+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt))) 3083+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
3029 return -EROFS; 3084 return -EROFS;
3030 if (get_user(generation, (int __user *) arg)) 3085 if (get_user(generation, (int __user *) arg))
3031 return -EFAULT; 3086 return -EFAULT;
3032@@ -165,7 +171,8 @@ flags_err: 3087@@ -166,7 +172,8 @@ flags_err:
3033 if (!test_opt(inode->i_sb, RESERVATION) ||!S_ISREG(inode->i_mode)) 3088 if (!test_opt(inode->i_sb, RESERVATION) ||!S_ISREG(inode->i_mode))
3034 return -ENOTTY; 3089 return -ENOTTY;
3035 3090
3036- if (IS_RDONLY(inode)) 3091- if (IS_RDONLY(inode))
3037+ if (IS_RDONLY(inode) || 3092+ if (IS_RDONLY(inode) ||
3038+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt))) 3093+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
3039 return -EROFS; 3094 return -EROFS;
3040 3095
3041 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER)) 3096 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
3042@@ -200,7 +207,8 @@ flags_err: 3097@@ -201,7 +208,8 @@ flags_err:
3043 if (!capable(CAP_SYS_RESOURCE)) 3098 if (!capable(CAP_SYS_RESOURCE))
3044 return -EPERM; 3099 return -EPERM;
3045 3100
3046- if (IS_RDONLY(inode)) 3101- if (IS_RDONLY(inode))
3047+ if (IS_RDONLY(inode) || 3102+ if (IS_RDONLY(inode) ||
3048+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt))) 3103+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
3049 return -EROFS; 3104 return -EROFS;
3050 3105
3051 if (get_user(n_blocks_count, (__u32 __user *)arg)) 3106 if (get_user(n_blocks_count, (__u32 __user *)arg))
3052@@ -221,7 +229,8 @@ flags_err: 3107@@ -222,7 +230,8 @@ flags_err:
3053 if (!capable(CAP_SYS_RESOURCE)) 3108 if (!capable(CAP_SYS_RESOURCE))
3054 return -EPERM; 3109 return -EPERM;
3055 3110
3056- if (IS_RDONLY(inode)) 3111- if (IS_RDONLY(inode))
3057+ if (IS_RDONLY(inode) || 3112+ if (IS_RDONLY(inode) ||
3058+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt))) 3113+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
3059 return -EROFS; 3114 return -EROFS;
3060 3115
3061 if (copy_from_user(&input, (struct ext3_new_group_input __user *)arg, 3116 if (copy_from_user(&input, (struct ext3_new_group_input __user *)arg,
3062@@ -236,6 +245,38 @@ flags_err: 3117@@ -237,6 +246,38 @@ flags_err:
3063 return err; 3118 return err;
3064 } 3119 }
3065 3120
3066+#if defined(CONFIG_VSERVER_LEGACY) && !defined(CONFIG_INOXID_NONE) 3121+#if defined(CONFIG_VSERVER_LEGACY) && !defined(CONFIG_INOXID_NONE)
3067+ case EXT3_IOC_SETXID: { 3122+ case EXT3_IOC_SETXID: {
3096+ } 3151+ }
3097+#endif 3152+#endif
3098 3153
3099 default: 3154 default:
3100 return -ENOTTY; 3155 return -ENOTTY;
3101Index: vserver-sources-2.0.2_2.6.15/fs/ext3/namei.c 3156Index: linux-2.6.16/fs/ext3/namei.c
3102=================================================================== 3157===================================================================
3103--- vserver-sources-2.0.2_2.6.15.orig/fs/ext3/namei.c 3158--- linux-2.6.16.orig/fs/ext3/namei.c
3104+++ vserver-sources-2.0.2_2.6.15/fs/ext3/namei.c 3159+++ linux-2.6.16/fs/ext3/namei.c
3105@@ -36,6 +36,7 @@ 3160@@ -36,6 +36,7 @@
3106 #include <linux/quotaops.h> 3161 #include <linux/quotaops.h>
3107 #include <linux/buffer_head.h> 3162 #include <linux/buffer_head.h>
3108 #include <linux/smp_lock.h> 3163 #include <linux/smp_lock.h>
3109+#include <linux/vserver/xid.h> 3164+#include <linux/vserver/xid.h>
3114 3169
3115 if (!inode) 3170 if (!inode)
3116 return ERR_PTR(-EACCES); 3171 return ERR_PTR(-EACCES);
3117+ vx_propagate_xid(nd, inode); 3172+ vx_propagate_xid(nd, inode);
3118 } 3173 }
3119 if (inode)
3120 return d_splice_alias(inode, dentry); 3174 return d_splice_alias(inode, dentry);
3175 }
3121@@ -2375,6 +2377,7 @@ struct inode_operations ext3_dir_inode_o 3176@@ -2373,6 +2375,7 @@ struct inode_operations ext3_dir_inode_o
3122 .removexattr = generic_removexattr, 3177 .removexattr = generic_removexattr,
3123 #endif 3178 #endif
3124 .permission = ext3_permission, 3179 .permission = ext3_permission,
3125+ .sync_flags = ext3_sync_flags, 3180+ .sync_flags = ext3_sync_flags,
3126 }; 3181 };
3127 3182
3128 struct inode_operations ext3_special_inode_operations = { 3183 struct inode_operations ext3_special_inode_operations = {
3129@@ -2386,4 +2389,5 @@ struct inode_operations ext3_special_ino 3184@@ -2384,4 +2387,5 @@ struct inode_operations ext3_special_ino
3130 .removexattr = generic_removexattr, 3185 .removexattr = generic_removexattr,
3131 #endif 3186 #endif
3132 .permission = ext3_permission, 3187 .permission = ext3_permission,
3133+ .sync_flags = ext3_sync_flags, 3188+ .sync_flags = ext3_sync_flags,
3134 }; 3189 };
3135Index: vserver-sources-2.0.2_2.6.15/fs/ext3/super.c 3190Index: linux-2.6.16/fs/ext3/super.c
3136=================================================================== 3191===================================================================
3137--- vserver-sources-2.0.2_2.6.15.orig/fs/ext3/super.c 3192--- linux-2.6.16.orig/fs/ext3/super.c
3138+++ vserver-sources-2.0.2_2.6.15/fs/ext3/super.c 3193+++ linux-2.6.16/fs/ext3/super.c
3139@@ -633,7 +633,7 @@ enum { 3194@@ -634,7 +634,7 @@ enum {
3140 Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota, 3195 Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
3141 Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_quota, Opt_noquota, 3196 Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_quota, Opt_noquota,
3142 Opt_ignore, Opt_barrier, Opt_err, Opt_resize, Opt_usrquota, 3197 Opt_ignore, Opt_barrier, Opt_err, Opt_resize, Opt_usrquota,
3143- Opt_grpquota 3198- Opt_grpquota
3144+ Opt_grpquota, Opt_tagxid 3199+ Opt_grpquota, Opt_tagxid
3145 }; 3200 };
3146 3201
3147 static match_table_t tokens = { 3202 static match_table_t tokens = {
3148@@ -681,6 +681,7 @@ static match_table_t tokens = { 3203@@ -683,6 +683,7 @@ static match_table_t tokens = {
3149 {Opt_quota, "quota"}, 3204 {Opt_quota, "quota"},
3150 {Opt_usrquota, "usrquota"}, 3205 {Opt_usrquota, "usrquota"},
3151 {Opt_barrier, "barrier=%u"}, 3206 {Opt_barrier, "barrier=%u"},
3152+ {Opt_tagxid, "tagxid"}, 3207+ {Opt_tagxid, "tagxid"},
3153 {Opt_err, NULL}, 3208 {Opt_err, NULL},
3154 {Opt_resize, "resize"}, 3209 {Opt_resize, "resize"},
3155 }; 3210 };
3156@@ -772,6 +773,11 @@ static int parse_options (char * options 3211@@ -775,6 +776,11 @@ static int parse_options (char *options,
3157 case Opt_nouid32: 3212 case Opt_nouid32:
3158 set_opt (sbi->s_mount_opt, NO_UID32); 3213 set_opt (sbi->s_mount_opt, NO_UID32);
3159 break; 3214 break;
3160+#ifndef CONFIG_INOXID_NONE 3215+#ifndef CONFIG_INOXID_NONE
3161+ case Opt_tagxid: 3216+ case Opt_tagxid:
3163+ break; 3218+ break;
3164+#endif 3219+#endif
3165 case Opt_nocheck: 3220 case Opt_nocheck:
3166 clear_opt (sbi->s_mount_opt, CHECK); 3221 clear_opt (sbi->s_mount_opt, CHECK);
3167 break; 3222 break;
3168@@ -1414,6 +1420,9 @@ static int ext3_fill_super (struct super 3223@@ -1429,6 +1435,9 @@ static int ext3_fill_super (struct super
3169 if (!parse_options ((char *) data, sb, &journal_inum, NULL, 0)) 3224 NULL, 0))
3170 goto failed_mount; 3225 goto failed_mount;
3171 3226
3172+ if (EXT3_SB(sb)->s_mount_opt & EXT3_MOUNT_TAGXID) 3227+ if (EXT3_SB(sb)->s_mount_opt & EXT3_MOUNT_TAGXID)
3173+ sb->s_flags |= MS_TAGXID; 3228+ sb->s_flags |= MS_TAGXID;
3174+ 3229+
3175 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | 3230 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
3176 ((sbi->s_mount_opt & EXT3_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); 3231 ((sbi->s_mount_opt & EXT3_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0);
3177 3232
3178@@ -2204,6 +2213,12 @@ static int ext3_remount (struct super_bl 3233@@ -2238,6 +2247,12 @@ static int ext3_remount (struct super_bl
3179 3234
3180 if (sbi->s_mount_opt & EXT3_MOUNT_ABORT) 3235 if (sbi->s_mount_opt & EXT3_MOUNT_ABORT)
3181 ext3_abort(sb, __FUNCTION__, "Abort forced by user"); 3236 ext3_abort(sb, __FUNCTION__, "Abort forced by user");
3182+ if ((sbi->s_mount_opt & EXT3_MOUNT_TAGXID) && 3237+ if ((sbi->s_mount_opt & EXT3_MOUNT_TAGXID) &&
3183+ !(sb->s_flags & MS_TAGXID)) { 3238+ !(sb->s_flags & MS_TAGXID)) {
3186+ return -EINVAL; 3241+ return -EINVAL;
3187+ } 3242+ }
3188 3243
3189 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | 3244 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
3190 ((sbi->s_mount_opt & EXT3_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); 3245 ((sbi->s_mount_opt & EXT3_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0);
3191Index: vserver-sources-2.0.2_2.6.15/fs/ext3/symlink.c 3246Index: linux-2.6.16/fs/ext3/symlink.c
3192=================================================================== 3247===================================================================
3193--- vserver-sources-2.0.2_2.6.15.orig/fs/ext3/symlink.c 3248--- linux-2.6.16.orig/fs/ext3/symlink.c
3194+++ vserver-sources-2.0.2_2.6.15/fs/ext3/symlink.c 3249+++ linux-2.6.16/fs/ext3/symlink.c
3195@@ -40,6 +40,7 @@ struct inode_operations ext3_symlink_ino 3250@@ -40,6 +40,7 @@ struct inode_operations ext3_symlink_ino
3196 .listxattr = ext3_listxattr, 3251 .listxattr = ext3_listxattr,
3197 .removexattr = generic_removexattr, 3252 .removexattr = generic_removexattr,
3198 #endif 3253 #endif
3199+ .sync_flags = ext3_sync_flags, 3254+ .sync_flags = ext3_sync_flags,
3204 .listxattr = ext3_listxattr, 3259 .listxattr = ext3_listxattr,
3205 .removexattr = generic_removexattr, 3260 .removexattr = generic_removexattr,
3206 #endif 3261 #endif
3207+ .sync_flags = ext3_sync_flags, 3262+ .sync_flags = ext3_sync_flags,
3208 }; 3263 };
3209Index: vserver-sources-2.0.2_2.6.15/fs/ext3/xattr.c 3264Index: linux-2.6.16/fs/ext3/xattr.c
3210=================================================================== 3265===================================================================
3211--- vserver-sources-2.0.2_2.6.15.orig/fs/ext3/xattr.c 3266--- linux-2.6.16.orig/fs/ext3/xattr.c
3212+++ vserver-sources-2.0.2_2.6.15/fs/ext3/xattr.c 3267+++ linux-2.6.16/fs/ext3/xattr.c
3213@@ -58,6 +58,7 @@ 3268@@ -58,6 +58,7 @@
3214 #include <linux/mbcache.h> 3269 #include <linux/mbcache.h>
3215 #include <linux/quotaops.h> 3270 #include <linux/quotaops.h>
3216 #include <linux/rwsem.h> 3271 #include <linux/rwsem.h>
3217+#include <linux/vs_dlimit.h> 3272+#include <linux/vs_dlimit.h>
3249+cleanup_dlimit: 3304+cleanup_dlimit:
3250+ DLIMIT_FREE_BLOCK(inode, 1); 3305+ DLIMIT_FREE_BLOCK(inode, 1);
3251 goto cleanup; 3306 goto cleanup;
3252 3307
3253 bad_block: 3308 bad_block:
3254Index: vserver-sources-2.0.2_2.6.15/fs/fcntl.c 3309Index: linux-2.6.16/fs/fcntl.c
3255=================================================================== 3310===================================================================
3256--- vserver-sources-2.0.2_2.6.15.orig/fs/fcntl.c 3311--- linux-2.6.16.orig/fs/fcntl.c
3257+++ vserver-sources-2.0.2_2.6.15/fs/fcntl.c 3312+++ linux-2.6.16/fs/fcntl.c
3258@@ -17,6 +17,7 @@ 3313@@ -18,6 +18,7 @@
3259 #include <linux/ptrace.h> 3314 #include <linux/ptrace.h>
3260 #include <linux/signal.h> 3315 #include <linux/signal.h>
3261 #include <linux/rcupdate.h> 3316 #include <linux/rcupdate.h>
3262+#include <linux/vs_limit.h> 3317+#include <linux/vs_limit.h>
3263 3318
3264 #include <asm/poll.h> 3319 #include <asm/poll.h>
3265 #include <asm/siginfo.h> 3320 #include <asm/siginfo.h>
3266@@ -84,6 +85,8 @@ repeat: 3321@@ -85,6 +86,8 @@ repeat:
3267 error = -EMFILE; 3322 error = -EMFILE;
3268 if (newfd >= current->signal->rlim[RLIMIT_NOFILE].rlim_cur) 3323 if (newfd >= current->signal->rlim[RLIMIT_NOFILE].rlim_cur)
3269 goto out; 3324 goto out;
3270+ if (!vx_files_avail(1)) 3325+ if (!vx_files_avail(1))
3271+ goto out; 3326+ goto out;
3272 3327
3273 error = expand_files(files, newfd); 3328 error = expand_files(files, newfd);
3274 if (error < 0) 3329 if (error < 0)
3275@@ -125,6 +128,7 @@ static int dupfd(struct file *file, unsi 3330@@ -126,6 +129,7 @@ static int dupfd(struct file *file, unsi
3276 FD_SET(fd, fdt->open_fds); 3331 FD_SET(fd, fdt->open_fds);
3277 FD_CLR(fd, fdt->close_on_exec); 3332 FD_CLR(fd, fdt->close_on_exec);
3278 spin_unlock(&files->file_lock); 3333 spin_unlock(&files->file_lock);
3279+ vx_openfd_inc(fd); 3334+ vx_openfd_inc(fd);
3280 fd_install(fd, file); 3335 fd_install(fd, file);
3281 } else { 3336 } else {
3282 spin_unlock(&files->file_lock); 3337 spin_unlock(&files->file_lock);
3283@@ -177,6 +181,9 @@ asmlinkage long sys_dup2(unsigned int ol 3338@@ -178,6 +182,9 @@ asmlinkage long sys_dup2(unsigned int ol
3284 3339
3285 if (tofree) 3340 if (tofree)
3286 filp_close(tofree, files); 3341 filp_close(tofree, files);
3287+ else 3342+ else
3288+ vx_openfd_inc(newfd); /* fd was unused */ 3343+ vx_openfd_inc(newfd); /* fd was unused */
3289+ 3344+
3290 err = newfd; 3345 err = newfd;
3291 out: 3346 out:
3292 return err; 3347 return err;
3293@@ -477,7 +484,7 @@ void send_sigio(struct fown_struct *fown 3348@@ -481,7 +488,7 @@ void send_sigio(struct fown_struct *fown
3294 3349
3295 read_lock(&tasklist_lock); 3350 read_lock(&tasklist_lock);
3296 if (pid > 0) { 3351 if (pid > 0) {
3297- p = find_task_by_pid(pid); 3352- p = find_task_by_pid(pid);
3298+ p = find_task_by_real_pid(pid); 3353+ p = find_task_by_real_pid(pid);
3299 if (p) { 3354 if (p) {
3300 send_sigio_to_task(p, fown, fd, band); 3355 send_sigio_to_task(p, fown, fd, band);
3301 } 3356 }
3302@@ -512,7 +519,7 @@ int send_sigurg(struct fown_struct *fown 3357@@ -516,7 +523,7 @@ int send_sigurg(struct fown_struct *fown
3303 3358
3304 read_lock(&tasklist_lock); 3359 read_lock(&tasklist_lock);
3305 if (pid > 0) { 3360 if (pid > 0) {
3306- p = find_task_by_pid(pid); 3361- p = find_task_by_pid(pid);
3307+ p = find_task_by_real_pid(pid); 3362+ p = find_task_by_real_pid(pid);
3308 if (p) { 3363 if (p) {
3309 send_sigurg_to_task(p, fown); 3364 send_sigurg_to_task(p, fown);
3310 } 3365 }
3311Index: vserver-sources-2.0.2_2.6.15/fs/file_table.c 3366Index: linux-2.6.16/fs/file_table.c
3312=================================================================== 3367===================================================================
3313--- vserver-sources-2.0.2_2.6.15.orig/fs/file_table.c 3368--- linux-2.6.16.orig/fs/file_table.c
3314+++ vserver-sources-2.0.2_2.6.15/fs/file_table.c 3369+++ linux-2.6.16/fs/file_table.c
3315@@ -18,6 +18,8 @@ 3370@@ -22,6 +22,8 @@
3316 #include <linux/mount.h>
3317 #include <linux/cdev.h>
3318 #include <linux/fsnotify.h> 3371 #include <linux/fsnotify.h>
3372 #include <linux/sysctl.h>
3373 #include <linux/percpu_counter.h>
3319+#include <linux/vs_limit.h> 3374+#include <linux/vs_limit.h>
3320+#include <linux/vs_context.h> 3375+#include <linux/vs_context.h>
3321 3376
3322 /* sysctl tunables... */ 3377 #include <asm/atomic.h>
3323 struct files_stat_struct files_stat = { 3378
3324@@ -96,6 +98,8 @@ struct file *get_empty_filp(void) 3379@@ -119,6 +121,8 @@ struct file *get_empty_filp(void)
3325 rwlock_init(&f->f_owner.lock); 3380 rwlock_init(&f->f_owner.lock);
3326 /* f->f_version: 0 */ 3381 /* f->f_version: 0 */
3327 INIT_LIST_HEAD(&f->f_u.fu_list); 3382 INIT_LIST_HEAD(&f->f_u.fu_list);
3328+ f->f_xid = vx_current_xid(); 3383+ f->f_xid = vx_current_xid();
3329+ vx_files_inc(f); 3384+ vx_files_inc(f);
3330 return f; 3385 return f;
3331 3386
3332 over: 3387 over:
3333@@ -150,6 +154,8 @@ void fastcall __fput(struct file *file) 3388@@ -173,6 +177,8 @@ void fastcall __fput(struct file *file)
3334 fops_put(file->f_op); 3389 fops_put(file->f_op);
3335 if (file->f_mode & FMODE_WRITE) 3390 if (file->f_mode & FMODE_WRITE)
3336 put_write_access(inode); 3391 put_write_access(inode);
3337+ vx_files_dec(file); 3392+ vx_files_dec(file);
3338+ file->f_xid = 0; 3393+ file->f_xid = 0;
3339 file_kill(file); 3394 file_kill(file);
3340 file->f_dentry = NULL; 3395 file->f_dentry = NULL;
3341 file->f_vfsmnt = NULL; 3396 file->f_vfsmnt = NULL;
3342@@ -215,6 +221,8 @@ void put_filp(struct file *file) 3397@@ -238,6 +244,8 @@ void put_filp(struct file *file)
3343 { 3398 {
3344 if (rcuref_dec_and_test(&file->f_count)) { 3399 if (atomic_dec_and_test(&file->f_count)) {
3345 security_file_free(file); 3400 security_file_free(file);
3346+ vx_files_dec(file); 3401+ vx_files_dec(file);
3347+ file->f_xid = 0; 3402+ file->f_xid = 0;
3348 file_kill(file); 3403 file_kill(file);
3349 file_free(file); 3404 file_free(file);
3350 } 3405 }
3351Index: vserver-sources-2.0.2_2.6.15/fs/hfsplus/ioctl.c 3406Index: linux-2.6.16/fs/hfsplus/ioctl.c
3352=================================================================== 3407===================================================================
3353--- vserver-sources-2.0.2_2.6.15.orig/fs/hfsplus/ioctl.c 3408--- linux-2.6.16.orig/fs/hfsplus/ioctl.c
3354+++ vserver-sources-2.0.2_2.6.15/fs/hfsplus/ioctl.c 3409+++ linux-2.6.16/fs/hfsplus/ioctl.c
3355@@ -15,6 +15,7 @@ 3410@@ -16,6 +16,7 @@
3356 #include <linux/fs.h> 3411 #include <linux/fs.h>
3357 #include <linux/sched.h> 3412 #include <linux/sched.h>
3358 #include <linux/xattr.h> 3413 #include <linux/xattr.h>
3359+#include <linux/mount.h> 3414+#include <linux/mount.h>
3360 #include <asm/uaccess.h> 3415 #include <asm/uaccess.h>
3361 #include "hfsplus_fs.h" 3416 #include "hfsplus_fs.h"
3362 3417
3363@@ -34,7 +35,8 @@ int hfsplus_ioctl(struct inode *inode, s 3418@@ -35,7 +36,8 @@ int hfsplus_ioctl(struct inode *inode, s
3364 flags |= EXT2_FLAG_NODUMP; /* EXT2_NODUMP_FL */ 3419 flags |= EXT2_FLAG_NODUMP; /* EXT2_NODUMP_FL */
3365 return put_user(flags, (int __user *)arg); 3420 return put_user(flags, (int __user *)arg);
3366 case HFSPLUS_IOC_EXT2_SETFLAGS: { 3421 case HFSPLUS_IOC_EXT2_SETFLAGS: {
3367- if (IS_RDONLY(inode)) 3422- if (IS_RDONLY(inode))
3368+ if (IS_RDONLY(inode) || 3423+ if (IS_RDONLY(inode) ||
3369+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt))) 3424+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
3370 return -EROFS; 3425 return -EROFS;
3371 3426
3372 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER)) 3427 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
3373Index: vserver-sources-2.0.2_2.6.15/fs/inode.c 3428Index: linux-2.6.16/fs/inode.c
3374=================================================================== 3429===================================================================
3375--- vserver-sources-2.0.2_2.6.15.orig/fs/inode.c 3430--- linux-2.6.16.orig/fs/inode.c
3376+++ vserver-sources-2.0.2_2.6.15/fs/inode.c 3431+++ linux-2.6.16/fs/inode.c
3377@@ -115,6 +115,9 @@ static struct inode *alloc_inode(struct 3432@@ -116,6 +116,9 @@ static struct inode *alloc_inode(struct
3378 struct address_space * const mapping = &inode->i_data; 3433 struct address_space * const mapping = &inode->i_data;
3379 3434
3380 inode->i_sb = sb; 3435 inode->i_sb = sb;
3381+ 3436+
3382+ /* essential because of inode slab reuse */ 3437+ /* essential because of inode slab reuse */
3383+ inode->i_xid = 0; 3438+ inode->i_xid = 0;
3384 inode->i_blkbits = sb->s_blocksize_bits; 3439 inode->i_blkbits = sb->s_blocksize_bits;
3385 inode->i_flags = 0; 3440 inode->i_flags = 0;
3386 atomic_set(&inode->i_count, 1); 3441 atomic_set(&inode->i_count, 1);
3387@@ -235,6 +238,8 @@ void __iget(struct inode * inode) 3442@@ -236,6 +239,8 @@ void __iget(struct inode * inode)
3388 inodes_stat.nr_unused--; 3443 inodes_stat.nr_unused--;
3389 } 3444 }
3390 3445
3391+EXPORT_SYMBOL_GPL(__iget); 3446+EXPORT_SYMBOL_GPL(__iget);
3392+ 3447+
3393 /** 3448 /**
3394 * clear_inode - clear an inode 3449 * clear_inode - clear an inode
3395 * @inode: inode to clear 3450 * @inode: inode to clear
3396Index: vserver-sources-2.0.2_2.6.15/fs/ioctl.c 3451Index: linux-2.6.16/fs/ioctl.c
3397=================================================================== 3452===================================================================
3398--- vserver-sources-2.0.2_2.6.15.orig/fs/ioctl.c 3453--- linux-2.6.16.orig/fs/ioctl.c
3399+++ vserver-sources-2.0.2_2.6.15/fs/ioctl.c 3454+++ linux-2.6.16/fs/ioctl.c
3400@@ -12,10 +12,19 @@ 3455@@ -13,10 +13,19 @@
3401 #include <linux/fs.h> 3456 #include <linux/fs.h>
3402 #include <linux/security.h> 3457 #include <linux/security.h>
3403 #include <linux/module.h> 3458 #include <linux/module.h>
3404+#include <linux/proc_fs.h> 3459+#include <linux/proc_fs.h>
3405+#include <linux/vserver/inode.h> 3460+#include <linux/vserver/inode.h>
3415+#endif 3470+#endif
3416+ 3471+
3417 static long do_ioctl(struct file *filp, unsigned int cmd, 3472 static long do_ioctl(struct file *filp, unsigned int cmd,
3418 unsigned long arg) 3473 unsigned long arg)
3419 { 3474 {
3420@@ -146,6 +155,48 @@ int vfs_ioctl(struct file *filp, unsigne 3475@@ -147,6 +156,48 @@ int vfs_ioctl(struct file *filp, unsigne
3421 else 3476 else
3422 error = -ENOTTY; 3477 error = -ENOTTY;
3423 break; 3478 break;
3424+#ifdef CONFIG_VSERVER_LEGACY 3479+#ifdef CONFIG_VSERVER_LEGACY
3425+#ifndef CONFIG_INOXID_NONE 3480+#ifndef CONFIG_INOXID_NONE
3464+ break; 3519+ break;
3465+#endif 3520+#endif
3466 default: 3521 default:
3467 if (S_ISREG(filp->f_dentry->d_inode->i_mode)) 3522 if (S_ISREG(filp->f_dentry->d_inode->i_mode))
3468 error = file_ioctl(filp, cmd, arg); 3523 error = file_ioctl(filp, cmd, arg);
3469Index: vserver-sources-2.0.2_2.6.15/fs/ioprio.c 3524Index: linux-2.6.16/fs/ioprio.c
3470=================================================================== 3525===================================================================
3471--- vserver-sources-2.0.2_2.6.15.orig/fs/ioprio.c 3526--- linux-2.6.16.orig/fs/ioprio.c
3472+++ vserver-sources-2.0.2_2.6.15/fs/ioprio.c 3527+++ linux-2.6.16/fs/ioprio.c
3473@@ -23,6 +23,7 @@ 3528@@ -24,6 +24,7 @@
3474 #include <linux/ioprio.h>
3475 #include <linux/blkdev.h> 3529 #include <linux/blkdev.h>
3530 #include <linux/capability.h>
3476 #include <linux/syscalls.h> 3531 #include <linux/syscalls.h>
3477+#include <linux/vs_cvirt.h> 3532+#include <linux/vs_cvirt.h>
3478 3533
3479 static int set_task_ioprio(struct task_struct *task, int ioprio) 3534 static int set_task_ioprio(struct task_struct *task, int ioprio)
3480 { 3535 {
3481@@ -94,7 +95,7 @@ asmlinkage long sys_ioprio_set(int which 3536@@ -95,7 +96,7 @@ asmlinkage long sys_ioprio_set(int which
3482 if (!who) 3537 if (!who)
3483 user = current->user; 3538 user = current->user;
3484 else 3539 else
3485- user = find_user(who); 3540- user = find_user(who);
3486+ user = find_user(who, vx_current_xid()); 3541+ user = find_user(who, vx_current_xid());
3487 3542
3488 if (!user) 3543 if (!user)
3489 break; 3544 break;
3490@@ -148,7 +149,7 @@ asmlinkage long sys_ioprio_get(int which 3545@@ -149,7 +150,7 @@ asmlinkage long sys_ioprio_get(int which
3491 if (!who) 3546 if (!who)
3492 user = current->user; 3547 user = current->user;
3493 else 3548 else
3494- user = find_user(who); 3549- user = find_user(who);
3495+ user = find_user(who, vx_current_xid()); 3550+ user = find_user(who, vx_current_xid());
3496 3551
3497 if (!user) 3552 if (!user)
3498 break; 3553 break;
3499Index: vserver-sources-2.0.2_2.6.15/fs/jfs/acl.c 3554Index: linux-2.6.16/fs/jfs/acl.c
3500=================================================================== 3555===================================================================
3501--- vserver-sources-2.0.2_2.6.15.orig/fs/jfs/acl.c 3556--- linux-2.6.16.orig/fs/jfs/acl.c
3502+++ vserver-sources-2.0.2_2.6.15/fs/jfs/acl.c 3557+++ linux-2.6.16/fs/jfs/acl.c
3503@@ -229,7 +229,8 @@ int jfs_setattr(struct dentry *dentry, s 3558@@ -229,7 +229,8 @@ int jfs_setattr(struct dentry *dentry, s
3504 return rc; 3559 return rc;
3505 3560
3506 if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) || 3561 if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
3507- (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) { 3562- (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
3508+ (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid) || 3563+ (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid) ||
3509+ (iattr->ia_valid & ATTR_XID && iattr->ia_xid != inode->i_xid)) { 3564+ (iattr->ia_valid & ATTR_XID && iattr->ia_xid != inode->i_xid)) {
3510 if (DQUOT_TRANSFER(inode, iattr)) 3565 if (DQUOT_TRANSFER(inode, iattr))
3511 return -EDQUOT; 3566 return -EDQUOT;
3512 } 3567 }
3513Index: vserver-sources-2.0.2_2.6.15/fs/jfs/inode.c 3568Index: linux-2.6.16/fs/jfs/inode.c
3514=================================================================== 3569===================================================================
3515--- vserver-sources-2.0.2_2.6.15.orig/fs/jfs/inode.c 3570--- linux-2.6.16.orig/fs/jfs/inode.c
3516+++ vserver-sources-2.0.2_2.6.15/fs/jfs/inode.c 3571+++ linux-2.6.16/fs/jfs/inode.c
3517@@ -22,6 +22,7 @@ 3572@@ -22,6 +22,7 @@
3518 #include <linux/buffer_head.h> 3573 #include <linux/buffer_head.h>
3519 #include <linux/pagemap.h> 3574 #include <linux/pagemap.h>
3520 #include <linux/quotaops.h> 3575 #include <linux/quotaops.h>
3521+#include <linux/vs_dlimit.h> 3576+#include <linux/vs_dlimit.h>
3528 DQUOT_DROP(inode); 3583 DQUOT_DROP(inode);
3529+ DLIMIT_FREE_INODE(inode); 3584+ DLIMIT_FREE_INODE(inode);
3530 } 3585 }
3531 3586
3532 clear_inode(inode); 3587 clear_inode(inode);
3533Index: vserver-sources-2.0.2_2.6.15/fs/jfs/jfs_dtree.c 3588Index: linux-2.6.16/fs/jfs/jfs_dtree.c
3534=================================================================== 3589===================================================================
3535--- vserver-sources-2.0.2_2.6.15.orig/fs/jfs/jfs_dtree.c 3590--- linux-2.6.16.orig/fs/jfs/jfs_dtree.c
3536+++ vserver-sources-2.0.2_2.6.15/fs/jfs/jfs_dtree.c 3591+++ linux-2.6.16/fs/jfs/jfs_dtree.c
3537@@ -102,6 +102,7 @@ 3592@@ -102,6 +102,7 @@
3538 3593
3539 #include <linux/fs.h> 3594 #include <linux/fs.h>
3540 #include <linux/quotaops.h> 3595 #include <linux/quotaops.h>
3541+#include <linux/vs_dlimit.h> 3596+#include <linux/vs_dlimit.h>
3651+ /* Free dlimit allocation */ 3706+ /* Free dlimit allocation */
3652+ DLIMIT_FREE_BLOCK(ip, xlen); 3707+ DLIMIT_FREE_BLOCK(ip, xlen);
3653 /* Free quota allocation */ 3708 /* Free quota allocation */
3654 DQUOT_FREE_BLOCK(ip, xlen); 3709 DQUOT_FREE_BLOCK(ip, xlen);
3655 3710
3656Index: vserver-sources-2.0.2_2.6.15/fs/jfs/jfs_extent.c 3711Index: linux-2.6.16/fs/jfs/jfs_extent.c
3657=================================================================== 3712===================================================================
3658--- vserver-sources-2.0.2_2.6.15.orig/fs/jfs/jfs_extent.c 3713--- linux-2.6.16.orig/fs/jfs/jfs_extent.c
3659+++ vserver-sources-2.0.2_2.6.15/fs/jfs/jfs_extent.c 3714+++ linux-2.6.16/fs/jfs/jfs_extent.c
3660@@ -18,6 +18,7 @@ 3715@@ -18,6 +18,7 @@
3661 3716
3662 #include <linux/fs.h> 3717 #include <linux/fs.h>
3663 #include <linux/quotaops.h> 3718 #include <linux/quotaops.h>
3664+#include <linux/vs_dlimit.h> 3719+#include <linux/vs_dlimit.h>
3715 dbFree(ip, nxaddr, nxlen); 3770 dbFree(ip, nxaddr, nxlen);
3716+ DLIMIT_FREE_BLOCK(ip, nxlen); 3771+ DLIMIT_FREE_BLOCK(ip, nxlen);
3717 DQUOT_FREE_BLOCK(ip, nxlen); 3772 DQUOT_FREE_BLOCK(ip, nxlen);
3718 goto exit; 3773 goto exit;
3719 } 3774 }
3720Index: vserver-sources-2.0.2_2.6.15/fs/jfs/jfs_filsys.h 3775Index: linux-2.6.16/fs/jfs/jfs_filsys.h
3721=================================================================== 3776===================================================================
3722--- vserver-sources-2.0.2_2.6.15.orig/fs/jfs/jfs_filsys.h 3777--- linux-2.6.16.orig/fs/jfs/jfs_filsys.h
3723+++ vserver-sources-2.0.2_2.6.15/fs/jfs/jfs_filsys.h 3778+++ linux-2.6.16/fs/jfs/jfs_filsys.h
3724@@ -84,6 +84,7 @@ 3779@@ -84,6 +84,7 @@
3725 #define JFS_DIR_INDEX 0x00200000 /* Persistant index for */ 3780 #define JFS_DIR_INDEX 0x00200000 /* Persistant index for */
3726 /* directory entries */ 3781 /* directory entries */
3727 3782
3728+#define JFS_TAGXID 0x00800000 /* xid tagging */ 3783+#define JFS_TAGXID 0x00800000 /* xid tagging */
3729 3784
3730 /* 3785 /*
3731 * buffer cache configuration 3786 * buffer cache configuration
3732Index: vserver-sources-2.0.2_2.6.15/fs/jfs/jfs_imap.c 3787Index: linux-2.6.16/fs/jfs/jfs_imap.c
3733=================================================================== 3788===================================================================
3734--- vserver-sources-2.0.2_2.6.15.orig/fs/jfs/jfs_imap.c 3789--- linux-2.6.16.orig/fs/jfs/jfs_imap.c
3735+++ vserver-sources-2.0.2_2.6.15/fs/jfs/jfs_imap.c 3790+++ linux-2.6.16/fs/jfs/jfs_imap.c
3736@@ -45,6 +45,7 @@ 3791@@ -45,6 +45,7 @@
3737 #include <linux/buffer_head.h> 3792 #include <linux/buffer_head.h>
3738 #include <linux/pagemap.h> 3793 #include <linux/pagemap.h>
3739 #include <linux/quotaops.h> 3794 #include <linux/quotaops.h>
3740+#include <linux/vserver/xid.h> 3795+#include <linux/vserver/xid.h>
3741 3796
3742 #include "jfs_incore.h" 3797 #include "jfs_incore.h"
3743 #include "jfs_inode.h" 3798 #include "jfs_inode.h"
3744@@ -3078,14 +3079,21 @@ static void duplicateIXtree(struct super 3799@@ -3074,14 +3075,21 @@ static void duplicateIXtree(struct super
3745 static int copy_from_dinode(struct dinode * dip, struct inode *ip) 3800 static int copy_from_dinode(struct dinode * dip, struct inode *ip)
3746 { 3801 {
3747 struct jfs_inode_info *jfs_ip = JFS_IP(ip); 3802 struct jfs_inode_info *jfs_ip = JFS_IP(ip);
3748+ uid_t uid; 3803+ uid_t uid;
3749+ gid_t gid; 3804+ gid_t gid;
3763+ ip->i_xid = INOXID_XID(XID_TAG(ip), uid, gid, 0); 3818+ ip->i_xid = INOXID_XID(XID_TAG(ip), uid, gid, 0);
3764+ 3819+
3765 ip->i_size = le64_to_cpu(dip->di_size); 3820 ip->i_size = le64_to_cpu(dip->di_size);
3766 ip->i_atime.tv_sec = le32_to_cpu(dip->di_atime.tv_sec); 3821 ip->i_atime.tv_sec = le32_to_cpu(dip->di_atime.tv_sec);
3767 ip->i_atime.tv_nsec = le32_to_cpu(dip->di_atime.tv_nsec); 3822 ip->i_atime.tv_nsec = le32_to_cpu(dip->di_atime.tv_nsec);
3768@@ -3136,6 +3144,8 @@ static int copy_from_dinode(struct dinod 3823@@ -3132,6 +3140,8 @@ static int copy_from_dinode(struct dinod
3769 static void copy_to_dinode(struct dinode * dip, struct inode *ip) 3824 static void copy_to_dinode(struct dinode * dip, struct inode *ip)
3770 { 3825 {
3771 struct jfs_inode_info *jfs_ip = JFS_IP(ip); 3826 struct jfs_inode_info *jfs_ip = JFS_IP(ip);
3772+ uid_t uid; 3827+ uid_t uid;
3773+ gid_t gid; 3828+ gid_t gid;
3774 3829
3775 dip->di_fileset = cpu_to_le32(jfs_ip->fileset); 3830 dip->di_fileset = cpu_to_le32(jfs_ip->fileset);
3776 dip->di_inostamp = cpu_to_le32(JFS_SBI(ip->i_sb)->inostamp); 3831 dip->di_inostamp = cpu_to_le32(JFS_SBI(ip->i_sb)->inostamp);
3777@@ -3144,8 +3154,11 @@ static void copy_to_dinode(struct dinode 3832@@ -3140,8 +3150,11 @@ static void copy_to_dinode(struct dinode
3778 dip->di_size = cpu_to_le64(ip->i_size); 3833 dip->di_size = cpu_to_le64(ip->i_size);
3779 dip->di_nblocks = cpu_to_le64(PBLK2LBLK(ip->i_sb, ip->i_blocks)); 3834 dip->di_nblocks = cpu_to_le64(PBLK2LBLK(ip->i_sb, ip->i_blocks));
3780 dip->di_nlink = cpu_to_le32(ip->i_nlink); 3835 dip->di_nlink = cpu_to_le32(ip->i_nlink);
3781- dip->di_uid = cpu_to_le32(ip->i_uid); 3836- dip->di_uid = cpu_to_le32(ip->i_uid);
3782- dip->di_gid = cpu_to_le32(ip->i_gid); 3837- dip->di_gid = cpu_to_le32(ip->i_gid);
3786+ dip->di_uid = cpu_to_le32(uid); 3841+ dip->di_uid = cpu_to_le32(uid);
3787+ dip->di_gid = cpu_to_le32(gid); 3842+ dip->di_gid = cpu_to_le32(gid);
3788 /* 3843 /*
3789 * mode2 is only needed for storing the higher order bits. 3844 * mode2 is only needed for storing the higher order bits.
3790 * Trust i_mode for the lower order ones 3845 * Trust i_mode for the lower order ones
3791Index: vserver-sources-2.0.2_2.6.15/fs/jfs/jfs_inode.c 3846Index: linux-2.6.16/fs/jfs/jfs_inode.c
3792=================================================================== 3847===================================================================
3793--- vserver-sources-2.0.2_2.6.15.orig/fs/jfs/jfs_inode.c 3848--- linux-2.6.16.orig/fs/jfs/jfs_inode.c
3794+++ vserver-sources-2.0.2_2.6.15/fs/jfs/jfs_inode.c 3849+++ linux-2.6.16/fs/jfs/jfs_inode.c
3795@@ -18,6 +18,8 @@ 3850@@ -18,6 +18,8 @@
3796 3851
3797 #include <linux/fs.h> 3852 #include <linux/fs.h>
3798 #include <linux/quotaops.h> 3853 #include <linux/quotaops.h>
3799+#include <linux/vs_dlimit.h> 3854+#include <linux/vs_dlimit.h>
3817 if (DQUOT_ALLOC_INODE(inode)) { 3872 if (DQUOT_ALLOC_INODE(inode)) {
3818+ DLIMIT_FREE_INODE(inode); 3873+ DLIMIT_FREE_INODE(inode);
3819 DQUOT_DROP(inode); 3874 DQUOT_DROP(inode);
3820 inode->i_flags |= S_NOQUOTA; 3875 inode->i_flags |= S_NOQUOTA;
3821 inode->i_nlink = 0; 3876 inode->i_nlink = 0;
3822Index: vserver-sources-2.0.2_2.6.15/fs/jfs/jfs_xtree.c 3877Index: linux-2.6.16/fs/jfs/jfs_xtree.c
3823=================================================================== 3878===================================================================
3824--- vserver-sources-2.0.2_2.6.15.orig/fs/jfs/jfs_xtree.c 3879--- linux-2.6.16.orig/fs/jfs/jfs_xtree.c
3825+++ vserver-sources-2.0.2_2.6.15/fs/jfs/jfs_xtree.c 3880+++ linux-2.6.16/fs/jfs/jfs_xtree.c
3826@@ -21,6 +21,7 @@ 3881@@ -21,6 +21,7 @@
3827 3882
3828 #include <linux/fs.h> 3883 #include <linux/fs.h>
3829 #include <linux/quotaops.h> 3884 #include <linux/quotaops.h>
3830+#include <linux/vs_dlimit.h> 3885+#include <linux/vs_dlimit.h>
3912+ /* update dlimit allocation to reflect freed blocks */ 3967+ /* update dlimit allocation to reflect freed blocks */
3913+ DLIMIT_FREE_BLOCK(ip, nfreed); 3968+ DLIMIT_FREE_BLOCK(ip, nfreed);
3914 /* update quota allocation to reflect freed blocks */ 3969 /* update quota allocation to reflect freed blocks */
3915 DQUOT_FREE_BLOCK(ip, nfreed); 3970 DQUOT_FREE_BLOCK(ip, nfreed);
3916 3971
3917Index: vserver-sources-2.0.2_2.6.15/fs/jfs/namei.c 3972Index: linux-2.6.16/fs/jfs/namei.c
3918=================================================================== 3973===================================================================
3919--- vserver-sources-2.0.2_2.6.15.orig/fs/jfs/namei.c 3974--- linux-2.6.16.orig/fs/jfs/namei.c
3920+++ vserver-sources-2.0.2_2.6.15/fs/jfs/namei.c 3975+++ linux-2.6.16/fs/jfs/namei.c
3921@@ -20,6 +20,7 @@ 3976@@ -20,6 +20,7 @@
3922 #include <linux/fs.h> 3977 #include <linux/fs.h>
3923 #include <linux/ctype.h> 3978 #include <linux/ctype.h>
3924 #include <linux/quotaops.h> 3979 #include <linux/quotaops.h>
3925+#include <linux/vserver/xid.h> 3980+#include <linux/vserver/xid.h>
3932 3987
3933+ vx_propagate_xid(nd, ip); 3988+ vx_propagate_xid(nd, ip);
3934 dentry = d_splice_alias(ip, dentry); 3989 dentry = d_splice_alias(ip, dentry);
3935 3990
3936 if (dentry && (JFS_SBI(dip->i_sb)->mntflag & JFS_OS2)) 3991 if (dentry && (JFS_SBI(dip->i_sb)->mntflag & JFS_OS2))
3937Index: vserver-sources-2.0.2_2.6.15/fs/jfs/super.c 3992Index: linux-2.6.16/fs/jfs/super.c
3938=================================================================== 3993===================================================================
3939--- vserver-sources-2.0.2_2.6.15.orig/fs/jfs/super.c 3994--- linux-2.6.16.orig/fs/jfs/super.c
3940+++ vserver-sources-2.0.2_2.6.15/fs/jfs/super.c 3995+++ linux-2.6.16/fs/jfs/super.c
3941@@ -195,7 +195,7 @@ static void jfs_put_super(struct super_b 3996@@ -195,7 +195,7 @@ static void jfs_put_super(struct super_b
3942 enum { 3997 enum {
3943 Opt_integrity, Opt_nointegrity, Opt_iocharset, Opt_resize, 3998 Opt_integrity, Opt_nointegrity, Opt_iocharset, Opt_resize,
3944 Opt_resize_nosize, Opt_errors, Opt_ignore, Opt_err, Opt_quota, 3999 Opt_resize_nosize, Opt_errors, Opt_ignore, Opt_err, Opt_quota,
3945- Opt_usrquota, Opt_grpquota 4000- Opt_usrquota, Opt_grpquota
3990+ if (sbi->flag & JFS_TAGXID) 4045+ if (sbi->flag & JFS_TAGXID)
3991+ sb->s_flags |= MS_TAGXID; 4046+ sb->s_flags |= MS_TAGXID;
3992 4047
3993 if (newLVSize) { 4048 if (newLVSize) {
3994 printk(KERN_ERR "resize option for remount only\n"); 4049 printk(KERN_ERR "resize option for remount only\n");
3995Index: vserver-sources-2.0.2_2.6.15/fs/jfs/xattr.c 4050Index: linux-2.6.16/fs/jfs/xattr.c
3996=================================================================== 4051===================================================================
3997--- vserver-sources-2.0.2_2.6.15.orig/fs/jfs/xattr.c 4052--- linux-2.6.16.orig/fs/jfs/xattr.c
3998+++ vserver-sources-2.0.2_2.6.15/fs/jfs/xattr.c 4053+++ linux-2.6.16/fs/jfs/xattr.c
3999@@ -22,6 +22,7 @@ 4054@@ -23,6 +23,7 @@
4000 #include <linux/posix_acl_xattr.h> 4055 #include <linux/posix_acl_xattr.h>
4001 #include <linux/quotaops.h> 4056 #include <linux/quotaops.h>
4002 #include <linux/security.h> 4057 #include <linux/security.h>
4003+#include <linux/vs_dlimit.h> 4058+#include <linux/vs_dlimit.h>
4004 #include "jfs_incore.h" 4059 #include "jfs_incore.h"
4005 #include "jfs_superblock.h" 4060 #include "jfs_superblock.h"
4006 #include "jfs_dmap.h" 4061 #include "jfs_dmap.h"
4007@@ -277,9 +278,16 @@ static int ea_write(struct inode *ip, st 4062@@ -263,9 +264,16 @@ static int ea_write(struct inode *ip, st
4008 if (DQUOT_ALLOC_BLOCK(ip, nblocks)) { 4063 if (DQUOT_ALLOC_BLOCK(ip, nblocks)) {
4009 return -EDQUOT; 4064 return -EDQUOT;
4010 } 4065 }
4011+ /* Allocate new blocks to dlimit. */ 4066+ /* Allocate new blocks to dlimit. */
4012+ if (DLIMIT_ALLOC_BLOCK(ip, nblocks)) { 4067+ if (DLIMIT_ALLOC_BLOCK(ip, nblocks)) {
4019+ /*Rollback dlimit allocation. */ 4074+ /*Rollback dlimit allocation. */
4020+ DLIMIT_FREE_BLOCK(ip, nblocks); 4075+ DLIMIT_FREE_BLOCK(ip, nblocks);
4021 /*Rollback quota allocation. */ 4076 /*Rollback quota allocation. */
4022 DQUOT_FREE_BLOCK(ip, nblocks); 4077 DQUOT_FREE_BLOCK(ip, nblocks);
4023 return rc; 4078 return rc;
4024@@ -346,6 +354,8 @@ static int ea_write(struct inode *ip, st 4079@@ -332,6 +340,8 @@ static int ea_write(struct inode *ip, st
4025 4080
4026 failed: 4081 failed:
4027 /* Rollback quota allocation. */ 4082 /* Rollback quota allocation. */
4028+ DLIMIT_FREE_BLOCK(ip, nblocks); 4083+ DLIMIT_FREE_BLOCK(ip, nblocks);
4029+ /* Rollback quota allocation. */ 4084+ /* Rollback quota allocation. */
4030 DQUOT_FREE_BLOCK(ip, nblocks); 4085 DQUOT_FREE_BLOCK(ip, nblocks);
4031 4086
4032 dbFree(ip, blkno, nblocks); 4087 dbFree(ip, blkno, nblocks);
4033@@ -482,6 +492,7 @@ static int ea_get(struct inode *inode, s 4088@@ -468,6 +478,7 @@ static int ea_get(struct inode *inode, s
4034 s64 blkno; 4089 s64 blkno;
4035 int rc; 4090 int rc;
4036 int quota_allocation = 0; 4091 int quota_allocation = 0;
4037+ int dlimit_allocation = 0; 4092+ int dlimit_allocation = 0;
4038 4093
4039 /* When fsck.jfs clears a bad ea, it doesn't clear the size */ 4094 /* When fsck.jfs clears a bad ea, it doesn't clear the size */
4040 if (ji->ea.flag == 0) 4095 if (ji->ea.flag == 0)
4041@@ -557,6 +568,12 @@ static int ea_get(struct inode *inode, s 4096@@ -543,6 +554,12 @@ static int ea_get(struct inode *inode, s
4042 4097
4043 quota_allocation = blocks_needed; 4098 quota_allocation = blocks_needed;
4044 4099
4045+ /* Allocate new blocks to dlimit. */ 4100+ /* Allocate new blocks to dlimit. */
4046+ rc = -ENOSPC; 4101+ rc = -ENOSPC;
4049+ dlimit_allocation = blocks_needed; 4104+ dlimit_allocation = blocks_needed;
4050+ 4105+
4051 rc = dbAlloc(inode, INOHINT(inode), (s64) blocks_needed, 4106 rc = dbAlloc(inode, INOHINT(inode), (s64) blocks_needed,
4052 &blkno); 4107 &blkno);
4053 if (rc) 4108 if (rc)
4054@@ -613,6 +630,9 @@ static int ea_get(struct inode *inode, s 4109@@ -599,6 +616,9 @@ static int ea_get(struct inode *inode, s
4055 return ea_size; 4110 return ea_size;
4056 4111
4057 clean_up: 4112 clean_up:
4058+ /* Rollback dlimit allocation */ 4113+ /* Rollback dlimit allocation */
4059+ if (dlimit_allocation) 4114+ if (dlimit_allocation)
4060+ DLIMIT_FREE_BLOCK(inode, dlimit_allocation); 4115+ DLIMIT_FREE_BLOCK(inode, dlimit_allocation);
4061 /* Rollback quota allocation */ 4116 /* Rollback quota allocation */
4062 if (quota_allocation) 4117 if (quota_allocation)
4063 DQUOT_FREE_BLOCK(inode, quota_allocation); 4118 DQUOT_FREE_BLOCK(inode, quota_allocation);
4064@@ -689,8 +709,10 @@ static int ea_put(tid_t tid, struct inod 4119@@ -675,8 +695,10 @@ static int ea_put(tid_t tid, struct inod
4065 } 4120 }
4066 4121
4067 /* If old blocks exist, they must be removed from quota allocation. */ 4122 /* If old blocks exist, they must be removed from quota allocation. */
4068- if (old_blocks) 4123- if (old_blocks)
4069+ if (old_blocks) { 4124+ if (old_blocks) {
4071 DQUOT_FREE_BLOCK(inode, old_blocks); 4126 DQUOT_FREE_BLOCK(inode, old_blocks);
4072+ } 4127+ }
4073 4128
4074 inode->i_ctime = CURRENT_TIME; 4129 inode->i_ctime = CURRENT_TIME;
4075 4130
4076Index: vserver-sources-2.0.2_2.6.15/fs/libfs.c 4131Index: linux-2.6.16/fs/libfs.c
4077=================================================================== 4132===================================================================
4078--- vserver-sources-2.0.2_2.6.15.orig/fs/libfs.c 4133--- linux-2.6.16.orig/fs/libfs.c
4079+++ vserver-sources-2.0.2_2.6.15/fs/libfs.c 4134+++ linux-2.6.16/fs/libfs.c
4080@@ -122,7 +122,8 @@ static inline unsigned char dt_type(stru 4135@@ -122,7 +122,8 @@ static inline unsigned char dt_type(stru
4081 * both impossible due to the lock on directory. 4136 * both impossible due to the lock on directory.
4082 */ 4137 */
4083 4138
4084-int dcache_readdir(struct file * filp, void * dirent, filldir_t filldir) 4139-int dcache_readdir(struct file * filp, void * dirent, filldir_t filldir)
4086+ void * dirent, filldir_t filldir, int (*filter)(struct dentry *dentry)) 4141+ void * dirent, filldir_t filldir, int (*filter)(struct dentry *dentry))
4087 { 4142 {
4088 struct dentry *dentry = filp->f_dentry; 4143 struct dentry *dentry = filp->f_dentry;
4089 struct dentry *cursor = filp->private_data; 4144 struct dentry *cursor = filp->private_data;
4090@@ -156,6 +157,8 @@ int dcache_readdir(struct file * filp, v 4145@@ -156,6 +157,8 @@ int dcache_readdir(struct file * filp, v
4091 next = list_entry(p, struct dentry, d_child); 4146 next = list_entry(p, struct dentry, d_u.d_child);
4092 if (d_unhashed(next) || !next->d_inode) 4147 if (d_unhashed(next) || !next->d_inode)
4093 continue; 4148 continue;
4094+ if (filter && !filter(next)) 4149+ if (filter && !filter(next))
4095+ continue; 4150+ continue;
4096 4151
4113+ 4168+
4114+ 4169+
4115 ssize_t generic_read_dir(struct file *filp, char __user *buf, size_t siz, loff_t *ppos) 4170 ssize_t generic_read_dir(struct file *filp, char __user *buf, size_t siz, loff_t *ppos)
4116 { 4171 {
4117 return -EISDIR; 4172 return -EISDIR;
4118@@ -620,6 +635,7 @@ EXPORT_SYMBOL(dcache_dir_close); 4173@@ -621,6 +636,7 @@ EXPORT_SYMBOL(dcache_dir_close);
4119 EXPORT_SYMBOL(dcache_dir_lseek); 4174 EXPORT_SYMBOL(dcache_dir_lseek);
4120 EXPORT_SYMBOL(dcache_dir_open); 4175 EXPORT_SYMBOL(dcache_dir_open);
4121 EXPORT_SYMBOL(dcache_readdir); 4176 EXPORT_SYMBOL(dcache_readdir);
4122+EXPORT_SYMBOL(dcache_readdir_filter); 4177+EXPORT_SYMBOL(dcache_readdir_filter);
4123 EXPORT_SYMBOL(generic_read_dir); 4178 EXPORT_SYMBOL(generic_read_dir);
4124 EXPORT_SYMBOL(get_sb_pseudo); 4179 EXPORT_SYMBOL(get_sb_pseudo);
4125 EXPORT_SYMBOL(simple_commit_write); 4180 EXPORT_SYMBOL(simple_commit_write);
4126Index: vserver-sources-2.0.2_2.6.15/fs/locks.c 4181Index: linux-2.6.16/fs/locks.c
4127=================================================================== 4182===================================================================
4128--- vserver-sources-2.0.2_2.6.15.orig/fs/locks.c 4183--- linux-2.6.16.orig/fs/locks.c
4129+++ vserver-sources-2.0.2_2.6.15/fs/locks.c 4184+++ linux-2.6.16/fs/locks.c
4130@@ -125,6 +125,7 @@ 4185@@ -125,6 +125,7 @@
4131 #include <linux/syscalls.h> 4186 #include <linux/syscalls.h>
4132 #include <linux/time.h> 4187 #include <linux/time.h>
4133 #include <linux/rcupdate.h> 4188 #include <linux/rcupdate.h>
4134+#include <linux/vs_limit.h> 4189+#include <linux/vs_limit.h>
4143+ return NULL; 4198+ return NULL;
4144 return kmem_cache_alloc(filelock_cache, SLAB_KERNEL); 4199 return kmem_cache_alloc(filelock_cache, SLAB_KERNEL);
4145 } 4200 }
4146 4201
4147 /* Free a lock which is not in use. */ 4202 /* Free a lock which is not in use. */
4148 static inline void locks_free_lock(struct file_lock *fl) 4203 static void locks_free_lock(struct file_lock *fl)
4149 { 4204 {
4150+ vx_locks_dec(fl); 4205+ vx_locks_dec(fl);
4151+ 4206+
4152 if (fl == NULL) { 4207 if (fl == NULL) {
4153 BUG(); 4208 BUG();
4191+ "f_xid(%d) == fl_xid(%d)", filp->f_xid, fl->fl_xid); 4246+ "f_xid(%d) == fl_xid(%d)", filp->f_xid, fl->fl_xid);
4192+ vx_locks_inc(fl); 4247+ vx_locks_inc(fl);
4193 error = lease_init(filp, type, fl); 4248 error = lease_init(filp, type, fl);
4194 if (error) 4249 if (error)
4195 return error; 4250 return error;
4196@@ -772,7 +790,7 @@ out: 4251@@ -771,7 +789,7 @@ out:
4197 4252
4198 EXPORT_SYMBOL(posix_lock_file); 4253 EXPORT_SYMBOL(posix_lock_file);
4199 4254
4200-static int __posix_lock_file(struct inode *inode, struct file_lock *request) 4255-static int __posix_lock_file(struct inode *inode, struct file_lock *request)
4201+static int __posix_lock_file(struct inode *inode, struct file_lock *request, xid_t xid) 4256+static int __posix_lock_file(struct inode *inode, struct file_lock *request, xid_t xid)
4202 { 4257 {
4203 struct file_lock *fl; 4258 struct file_lock *fl;
4204 struct file_lock *new_fl, *new_fl2; 4259 struct file_lock *new_fl, *new_fl2;
4205@@ -781,12 +799,18 @@ static int __posix_lock_file(struct inod 4260@@ -780,12 +798,18 @@ static int __posix_lock_file(struct inod
4206 struct file_lock **before; 4261 struct file_lock **before;
4207 int error, added = 0; 4262 int error, added = 0;
4208 4263
4209+ vxd_assert(xid == vx_current_xid(), 4264+ vxd_assert(xid == vx_current_xid(),
4210+ "xid(%d) == current(%d)", xid, vx_current_xid()); 4265+ "xid(%d) == current(%d)", xid, vx_current_xid());
4219+ new_fl2->fl_xid = xid; 4274+ new_fl2->fl_xid = xid;
4220+ vx_locks_inc(new_fl2); 4275+ vx_locks_inc(new_fl2);
4221 4276
4222 lock_kernel(); 4277 lock_kernel();
4223 if (request->fl_type != F_UNLCK) { 4278 if (request->fl_type != F_UNLCK) {
4224@@ -964,7 +988,7 @@ static int __posix_lock_file(struct inod 4279@@ -963,7 +987,7 @@ static int __posix_lock_file(struct inod
4225 */ 4280 */
4226 int posix_lock_file(struct file *filp, struct file_lock *fl) 4281 int posix_lock_file(struct file *filp, struct file_lock *fl)
4227 { 4282 {
4228- return __posix_lock_file(filp->f_dentry->d_inode, fl); 4283- return __posix_lock_file(filp->f_dentry->d_inode, fl);
4229+ return __posix_lock_file(filp->f_dentry->d_inode, fl, filp->f_xid); 4284+ return __posix_lock_file(filp->f_dentry->d_inode, fl, filp->f_xid);
4230 } 4285 }
4231 4286
4232 /** 4287 /**
4233@@ -981,7 +1005,8 @@ int posix_lock_file_wait(struct file *fi 4288@@ -980,7 +1004,8 @@ int posix_lock_file_wait(struct file *fi
4234 int error; 4289 int error;
4235 might_sleep (); 4290 might_sleep ();
4236 for (;;) { 4291 for (;;) {
4237- error = __posix_lock_file(filp->f_dentry->d_inode, fl); 4292- error = __posix_lock_file(filp->f_dentry->d_inode, fl);
4238+ error = __posix_lock_file(filp->f_dentry->d_inode, 4293+ error = __posix_lock_file(filp->f_dentry->d_inode,
4239+ fl, filp->f_xid); 4294+ fl, filp->f_xid);
4240 if ((error != -EAGAIN) || !(fl->fl_flags & FL_SLEEP)) 4295 if ((error != -EAGAIN) || !(fl->fl_flags & FL_SLEEP))
4241 break; 4296 break;
4242 error = wait_event_interruptible(fl->fl_wait, !fl->fl_next); 4297 error = wait_event_interruptible(fl->fl_wait, !fl->fl_next);
4243@@ -1053,7 +1078,7 @@ int locks_mandatory_area(int read_write, 4298@@ -1052,7 +1077,7 @@ int locks_mandatory_area(int read_write,
4244 fl.fl_end = offset + count - 1; 4299 fl.fl_end = offset + count - 1;
4245 4300
4246 for (;;) { 4301 for (;;) {
4247- error = __posix_lock_file(inode, &fl); 4302- error = __posix_lock_file(inode, &fl);
4248+ error = __posix_lock_file(inode, &fl, filp->f_xid); 4303+ error = __posix_lock_file(inode, &fl, filp->f_xid);
4249 if (error != -EAGAIN) 4304 if (error != -EAGAIN)
4250 break; 4305 break;
4251 if (!(fl.fl_flags & FL_SLEEP)) 4306 if (!(fl.fl_flags & FL_SLEEP))
4252@@ -1614,6 +1639,11 @@ int fcntl_setlk(unsigned int fd, struct 4307@@ -1613,6 +1638,11 @@ int fcntl_setlk(unsigned int fd, struct
4253 if (file_lock == NULL) 4308 if (file_lock == NULL)
4254 return -ENOLCK; 4309 return -ENOLCK;
4255 4310
4256+ vxd_assert(filp->f_xid == vx_current_xid(), 4311+ vxd_assert(filp->f_xid == vx_current_xid(),
4257+ "f_xid(%d) == current(%d)", filp->f_xid, vx_current_xid()); 4312+ "f_xid(%d) == current(%d)", filp->f_xid, vx_current_xid());
4259+ vx_locks_inc(file_lock); 4314+ vx_locks_inc(file_lock);
4260+ 4315+
4261 /* 4316 /*
4262 * This might block, so we do it before checking the inode. 4317 * This might block, so we do it before checking the inode.
4263 */ 4318 */
4264@@ -1666,7 +1696,8 @@ again: 4319@@ -1665,7 +1695,8 @@ again:
4265 error = filp->f_op->lock(filp, cmd, file_lock); 4320 error = filp->f_op->lock(filp, cmd, file_lock);
4266 else { 4321 else {
4267 for (;;) { 4322 for (;;) {
4268- error = __posix_lock_file(inode, file_lock); 4323- error = __posix_lock_file(inode, file_lock);
4269+ error = __posix_lock_file(inode, file_lock, 4324+ error = __posix_lock_file(inode, file_lock,
4270+ filp->f_xid); 4325+ filp->f_xid);
4271 if ((error != -EAGAIN) || (cmd == F_SETLK)) 4326 if ((error != -EAGAIN) || (cmd == F_SETLK))
4272 break; 4327 break;
4273 error = wait_event_interruptible(file_lock->fl_wait, 4328 error = wait_event_interruptible(file_lock->fl_wait,
4274@@ -1757,6 +1788,11 @@ int fcntl_setlk64(unsigned int fd, struc 4329@@ -1756,6 +1787,11 @@ int fcntl_setlk64(unsigned int fd, struc
4275 if (file_lock == NULL) 4330 if (file_lock == NULL)
4276 return -ENOLCK; 4331 return -ENOLCK;
4277 4332
4278+ vxd_assert(filp->f_xid == vx_current_xid(), 4333+ vxd_assert(filp->f_xid == vx_current_xid(),
4279+ "f_xid(%d) == current(%d)", filp->f_xid, vx_current_xid()); 4334+ "f_xid(%d) == current(%d)", filp->f_xid, vx_current_xid());
4281+ vx_locks_inc(file_lock); 4336+ vx_locks_inc(file_lock);
4282+ 4337+
4283 /* 4338 /*
4284 * This might block, so we do it before checking the inode. 4339 * This might block, so we do it before checking the inode.
4285 */ 4340 */
4286@@ -1809,7 +1845,8 @@ again: 4341@@ -1808,7 +1844,8 @@ again:
4287 error = filp->f_op->lock(filp, cmd, file_lock); 4342 error = filp->f_op->lock(filp, cmd, file_lock);
4288 else { 4343 else {
4289 for (;;) { 4344 for (;;) {
4290- error = __posix_lock_file(inode, file_lock); 4345- error = __posix_lock_file(inode, file_lock);
4291+ error = __posix_lock_file(inode, file_lock, 4346+ error = __posix_lock_file(inode, file_lock,
4292+ filp->f_xid); 4347+ filp->f_xid);
4293 if ((error != -EAGAIN) || (cmd == F_SETLK64)) 4348 if ((error != -EAGAIN) || (cmd == F_SETLK64))
4294 break; 4349 break;
4295 error = wait_event_interruptible(file_lock->fl_wait, 4350 error = wait_event_interruptible(file_lock->fl_wait,
4296@@ -2086,6 +2123,10 @@ int get_locks_status(char *buffer, char 4351@@ -2081,6 +2118,10 @@ int get_locks_status(char *buffer, char
4297 list_for_each(tmp, &file_lock_list) { 4352 list_for_each(tmp, &file_lock_list) {
4298 struct list_head *btmp; 4353 struct list_head *btmp;
4299 struct file_lock *fl = list_entry(tmp, struct file_lock, fl_link); 4354 struct file_lock *fl = list_entry(tmp, struct file_lock, fl_link);
4300+ 4355+
4301+ if (!vx_check(fl->fl_xid, VX_IDENT|VX_WATCH)) 4356+ if (!vx_check(fl->fl_xid, VX_IDENT|VX_WATCH))
4302+ continue; 4357+ continue;
4303+ 4358+
4304 lock_get_status(q, fl, ++i, ""); 4359 lock_get_status(q, fl, ++i, "");
4305 move_lock_status(&q, &pos, offset); 4360 move_lock_status(&q, &pos, offset);
4306 4361
4307Index: vserver-sources-2.0.2_2.6.15/fs/namei.c 4362Index: linux-2.6.16/fs/namei.c
4308=================================================================== 4363===================================================================
4309--- vserver-sources-2.0.2_2.6.15.orig/fs/namei.c 4364--- linux-2.6.16.orig/fs/namei.c
4310+++ vserver-sources-2.0.2_2.6.15/fs/namei.c 4365+++ linux-2.6.16/fs/namei.c
4311@@ -29,6 +29,9 @@ 4366@@ -32,6 +32,9 @@
4312 #include <linux/mount.h>
4313 #include <linux/audit.h>
4314 #include <linux/file.h> 4367 #include <linux/file.h>
4368 #include <linux/fcntl.h>
4369 #include <linux/namei.h>
4315+#include <linux/proc_fs.h> 4370+#include <linux/proc_fs.h>
4316+#include <linux/vserver/inode.h> 4371+#include <linux/vserver/inode.h>
4317+#include <linux/vserver/debug.h> 4372+#include <linux/vserver/debug.h>
4318 #include <asm/namei.h> 4373 #include <asm/namei.h>
4319 #include <asm/uaccess.h> 4374 #include <asm/uaccess.h>
4320 4375
4321@@ -222,6 +225,24 @@ int generic_permission(struct inode *ino 4376@@ -225,6 +228,24 @@ int generic_permission(struct inode *ino
4322 return -EACCES; 4377 return -EACCES;
4323 } 4378 }
4324 4379
4325+static inline int xid_permission(struct inode *inode, int mask, struct nameidata *nd) 4380+static inline int xid_permission(struct inode *inode, int mask, struct nameidata *nd)
4326+{ 4381+{
4341+} 4396+}
4342+ 4397+
4343 int permission(struct inode *inode, int mask, struct nameidata *nd) 4398 int permission(struct inode *inode, int mask, struct nameidata *nd)
4344 { 4399 {
4345 int retval, submask; 4400 int retval, submask;
4346@@ -232,7 +253,7 @@ int permission(struct inode *inode, int 4401@@ -235,7 +256,7 @@ int permission(struct inode *inode, int
4347 /* 4402 /*
4348 * Nobody gets write access to a read-only fs. 4403 * Nobody gets write access to a read-only fs.
4349 */ 4404 */
4350- if (IS_RDONLY(inode) && 4405- if (IS_RDONLY(inode) &&
4351+ if ((IS_RDONLY(inode) || (nd && MNT_IS_RDONLY(nd->mnt))) && 4406+ if ((IS_RDONLY(inode) || (nd && MNT_IS_RDONLY(nd->mnt))) &&
4352 (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode))) 4407 (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)))
4353 return -EROFS; 4408 return -EROFS;
4354 4409
4355@@ -246,6 +267,8 @@ int permission(struct inode *inode, int 4410@@ -249,6 +270,8 @@ int permission(struct inode *inode, int
4356 4411
4357 /* Ordinary permission routines do not understand MAY_APPEND. */ 4412 /* Ordinary permission routines do not understand MAY_APPEND. */
4358 submask = mask & ~MAY_APPEND; 4413 submask = mask & ~MAY_APPEND;
4359+ if ((retval = xid_permission(inode, mask, nd))) 4414+ if ((retval = xid_permission(inode, mask, nd)))
4360+ return retval; 4415+ return retval;
4361 if (inode->i_op && inode->i_op->permission) 4416 if (inode->i_op && inode->i_op->permission)
4362 retval = inode->i_op->permission(inode, submask, nd); 4417 retval = inode->i_op->permission(inode, submask, nd);
4363 else 4418 else
4364@@ -699,7 +722,8 @@ static inline void follow_dotdot(struct 4419@@ -702,7 +725,8 @@ static __always_inline void follow_dotdo
4365 if (nd->dentry == current->fs->root && 4420 if (nd->dentry == current->fs->root &&
4366 nd->mnt == current->fs->rootmnt) { 4421 nd->mnt == current->fs->rootmnt) {
4367 read_unlock(&current->fs->lock); 4422 read_unlock(&current->fs->lock);
4368- break; 4423- break;
4369+ /* for sane '/' avoid follow_mount() */ 4424+ /* for sane '/' avoid follow_mount() */
4370+ return; 4425+ return;
4371 } 4426 }
4372 read_unlock(&current->fs->lock); 4427 read_unlock(&current->fs->lock);
4373 spin_lock(&dcache_lock); 4428 spin_lock(&dcache_lock);
4374@@ -736,16 +760,34 @@ static int do_lookup(struct nameidata *n 4429@@ -739,16 +763,34 @@ static int do_lookup(struct nameidata *n
4375 { 4430 {
4376 struct vfsmount *mnt = nd->mnt; 4431 struct vfsmount *mnt = nd->mnt;
4377 struct dentry *dentry = __d_lookup(nd->dentry, name); 4432 struct dentry *dentry = __d_lookup(nd->dentry, name);
4378+ struct inode *inode; 4433+ struct inode *inode;
4379 4434
4404+ dput(dentry); 4459+ dput(dentry);
4405+ return -ENOENT; 4460+ return -ENOENT;
4406 4461
4407 need_lookup: 4462 need_lookup:
4408 dentry = real_lookup(nd->dentry, name, nd); 4463 dentry = real_lookup(nd->dentry, name, nd);
4409@@ -1293,7 +1335,8 @@ static inline int check_sticky(struct in 4464@@ -1345,7 +1387,8 @@ static inline int check_sticky(struct in
4410 * 10. We don't allow removal of NFS sillyrenamed files; it's handled by 4465 * 10. We don't allow removal of NFS sillyrenamed files; it's handled by
4411 * nfs_async_unlink(). 4466 * nfs_async_unlink().
4412 */ 4467 */
4413-static inline int may_delete(struct inode *dir,struct dentry *victim,int isdir) 4468-static int may_delete(struct inode *dir,struct dentry *victim,int isdir)
4414+static inline int may_delete(struct inode *dir, struct dentry *victim, 4469+static int may_delete(struct inode *dir, struct dentry *victim,
4415+ int isdir, struct nameidata *nd) 4470+ int isdir, struct nameidata *nd)
4416 { 4471 {
4417 int error; 4472 int error;
4418 4473
4419@@ -1302,13 +1345,13 @@ static inline int may_delete(struct inod 4474@@ -1354,13 +1397,13 @@ static int may_delete(struct inode *dir,
4420 4475
4421 BUG_ON(victim->d_parent->d_inode != dir); 4476 BUG_ON(victim->d_parent->d_inode != dir);
4422 4477
4423- error = permission(dir,MAY_WRITE | MAY_EXEC, NULL); 4478- error = permission(dir,MAY_WRITE | MAY_EXEC, NULL);
4424+ error = permission(dir,MAY_WRITE | MAY_EXEC, nd); 4479+ error = permission(dir,MAY_WRITE | MAY_EXEC, nd);
4430- IS_IMMUTABLE(victim->d_inode)) 4485- IS_IMMUTABLE(victim->d_inode))
4431+ IS_IXORUNLINK(victim->d_inode)) 4486+ IS_IXORUNLINK(victim->d_inode))
4432 return -EPERM; 4487 return -EPERM;
4433 if (isdir) { 4488 if (isdir) {
4434 if (!S_ISDIR(victim->d_inode->i_mode)) 4489 if (!S_ISDIR(victim->d_inode->i_mode))
4435@@ -1455,7 +1498,8 @@ int may_open(struct nameidata *nd, int a 4490@@ -1507,7 +1550,8 @@ int may_open(struct nameidata *nd, int a
4436 return -EACCES; 4491 return -EACCES;
4437 4492
4438 flag &= ~O_TRUNC; 4493 flag &= ~O_TRUNC;
4439- } else if (IS_RDONLY(inode) && (flag & FMODE_WRITE)) 4494- } else if (IS_RDONLY(inode) && (flag & FMODE_WRITE))
4440+ } else if ((IS_RDONLY(inode) || MNT_IS_RDONLY(nd->mnt)) 4495+ } else if ((IS_RDONLY(inode) || MNT_IS_RDONLY(nd->mnt))
4441+ && (flag & FMODE_WRITE)) 4496+ && (flag & FMODE_WRITE))
4442 return -EROFS; 4497 return -EROFS;
4443 /* 4498 /*
4444 * An append-only file must be opened in append mode for writing. 4499 * An append-only file must be opened in append mode for writing.
4445@@ -1719,9 +1763,10 @@ fail: 4500@@ -1773,9 +1817,10 @@ fail:
4446 } 4501 }
4447 EXPORT_SYMBOL_GPL(lookup_create); 4502 EXPORT_SYMBOL_GPL(lookup_create);
4448 4503
4449-int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) 4504-int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
4450+int vfs_mknod(struct inode *dir, struct dentry *dentry, 4505+int vfs_mknod(struct inode *dir, struct dentry *dentry,
4453- int error = may_create(dir, dentry, NULL); 4508- int error = may_create(dir, dentry, NULL);
4454+ int error = may_create(dir, dentry, nd); 4509+ int error = may_create(dir, dentry, nd);
4455 4510
4456 if (error) 4511 if (error)
4457 return error; 4512 return error;
4458@@ -1770,11 +1815,12 @@ asmlinkage long sys_mknod(const char __u 4513@@ -1825,11 +1870,12 @@ asmlinkage long sys_mknodat(int dfd, con
4459 error = vfs_create(nd.dentry->d_inode,dentry,mode,&nd); 4514 error = vfs_create(nd.dentry->d_inode,dentry,mode,&nd);
4460 break; 4515 break;
4461 case S_IFCHR: case S_IFBLK: 4516 case S_IFCHR: case S_IFBLK:
4462- error = vfs_mknod(nd.dentry->d_inode,dentry,mode, 4517- error = vfs_mknod(nd.dentry->d_inode,dentry,mode,
4463- new_decode_dev(dev)); 4518- new_decode_dev(dev));
4469+ error = vfs_mknod(nd.dentry->d_inode, dentry, mode, 4524+ error = vfs_mknod(nd.dentry->d_inode, dentry, mode,
4470+ 0, &nd); 4525+ 0, &nd);
4471 break; 4526 break;
4472 case S_IFDIR: 4527 case S_IFDIR:
4473 error = -EPERM; 4528 error = -EPERM;
4474@@ -1792,9 +1838,10 @@ out: 4529@@ -1852,9 +1898,10 @@ asmlinkage long sys_mknod(const char __u
4475 return error; 4530 return sys_mknodat(AT_FDCWD, filename, mode, dev);
4476 } 4531 }
4477 4532
4478-int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) 4533-int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
4479+int vfs_mkdir(struct inode *dir, struct dentry *dentry, 4534+int vfs_mkdir(struct inode *dir, struct dentry *dentry,
4480+ int mode, struct nameidata *nd) 4535+ int mode, struct nameidata *nd)
4482- int error = may_create(dir, dentry, NULL); 4537- int error = may_create(dir, dentry, NULL);
4483+ int error = may_create(dir, dentry, nd); 4538+ int error = may_create(dir, dentry, nd);
4484 4539
4485 if (error) 4540 if (error)
4486 return error; 4541 return error;
4487@@ -1833,7 +1880,8 @@ asmlinkage long sys_mkdir(const char __u 4542@@ -1893,7 +1940,8 @@ asmlinkage long sys_mkdirat(int dfd, con
4488 if (!IS_ERR(dentry)) { 4543 if (!IS_ERR(dentry)) {
4489 if (!IS_POSIXACL(nd.dentry->d_inode)) 4544 if (!IS_POSIXACL(nd.dentry->d_inode))
4490 mode &= ~current->fs->umask; 4545 mode &= ~current->fs->umask;
4491- error = vfs_mkdir(nd.dentry->d_inode, dentry, mode); 4546- error = vfs_mkdir(nd.dentry->d_inode, dentry, mode);
4492+ error = vfs_mkdir(nd.dentry->d_inode, dentry, 4547+ error = vfs_mkdir(nd.dentry->d_inode, dentry,
4493+ mode, &nd); 4548+ mode, &nd);
4494 dput(dentry); 4549 dput(dentry);
4495 } 4550 }
4496 up(&nd.dentry->d_inode->i_sem); 4551 mutex_unlock(&nd.dentry->d_inode->i_mutex);
4497@@ -1873,9 +1921,10 @@ void dentry_unhash(struct dentry *dentry 4552@@ -1938,9 +1986,10 @@ void dentry_unhash(struct dentry *dentry
4498 spin_unlock(&dcache_lock); 4553 spin_unlock(&dcache_lock);
4499 } 4554 }
4500 4555
4501-int vfs_rmdir(struct inode *dir, struct dentry *dentry) 4556-int vfs_rmdir(struct inode *dir, struct dentry *dentry)
4502+int vfs_rmdir(struct inode *dir, struct dentry *dentry, 4557+int vfs_rmdir(struct inode *dir, struct dentry *dentry,
4505- int error = may_delete(dir, dentry, 1); 4560- int error = may_delete(dir, dentry, 1);
4506+ int error = may_delete(dir, dentry, 1, nd); 4561+ int error = may_delete(dir, dentry, 1, nd);
4507 4562
4508 if (error) 4563 if (error)
4509 return error; 4564 return error;
4510@@ -1936,7 +1985,7 @@ asmlinkage long sys_rmdir(const char __u 4565@@ -2001,7 +2050,7 @@ static long do_rmdir(int dfd, const char
4511 dentry = lookup_hash(&nd); 4566 dentry = lookup_hash(&nd);
4512 error = PTR_ERR(dentry); 4567 error = PTR_ERR(dentry);
4513 if (!IS_ERR(dentry)) { 4568 if (!IS_ERR(dentry)) {
4514- error = vfs_rmdir(nd.dentry->d_inode, dentry); 4569- error = vfs_rmdir(nd.dentry->d_inode, dentry);
4515+ error = vfs_rmdir(nd.dentry->d_inode, dentry, &nd); 4570+ error = vfs_rmdir(nd.dentry->d_inode, dentry, &nd);
4516 dput(dentry); 4571 dput(dentry);
4517 } 4572 }
4518 up(&nd.dentry->d_inode->i_sem); 4573 mutex_unlock(&nd.dentry->d_inode->i_mutex);
4519@@ -1947,9 +1996,10 @@ exit: 4574@@ -2017,9 +2066,10 @@ asmlinkage long sys_rmdir(const char __u
4520 return error; 4575 return do_rmdir(AT_FDCWD, pathname);
4521 } 4576 }
4522 4577
4523-int vfs_unlink(struct inode *dir, struct dentry *dentry) 4578-int vfs_unlink(struct inode *dir, struct dentry *dentry)
4524+int vfs_unlink(struct inode *dir, struct dentry *dentry, 4579+int vfs_unlink(struct inode *dir, struct dentry *dentry,
4525+ struct nameidata *nd) 4580+ struct nameidata *nd)
4527- int error = may_delete(dir, dentry, 0); 4582- int error = may_delete(dir, dentry, 0);
4528+ int error = may_delete(dir, dentry, 0, nd); 4583+ int error = may_delete(dir, dentry, 0, nd);
4529 4584
4530 if (error) 4585 if (error)
4531 return error; 4586 return error;
4532@@ -2011,7 +2061,7 @@ asmlinkage long sys_unlink(const char __ 4587@@ -2081,7 +2131,7 @@ static long do_unlinkat(int dfd, const c
4533 inode = dentry->d_inode; 4588 inode = dentry->d_inode;
4534 if (inode) 4589 if (inode)
4535 atomic_inc(&inode->i_count); 4590 atomic_inc(&inode->i_count);
4536- error = vfs_unlink(nd.dentry->d_inode, dentry); 4591- error = vfs_unlink(nd.dentry->d_inode, dentry);
4537+ error = vfs_unlink(nd.dentry->d_inode, dentry, &nd); 4592+ error = vfs_unlink(nd.dentry->d_inode, dentry, &nd);
4538 exit2: 4593 exit2:
4539 dput(dentry); 4594 dput(dentry);
4540 } 4595 }
4541@@ -2030,9 +2080,10 @@ slashes: 4596@@ -2116,9 +2166,10 @@ asmlinkage long sys_unlink(const char __
4542 goto exit2; 4597 return do_unlinkat(AT_FDCWD, pathname);
4543 } 4598 }
4544 4599
4545-int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname, int mode) 4600-int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname, int mode)
4546+int vfs_symlink(struct inode *dir, struct dentry *dentry, 4601+int vfs_symlink(struct inode *dir, struct dentry *dentry,
4547+ const char *oldname, int mode, struct nameidata *nd) 4602+ const char *oldname, int mode, struct nameidata *nd)
4549- int error = may_create(dir, dentry, NULL); 4604- int error = may_create(dir, dentry, NULL);
4550+ int error = may_create(dir, dentry, nd); 4605+ int error = may_create(dir, dentry, nd);
4551 4606
4552 if (error) 4607 if (error)
4553 return error; 4608 return error;
4554@@ -2072,7 +2123,8 @@ asmlinkage long sys_symlink(const char _ 4609@@ -2159,7 +2210,8 @@ asmlinkage long sys_symlinkat(const char
4555 dentry = lookup_create(&nd, 0); 4610 dentry = lookup_create(&nd, 0);
4556 error = PTR_ERR(dentry); 4611 error = PTR_ERR(dentry);
4557 if (!IS_ERR(dentry)) { 4612 if (!IS_ERR(dentry)) {
4558- error = vfs_symlink(nd.dentry->d_inode, dentry, from, S_IALLUGO); 4613- error = vfs_symlink(nd.dentry->d_inode, dentry, from, S_IALLUGO);
4559+ error = vfs_symlink(nd.dentry->d_inode, dentry, 4614+ error = vfs_symlink(nd.dentry->d_inode, dentry,
4560+ from, S_IALLUGO, &nd); 4615+ from, S_IALLUGO, &nd);
4561 dput(dentry); 4616 dput(dentry);
4562 } 4617 }
4563 up(&nd.dentry->d_inode->i_sem); 4618 mutex_unlock(&nd.dentry->d_inode->i_mutex);
4564@@ -2084,7 +2136,8 @@ out: 4619@@ -2176,7 +2228,8 @@ asmlinkage long sys_symlink(const char _
4565 return error; 4620 return sys_symlinkat(oldname, AT_FDCWD, newname);
4566 } 4621 }
4567 4622
4568-int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry) 4623-int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry)
4569+int vfs_link(struct dentry *old_dentry, struct inode *dir, 4624+int vfs_link(struct dentry *old_dentry, struct inode *dir,
4570+ struct dentry *new_dentry, struct nameidata *nd) 4625+ struct dentry *new_dentry, struct nameidata *nd)
4571 { 4626 {
4572 struct inode *inode = old_dentry->d_inode; 4627 struct inode *inode = old_dentry->d_inode;
4573 int error; 4628 int error;
4574@@ -2092,7 +2145,7 @@ int vfs_link(struct dentry *old_dentry, 4629@@ -2184,7 +2237,7 @@ int vfs_link(struct dentry *old_dentry,
4575 if (!inode) 4630 if (!inode)
4576 return -ENOENT; 4631 return -ENOENT;
4577 4632
4578- error = may_create(dir, new_dentry, NULL); 4633- error = may_create(dir, new_dentry, NULL);
4579+ error = may_create(dir, new_dentry, nd); 4634+ error = may_create(dir, new_dentry, nd);
4580 if (error) 4635 if (error)
4581 return error; 4636 return error;
4582 4637
4583@@ -2102,7 +2155,7 @@ int vfs_link(struct dentry *old_dentry, 4638@@ -2194,7 +2247,7 @@ int vfs_link(struct dentry *old_dentry,
4584 /* 4639 /*
4585 * A link to an append-only or immutable file cannot be created. 4640 * A link to an append-only or immutable file cannot be created.
4586 */ 4641 */
4587- if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) 4642- if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
4588+ if (IS_APPEND(inode) || IS_IXORUNLINK(inode)) 4643+ if (IS_APPEND(inode) || IS_IXORUNLINK(inode))
4589 return -EPERM; 4644 return -EPERM;
4590 if (!dir->i_op || !dir->i_op->link) 4645 if (!dir->i_op || !dir->i_op->link)
4591 return -EPERM; 4646 return -EPERM;
4592@@ -2154,7 +2207,8 @@ asmlinkage long sys_link(const char __us 4647@@ -2251,7 +2304,8 @@ asmlinkage long sys_linkat(int olddfd, c
4593 new_dentry = lookup_create(&nd, 0); 4648 new_dentry = lookup_create(&nd, 0);
4594 error = PTR_ERR(new_dentry); 4649 error = PTR_ERR(new_dentry);
4595 if (!IS_ERR(new_dentry)) { 4650 if (!IS_ERR(new_dentry)) {
4596- error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry); 4651- error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry);
4597+ error = vfs_link(old_nd.dentry, nd.dentry->d_inode, 4652+ error = vfs_link(old_nd.dentry, nd.dentry->d_inode,
4598+ new_dentry, &nd); 4653+ new_dentry, &nd);
4599 dput(new_dentry); 4654 dput(new_dentry);
4600 } 4655 }
4601 up(&nd.dentry->d_inode->i_sem); 4656 mutex_unlock(&nd.dentry->d_inode->i_mutex);
4602@@ -2281,14 +2335,14 @@ int vfs_rename(struct inode *old_dir, st 4657@@ -2383,14 +2437,14 @@ int vfs_rename(struct inode *old_dir, st
4603 if (old_dentry->d_inode == new_dentry->d_inode) 4658 if (old_dentry->d_inode == new_dentry->d_inode)
4604 return 0; 4659 return 0;
4605 4660
4606- error = may_delete(old_dir, old_dentry, is_dir); 4661- error = may_delete(old_dir, old_dentry, is_dir);
4607+ error = may_delete(old_dir, old_dentry, is_dir, NULL); 4662+ error = may_delete(old_dir, old_dentry, is_dir, NULL);
4614- error = may_delete(new_dir, new_dentry, is_dir); 4669- error = may_delete(new_dir, new_dentry, is_dir);
4615+ error = may_delete(new_dir, new_dentry, is_dir, NULL); 4670+ error = may_delete(new_dir, new_dentry, is_dir, NULL);
4616 if (error) 4671 if (error)
4617 return error; 4672 return error;
4618 4673
4619@@ -2365,6 +2419,9 @@ static inline int do_rename(const char * 4674@@ -2468,6 +2522,9 @@ static int do_rename(int olddfd, const c
4620 error = -EINVAL; 4675 error = -EINVAL;
4621 if (old_dentry == trap) 4676 if (old_dentry == trap)
4622 goto exit4; 4677 goto exit4;
4623+ error = -EROFS; 4678+ error = -EROFS;
4624+ if (MNT_IS_RDONLY(newnd.mnt)) 4679+ if (MNT_IS_RDONLY(newnd.mnt))
4625+ goto exit4; 4680+ goto exit4;
4626 new_dentry = lookup_hash(&newnd); 4681 new_dentry = lookup_hash(&newnd);
4627 error = PTR_ERR(new_dentry); 4682 error = PTR_ERR(new_dentry);
4628 if (IS_ERR(new_dentry)) 4683 if (IS_ERR(new_dentry))
4629Index: vserver-sources-2.0.2_2.6.15/fs/namespace.c 4684Index: linux-2.6.16/fs/namespace.c
4630=================================================================== 4685===================================================================
4631--- vserver-sources-2.0.2_2.6.15.orig/fs/namespace.c 4686--- linux-2.6.16.orig/fs/namespace.c
4632+++ vserver-sources-2.0.2_2.6.15/fs/namespace.c 4687+++ linux-2.6.16/fs/namespace.c
4633@@ -22,6 +22,8 @@ 4688@@ -23,6 +23,8 @@
4634 #include <linux/namei.h> 4689 #include <linux/namei.h>
4635 #include <linux/security.h> 4690 #include <linux/security.h>
4636 #include <linux/mount.h> 4691 #include <linux/mount.h>
4637+#include <linux/vserver/namespace.h> 4692+#include <linux/vserver/namespace.h>
4638+#include <linux/vserver/xid.h> 4693+#include <linux/vserver/xid.h>
4639 #include <asm/uaccess.h> 4694 #include <asm/uaccess.h>
4640 #include <asm/unistd.h> 4695 #include <asm/unistd.h>
4641 #include "pnode.h" 4696 #include "pnode.h"
4642@@ -236,6 +238,7 @@ static struct vfsmount *clone_mnt(struct 4697@@ -241,6 +243,7 @@ static struct vfsmount *clone_mnt(struct
4643 mnt->mnt_root = dget(root); 4698 mnt->mnt_root = dget(root);
4644 mnt->mnt_mountpoint = mnt->mnt_root; 4699 mnt->mnt_mountpoint = mnt->mnt_root;
4645 mnt->mnt_parent = mnt; 4700 mnt->mnt_parent = mnt;
4646+ mnt->mnt_xid = old->mnt_xid; 4701+ mnt->mnt_xid = old->mnt_xid;
4647 4702
4648 if (flag & CL_SLAVE) { 4703 if (flag & CL_SLAVE) {
4649 list_add(&mnt->mnt_slave, &old->mnt_slave_list); 4704 list_add(&mnt->mnt_slave, &old->mnt_slave_list);
4650@@ -344,43 +347,85 @@ static inline void mangle(struct seq_fil 4705@@ -349,43 +352,85 @@ static inline void mangle(struct seq_fil
4651 seq_escape(m, s, " \t\n\\"); 4706 seq_escape(m, s, " \t\n\\");
4652 } 4707 }
4653 4708
4654+static int mnt_is_reachable(struct vfsmount *mnt) 4709+static int mnt_is_reachable(struct vfsmount *mnt)
4655+{ 4710+{
4690+ char *unset_str; 4745+ char *unset_str;
4691 } fs_info[] = { 4746 } fs_info[] = {
4692- { MS_SYNCHRONOUS, ",sync" }, 4747- { MS_SYNCHRONOUS, ",sync" },
4693- { MS_DIRSYNC, ",dirsync" }, 4748- { MS_DIRSYNC, ",dirsync" },
4694- { MS_MANDLOCK, ",mand" }, 4749- { MS_MANDLOCK, ",mand" },
4695- { MS_NOATIME, ",noatime" },
4696- { MS_NODIRATIME, ",nodiratime" },
4697- { 0, NULL } 4750- { 0, NULL }
4698- }; 4751- };
4699- static struct proc_fs_info mnt_info[] = { 4752- static struct proc_fs_info mnt_info[] = {
4700- { MNT_NOSUID, ",nosuid" }, 4753- { MNT_NOSUID, ",nosuid" },
4701- { MNT_NODEV, ",nodev" }, 4754- { MNT_NODEV, ",nodev" },
4702- { MNT_NOEXEC, ",noexec" }, 4755- { MNT_NOEXEC, ",noexec" },
4756- { MNT_NOATIME, ",noatime" },
4757- { MNT_NODIRATIME, ",nodiratime" },
4703- { 0, NULL } 4758- { 0, NULL }
4704+ { MS_RDONLY, MNT_RDONLY, "ro", "rw" }, 4759+ { MS_RDONLY, MNT_RDONLY, "ro", "rw" },
4705+ { MS_SYNCHRONOUS, 0, ",sync", NULL }, 4760+ { MS_SYNCHRONOUS, 0, ",sync", NULL },
4706+ { MS_DIRSYNC, 0, ",dirsync", NULL }, 4761+ { MS_DIRSYNC, 0, ",dirsync", NULL },
4707+ { MS_MANDLOCK, 0, ",mand", NULL }, 4762+ { MS_MANDLOCK, 0, ",mand", NULL },
4758+ if (mnt->mnt_flags & MNT_XID) 4813+ if (mnt->mnt_flags & MNT_XID)
4759+ seq_printf(m, ",xid=%d", mnt->mnt_xid); 4814+ seq_printf(m, ",xid=%d", mnt->mnt_xid);
4760 if (mnt->mnt_sb->s_op->show_options) 4815 if (mnt->mnt_sb->s_op->show_options)
4761 err = mnt->mnt_sb->s_op->show_options(m, mnt); 4816 err = mnt->mnt_sb->s_op->show_options(m, mnt);
4762 seq_puts(m, " 0 0\n"); 4817 seq_puts(m, " 0 0\n");
4763@@ -470,15 +515,11 @@ void release_mounts(struct list_head *he 4818@@ -475,15 +520,11 @@ void release_mounts(struct list_head *he
4764 } 4819 }
4765 } 4820 }
4766 4821
4767-void umount_tree(struct vfsmount *mnt, int propagate, struct list_head *kill) 4822-void umount_tree(struct vfsmount *mnt, int propagate, struct list_head *kill)
4768+static inline void __umount_list(struct vfsmount *mnt, 4823+static inline void __umount_list(struct vfsmount *mnt,
4776- } 4831- }
4777- 4832-
4778 if (propagate) 4833 if (propagate)
4779 propagate_umount(kill); 4834 propagate_umount(kill);
4780 4835
4781@@ -494,6 +535,33 @@ void umount_tree(struct vfsmount *mnt, i 4836@@ -499,6 +540,33 @@ void umount_tree(struct vfsmount *mnt, i
4782 } 4837 }
4783 } 4838 }
4784 4839
4785+void umount_tree(struct vfsmount *mnt, int propagate, struct list_head *kill) 4840+void umount_tree(struct vfsmount *mnt, int propagate, struct list_head *kill)
4786+{ 4841+{
4810+} 4865+}
4811+ 4866+
4812 static int do_umount(struct vfsmount *mnt, int flags) 4867 static int do_umount(struct vfsmount *mnt, int flags)
4813 { 4868 {
4814 struct super_block *sb = mnt->mnt_sb; 4869 struct super_block *sb = mnt->mnt_sb;
4815@@ -603,7 +671,7 @@ asmlinkage long sys_umount(char __user * 4870@@ -608,7 +676,7 @@ asmlinkage long sys_umount(char __user *
4816 goto dput_and_out; 4871 goto dput_and_out;
4817 4872
4818 retval = -EPERM; 4873 retval = -EPERM;
4819- if (!capable(CAP_SYS_ADMIN)) 4874- if (!capable(CAP_SYS_ADMIN))
4820+ if (!capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_SECURE_MOUNT)) 4875+ if (!capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_SECURE_MOUNT))
4821 goto dput_and_out; 4876 goto dput_and_out;
4822 4877
4823 retval = do_umount(nd.mnt, flags); 4878 retval = do_umount(nd.mnt, flags);
4824@@ -629,6 +697,8 @@ static int mount_is_safe(struct nameidat 4879@@ -634,6 +702,8 @@ static int mount_is_safe(struct nameidat
4825 { 4880 {
4826 if (capable(CAP_SYS_ADMIN)) 4881 if (capable(CAP_SYS_ADMIN))
4827 return 0; 4882 return 0;
4828+ if (vx_ccaps(VXC_SECURE_MOUNT)) 4883+ if (vx_ccaps(VXC_SECURE_MOUNT))
4829+ return 0; 4884+ return 0;
4830 return -EPERM; 4885 return -EPERM;
4831 #ifdef notyet 4886 #ifdef notyet
4832 if (S_ISLNK(nd->dentry->d_inode->i_mode)) 4887 if (S_ISLNK(nd->dentry->d_inode->i_mode))
4833@@ -856,11 +926,13 @@ static int do_change_type(struct nameida 4888@@ -861,11 +931,13 @@ static int do_change_type(struct nameida
4834 /* 4889 /*
4835 * do loopback mount. 4890 * do loopback mount.
4836 */ 4891 */
4837-static int do_loopback(struct nameidata *nd, char *old_name, int recurse) 4892-static int do_loopback(struct nameidata *nd, char *old_name, int recurse)
4838+static int do_loopback(struct nameidata *nd, char *old_name, xid_t xid, 4893+static int do_loopback(struct nameidata *nd, char *old_name, xid_t xid,
4843 int err = mount_is_safe(nd); 4898 int err = mount_is_safe(nd);
4844+ int recurse = flags & MS_REC; 4899+ int recurse = flags & MS_REC;
4845 if (err) 4900 if (err)
4846 return err; 4901 return err;
4847 if (!old_name || !*old_name) 4902 if (!old_name || !*old_name)
4848@@ -886,6 +958,12 @@ static int do_loopback(struct nameidata 4903@@ -891,6 +963,12 @@ static int do_loopback(struct nameidata
4849 if (!mnt) 4904 if (!mnt)
4850 goto out; 4905 goto out;
4851 4906
4852+ mnt->mnt_flags = mnt_flags; 4907+ mnt->mnt_flags = mnt_flags;
4853+ if (flags & MS_XID) { 4908+ if (flags & MS_XID) {
4856+ } 4911+ }
4857+ 4912+
4858 err = graft_tree(mnt, nd); 4913 err = graft_tree(mnt, nd);
4859 if (err) { 4914 if (err) {
4860 LIST_HEAD(umount_list); 4915 LIST_HEAD(umount_list);
4916@@ -899,6 +977,7 @@ static int do_loopback(struct nameidata
4917 spin_unlock(&vfsmount_lock);
4918 release_mounts(&umount_list);
4919 }
4920+ mnt->mnt_flags = mnt_flags;
4921
4922 out:
4923 up_write(&namespace_sem);
4861@@ -907,12 +985,12 @@ out: 4924@@ -912,12 +991,12 @@ out:
4862 * on it - tough luck. 4925 * on it - tough luck.
4863 */ 4926 */
4864 static int do_remount(struct nameidata *nd, int flags, int mnt_flags, 4927 static int do_remount(struct nameidata *nd, int flags, int mnt_flags,
4865- void *data) 4928- void *data)
4866+ void *data, xid_t xid) 4929+ void *data, xid_t xid)
4871- if (!capable(CAP_SYS_ADMIN)) 4934- if (!capable(CAP_SYS_ADMIN))
4872+ if (!capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_SECURE_REMOUNT)) 4935+ if (!capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_SECURE_REMOUNT))
4873 return -EPERM; 4936 return -EPERM;
4874 4937
4875 if (!check_mnt(nd->mnt)) 4938 if (!check_mnt(nd->mnt))
4876@@ -946,7 +1024,7 @@ static int do_move_mount(struct nameidat 4939@@ -951,7 +1030,7 @@ static int do_move_mount(struct nameidat
4877 struct nameidata old_nd, parent_nd; 4940 struct nameidata old_nd, parent_nd;
4878 struct vfsmount *p; 4941 struct vfsmount *p;
4879 int err = 0; 4942 int err = 0;
4880- if (!capable(CAP_SYS_ADMIN)) 4943- if (!capable(CAP_SYS_ADMIN))
4881+ if (!capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_SECURE_MOUNT)) 4944+ if (!capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_SECURE_MOUNT))
4882 return -EPERM; 4945 return -EPERM;
4883 if (!old_name || !*old_name) 4946 if (!old_name || !*old_name)
4884 return -EINVAL; 4947 return -EINVAL;
4885@@ -1026,7 +1104,7 @@ static int do_new_mount(struct nameidata 4948@@ -1031,7 +1110,7 @@ static int do_new_mount(struct nameidata
4886 return -EINVAL; 4949 return -EINVAL;
4887 4950
4888 /* we need capabilities... */ 4951 /* we need capabilities... */
4889- if (!capable(CAP_SYS_ADMIN)) 4952- if (!capable(CAP_SYS_ADMIN))
4890+ if (!capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_SECURE_MOUNT)) 4953+ if (!capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_SECURE_MOUNT))
4891 return -EPERM; 4954 return -EPERM;
4892 4955
4893 mnt = do_kern_mount(type, flags, name, data); 4956 mnt = do_kern_mount(type, flags, name, data);
4894@@ -1264,6 +1342,7 @@ long do_mount(char *dev_name, char *dir_ 4957@@ -1269,6 +1348,7 @@ long do_mount(char *dev_name, char *dir_
4895 struct nameidata nd; 4958 struct nameidata nd;
4896 int retval = 0; 4959 int retval = 0;
4897 int mnt_flags = 0; 4960 int mnt_flags = 0;
4898+ xid_t xid = 0; 4961+ xid_t xid = 0;
4899 4962
4900 /* Discard magic */ 4963 /* Discard magic */
4901 if ((flags & MS_MGC_MSK) == MS_MGC_VAL) 4964 if ((flags & MS_MGC_MSK) == MS_MGC_VAL)
4902@@ -1279,15 +1358,32 @@ long do_mount(char *dev_name, char *dir_ 4965@@ -1284,7 +1364,17 @@ long do_mount(char *dev_name, char *dir_
4903 if (data_page) 4966 if (data_page)
4904 ((char *)data_page)[PAGE_SIZE - 1] = 0; 4967 ((char *)data_page)[PAGE_SIZE - 1] = 0;
4905 4968
4906+ retval = vx_parse_xid(data_page, &xid, 1); 4969+ retval = vx_parse_xid(data_page, &xid, 1);
4907+ if (retval) { 4970+ if (retval) {
4915+ if (flags & MS_RDONLY) 4978+ if (flags & MS_RDONLY)
4916+ mnt_flags |= MNT_RDONLY; 4979+ mnt_flags |= MNT_RDONLY;
4917 if (flags & MS_NOSUID) 4980 if (flags & MS_NOSUID)
4918 mnt_flags |= MNT_NOSUID; 4981 mnt_flags |= MNT_NOSUID;
4919 if (flags & MS_NODEV) 4982 if (flags & MS_NODEV)
4920 mnt_flags |= MNT_NODEV; 4983@@ -1296,6 +1386,8 @@ long do_mount(char *dev_name, char *dir_
4921 if (flags & MS_NOEXEC)
4922 mnt_flags |= MNT_NOEXEC;
4923+ if (flags & MS_NOATIME)
4924+ mnt_flags |= MNT_NOATIME;
4925+ if (flags & MS_NODIRATIME) 4984 if (flags & MS_NODIRATIME)
4926+ mnt_flags |= MNT_NODIRATIME; 4985 mnt_flags |= MNT_NODIRATIME;
4927 flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE);
4928 4986
4929+ if (vx_ccaps(VXC_SECURE_MOUNT)) 4987+ if (vx_ccaps(VXC_SECURE_MOUNT))
4930+ mnt_flags |= MNT_NODEV; 4988+ mnt_flags |= MNT_NODEV;
4931+ 4989 flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE |
4932 /* ... and get the mountpoint */ 4990 MS_NOATIME | MS_NODIRATIME);
4933 retval = path_lookup(dir_name, LOOKUP_FOLLOW, &nd); 4991
4934 if (retval)
4935@@ -1299,9 +1395,9 @@ long do_mount(char *dev_name, char *dir_ 4992@@ -1310,9 +1402,9 @@ long do_mount(char *dev_name, char *dir_
4936 4993
4937 if (flags & MS_REMOUNT) 4994 if (flags & MS_REMOUNT)
4938 retval = do_remount(&nd, flags & ~MS_REMOUNT, mnt_flags, 4995 retval = do_remount(&nd, flags & ~MS_REMOUNT, mnt_flags,
4939- data_page); 4996- data_page);
4940+ data_page, xid); 4997+ data_page, xid);
4942- retval = do_loopback(&nd, dev_name, flags & MS_REC); 4999- retval = do_loopback(&nd, dev_name, flags & MS_REC);
4943+ retval = do_loopback(&nd, dev_name, xid, flags, mnt_flags); 5000+ retval = do_loopback(&nd, dev_name, xid, flags, mnt_flags);
4944 else if (flags & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE)) 5001 else if (flags & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE))
4945 retval = do_change_type(&nd, flags); 5002 retval = do_change_type(&nd, flags);
4946 else if (flags & MS_MOVE) 5003 else if (flags & MS_MOVE)
4947@@ -1330,7 +1426,7 @@ int copy_namespace(int flags, struct tas 5004@@ -1410,7 +1502,7 @@ int copy_namespace(int flags, struct tas
4948 if (!(flags & CLONE_NEWNS)) 5005 if (!(flags & CLONE_NEWNS))
4949 return 0; 5006 return 0;
4950 5007
4951- if (!capable(CAP_SYS_ADMIN)) { 5008- if (!capable(CAP_SYS_ADMIN)) {
4952+ if (!capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_SECURE_MOUNT)) { 5009+ if (!capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_SECURE_MOUNT)) {
4953 put_namespace(namespace);
4954 return -EPERM; 5010 err = -EPERM;
5011 goto out;
4955 } 5012 }
4956Index: vserver-sources-2.0.2_2.6.15/fs/nfs/dir.c 5013Index: linux-2.6.16/fs/nfs/dir.c
4957=================================================================== 5014===================================================================
4958--- vserver-sources-2.0.2_2.6.15.orig/fs/nfs/dir.c 5015--- linux-2.6.16.orig/fs/nfs/dir.c
4959+++ vserver-sources-2.0.2_2.6.15/fs/nfs/dir.c 5016+++ linux-2.6.16/fs/nfs/dir.c
4960@@ -28,9 +28,11 @@ 5017@@ -28,9 +28,11 @@
4961 #include <linux/sunrpc/clnt.h> 5018 #include <linux/sunrpc/clnt.h>
4962 #include <linux/nfs_fs.h> 5019 #include <linux/nfs_fs.h>
4963 #include <linux/nfs_mount.h> 5020 #include <linux/nfs_mount.h>
4964+#include <linux/mount.h> 5021+#include <linux/mount.h>
4985+ if ((IS_RDONLY(dir) || MNT_IS_RDONLY(nd->mnt)) && 5042+ if ((IS_RDONLY(dir) || MNT_IS_RDONLY(nd->mnt)) &&
4986+ (nd->intent.open.flags & (O_CREAT|O_TRUNC|FMODE_WRITE))) 5043+ (nd->intent.open.flags & (O_CREAT|O_TRUNC|FMODE_WRITE)))
4987 return 0; 5044 return 0;
4988 return 1; 5045 return 1;
4989 } 5046 }
4990Index: vserver-sources-2.0.2_2.6.15/fs/nfs/inode.c 5047Index: linux-2.6.16/fs/nfs/inode.c
4991=================================================================== 5048===================================================================
4992--- vserver-sources-2.0.2_2.6.15.orig/fs/nfs/inode.c 5049--- linux-2.6.16.orig/fs/nfs/inode.c
4993+++ vserver-sources-2.0.2_2.6.15/fs/nfs/inode.c 5050+++ linux-2.6.16/fs/nfs/inode.c
4994@@ -35,6 +35,7 @@ 5051@@ -35,6 +35,7 @@
4995 #include <linux/mount.h> 5052 #include <linux/mount.h>
4996 #include <linux/nfs_idmap.h> 5053 #include <linux/nfs_idmap.h>
4997 #include <linux/vfs.h> 5054 #include <linux/vfs.h>
4998+#include <linux/vserver/xid.h> 5055+#include <linux/vserver/xid.h>
4999 5056
5000 #include <asm/system.h> 5057 #include <asm/system.h>
5001 #include <asm/uaccess.h> 5058 #include <asm/uaccess.h>
5002@@ -340,12 +341,16 @@ nfs_sb_init(struct super_block *sb, rpc_ 5059@@ -336,12 +337,16 @@ nfs_sb_init(struct super_block *sb, rpc_
5003 } 5060 }
5004 server->backing_dev_info.ra_pages = server->rpages * NFS_MAX_READAHEAD; 5061 server->backing_dev_info.ra_pages = server->rpages * NFS_MAX_READAHEAD;
5005 5062
5006+ if (server->flags & NFS_MOUNT_TAGXID) 5063+ if (server->flags & NFS_MOUNT_TAGXID)
5007+ sb->s_flags |= MS_TAGXID; 5064+ sb->s_flags |= MS_TAGXID;
5014 server->client->cl_softrtry = (server->flags & NFS_MOUNT_SOFT) ? 1 : 0; 5071 server->client->cl_softrtry = (server->flags & NFS_MOUNT_SOFT) ? 1 : 0;
5015+ server->client->cl_tagxid = (server->flags & NFS_MOUNT_TAGXID) ? 1 : 0; 5072+ server->client->cl_tagxid = (server->flags & NFS_MOUNT_TAGXID) ? 1 : 0;
5016 5073
5017 /* We're airborne Set socket buffersize */ 5074 /* We're airborne Set socket buffersize */
5018 rpc_setbufsize(server->client, server->wsize + 100, server->rsize + 100); 5075 rpc_setbufsize(server->client, server->wsize + 100, server->rsize + 100);
5019@@ -417,6 +422,7 @@ nfs_create_client(struct nfs_server *ser 5076@@ -413,6 +418,7 @@ nfs_create_client(struct nfs_server *ser
5020 5077
5021 clnt->cl_intr = 1; 5078 clnt->cl_intr = 1;
5022 clnt->cl_softrtry = 1; 5079 clnt->cl_softrtry = 1;
5023+ clnt->cl_tagxid = 1; 5080+ clnt->cl_tagxid = 1;
5024 clnt->cl_chatty = 1;
5025 5081
5026 return clnt; 5082 return clnt;
5083
5027@@ -599,6 +605,7 @@ static int nfs_show_options(struct seq_f 5084@@ -593,6 +599,7 @@ static int nfs_show_options(struct seq_f
5028 { NFS_MOUNT_NOAC, ",noac", "" }, 5085 { NFS_MOUNT_NOAC, ",noac", "" },
5029 { NFS_MOUNT_NONLM, ",nolock", ",lock" }, 5086 { NFS_MOUNT_NONLM, ",nolock", ",lock" },
5030 { NFS_MOUNT_NOACL, ",noacl", "" }, 5087 { NFS_MOUNT_NOACL, ",noacl", "" },
5031+ { NFS_MOUNT_TAGXID, ",tagxid", "" }, 5088+ { NFS_MOUNT_TAGXID, ",tagxid", "" },
5032 { 0, NULL, NULL } 5089 { 0, NULL, NULL }
5033 }; 5090 };
5034 struct proc_nfs_info *nfs_infop; 5091 struct proc_nfs_info *nfs_infop;
5035@@ -814,8 +821,10 @@ nfs_fhget(struct super_block *sb, struct 5092@@ -805,8 +812,10 @@ nfs_fhget(struct super_block *sb, struct
5036 nfsi->change_attr = fattr->change_attr; 5093 nfsi->change_attr = fattr->change_attr;
5037 inode->i_size = nfs_size_to_loff_t(fattr->size); 5094 inode->i_size = nfs_size_to_loff_t(fattr->size);
5038 inode->i_nlink = fattr->nlink; 5095 inode->i_nlink = fattr->nlink;
5039- inode->i_uid = fattr->uid; 5096- inode->i_uid = fattr->uid;
5040- inode->i_gid = fattr->gid; 5097- inode->i_gid = fattr->gid;
5043+ inode->i_xid = INOXID_XID(XID_TAG(inode), fattr->uid, fattr->gid, 0); 5100+ inode->i_xid = INOXID_XID(XID_TAG(inode), fattr->uid, fattr->gid, 0);
5044+ /* maybe fattr->xid someday */ 5101+ /* maybe fattr->xid someday */
5045 if (fattr->valid & (NFS_ATTR_FATTR_V3 | NFS_ATTR_FATTR_V4)) { 5102 if (fattr->valid & (NFS_ATTR_FATTR_V3 | NFS_ATTR_FATTR_V4)) {
5046 /* 5103 /*
5047 * report the blocks in 512byte units 5104 * report the blocks in 512byte units
5048@@ -907,6 +916,8 @@ void nfs_setattr_update_inode(struct ino 5105@@ -897,6 +906,8 @@ void nfs_setattr_update_inode(struct ino
5049 inode->i_uid = attr->ia_uid; 5106 inode->i_uid = attr->ia_uid;
5050 if ((attr->ia_valid & ATTR_GID) != 0) 5107 if ((attr->ia_valid & ATTR_GID) != 0)
5051 inode->i_gid = attr->ia_gid; 5108 inode->i_gid = attr->ia_gid;
5052+ if ((attr->ia_valid & ATTR_XID) && IS_TAGXID(inode)) 5109+ if ((attr->ia_valid & ATTR_XID) && IS_TAGXID(inode))
5053+ inode->i_xid = attr->ia_xid; 5110+ inode->i_xid = attr->ia_xid;
5054 spin_lock(&inode->i_lock); 5111 spin_lock(&inode->i_lock);
5055 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL; 5112 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL;
5056 spin_unlock(&inode->i_lock); 5113 spin_unlock(&inode->i_lock);
5057@@ -1266,6 +1277,9 @@ static int nfs_check_inode_attributes(st 5114@@ -1294,6 +1305,9 @@ static int nfs_check_inode_attributes(st
5058 struct nfs_inode *nfsi = NFS_I(inode); 5115 struct nfs_inode *nfsi = NFS_I(inode);
5059 loff_t cur_size, new_isize; 5116 loff_t cur_size, new_isize;
5060 int data_unstable; 5117 int data_unstable;
5061+ uid_t uid; 5118+ uid_t uid;
5062+ gid_t gid; 5119+ gid_t gid;
5063+ xid_t xid; 5120+ xid_t xid;
5064 5121
5065 5122
5066 /* Are we in the process of updating data on the server? */ 5123 if ((fattr->valid & NFS_ATTR_FATTR) == 0)
5067@@ -1315,10 +1329,15 @@ static int nfs_check_inode_attributes(st 5124@@ -1333,10 +1347,15 @@ static int nfs_check_inode_attributes(st
5068 nfsi->cache_validity |= NFS_INO_REVAL_PAGECACHE; 5125 nfsi->cache_validity |= NFS_INO_REVAL_PAGECACHE;
5069 } 5126 }
5070 5127
5071+ uid = INOXID_UID(XID_TAG(inode), fattr->uid, fattr->gid); 5128+ uid = INOXID_UID(XID_TAG(inode), fattr->uid, fattr->gid);
5072+ gid = INOXID_GID(XID_TAG(inode), fattr->uid, fattr->gid); 5129+ gid = INOXID_GID(XID_TAG(inode), fattr->uid, fattr->gid);
5080+ || inode->i_gid != gid 5137+ || inode->i_gid != gid
5081+ || inode->i_xid != xid) 5138+ || inode->i_xid != xid)
5082 nfsi->cache_validity |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL; 5139 nfsi->cache_validity |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL;
5083 5140
5084 /* Has the link count changed? */ 5141 /* Has the link count changed? */
5085@@ -1402,6 +1421,9 @@ static int nfs_update_inode(struct inode 5142@@ -1420,6 +1439,9 @@ static int nfs_update_inode(struct inode
5086 loff_t cur_isize, new_isize; 5143 loff_t cur_isize, new_isize;
5087 unsigned int invalid = 0; 5144 unsigned int invalid = 0;
5088 int data_stable; 5145 int data_stable;
5089+ uid_t uid; 5146+ uid_t uid;
5090+ gid_t gid; 5147+ gid_t gid;
5091+ xid_t xid; 5148+ xid_t xid;
5092 5149
5093 dfprintk(VFS, "NFS: %s(%s/%ld ct=%d info=0x%x)\n", 5150 dfprintk(VFS, "NFS: %s(%s/%ld ct=%d info=0x%x)\n",
5094 __FUNCTION__, inode->i_sb->s_id, inode->i_ino, 5151 __FUNCTION__, inode->i_sb->s_id, inode->i_ino,
5095@@ -1483,15 +1505,21 @@ static int nfs_update_inode(struct inode 5152@@ -1498,15 +1520,21 @@ static int nfs_update_inode(struct inode
5096 } 5153 }
5097 memcpy(&inode->i_atime, &fattr->atime, sizeof(inode->i_atime)); 5154 memcpy(&inode->i_atime, &fattr->atime, sizeof(inode->i_atime));
5098 5155
5099+ uid = INOXID_UID(XID_TAG(inode), fattr->uid, fattr->gid); 5156+ uid = INOXID_UID(XID_TAG(inode), fattr->uid, fattr->gid);
5100+ gid = INOXID_GID(XID_TAG(inode), fattr->uid, fattr->gid); 5157+ gid = INOXID_GID(XID_TAG(inode), fattr->uid, fattr->gid);
5116+ inode->i_gid = gid; 5173+ inode->i_gid = gid;
5117+ inode->i_xid = xid; 5174+ inode->i_xid = xid;
5118 5175
5119 if (fattr->valid & (NFS_ATTR_FATTR_V3 | NFS_ATTR_FATTR_V4)) { 5176 if (fattr->valid & (NFS_ATTR_FATTR_V3 | NFS_ATTR_FATTR_V4)) {
5120 /* 5177 /*
5121Index: vserver-sources-2.0.2_2.6.15/fs/nfs/nfs3xdr.c 5178Index: linux-2.6.16/fs/nfs/nfs3xdr.c
5122=================================================================== 5179===================================================================
5123--- vserver-sources-2.0.2_2.6.15.orig/fs/nfs/nfs3xdr.c 5180--- linux-2.6.16.orig/fs/nfs/nfs3xdr.c
5124+++ vserver-sources-2.0.2_2.6.15/fs/nfs/nfs3xdr.c 5181+++ linux-2.6.16/fs/nfs/nfs3xdr.c
5125@@ -22,6 +22,7 @@ 5182@@ -22,6 +22,7 @@
5126 #include <linux/nfs3.h> 5183 #include <linux/nfs3.h>
5127 #include <linux/nfs_fs.h> 5184 #include <linux/nfs_fs.h>
5128 #include <linux/nfsacl.h> 5185 #include <linux/nfsacl.h>
5129+#include <linux/vserver/xid.h> 5186+#include <linux/vserver/xid.h>
5209+ p = xdr_encode_sattr(p, args->sattr, 5266+ p = xdr_encode_sattr(p, args->sattr,
5210+ req->rq_task->tk_client->cl_tagxid); 5267+ req->rq_task->tk_client->cl_tagxid);
5211 if (args->type == NF3CHR || args->type == NF3BLK) { 5268 if (args->type == NF3CHR || args->type == NF3BLK) {
5212 *p++ = htonl(MAJOR(args->rdev)); 5269 *p++ = htonl(MAJOR(args->rdev));
5213 *p++ = htonl(MINOR(args->rdev)); 5270 *p++ = htonl(MINOR(args->rdev));
5214Index: vserver-sources-2.0.2_2.6.15/fs/nfs/nfsroot.c 5271Index: linux-2.6.16/fs/nfs/nfsroot.c
5215=================================================================== 5272===================================================================
5216--- vserver-sources-2.0.2_2.6.15.orig/fs/nfs/nfsroot.c 5273--- linux-2.6.16.orig/fs/nfs/nfsroot.c
5217+++ vserver-sources-2.0.2_2.6.15/fs/nfs/nfsroot.c 5274+++ linux-2.6.16/fs/nfs/nfsroot.c
5218@@ -87,6 +87,7 @@ 5275@@ -87,6 +87,7 @@
5219 #include <linux/root_dev.h> 5276 #include <linux/root_dev.h>
5220 #include <net/ipconfig.h> 5277 #include <net/ipconfig.h>
5221 #include <linux/parser.h> 5278 #include <linux/parser.h>
5222+#include <linux/vs_cvirt.h> 5279+#include <linux/vs_cvirt.h>
5247+#ifndef CONFIG_INOXID_NONE 5304+#ifndef CONFIG_INOXID_NONE
5248+ case Opt_tagxid: 5305+ case Opt_tagxid:
5249+ nfs_data.flags |= NFS_MOUNT_TAGXID; 5306+ nfs_data.flags |= NFS_MOUNT_TAGXID;
5250+ break; 5307+ break;
5251+#endif 5308+#endif
5252 default : 5309 default:
5253 return 0; 5310 printk(KERN_WARNING "Root-NFS: unknown "
5254 } 5311 "option: %s\n", p);
5255@@ -310,7 +317,7 @@ static int __init root_nfs_name(char *na 5312@@ -312,7 +319,7 @@ static int __init root_nfs_name(char *na
5256 /* Override them by options set on kernel command-line */ 5313 /* Override them by options set on kernel command-line */
5257 root_nfs_parse(name, buf); 5314 root_nfs_parse(name, buf);
5258 5315
5259- cp = system_utsname.nodename; 5316- cp = system_utsname.nodename;
5260+ cp = vx_new_uts(nodename); 5317+ cp = vx_new_uts(nodename);
5261 if (strlen(buf) + strlen(cp) > NFS_MAXPATHLEN) { 5318 if (strlen(buf) + strlen(cp) > NFS_MAXPATHLEN) {
5262 printk(KERN_ERR "Root-NFS: Pathname for remote directory too long.\n"); 5319 printk(KERN_ERR "Root-NFS: Pathname for remote directory too long.\n");
5263 return -1; 5320 return -1;
5264Index: vserver-sources-2.0.2_2.6.15/fs/nfsd/auth.c 5321Index: linux-2.6.16/fs/nfsd/auth.c
5265=================================================================== 5322===================================================================
5266--- vserver-sources-2.0.2_2.6.15.orig/fs/nfsd/auth.c 5323--- linux-2.6.16.orig/fs/nfsd/auth.c
5267+++ vserver-sources-2.0.2_2.6.15/fs/nfsd/auth.c 5324+++ linux-2.6.16/fs/nfsd/auth.c
5268@@ -9,6 +9,7 @@ 5325@@ -9,6 +9,7 @@
5269 #include <linux/sunrpc/svc.h> 5326 #include <linux/sunrpc/svc.h>
5270 #include <linux/sunrpc/svcauth.h> 5327 #include <linux/sunrpc/svcauth.h>
5271 #include <linux/nfsd/nfsd.h> 5328 #include <linux/nfsd/nfsd.h>
5272+#include <linux/vserver/xid.h> 5329+#include <linux/vserver/xid.h>
5295- if ((cred->cr_uid)) { 5352- if ((cred->cr_uid)) {
5296+ if (INOXID_UID(XID_TAG_NFSD, cred->cr_uid, cred->cr_gid)) { 5353+ if (INOXID_UID(XID_TAG_NFSD, cred->cr_uid, cred->cr_gid)) {
5297 cap_t(current->cap_effective) &= ~CAP_NFSD_MASK; 5354 cap_t(current->cap_effective) &= ~CAP_NFSD_MASK;
5298 } else { 5355 } else {
5299 cap_t(current->cap_effective) |= (CAP_NFSD_MASK & 5356 cap_t(current->cap_effective) |= (CAP_NFSD_MASK &
5300Index: vserver-sources-2.0.2_2.6.15/fs/nfsd/nfs3xdr.c 5357Index: linux-2.6.16/fs/nfsd/nfs3xdr.c
5301=================================================================== 5358===================================================================
5302--- vserver-sources-2.0.2_2.6.15.orig/fs/nfsd/nfs3xdr.c 5359--- linux-2.6.16.orig/fs/nfsd/nfs3xdr.c
5303+++ vserver-sources-2.0.2_2.6.15/fs/nfsd/nfs3xdr.c 5360+++ linux-2.6.16/fs/nfsd/nfs3xdr.c
5304@@ -21,6 +21,7 @@ 5361@@ -21,6 +21,7 @@
5305 #include <linux/sunrpc/svc.h> 5362 #include <linux/sunrpc/svc.h>
5306 #include <linux/nfsd/nfsd.h> 5363 #include <linux/nfsd/nfsd.h>
5307 #include <linux/nfsd/xdr3.h> 5364 #include <linux/nfsd/xdr3.h>
5308+#include <linux/vserver/xid.h> 5365+#include <linux/vserver/xid.h>
5334+ iap->ia_gid = INOXID_GID(XID_TAG_NFSD, uid, gid); 5391+ iap->ia_gid = INOXID_GID(XID_TAG_NFSD, uid, gid);
5335+ iap->ia_xid = INOXID_XID(XID_TAG_NFSD, uid, gid, 0); 5392+ iap->ia_xid = INOXID_XID(XID_TAG_NFSD, uid, gid, 0);
5336 if (*p++) { 5393 if (*p++) {
5337 u64 newsize; 5394 u64 newsize;
5338 5395
5339@@ -166,8 +172,10 @@ encode_fattr3(struct svc_rqst *rqstp, u3 5396@@ -163,8 +169,10 @@ encode_fattr3(struct svc_rqst *rqstp, u3
5340 *p++ = htonl(nfs3_ftypes[(stat.mode & S_IFMT) >> 12]); 5397 *p++ = htonl(nfs3_ftypes[(stat->mode & S_IFMT) >> 12]);
5341 *p++ = htonl((u32) stat.mode); 5398 *p++ = htonl((u32) stat->mode);
5342 *p++ = htonl((u32) stat.nlink); 5399 *p++ = htonl((u32) stat->nlink);
5343- *p++ = htonl((u32) nfsd_ruid(rqstp, stat.uid)); 5400- *p++ = htonl((u32) nfsd_ruid(rqstp, stat->uid));
5344- *p++ = htonl((u32) nfsd_rgid(rqstp, stat.gid)); 5401- *p++ = htonl((u32) nfsd_rgid(rqstp, stat->gid));
5345+ *p++ = htonl((u32) nfsd_ruid(rqstp, 5402+ *p++ = htonl((u32) nfsd_ruid(rqstp,
5346+ XIDINO_UID(XID_TAG(dentry->d_inode), stat.uid, stat.xid))); 5403+ XIDINO_UID(XID_TAG(dentry->d_inode), stat->uid, stat->xid)));
5347+ *p++ = htonl((u32) nfsd_rgid(rqstp, 5404+ *p++ = htonl((u32) nfsd_rgid(rqstp,
5348+ XIDINO_GID(XID_TAG(dentry->d_inode), stat.gid, stat.xid))); 5405+ XIDINO_GID(XID_TAG(dentry->d_inode), stat->gid, stat->xid)));
5349 if (S_ISLNK(stat.mode) && stat.size > NFS3_MAXPATHLEN) { 5406 if (S_ISLNK(stat->mode) && stat->size > NFS3_MAXPATHLEN) {
5350 p = xdr_encode_hyper(p, (u64) NFS3_MAXPATHLEN); 5407 p = xdr_encode_hyper(p, (u64) NFS3_MAXPATHLEN);
5351 } else { 5408 } else {
5352Index: vserver-sources-2.0.2_2.6.15/fs/nfsd/nfs4recover.c 5409Index: linux-2.6.16/fs/nfsd/nfs4recover.c
5353=================================================================== 5410===================================================================
5354--- vserver-sources-2.0.2_2.6.15.orig/fs/nfsd/nfs4recover.c 5411--- linux-2.6.16.orig/fs/nfsd/nfs4recover.c
5355+++ vserver-sources-2.0.2_2.6.15/fs/nfsd/nfs4recover.c 5412+++ linux-2.6.16/fs/nfsd/nfs4recover.c
5356@@ -155,7 +155,7 @@ nfsd4_create_clid_dir(struct nfs4_client 5413@@ -155,7 +155,7 @@ nfsd4_create_clid_dir(struct nfs4_client
5357 dprintk("NFSD: nfsd4_create_clid_dir: DIRECTORY EXISTS\n"); 5414 dprintk("NFSD: nfsd4_create_clid_dir: DIRECTORY EXISTS\n");
5358 goto out_put; 5415 goto out_put;
5359 } 5416 }
5360- status = vfs_mkdir(rec_dir.dentry->d_inode, dentry, S_IRWXU); 5417- status = vfs_mkdir(rec_dir.dentry->d_inode, dentry, S_IRWXU);
5361+ status = vfs_mkdir(rec_dir.dentry->d_inode, dentry, S_IRWXU, NULL); 5418+ status = vfs_mkdir(rec_dir.dentry->d_inode, dentry, S_IRWXU, NULL);
5362 out_put: 5419 out_put:
5363 dput(dentry); 5420 dput(dentry);
5364 out_unlock: 5421 out_unlock:
5365@@ -260,7 +260,7 @@ nfsd4_remove_clid_file(struct dentry *di 5422@@ -259,7 +259,7 @@ nfsd4_remove_clid_file(struct dentry *di
5366 return -EINVAL; 5423 return -EINVAL;
5367 } 5424 }
5368 down(&dir->d_inode->i_sem); 5425 mutex_lock(&dir->d_inode->i_mutex);
5369- status = vfs_unlink(dir->d_inode, dentry); 5426- status = vfs_unlink(dir->d_inode, dentry);
5370+ status = vfs_unlink(dir->d_inode, dentry, NULL); 5427+ status = vfs_unlink(dir->d_inode, dentry, NULL);
5371 up(&dir->d_inode->i_sem); 5428 mutex_unlock(&dir->d_inode->i_mutex);
5372 return status; 5429 return status;
5373 } 5430 }
5374@@ -275,7 +275,7 @@ nfsd4_clear_clid_dir(struct dentry *dir, 5431@@ -274,7 +274,7 @@ nfsd4_clear_clid_dir(struct dentry *dir,
5375 * a kernel from the future.... */ 5432 * a kernel from the future.... */
5376 nfsd4_list_rec_dir(dentry, nfsd4_remove_clid_file); 5433 nfsd4_list_rec_dir(dentry, nfsd4_remove_clid_file);
5377 down(&dir->d_inode->i_sem); 5434 mutex_lock(&dir->d_inode->i_mutex);
5378- status = vfs_rmdir(dir->d_inode, dentry); 5435- status = vfs_rmdir(dir->d_inode, dentry);
5379+ status = vfs_rmdir(dir->d_inode, dentry, NULL); 5436+ status = vfs_rmdir(dir->d_inode, dentry, NULL);
5380 up(&dir->d_inode->i_sem); 5437 mutex_unlock(&dir->d_inode->i_mutex);
5381 return status; 5438 return status;
5382 } 5439 }
5383Index: vserver-sources-2.0.2_2.6.15/fs/nfsd/nfs4xdr.c 5440Index: linux-2.6.16/fs/nfsd/nfs4xdr.c
5384=================================================================== 5441===================================================================
5385--- vserver-sources-2.0.2_2.6.15.orig/fs/nfsd/nfs4xdr.c 5442--- linux-2.6.16.orig/fs/nfsd/nfs4xdr.c
5386+++ vserver-sources-2.0.2_2.6.15/fs/nfsd/nfs4xdr.c 5443+++ linux-2.6.16/fs/nfsd/nfs4xdr.c
5387@@ -57,6 +57,7 @@ 5444@@ -57,6 +57,7 @@
5388 #include <linux/nfsd_idmap.h> 5445 #include <linux/nfsd_idmap.h>
5389 #include <linux/nfs4.h> 5446 #include <linux/nfs4.h>
5390 #include <linux/nfs4_acl.h> 5447 #include <linux/nfs4_acl.h>
5391+#include <linux/vserver/xid.h> 5448+#include <linux/vserver/xid.h>
5411+ XIDINO_GID(XID_TAG(dentry->d_inode), 5468+ XIDINO_GID(XID_TAG(dentry->d_inode),
5412+ stat.gid, stat.xid), &p, &buflen); 5469+ stat.gid, stat.xid), &p, &buflen);
5413 if (status == nfserr_resource) 5470 if (status == nfserr_resource)
5414 goto out_resource; 5471 goto out_resource;
5415 if (status) 5472 if (status)
5416Index: vserver-sources-2.0.2_2.6.15/fs/nfsd/nfsxdr.c 5473Index: linux-2.6.16/fs/nfsd/nfsxdr.c
5417=================================================================== 5474===================================================================
5418--- vserver-sources-2.0.2_2.6.15.orig/fs/nfsd/nfsxdr.c 5475--- linux-2.6.16.orig/fs/nfsd/nfsxdr.c
5419+++ vserver-sources-2.0.2_2.6.15/fs/nfsd/nfsxdr.c 5476+++ linux-2.6.16/fs/nfsd/nfsxdr.c
5420@@ -15,6 +15,7 @@ 5477@@ -15,6 +15,7 @@
5421 #include <linux/nfsd/nfsd.h> 5478 #include <linux/nfsd/nfsd.h>
5422 #include <linux/nfsd/xdr.h> 5479 #include <linux/nfsd/xdr.h>
5423 #include <linux/mm.h> 5480 #include <linux/mm.h>
5424+#include <linux/vserver/xid.h> 5481+#include <linux/vserver/xid.h>
5450+ iap->ia_gid = INOXID_GID(XID_TAG_NFSD, uid, gid); 5507+ iap->ia_gid = INOXID_GID(XID_TAG_NFSD, uid, gid);
5451+ iap->ia_xid = INOXID_XID(XID_TAG_NFSD, uid, gid, 0); 5508+ iap->ia_xid = INOXID_XID(XID_TAG_NFSD, uid, gid, 0);
5452 if ((tmp = ntohl(*p++)) != (u32)-1) { 5509 if ((tmp = ntohl(*p++)) != (u32)-1) {
5453 iap->ia_valid |= ATTR_SIZE; 5510 iap->ia_valid |= ATTR_SIZE;
5454 iap->ia_size = tmp; 5511 iap->ia_size = tmp;
5455@@ -166,8 +172,10 @@ encode_fattr(struct svc_rqst *rqstp, u32 5512@@ -164,8 +170,10 @@ encode_fattr(struct svc_rqst *rqstp, u32
5456 *p++ = htonl(nfs_ftypes[type >> 12]); 5513 *p++ = htonl(nfs_ftypes[type >> 12]);
5457 *p++ = htonl((u32) stat.mode); 5514 *p++ = htonl((u32) stat->mode);
5458 *p++ = htonl((u32) stat.nlink); 5515 *p++ = htonl((u32) stat->nlink);
5459- *p++ = htonl((u32) nfsd_ruid(rqstp, stat.uid)); 5516- *p++ = htonl((u32) nfsd_ruid(rqstp, stat->uid));
5460- *p++ = htonl((u32) nfsd_rgid(rqstp, stat.gid)); 5517- *p++ = htonl((u32) nfsd_rgid(rqstp, stat->gid));
5461+ *p++ = htonl((u32) nfsd_ruid(rqstp, 5518+ *p++ = htonl((u32) nfsd_ruid(rqstp,
5462+ XIDINO_UID(XID_TAG(dentry->d_inode), stat.uid, stat.xid))); 5519+ XIDINO_UID(XID_TAG(dentry->d_inode), stat->uid, stat->xid)));
5463+ *p++ = htonl((u32) nfsd_rgid(rqstp, 5520+ *p++ = htonl((u32) nfsd_rgid(rqstp,
5464+ XIDINO_GID(XID_TAG(dentry->d_inode), stat.gid, stat.xid))); 5521+ XIDINO_GID(XID_TAG(dentry->d_inode), stat->gid, stat->xid)));
5465 5522
5466 if (S_ISLNK(type) && stat.size > NFS_MAXPATHLEN) { 5523 if (S_ISLNK(type) && stat->size > NFS_MAXPATHLEN) {
5467 *p++ = htonl(NFS_MAXPATHLEN); 5524 *p++ = htonl(NFS_MAXPATHLEN);
5468Index: vserver-sources-2.0.2_2.6.15/fs/nfsd/vfs.c 5525Index: linux-2.6.16/fs/nfsd/vfs.c
5469=================================================================== 5526===================================================================
5470--- vserver-sources-2.0.2_2.6.15.orig/fs/nfsd/vfs.c 5527--- linux-2.6.16.orig/fs/nfsd/vfs.c
5471+++ vserver-sources-2.0.2_2.6.15/fs/nfsd/vfs.c 5528+++ linux-2.6.16/fs/nfsd/vfs.c
5472@@ -1161,13 +1161,13 @@ nfsd_create(struct svc_rqst *rqstp, stru 5529@@ -1160,13 +1160,13 @@ nfsd_create(struct svc_rqst *rqstp, stru
5473 err = vfs_create(dirp, dchild, iap->ia_mode, NULL); 5530 err = vfs_create(dirp, dchild, iap->ia_mode, NULL);
5474 break; 5531 break;
5475 case S_IFDIR: 5532 case S_IFDIR:
5476- err = vfs_mkdir(dirp, dchild, iap->ia_mode); 5533- err = vfs_mkdir(dirp, dchild, iap->ia_mode);
5477+ err = vfs_mkdir(dirp, dchild, iap->ia_mode, NULL); 5534+ err = vfs_mkdir(dirp, dchild, iap->ia_mode, NULL);
5483- err = vfs_mknod(dirp, dchild, iap->ia_mode, rdev); 5540- err = vfs_mknod(dirp, dchild, iap->ia_mode, rdev);
5484+ err = vfs_mknod(dirp, dchild, iap->ia_mode, rdev, NULL); 5541+ err = vfs_mknod(dirp, dchild, iap->ia_mode, rdev, NULL);
5485 break; 5542 break;
5486 default: 5543 default:
5487 printk("nfsd: bad file type %o in nfsd_create\n", type); 5544 printk("nfsd: bad file type %o in nfsd_create\n", type);
5488@@ -1443,11 +1443,13 @@ nfsd_symlink(struct svc_rqst *rqstp, str 5545@@ -1446,11 +1446,13 @@ nfsd_symlink(struct svc_rqst *rqstp, str
5489 else { 5546 else {
5490 strncpy(path_alloced, path, plen); 5547 strncpy(path_alloced, path, plen);
5491 path_alloced[plen] = 0; 5548 path_alloced[plen] = 0;
5492- err = vfs_symlink(dentry->d_inode, dnew, path_alloced, mode); 5549- err = vfs_symlink(dentry->d_inode, dnew, path_alloced, mode);
5493+ err = vfs_symlink(dentry->d_inode, dnew, 5550+ err = vfs_symlink(dentry->d_inode, dnew,
5497 } else 5554 } else
5498- err = vfs_symlink(dentry->d_inode, dnew, path, mode); 5555- err = vfs_symlink(dentry->d_inode, dnew, path, mode);
5499+ err = vfs_symlink(dentry->d_inode, dnew, 5556+ err = vfs_symlink(dentry->d_inode, dnew,
5500+ path, mode, NULL); 5557+ path, mode, NULL);
5501 5558
5502 if (!err) { 5559 if (!err)
5503 if (EX_ISSYNC(fhp->fh_export)) 5560 if (EX_ISSYNC(fhp->fh_export))
5504@@ -1505,7 +1507,7 @@ nfsd_link(struct svc_rqst *rqstp, struct 5561@@ -1508,7 +1510,7 @@ nfsd_link(struct svc_rqst *rqstp, struct
5505 dold = tfhp->fh_dentry; 5562 dold = tfhp->fh_dentry;
5506 dest = dold->d_inode; 5563 dest = dold->d_inode;
5507 5564
5508- err = vfs_link(dold, dirp, dnew); 5565- err = vfs_link(dold, dirp, dnew);
5509+ err = vfs_link(dold, dirp, dnew, NULL); 5566+ err = vfs_link(dold, dirp, dnew, NULL);
5510 if (!err) { 5567 if (!err) {
5511 if (EX_ISSYNC(ffhp->fh_export)) { 5568 if (EX_ISSYNC(ffhp->fh_export)) {
5512 nfsd_sync_dir(ddir); 5569 err = nfserrno(nfsd_sync_dir(ddir));
5513@@ -1666,9 +1668,9 @@ nfsd_unlink(struct svc_rqst *rqstp, stru 5570@@ -1670,9 +1672,9 @@ nfsd_unlink(struct svc_rqst *rqstp, stru
5514 err = nfserr_perm; 5571 err = -EPERM;
5515 } else 5572 } else
5516 #endif 5573 #endif
5517- err = vfs_unlink(dirp, rdentry); 5574- err = vfs_unlink(dirp, rdentry);
5518+ err = vfs_unlink(dirp, rdentry, NULL); 5575+ err = vfs_unlink(dirp, rdentry, NULL);
5519 } else { /* It's RMDIR */ 5576 } else { /* It's RMDIR */
5520- err = vfs_rmdir(dirp, rdentry); 5577- err = vfs_rmdir(dirp, rdentry);
5521+ err = vfs_rmdir(dirp, rdentry, NULL); 5578+ err = vfs_rmdir(dirp, rdentry, NULL);
5522 } 5579 }
5523 5580
5524 dput(rdentry); 5581 dput(rdentry);
5525@@ -1780,7 +1782,8 @@ nfsd_permission(struct svc_export *exp, 5582@@ -1781,7 +1783,8 @@ nfsd_permission(struct svc_export *exp,
5526 */ 5583 */
5527 if (!(acc & MAY_LOCAL_ACCESS)) 5584 if (!(acc & MAY_LOCAL_ACCESS))
5528 if (acc & (MAY_WRITE | MAY_SATTR | MAY_TRUNC)) { 5585 if (acc & (MAY_WRITE | MAY_SATTR | MAY_TRUNC)) {
5529- if (EX_RDONLY(exp) || IS_RDONLY(inode)) 5586- if (EX_RDONLY(exp) || IS_RDONLY(inode))
5530+ if (EX_RDONLY(exp) || IS_RDONLY(inode) 5587+ if (EX_RDONLY(exp) || IS_RDONLY(inode)
5531+ || MNT_IS_RDONLY(exp->ex_mnt)) 5588+ || MNT_IS_RDONLY(exp->ex_mnt))
5532 return nfserr_rofs; 5589 return nfserr_rofs;
5533 if (/* (acc & MAY_WRITE) && */ IS_IMMUTABLE(inode)) 5590 if (/* (acc & MAY_WRITE) && */ IS_IMMUTABLE(inode))
5534 return nfserr_perm; 5591 return nfserr_perm;
5535Index: vserver-sources-2.0.2_2.6.15/fs/open.c 5592Index: linux-2.6.16/fs/open.c
5536=================================================================== 5593===================================================================
5537--- vserver-sources-2.0.2_2.6.15.orig/fs/open.c 5594--- linux-2.6.16.orig/fs/open.c
5538+++ vserver-sources-2.0.2_2.6.15/fs/open.c 5595+++ linux-2.6.16/fs/open.c
5539@@ -25,6 +25,9 @@ 5596@@ -27,6 +27,9 @@
5540 #include <linux/pagemap.h> 5597 #include <linux/pagemap.h>
5541 #include <linux/syscalls.h> 5598 #include <linux/syscalls.h>
5542 #include <linux/rcupdate.h> 5599 #include <linux/rcupdate.h>
5543+#include <linux/vs_limit.h> 5600+#include <linux/vs_limit.h>
5544+#include <linux/vs_dlimit.h> 5601+#include <linux/vs_dlimit.h>
5545+#include <linux/vserver/xid.h> 5602+#include <linux/vserver/xid.h>
5546 5603
5547 #include <asm/unistd.h> 5604 #include <asm/unistd.h>
5548 5605
5549@@ -43,6 +46,8 @@ int vfs_statfs(struct super_block *sb, s 5606@@ -45,6 +48,8 @@ int vfs_statfs(struct super_block *sb, s
5550 if (retval == 0 && buf->f_frsize == 0) 5607 if (retval == 0 && buf->f_frsize == 0)
5551 buf->f_frsize = buf->f_bsize; 5608 buf->f_frsize = buf->f_bsize;
5552 } 5609 }
5553+ if (!vx_check(0, VX_ADMIN|VX_WATCH)) 5610+ if (!vx_check(0, VX_ADMIN|VX_WATCH))
5554+ vx_vsi_statfs(sb, buf); 5611+ vx_vsi_statfs(sb, buf);
5555 } 5612 }
5556 return retval; 5613 return retval;
5557 } 5614 }
5558@@ -245,7 +250,7 @@ static inline long do_sys_truncate(const 5615@@ -248,7 +253,7 @@ static long do_sys_truncate(const char _
5559 goto dput_and_out; 5616 goto dput_and_out;
5560 5617
5561 error = -EROFS; 5618 error = -EROFS;
5562- if (IS_RDONLY(inode)) 5619- if (IS_RDONLY(inode))
5563+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(nd.mnt)) 5620+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(nd.mnt))
5564 goto dput_and_out; 5621 goto dput_and_out;
5565 5622
5566 error = -EPERM; 5623 error = -EPERM;
5567@@ -369,7 +374,7 @@ asmlinkage long sys_utime(char __user * 5624@@ -372,7 +377,7 @@ asmlinkage long sys_utime(char __user *
5568 inode = nd.dentry->d_inode; 5625 inode = nd.dentry->d_inode;
5569 5626
5570 error = -EROFS; 5627 error = -EROFS;
5571- if (IS_RDONLY(inode)) 5628- if (IS_RDONLY(inode))
5572+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(nd.mnt)) 5629+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(nd.mnt))
5573 goto dput_and_out; 5630 goto dput_and_out;
5574 5631
5575 /* Don't worry, the checks are done in inode_change_ok() */ 5632 /* Don't worry, the checks are done in inode_change_ok() */
5576@@ -426,7 +431,7 @@ long do_utimes(char __user * filename, s 5633@@ -429,7 +434,7 @@ long do_utimes(int dfd, char __user *fil
5577 inode = nd.dentry->d_inode; 5634 inode = nd.dentry->d_inode;
5578 5635
5579 error = -EROFS; 5636 error = -EROFS;
5580- if (IS_RDONLY(inode)) 5637- if (IS_RDONLY(inode))
5581+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(nd.mnt)) 5638+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(nd.mnt))
5582 goto dput_and_out; 5639 goto dput_and_out;
5583 5640
5584 /* Don't worry, the checks are done in inode_change_ok() */ 5641 /* Don't worry, the checks are done in inode_change_ok() */
5585@@ -508,7 +513,8 @@ asmlinkage long sys_access(const char __ 5642@@ -516,7 +521,8 @@ asmlinkage long sys_faccessat(int dfd, c
5586 if (!res) { 5643 if (!res) {
5587 res = vfs_permission(&nd, mode); 5644 res = vfs_permission(&nd, mode);
5588 /* SuS v2 requires we report a read only fs too */ 5645 /* SuS v2 requires we report a read only fs too */
5589- if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode) 5646- if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode)
5590+ if(!res && (mode & S_IWOTH) 5647+ if(!res && (mode & S_IWOTH)
5591+ && (IS_RDONLY(nd.dentry->d_inode) || MNT_IS_RDONLY(nd.mnt)) 5648+ && (IS_RDONLY(nd.dentry->d_inode) || MNT_IS_RDONLY(nd.mnt))
5592 && !special_file(nd.dentry->d_inode->i_mode)) 5649 && !special_file(nd.dentry->d_inode->i_mode))
5593 res = -EROFS; 5650 res = -EROFS;
5594 path_release(&nd); 5651 path_release(&nd);
5595@@ -614,7 +620,7 @@ asmlinkage long sys_fchmod(unsigned int 5652@@ -627,7 +633,7 @@ asmlinkage long sys_fchmod(unsigned int
5596 inode = dentry->d_inode; 5653 inode = dentry->d_inode;
5597 5654
5598 err = -EROFS; 5655 err = -EROFS;
5599- if (IS_RDONLY(inode)) 5656- if (IS_RDONLY(inode))
5600+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(file->f_vfsmnt)) 5657+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(file->f_vfsmnt))
5601 goto out_putf; 5658 goto out_putf;
5602 err = -EPERM; 5659 err = -EPERM;
5603 if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) 5660 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
5604@@ -646,7 +652,7 @@ asmlinkage long sys_chmod(const char __u 5661@@ -660,7 +666,7 @@ asmlinkage long sys_fchmodat(int dfd, co
5605 inode = nd.dentry->d_inode; 5662 inode = nd.dentry->d_inode;
5606 5663
5607 error = -EROFS; 5664 error = -EROFS;
5608- if (IS_RDONLY(inode)) 5665- if (IS_RDONLY(inode))
5609+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(nd.mnt)) 5666+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(nd.mnt))
5610 goto dput_and_out; 5667 goto dput_and_out;
5611 5668
5612 error = -EPERM; 5669 error = -EPERM;
5613@@ -667,7 +673,8 @@ out: 5670@@ -686,7 +692,8 @@ asmlinkage long sys_chmod(const char __u
5614 return error; 5671 return sys_fchmodat(AT_FDCWD, filename, mode);
5615 } 5672 }
5616 5673
5617-static int chown_common(struct dentry * dentry, uid_t user, gid_t group) 5674-static int chown_common(struct dentry * dentry, uid_t user, gid_t group)
5618+static int chown_common(struct dentry *dentry, struct vfsmount *mnt, 5675+static int chown_common(struct dentry *dentry, struct vfsmount *mnt,
5619+ uid_t user, gid_t group) 5676+ uid_t user, gid_t group)
5620 { 5677 {
5621 struct inode * inode; 5678 struct inode * inode;
5622 int error; 5679 int error;
5623@@ -679,7 +686,7 @@ static int chown_common(struct dentry * 5680@@ -698,7 +705,7 @@ static int chown_common(struct dentry *
5624 goto out; 5681 goto out;
5625 } 5682 }
5626 error = -EROFS; 5683 error = -EROFS;
5627- if (IS_RDONLY(inode)) 5684- if (IS_RDONLY(inode))
5628+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(mnt)) 5685+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(mnt))
5629 goto out; 5686 goto out;
5630 error = -EPERM; 5687 error = -EPERM;
5631 if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) 5688 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
5632@@ -687,11 +694,11 @@ static int chown_common(struct dentry * 5689@@ -706,11 +713,11 @@ static int chown_common(struct dentry *
5633 newattrs.ia_valid = ATTR_CTIME; 5690 newattrs.ia_valid = ATTR_CTIME;
5634 if (user != (uid_t) -1) { 5691 if (user != (uid_t) -1) {
5635 newattrs.ia_valid |= ATTR_UID; 5692 newattrs.ia_valid |= ATTR_UID;
5636- newattrs.ia_uid = user; 5693- newattrs.ia_uid = user;
5637+ newattrs.ia_uid = vx_map_uid(user); 5694+ newattrs.ia_uid = vx_map_uid(user);
5641- newattrs.ia_gid = group; 5698- newattrs.ia_gid = group;
5642+ newattrs.ia_gid = vx_map_gid(group); 5699+ newattrs.ia_gid = vx_map_gid(group);
5643 } 5700 }
5644 if (!S_ISDIR(inode->i_mode)) 5701 if (!S_ISDIR(inode->i_mode))
5645 newattrs.ia_valid |= ATTR_KILL_SUID|ATTR_KILL_SGID; 5702 newattrs.ia_valid |= ATTR_KILL_SUID|ATTR_KILL_SGID;
5646@@ -709,7 +716,7 @@ asmlinkage long sys_chown(const char __u 5703@@ -728,7 +735,7 @@ asmlinkage long sys_chown(const char __u
5647 5704
5648 error = user_path_walk(filename, &nd); 5705 error = user_path_walk(filename, &nd);
5649 if (!error) { 5706 if (!error) {
5650- error = chown_common(nd.dentry, user, group); 5707- error = chown_common(nd.dentry, user, group);
5651+ error = chown_common(nd.dentry, nd.mnt, user, group); 5708+ error = chown_common(nd.dentry, nd.mnt, user, group);
5652 path_release(&nd); 5709 path_release(&nd);
5653 } 5710 }
5654 return error; 5711 return error;
5712@@ -747,7 +754,7 @@ asmlinkage long sys_fchownat(int dfd, co
5713 follow = (flag & AT_SYMLINK_NOFOLLOW) ? 0 : LOOKUP_FOLLOW;
5714 error = __user_walk_fd(dfd, filename, follow, &nd);
5715 if (!error) {
5716- error = chown_common(nd.dentry, user, group);
5717+ error = chown_common(nd.dentry, nd.mnt, user, group);
5718 path_release(&nd);
5719 }
5720 out:
5655@@ -722,7 +729,7 @@ asmlinkage long sys_lchown(const char __ 5721@@ -761,7 +768,7 @@ asmlinkage long sys_lchown(const char __
5656 5722
5657 error = user_path_walk_link(filename, &nd); 5723 error = user_path_walk_link(filename, &nd);
5658 if (!error) { 5724 if (!error) {
5659- error = chown_common(nd.dentry, user, group); 5725- error = chown_common(nd.dentry, user, group);
5660+ error = chown_common(nd.dentry, nd.mnt, user, group); 5726+ error = chown_common(nd.dentry, nd.mnt, user, group);
5661 path_release(&nd); 5727 path_release(&nd);
5662 } 5728 }
5663 return error; 5729 return error;
5664@@ -736,7 +743,7 @@ asmlinkage long sys_fchown(unsigned int 5730@@ -775,7 +782,7 @@ asmlinkage long sys_fchown(unsigned int
5665 5731
5666 file = fget(fd); 5732 file = fget(fd);
5667 if (file) { 5733 if (file) {
5668- error = chown_common(file->f_dentry, user, group); 5734- error = chown_common(file->f_dentry, user, group);
5669+ error = chown_common(file->f_dentry, file->f_vfsmnt, user, group); 5735+ error = chown_common(file->f_dentry, file->f_vfsmnt, user, group);
5670 fput(file); 5736 fput(file);
5671 } 5737 }
5672 return error; 5738 return error;
5673@@ -954,6 +961,7 @@ repeat: 5739@@ -999,6 +1006,7 @@ repeat:
5674 FD_SET(fd, fdt->open_fds); 5740 FD_SET(fd, fdt->open_fds);
5675 FD_CLR(fd, fdt->close_on_exec); 5741 FD_CLR(fd, fdt->close_on_exec);
5676 fdt->next_fd = fd + 1; 5742 fdt->next_fd = fd + 1;
5677+ vx_openfd_inc(fd); 5743+ vx_openfd_inc(fd);
5678 #if 1 5744 #if 1
5679 /* Sanity check */ 5745 /* Sanity check */
5680 if (fdt->fd[fd] != NULL) { 5746 if (fdt->fd[fd] != NULL) {
5681@@ -976,6 +984,7 @@ static inline void __put_unused_fd(struc 5747@@ -1021,6 +1029,7 @@ static void __put_unused_fd(struct files
5682 __FD_CLR(fd, fdt->open_fds); 5748 __FD_CLR(fd, fdt->open_fds);
5683 if (fd < fdt->next_fd) 5749 if (fd < fdt->next_fd)
5684 fdt->next_fd = fd; 5750 fdt->next_fd = fd;
5685+ vx_openfd_dec(fd); 5751+ vx_openfd_dec(fd);
5686 } 5752 }
5687 5753
5688 void fastcall put_unused_fd(unsigned int fd) 5754 void fastcall put_unused_fd(unsigned int fd)
5689Index: vserver-sources-2.0.2_2.6.15/fs/proc/array.c 5755Index: linux-2.6.16/fs/proc/array.c
5690=================================================================== 5756===================================================================
5691--- vserver-sources-2.0.2_2.6.15.orig/fs/proc/array.c 5757--- linux-2.6.16.orig/fs/proc/array.c
5692+++ vserver-sources-2.0.2_2.6.15/fs/proc/array.c 5758+++ linux-2.6.16/fs/proc/array.c
5693@@ -75,6 +75,9 @@ 5759@@ -75,6 +75,9 @@
5694 #include <linux/times.h> 5760 #include <linux/times.h>
5695 #include <linux/cpuset.h> 5761 #include <linux/cpuset.h>
5696 #include <linux/rcupdate.h> 5762 #include <linux/rcupdate.h>
5697+#include <linux/vs_context.h> 5763+#include <linux/vs_context.h>
5802+ buffer += sprintf (buffer,"ipv4root_bcast: 0\n"); 5868+ buffer += sprintf (buffer,"ipv4root_bcast: 0\n");
5803+ } 5869+ }
5804+ put_nx_info(nxi); 5870+ put_nx_info(nxi);
5805+#endif 5871+#endif
5806+skip: 5872+skip:
5807 #if defined(CONFIG_ARCH_S390) 5873 #if defined(CONFIG_S390)
5808 buffer = task_show_regs(task, buffer); 5874 buffer = task_show_regs(task, buffer);
5809 #endif 5875 #endif
5810@@ -322,7 +378,7 @@ static int do_task_stat(struct task_stru 5876@@ -322,7 +378,7 @@ static int do_task_stat(struct task_stru
5811 sigset_t sigign, sigcatch; 5877 sigset_t sigign, sigcatch;
5812 char state; 5878 char state;
5816 int num_threads = 0; 5882 int num_threads = 0;
5817 struct mm_struct *mm; 5883 struct mm_struct *mm;
5818 unsigned long long start_time; 5884 unsigned long long start_time;
5819@@ -388,7 +444,11 @@ static int do_task_stat(struct task_stru 5885@@ -388,7 +444,11 @@ static int do_task_stat(struct task_stru
5820 } 5886 }
5821 it_real_value = task->signal->it_real_value; 5887 it_real_value = task->signal->real_timer.expires;
5822 } 5888 }
5823- ppid = pid_alive(task) ? task->group_leader->real_parent->tgid : 0; 5889- ppid = pid_alive(task) ? task->group_leader->real_parent->tgid : 0;
5824+ pid = vx_info_map_pid(task->vx_info, pid_alive(task) ? task->pid : 0); 5890+ pid = vx_info_map_pid(task->vx_info, pid_alive(task) ? task->pid : 0);
5825+ ppid = (!(pid > 1)) ? 0 : vx_info_map_tgid(task->vx_info, 5891+ ppid = (!(pid > 1)) ? 0 : vx_info_map_tgid(task->vx_info,
5826+ task->group_leader->real_parent->tgid); 5892+ task->group_leader->real_parent->tgid);
5850- task->pid, 5916- task->pid,
5851+ pid, 5917+ pid,
5852 tcomm, 5918 tcomm,
5853 state, 5919 state,
5854 ppid, 5920 ppid,
5855Index: vserver-sources-2.0.2_2.6.15/fs/proc/base.c 5921Index: linux-2.6.16/fs/proc/base.c
5856=================================================================== 5922===================================================================
5857--- vserver-sources-2.0.2_2.6.15.orig/fs/proc/base.c 5923--- linux-2.6.16.orig/fs/proc/base.c
5858+++ vserver-sources-2.0.2_2.6.15/fs/proc/base.c 5924+++ linux-2.6.16/fs/proc/base.c
5859@@ -71,6 +71,8 @@ 5925@@ -72,6 +72,8 @@
5860 #include <linux/cpuset.h> 5926 #include <linux/cpuset.h>
5861 #include <linux/audit.h> 5927 #include <linux/audit.h>
5862 #include <linux/poll.h> 5928 #include <linux/poll.h>
5863+#include <linux/vs_cvirt.h> 5929+#include <linux/vs_cvirt.h>
5864+#include <linux/vs_network.h> 5930+#include <linux/vs_network.h>
5865 #include "internal.h" 5931 #include "internal.h"
5866 5932
5867 /* 5933 /*
5868@@ -120,6 +122,8 @@ enum pid_directory_inos { 5934@@ -121,6 +123,8 @@ enum pid_directory_inos {
5869 PROC_TGID_ATTR_EXEC, 5935 PROC_TGID_ATTR_EXEC,
5870 PROC_TGID_ATTR_FSCREATE, 5936 PROC_TGID_ATTR_FSCREATE,
5871 #endif 5937 #endif
5872+ PROC_TGID_VX_INFO, 5938+ PROC_TGID_VX_INFO,
5873+ PROC_TGID_IP_INFO, 5939+ PROC_TGID_IP_INFO,
5874 #ifdef CONFIG_AUDITSYSCALL 5940 #ifdef CONFIG_AUDITSYSCALL
5875 PROC_TGID_LOGINUID, 5941 PROC_TGID_LOGINUID,
5876 #endif 5942 #endif
5877@@ -160,6 +164,8 @@ enum pid_directory_inos { 5943@@ -161,6 +165,8 @@ enum pid_directory_inos {
5878 PROC_TID_ATTR_EXEC, 5944 PROC_TID_ATTR_EXEC,
5879 PROC_TID_ATTR_FSCREATE, 5945 PROC_TID_ATTR_FSCREATE,
5880 #endif 5946 #endif
5881+ PROC_TID_VX_INFO, 5947+ PROC_TID_VX_INFO,
5882+ PROC_TID_IP_INFO, 5948+ PROC_TID_IP_INFO,
5883 #ifdef CONFIG_AUDITSYSCALL 5949 #ifdef CONFIG_AUDITSYSCALL
5884 PROC_TID_LOGINUID, 5950 PROC_TID_LOGINUID,
5885 #endif 5951 #endif
5886@@ -215,6 +221,8 @@ static struct pid_entry tgid_base_stuff[ 5952@@ -216,6 +222,8 @@ static struct pid_entry tgid_base_stuff[
5887 #ifdef CONFIG_CPUSETS 5953 #ifdef CONFIG_CPUSETS
5888 E(PROC_TGID_CPUSET, "cpuset", S_IFREG|S_IRUGO), 5954 E(PROC_TGID_CPUSET, "cpuset", S_IFREG|S_IRUGO),
5889 #endif 5955 #endif
5890+ E(PROC_TGID_VX_INFO, "vinfo", S_IFREG|S_IRUGO), 5956+ E(PROC_TGID_VX_INFO, "vinfo", S_IFREG|S_IRUGO),
5891+ E(PROC_TGID_IP_INFO, "ninfo", S_IFREG|S_IRUGO), 5957+ E(PROC_TGID_IP_INFO, "ninfo", S_IFREG|S_IRUGO),
5892 E(PROC_TGID_OOM_SCORE, "oom_score",S_IFREG|S_IRUGO), 5958 E(PROC_TGID_OOM_SCORE, "oom_score",S_IFREG|S_IRUGO),
5893 E(PROC_TGID_OOM_ADJUST,"oom_adj", S_IFREG|S_IRUGO|S_IWUSR), 5959 E(PROC_TGID_OOM_ADJUST,"oom_adj", S_IFREG|S_IRUGO|S_IWUSR),
5894 #ifdef CONFIG_AUDITSYSCALL 5960 #ifdef CONFIG_AUDITSYSCALL
5895@@ -257,6 +265,8 @@ static struct pid_entry tid_base_stuff[] 5961@@ -258,6 +266,8 @@ static struct pid_entry tid_base_stuff[]
5896 #ifdef CONFIG_CPUSETS 5962 #ifdef CONFIG_CPUSETS
5897 E(PROC_TID_CPUSET, "cpuset", S_IFREG|S_IRUGO), 5963 E(PROC_TID_CPUSET, "cpuset", S_IFREG|S_IRUGO),
5898 #endif 5964 #endif
5899+ E(PROC_TID_VX_INFO, "vinfo", S_IFREG|S_IRUGO), 5965+ E(PROC_TID_VX_INFO, "vinfo", S_IFREG|S_IRUGO),
5900+ E(PROC_TID_IP_INFO, "ninfo", S_IFREG|S_IRUGO), 5966+ E(PROC_TID_IP_INFO, "ninfo", S_IFREG|S_IRUGO),
5901 E(PROC_TID_OOM_SCORE, "oom_score",S_IFREG|S_IRUGO), 5967 E(PROC_TID_OOM_SCORE, "oom_score",S_IFREG|S_IRUGO),
5902 E(PROC_TID_OOM_ADJUST, "oom_adj", S_IFREG|S_IRUGO|S_IWUSR), 5968 E(PROC_TID_OOM_ADJUST, "oom_adj", S_IFREG|S_IRUGO|S_IWUSR),
5903 #ifdef CONFIG_AUDITSYSCALL 5969 #ifdef CONFIG_AUDITSYSCALL
5904@@ -530,12 +540,19 @@ static int proc_oom_score(struct task_st 5970@@ -537,6 +547,11 @@ static int proc_check_chroot(struct dent
5905
5906 /* If the process being read is separated by chroot from the reading process,
5907 * don't let the reader access the threads.
5908+ *
5909+ * note: this does dput(root) and mntput(vfsmnt) on exit.
5910 */
5911 static int proc_check_chroot(struct dentry *root, struct vfsmount *vfsmnt)
5912 {
5913 struct dentry *de, *base; 5971 struct dentry *de, *base;
5914 struct vfsmount *our_vfsmnt, *mnt; 5972 struct vfsmount *our_vfsmnt, *mnt;
5915 int res = 0; 5973 int res = 0;
5916+ 5974+
5917+ /* context admin override */ 5975+ /* context admin override */
5919+ goto override; 5977+ goto override;
5920+ 5978+
5921 read_lock(&current->fs->lock); 5979 read_lock(&current->fs->lock);
5922 our_vfsmnt = mntget(current->fs->rootmnt); 5980 our_vfsmnt = mntget(current->fs->rootmnt);
5923 base = dget(current->fs->root); 5981 base = dget(current->fs->root);
5924@@ -545,11 +562,11 @@ static int proc_check_chroot(struct dent 5982@@ -546,11 +561,11 @@ static int proc_check_chroot(struct dent
5925 de = root; 5983 de = root;
5926 mnt = vfsmnt; 5984 mnt = vfsmnt;
5927 5985
5928- while (vfsmnt != our_vfsmnt) { 5986- while (vfsmnt != our_vfsmnt) {
5929- if (vfsmnt == vfsmnt->mnt_parent) 5987- if (vfsmnt == vfsmnt->mnt_parent)
5935+ de = mnt->mnt_mountpoint; 5993+ de = mnt->mnt_mountpoint;
5936+ mnt = mnt->mnt_parent; 5994+ mnt = mnt->mnt_parent;
5937 } 5995 }
5938 5996
5939 if (!is_subdir(de, base)) 5997 if (!is_subdir(de, base))
5940@@ -559,8 +576,9 @@ static int proc_check_chroot(struct dent 5998@@ -560,8 +575,9 @@ static int proc_check_chroot(struct dent
5941 exit: 5999 exit:
5942 dput(base); 6000 dput(base);
5943 mntput(our_vfsmnt); 6001 mntput(our_vfsmnt);
5944+override: 6002+override:
5945 dput(root); 6003 dput(root);
5946- mntput(mnt); 6004- mntput(mnt);
5947+ mntput(vfsmnt); 6005+ mntput(vfsmnt);
5948 return res; 6006 return res;
5949 out: 6007 out:
5950 spin_unlock(&vfsmount_lock); 6008 spin_unlock(&vfsmount_lock);
5951@@ -1220,7 +1238,7 @@ static int proc_pident_readdir(struct fi 6009@@ -1221,7 +1237,7 @@ static int proc_pident_readdir(struct fi
5952 struct inode *inode = dentry->d_inode; 6010 struct inode *inode = dentry->d_inode;
5953 struct pid_entry *p; 6011 struct pid_entry *p;
5954 ino_t ino; 6012 ino_t ino;
5955- int ret; 6013- int ret;
5956+ int ret, hide; 6014+ int ret, hide;
5957 6015
5958 ret = -ENOENT; 6016 ret = -ENOENT;
5959 if (!pid_alive(proc_task(inode))) 6017 if (!pid_alive(proc_task(inode)))
5960@@ -1251,11 +1269,20 @@ static int proc_pident_readdir(struct fi 6018@@ -1252,11 +1268,20 @@ static int proc_pident_readdir(struct fi
5961 goto out; 6019 goto out;
5962 } 6020 }
5963 p = ents + i; 6021 p = ents + i;
5964+ hide = vx_flags(VXF_INFO_HIDE, 0); 6022+ hide = vx_flags(VXF_INFO_HIDE, 0);
5965 while (p->name) { 6023 while (p->name) {
5976 filp->f_pos++; 6034 filp->f_pos++;
5977+ skip: 6035+ skip:
5978 p++; 6036 p++;
5979 } 6037 }
5980 } 6038 }
5981@@ -1329,6 +1356,7 @@ static struct inode *proc_pid_make_inode 6039@@ -1330,6 +1355,7 @@ static struct inode *proc_pid_make_inode
5982 inode->i_uid = task->euid; 6040 inode->i_uid = task->euid;
5983 inode->i_gid = task->egid; 6041 inode->i_gid = task->egid;
5984 } 6042 }
5985+ inode->i_xid = vx_task_xid(task); 6043+ inode->i_xid = vx_task_xid(task);
5986 security_task_to_inode(task, inode); 6044 security_task_to_inode(task, inode);
5987 6045
5988 out: 6046 out:
5989@@ -1354,6 +1382,11 @@ static int pid_revalidate(struct dentry 6047@@ -1355,6 +1381,11 @@ static int pid_revalidate(struct dentry
5990 { 6048 {
5991 struct inode *inode = dentry->d_inode; 6049 struct inode *inode = dentry->d_inode;
5992 struct task_struct *task = proc_task(inode); 6050 struct task_struct *task = proc_task(inode);
5993+ 6051+
5994+ if (!vx_check(vx_task_xid(task), VX_IDENT)) 6052+ if (!vx_check(vx_task_xid(task), VX_IDENT))
5996+ /* discard wrong fakeinit */ 6054+ /* discard wrong fakeinit */
5997+ 6055+
5998 if (pid_alive(task)) { 6056 if (pid_alive(task)) {
5999 if (proc_type(inode) == PROC_TGID_INO || proc_type(inode) == PROC_TID_INO || task_dumpable(task)) { 6057 if (proc_type(inode) == PROC_TGID_INO || proc_type(inode) == PROC_TID_INO || task_dumpable(task)) {
6000 inode->i_uid = task->euid; 6058 inode->i_uid = task->euid;
6001@@ -1365,6 +1398,7 @@ static int pid_revalidate(struct dentry 6059@@ -1366,6 +1397,7 @@ static int pid_revalidate(struct dentry
6002 security_task_to_inode(task, inode); 6060 security_task_to_inode(task, inode);
6003 return 1; 6061 return 1;
6004 } 6062 }
6005+out_drop: 6063+out_drop:
6006 d_drop(dentry); 6064 d_drop(dentry);
6007 return 0; 6065 return 0;
6008 } 6066 }
6009@@ -1599,6 +1633,9 @@ static struct file_operations proc_tgid_ 6067@@ -1600,6 +1632,9 @@ static struct file_operations proc_tgid_
6010 static struct inode_operations proc_tgid_attr_inode_operations; 6068 static struct inode_operations proc_tgid_attr_inode_operations;
6011 #endif 6069 #endif
6012 6070
6013+extern int proc_pid_vx_info(struct task_struct *, char *); 6071+extern int proc_pid_vx_info(struct task_struct *, char *);
6014+extern int proc_pid_nx_info(struct task_struct *, char *); 6072+extern int proc_pid_nx_info(struct task_struct *, char *);
6015+ 6073+
6016 static int get_tid_list(int index, unsigned int *tids, struct inode *dir); 6074 static int get_tid_list(int index, unsigned int *tids, struct inode *dir);
6017 6075
6018 /* SMP-safe */ 6076 /* SMP-safe */
6019@@ -1786,15 +1823,33 @@ static struct dentry *proc_pident_lookup 6077@@ -1787,15 +1822,33 @@ static struct dentry *proc_pident_lookup
6020 inode->i_fop = &proc_loginuid_operations; 6078 inode->i_fop = &proc_loginuid_operations;
6021 break; 6079 break;
6022 #endif 6080 #endif
6023+ case PROC_TID_VX_INFO: 6081+ case PROC_TID_VX_INFO:
6024+ case PROC_TGID_VX_INFO: 6082+ case PROC_TGID_VX_INFO:
6050+out_put: 6108+out_put:
6051+ iput(inode); 6109+ iput(inode);
6052 out: 6110 out:
6053 return ERR_PTR(error); 6111 return ERR_PTR(error);
6054 } 6112 }
6055@@ -1878,14 +1933,14 @@ static int proc_self_readlink(struct den 6113@@ -1879,14 +1932,14 @@ static int proc_self_readlink(struct den
6056 int buflen) 6114 int buflen)
6057 { 6115 {
6058 char tmp[30]; 6116 char tmp[30];
6059- sprintf(tmp, "%d", current->tgid); 6117- sprintf(tmp, "%d", current->tgid);
6060+ sprintf(tmp, "%d", vx_map_tgid(current->tgid)); 6118+ sprintf(tmp, "%d", vx_map_tgid(current->tgid));
6067- sprintf(tmp, "%d", current->tgid); 6125- sprintf(tmp, "%d", current->tgid);
6068+ sprintf(tmp, "%d", vx_map_tgid(current->tgid)); 6126+ sprintf(tmp, "%d", vx_map_tgid(current->tgid));
6069 return ERR_PTR(vfs_follow_link(nd,tmp)); 6127 return ERR_PTR(vfs_follow_link(nd,tmp));
6070 } 6128 }
6071 6129
6072@@ -1948,6 +2003,20 @@ void proc_pid_flush(struct dentry *proc_ 6130@@ -1949,6 +2002,20 @@ void proc_pid_flush(struct dentry *proc_
6073 } 6131 }
6074 } 6132 }
6075 6133
6076+#define VXF_FAKE_INIT (VXF_INFO_INIT|VXF_STATE_INIT) 6134+#define VXF_FAKE_INIT (VXF_INFO_INIT|VXF_STATE_INIT)
6077+ 6135+
6088+} 6146+}
6089+ 6147+
6090 /* SMP-safe */ 6148 /* SMP-safe */
6091 struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd) 6149 struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd)
6092 { 6150 {
6093@@ -1984,13 +2053,14 @@ struct dentry *proc_pid_lookup(struct in 6151@@ -1985,13 +2052,14 @@ struct dentry *proc_pid_lookup(struct in
6094 if (!task) 6152 if (!task)
6095 goto out; 6153 goto out;
6096 6154
6097- inode = proc_pid_make_inode(dir->i_sb, task, PROC_TGID_INO); 6155- inode = proc_pid_make_inode(dir->i_sb, task, PROC_TGID_INO);
6098+ /* check for context visibility */ 6156+ /* check for context visibility */
6108- goto out; 6166- goto out;
6109- } 6167- }
6110 inode->i_mode = S_IFDIR|S_IRUGO|S_IXUGO; 6168 inode->i_mode = S_IFDIR|S_IRUGO|S_IXUGO;
6111 inode->i_op = &proc_tgid_base_inode_operations; 6169 inode->i_op = &proc_tgid_base_inode_operations;
6112 inode->i_fop = &proc_tgid_base_operations; 6170 inode->i_fop = &proc_tgid_base_operations;
6113@@ -2019,6 +2089,8 @@ struct dentry *proc_pid_lookup(struct in 6171@@ -2020,6 +2088,8 @@ struct dentry *proc_pid_lookup(struct in
6114 goto out; 6172 goto out;
6115 } 6173 }
6116 return NULL; 6174 return NULL;
6117+out_drop_task: 6175+out_drop_task:
6118+ put_task_struct(task); 6176+ put_task_struct(task);
6119 out: 6177 out:
6120 return ERR_PTR(-ENOENT); 6178 return ERR_PTR(-ENOENT);
6121 } 6179 }
6122@@ -2034,6 +2106,8 @@ static struct dentry *proc_task_lookup(s 6180@@ -2035,6 +2105,8 @@ static struct dentry *proc_task_lookup(s
6123 tid = name_to_int(dentry); 6181 tid = name_to_int(dentry);
6124 if (tid == ~0U) 6182 if (tid == ~0U)
6125 goto out; 6183 goto out;
6126+ if (vx_current_initpid(tid)) 6184+ if (vx_current_initpid(tid))
6127+ goto out; 6185+ goto out;
6128 6186
6129 read_lock(&tasklist_lock); 6187 read_lock(&tasklist_lock);
6130 task = find_task_by_pid(tid); 6188 task = find_task_by_pid(tid);
6131@@ -2045,11 +2119,14 @@ static struct dentry *proc_task_lookup(s 6189@@ -2046,11 +2118,14 @@ static struct dentry *proc_task_lookup(s
6132 if (leader->tgid != task->tgid) 6190 if (leader->tgid != task->tgid)
6133 goto out_drop_task; 6191 goto out_drop_task;
6134 6192
6135- inode = proc_pid_make_inode(dir->i_sb, task, PROC_TID_INO); 6193- inode = proc_pid_make_inode(dir->i_sb, task, PROC_TID_INO);
6136- 6194-
6143 goto out_drop_task; 6201 goto out_drop_task;
6144+ 6202+
6145 inode->i_mode = S_IFDIR|S_IRUGO|S_IXUGO; 6203 inode->i_mode = S_IFDIR|S_IRUGO|S_IXUGO;
6146 inode->i_op = &proc_tid_base_inode_operations; 6204 inode->i_op = &proc_tid_base_inode_operations;
6147 inode->i_fop = &proc_tid_base_operations; 6205 inode->i_fop = &proc_tid_base_operations;
6148@@ -2089,7 +2166,7 @@ static int get_tgid_list(int index, unsi 6206@@ -2090,7 +2165,7 @@ static int get_tgid_list(int index, unsi
6149 read_lock(&tasklist_lock); 6207 read_lock(&tasklist_lock);
6150 p = NULL; 6208 p = NULL;
6151 if (version) { 6209 if (version) {
6152- p = find_task_by_pid(version); 6210- p = find_task_by_pid(version);
6153+ p = find_task_by_real_pid(version); 6211+ p = find_task_by_real_pid(version);
6154 if (p && !thread_group_leader(p)) 6212 if (p && !thread_group_leader(p))
6155 p = NULL; 6213 p = NULL;
6156 } 6214 }
6157@@ -2101,11 +2178,15 @@ static int get_tgid_list(int index, unsi 6215@@ -2102,11 +2177,15 @@ static int get_tgid_list(int index, unsi
6158 6216
6159 for ( ; p != &init_task; p = next_task(p)) { 6217 for ( ; p != &init_task; p = next_task(p)) {
6160 int tgid = p->pid; 6218 int tgid = p->pid;
6161+ 6219+
6162 if (!pid_alive(p)) 6220 if (!pid_alive(p))
6169- tgids[nr_tgids] = tgid; 6227- tgids[nr_tgids] = tgid;
6170+ tgids[nr_tgids] = vx_map_tgid(tgid); 6228+ tgids[nr_tgids] = vx_map_tgid(tgid);
6171 nr_tgids++; 6229 nr_tgids++;
6172 if (nr_tgids >= PROC_MAXPIDS) 6230 if (nr_tgids >= PROC_MAXPIDS)
6173 break; 6231 break;
6174@@ -2135,10 +2216,13 @@ static int get_tid_list(int index, unsig 6232@@ -2136,10 +2215,13 @@ static int get_tid_list(int index, unsig
6175 if (pid_alive(task)) do { 6233 if (pid_alive(task)) do {
6176 int tid = task->pid; 6234 int tid = task->pid;
6177 6235
6178+ /* check for context visibility */ 6236+ /* check for context visibility */
6179+ if (!proc_pid_visible(task, tid)) 6237+ if (!proc_pid_visible(task, tid))
6184- tids[nr_tids] = tid; 6242- tids[nr_tids] = tid;
6185+ tids[nr_tids] = vx_map_pid(tid); 6243+ tids[nr_tids] = vx_map_pid(tid);
6186 nr_tids++; 6244 nr_tids++;
6187 if (nr_tids >= PROC_MAXPIDS) 6245 if (nr_tids >= PROC_MAXPIDS)
6188 break; 6246 break;
6189@@ -2214,11 +2298,14 @@ static int proc_task_readdir(struct file 6247@@ -2215,11 +2297,14 @@ static int proc_task_readdir(struct file
6190 unsigned int nr_tids, i; 6248 unsigned int nr_tids, i;
6191 struct dentry *dentry = filp->f_dentry; 6249 struct dentry *dentry = filp->f_dentry;
6192 struct inode *inode = dentry->d_inode; 6250 struct inode *inode = dentry->d_inode;
6193+ struct task_struct *task = proc_task(inode); 6251+ struct task_struct *task = proc_task(inode);
6194 int retval = -ENOENT; 6252 int retval = -ENOENT;
6200+ goto out; 6258+ goto out;
6201+ if (!pid_alive(task)) 6259+ if (!pid_alive(task))
6202 goto out; 6260 goto out;
6203 retval = 0; 6261 retval = 0;
6204 6262
6205Index: vserver-sources-2.0.2_2.6.15/fs/proc/generic.c 6263Index: linux-2.6.16/fs/proc/generic.c
6206=================================================================== 6264===================================================================
6207--- vserver-sources-2.0.2_2.6.15.orig/fs/proc/generic.c 6265--- linux-2.6.16.orig/fs/proc/generic.c
6208+++ vserver-sources-2.0.2_2.6.15/fs/proc/generic.c 6266+++ linux-2.6.16/fs/proc/generic.c
6209@@ -19,6 +19,7 @@ 6267@@ -19,6 +19,7 @@
6210 #include <linux/idr.h> 6268 #include <linux/idr.h>
6211 #include <linux/namei.h> 6269 #include <linux/namei.h>
6212 #include <linux/bitops.h> 6270 #include <linux/bitops.h>
6213+#include <linux/vserver/inode.h> 6271+#include <linux/vserver/inode.h>
6214 #include <asm/uaccess.h> 6272 #include <asm/uaccess.h>
6215 6273
6216 static ssize_t proc_file_read(struct file *file, char __user *buf, 6274 #include "internal.h"
6217@@ -383,11 +384,15 @@ struct dentry *proc_lookup(struct inode 6275@@ -385,11 +386,15 @@ struct dentry *proc_lookup(struct inode
6218 for (de = de->subdir; de ; de = de->next) { 6276 for (de = de->subdir; de ; de = de->next) {
6219 if (de->namelen != dentry->d_name.len) 6277 if (de->namelen != dentry->d_name.len)
6220 continue; 6278 continue;
6221+ if (!vx_hide_check(0, de->vx_flags)) 6279+ if (!vx_hide_check(0, de->vx_flags))
6222+ continue; 6280+ continue;
6228+ /* generic proc entries belong to the host */ 6286+ /* generic proc entries belong to the host */
6229+ inode->i_xid = 0; 6287+ inode->i_xid = 0;
6230 break; 6288 break;
6231 } 6289 }
6232 } 6290 }
6233@@ -459,9 +464,12 @@ int proc_readdir(struct file * filp, 6291@@ -461,9 +466,12 @@ int proc_readdir(struct file * filp,
6234 } 6292 }
6235 6293
6236 do { 6294 do {
6237+ if (!vx_hide_check(0, de->vx_flags)) 6295+ if (!vx_hide_check(0, de->vx_flags))
6238+ goto skip; 6296+ goto skip;
6241 goto out; 6299 goto out;
6242+ skip: 6300+ skip:
6243 filp->f_pos++; 6301 filp->f_pos++;
6244 de = de->next; 6302 de = de->next;
6245 } while (de); 6303 } while (de);
6246@@ -579,6 +587,7 @@ static struct proc_dir_entry *proc_creat 6304@@ -581,6 +589,7 @@ static struct proc_dir_entry *proc_creat
6247 ent->namelen = len; 6305 ent->namelen = len;
6248 ent->mode = mode; 6306 ent->mode = mode;
6249 ent->nlink = nlink; 6307 ent->nlink = nlink;
6250+ ent->vx_flags = IATTR_PROC_DEFAULT; 6308+ ent->vx_flags = IATTR_PROC_DEFAULT;
6251 out: 6309 out:
6252 return ent; 6310 return ent;
6253 } 6311 }
6254@@ -599,7 +608,8 @@ struct proc_dir_entry *proc_symlink(cons 6312@@ -601,7 +610,8 @@ struct proc_dir_entry *proc_symlink(cons
6255 kfree(ent->data); 6313 kfree(ent->data);
6256 kfree(ent); 6314 kfree(ent);
6257 ent = NULL; 6315 ent = NULL;
6258- } 6316- }
6259+ } else 6317+ } else
6260+ ent->vx_flags = IATTR_PROC_SYMLINK; 6318+ ent->vx_flags = IATTR_PROC_SYMLINK;
6261 } else { 6319 } else {
6262 kfree(ent); 6320 kfree(ent);
6263 ent = NULL; 6321 ent = NULL;
6264Index: vserver-sources-2.0.2_2.6.15/fs/proc/inode.c 6322Index: linux-2.6.16/fs/proc/inode.c
6265=================================================================== 6323===================================================================
6266--- vserver-sources-2.0.2_2.6.15.orig/fs/proc/inode.c 6324--- linux-2.6.16.orig/fs/proc/inode.c
6267+++ vserver-sources-2.0.2_2.6.15/fs/proc/inode.c 6325+++ linux-2.6.16/fs/proc/inode.c
6268@@ -170,6 +170,8 @@ struct inode *proc_get_inode(struct supe 6326@@ -170,6 +170,8 @@ struct inode *proc_get_inode(struct supe
6269 inode->i_uid = de->uid; 6327 inode->i_uid = de->uid;
6270 inode->i_gid = de->gid; 6328 inode->i_gid = de->gid;
6271 } 6329 }
6272+ if (de->vx_flags) 6330+ if (de->vx_flags)
6273+ PROC_I(inode)->vx_flags = de->vx_flags; 6331+ PROC_I(inode)->vx_flags = de->vx_flags;
6274 if (de->size) 6332 if (de->size)
6275 inode->i_size = de->size; 6333 inode->i_size = de->size;
6276 if (de->nlink) 6334 if (de->nlink)
6277Index: vserver-sources-2.0.2_2.6.15/fs/proc/proc_misc.c 6335Index: linux-2.6.16/fs/proc/proc_misc.c
6278=================================================================== 6336===================================================================
6279--- vserver-sources-2.0.2_2.6.15.orig/fs/proc/proc_misc.c 6337--- linux-2.6.16.orig/fs/proc/proc_misc.c
6280+++ vserver-sources-2.0.2_2.6.15/fs/proc/proc_misc.c 6338+++ linux-2.6.16/fs/proc/proc_misc.c
6281@@ -52,6 +52,8 @@ 6339@@ -53,6 +53,8 @@
6282 #include <asm/div64.h> 6340 #include <asm/div64.h>
6283 #include "internal.h" 6341 #include "internal.h"
6284 6342
6285+#include <linux/vs_cvirt.h> 6343+#include <linux/vs_cvirt.h>
6286+ 6344+
6354+ vx_new_uts(release), 6412+ vx_new_uts(release),
6355+ vx_new_uts(version)); 6413+ vx_new_uts(version));
6356 return proc_calc_metrics(page, start, off, count, eof, len); 6414 return proc_calc_metrics(page, start, off, count, eof, len);
6357 } 6415 }
6358 6416
6359Index: vserver-sources-2.0.2_2.6.15/fs/proc/root.c 6417Index: linux-2.6.16/fs/proc/root.c
6360=================================================================== 6418===================================================================
6361--- vserver-sources-2.0.2_2.6.15.orig/fs/proc/root.c 6419--- linux-2.6.16.orig/fs/proc/root.c
6362+++ vserver-sources-2.0.2_2.6.15/fs/proc/root.c 6420+++ linux-2.6.16/fs/proc/root.c
6363@@ -23,6 +23,9 @@ struct proc_dir_entry *proc_net, *proc_n 6421@@ -25,6 +25,9 @@ struct proc_dir_entry *proc_net, *proc_n
6364 #ifdef CONFIG_SYSCTL 6422 #ifdef CONFIG_SYSCTL
6365 struct proc_dir_entry *proc_sys_root; 6423 struct proc_dir_entry *proc_sys_root;
6366 #endif 6424 #endif
6367+struct proc_dir_entry *proc_virtual; 6425+struct proc_dir_entry *proc_virtual;
6368+ 6426+
6369+extern void proc_vx_init(void); 6427+extern void proc_vx_init(void);
6370 6428
6371 static struct super_block *proc_get_sb(struct file_system_type *fs_type, 6429 static struct super_block *proc_get_sb(struct file_system_type *fs_type,
6372 int flags, const char *dev_name, void *data) 6430 int flags, const char *dev_name, void *data)
6373@@ -77,6 +80,7 @@ void __init proc_root_init(void) 6431@@ -78,6 +81,7 @@ void __init proc_root_init(void)
6374 proc_device_tree_init(); 6432 proc_device_tree_init();
6375 #endif 6433 #endif
6376 proc_bus = proc_mkdir("bus", NULL); 6434 proc_bus = proc_mkdir("bus", NULL);
6377+ proc_vx_init(); 6435+ proc_vx_init();
6378 } 6436 }
6379 6437
6380 static struct dentry *proc_root_lookup(struct inode * dir, struct dentry * dentry, struct nameidata *nd) 6438 static int proc_root_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat
6381Index: vserver-sources-2.0.2_2.6.15/fs/quota.c 6439Index: linux-2.6.16/fs/quota.c
6382=================================================================== 6440===================================================================
6383--- vserver-sources-2.0.2_2.6.15.orig/fs/quota.c 6441--- linux-2.6.16.orig/fs/quota.c
6384+++ vserver-sources-2.0.2_2.6.15/fs/quota.c 6442+++ linux-2.6.16/fs/quota.c
6385@@ -16,6 +16,9 @@ 6443@@ -17,6 +17,9 @@
6386 #include <linux/syscalls.h>
6387 #include <linux/buffer_head.h> 6444 #include <linux/buffer_head.h>
6445 #include <linux/capability.h>
6388 #include <linux/quotaops.h> 6446 #include <linux/quotaops.h>
6389+#include <linux/major.h> 6447+#include <linux/major.h>
6390+#include <linux/blkdev.h> 6448+#include <linux/blkdev.h>
6391+#include <linux/vserver/debug.h> 6449+#include <linux/vserver/debug.h>
6392 6450
6393 /* Check validity of generic quotactl commands */ 6451 /* Check validity of generic quotactl commands */
6394 static int generic_quotactl_valid(struct super_block *sb, int type, int cmd, qid_t id) 6452 static int generic_quotactl_valid(struct super_block *sb, int type, int cmd, qid_t id)
6395@@ -80,11 +83,11 @@ static int generic_quotactl_valid(struct 6453@@ -81,11 +84,11 @@ static int generic_quotactl_valid(struct
6396 if (cmd == Q_GETQUOTA) { 6454 if (cmd == Q_GETQUOTA) {
6397 if (((type == USRQUOTA && current->euid != id) || 6455 if (((type == USRQUOTA && current->euid != id) ||
6398 (type == GRPQUOTA && !in_egroup_p(id))) && 6456 (type == GRPQUOTA && !in_egroup_p(id))) &&
6399- !capable(CAP_SYS_ADMIN)) 6457- !capable(CAP_SYS_ADMIN))
6400+ !capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_QUOTA_CTL)) 6458+ !capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_QUOTA_CTL))
6404- if (!capable(CAP_SYS_ADMIN)) 6462- if (!capable(CAP_SYS_ADMIN))
6405+ if (!capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_QUOTA_CTL)) 6463+ if (!capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_QUOTA_CTL))
6406 return -EPERM; 6464 return -EPERM;
6407 6465
6408 return 0; 6466 return 0;
6409@@ -131,10 +134,10 @@ static int xqm_quotactl_valid(struct sup 6467@@ -132,10 +135,10 @@ static int xqm_quotactl_valid(struct sup
6410 if (cmd == Q_XGETQUOTA) { 6468 if (cmd == Q_XGETQUOTA) {
6411 if (((type == XQM_USRQUOTA && current->euid != id) || 6469 if (((type == XQM_USRQUOTA && current->euid != id) ||
6412 (type == XQM_GRPQUOTA && !in_egroup_p(id))) && 6470 (type == XQM_GRPQUOTA && !in_egroup_p(id))) &&
6413- !capable(CAP_SYS_ADMIN)) 6471- !capable(CAP_SYS_ADMIN))
6414+ !capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_QUOTA_CTL)) 6472+ !capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_QUOTA_CTL))
6417- if (!capable(CAP_SYS_ADMIN)) 6475- if (!capable(CAP_SYS_ADMIN))
6418+ if (!capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_QUOTA_CTL)) 6476+ if (!capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_QUOTA_CTL))
6419 return -EPERM; 6477 return -EPERM;
6420 } 6478 }
6421 6479
6422@@ -336,6 +339,43 @@ static int do_quotactl(struct super_bloc 6480@@ -337,6 +340,43 @@ static int do_quotactl(struct super_bloc
6423 return 0; 6481 return 0;
6424 } 6482 }
6425 6483
6426+#if defined(CONFIG_BLK_DEV_VROOT) || defined(CONFIG_BLK_DEV_VROOT_MODULE) 6484+#if defined(CONFIG_BLK_DEV_VROOT) || defined(CONFIG_BLK_DEV_VROOT_MODULE)
6427+ 6485+
6461+#endif 6519+#endif
6462+ 6520+
6463 /* 6521 /*
6464 * This is the system call interface. This communicates with 6522 * This is the system call interface. This communicates with
6465 * the user-level programs. Currently this only supports diskquota 6523 * the user-level programs. Currently this only supports diskquota
6466@@ -361,6 +401,23 @@ asmlinkage long sys_quotactl(unsigned in 6524@@ -362,6 +402,23 @@ asmlinkage long sys_quotactl(unsigned in
6467 putname(tmp); 6525 putname(tmp);
6468 if (IS_ERR(bdev)) 6526 if (IS_ERR(bdev))
6469 return PTR_ERR(bdev); 6527 return PTR_ERR(bdev);
6470+#if defined(CONFIG_BLK_DEV_VROOT) || defined(CONFIG_BLK_DEV_VROOT_MODULE) 6528+#if defined(CONFIG_BLK_DEV_VROOT) || defined(CONFIG_BLK_DEV_VROOT_MODULE)
6471+ if (bdev && bdev->bd_inode && 6529+ if (bdev && bdev->bd_inode &&
6485+ } 6543+ }
6486+#endif 6544+#endif
6487 sb = get_super(bdev); 6545 sb = get_super(bdev);
6488 bdput(bdev); 6546 bdput(bdev);
6489 if (!sb) 6547 if (!sb)
6490Index: vserver-sources-2.0.2_2.6.15/fs/reiserfs/bitmap.c 6548Index: linux-2.6.16/fs/read_write.c
6491=================================================================== 6549===================================================================
6492--- vserver-sources-2.0.2_2.6.15.orig/fs/reiserfs/bitmap.c 6550--- linux-2.6.16.orig/fs/read_write.c
6493+++ vserver-sources-2.0.2_2.6.15/fs/reiserfs/bitmap.c 6551+++ linux-2.6.16/fs/read_write.c
6552@@ -667,9 +667,8 @@ static ssize_t do_sendfile(int out_fd, i
6553 if (!(in_file->f_mode & FMODE_PREAD))
6554 goto fput_in;
6555 retval = rw_verify_area(READ, in_file, ppos, count);
6556- if (retval < 0)
6557+ if (retval)
6558 goto fput_in;
6559- count = retval;
6560
6561 retval = security_file_permission (in_file, MAY_READ);
6562 if (retval)
6563@@ -689,9 +688,8 @@ static ssize_t do_sendfile(int out_fd, i
6564 goto fput_out;
6565 out_inode = out_file->f_dentry->d_inode;
6566 retval = rw_verify_area(WRITE, out_file, &out_file->f_pos, count);
6567- if (retval < 0)
6568+ if (retval)
6569 goto fput_out;
6570- count = retval;
6571
6572 retval = security_file_permission (out_file, MAY_WRITE);
6573 if (retval)
6574Index: linux-2.6.16/fs/reiserfs/bitmap.c
6575===================================================================
6576--- linux-2.6.16.orig/fs/reiserfs/bitmap.c
6577+++ linux-2.6.16/fs/reiserfs/bitmap.c
6494@@ -13,6 +13,7 @@ 6578@@ -13,6 +13,7 @@
6495 #include <linux/reiserfs_fs_sb.h> 6579 #include <linux/reiserfs_fs_sb.h>
6496 #include <linux/reiserfs_fs_i.h> 6580 #include <linux/reiserfs_fs_i.h>
6497 #include <linux/quotaops.h> 6581 #include <linux/quotaops.h>
6498+#include <linux/vs_dlimit.h> 6582+#include <linux/vs_dlimit.h>
6585+ DLIMIT_FREE_BLOCK(hint->inode, blocks); 6669+ DLIMIT_FREE_BLOCK(hint->inode, blocks);
6586+ DQUOT_FREE_BLOCK_NODIRTY(hint->inode, blocks); 6670+ DQUOT_FREE_BLOCK_NODIRTY(hint->inode, blocks);
6587 } 6671 }
6588 6672
6589 return CARRY_ON; 6673 return CARRY_ON;
6590Index: vserver-sources-2.0.2_2.6.15/fs/reiserfs/file.c 6674Index: linux-2.6.16/fs/reiserfs/file.c
6591=================================================================== 6675===================================================================
6592--- vserver-sources-2.0.2_2.6.15.orig/fs/reiserfs/file.c 6676--- linux-2.6.16.orig/fs/reiserfs/file.c
6593+++ vserver-sources-2.0.2_2.6.15/fs/reiserfs/file.c 6677+++ linux-2.6.16/fs/reiserfs/file.c
6594@@ -1567,4 +1567,5 @@ struct inode_operations reiserfs_file_in 6678@@ -1586,4 +1586,5 @@ struct inode_operations reiserfs_file_in
6595 .listxattr = reiserfs_listxattr, 6679 .listxattr = reiserfs_listxattr,
6596 .removexattr = reiserfs_removexattr, 6680 .removexattr = reiserfs_removexattr,
6597 .permission = reiserfs_permission, 6681 .permission = reiserfs_permission,
6598+ .sync_flags = reiserfs_sync_flags, 6682+ .sync_flags = reiserfs_sync_flags,
6599 }; 6683 };
6600Index: vserver-sources-2.0.2_2.6.15/fs/reiserfs/inode.c 6684Index: linux-2.6.16/fs/reiserfs/inode.c
6601=================================================================== 6685===================================================================
6602--- vserver-sources-2.0.2_2.6.15.orig/fs/reiserfs/inode.c 6686--- linux-2.6.16.orig/fs/reiserfs/inode.c
6603+++ vserver-sources-2.0.2_2.6.15/fs/reiserfs/inode.c 6687+++ linux-2.6.16/fs/reiserfs/inode.c
6604@@ -17,6 +17,8 @@ 6688@@ -17,6 +17,8 @@
6605 #include <linux/mpage.h> 6689 #include <linux/mpage.h>
6606 #include <linux/writeback.h> 6690 #include <linux/writeback.h>
6607 #include <linux/quotaops.h> 6691 #include <linux/quotaops.h>
6608+#include <linux/vs_dlimit.h> 6692+#include <linux/vs_dlimit.h>
6615 if (!err) 6699 if (!err)
6616 DQUOT_FREE_INODE(inode); 6700 DQUOT_FREE_INODE(inode);
6617+ DLIMIT_FREE_INODE(inode); 6701+ DLIMIT_FREE_INODE(inode);
6618 6702
6619 if (journal_end(&th, inode->i_sb, jbegin_count)) { 6703 if (journal_end(&th, inode->i_sb, jbegin_count)) {
6620 up(&inode->i_sem); 6704 mutex_unlock(&inode->i_mutex);
6621@@ -1130,6 +1133,8 @@ static void init_inode(struct inode *ino 6705@@ -1126,6 +1129,8 @@ static void init_inode(struct inode *ino
6622 struct buffer_head *bh; 6706 struct buffer_head *bh;
6623 struct item_head *ih; 6707 struct item_head *ih;
6624 __u32 rdev; 6708 __u32 rdev;
6625+ uid_t uid; 6709+ uid_t uid;
6626+ gid_t gid; 6710+ gid_t gid;
6627 //int version = ITEM_VERSION_1; 6711 //int version = ITEM_VERSION_1;
6628 6712
6629 bh = PATH_PLAST_BUFFER(path); 6713 bh = PATH_PLAST_BUFFER(path);
6630@@ -1153,12 +1158,13 @@ static void init_inode(struct inode *ino 6714@@ -1149,12 +1154,13 @@ static void init_inode(struct inode *ino
6631 (struct stat_data_v1 *)B_I_PITEM(bh, ih); 6715 (struct stat_data_v1 *)B_I_PITEM(bh, ih);
6632 unsigned long blocks; 6716 unsigned long blocks;
6633 6717
6634+ uid = sd_v1_uid(sd); 6718+ uid = sd_v1_uid(sd);
6635+ gid = sd_v1_gid(sd); 6719+ gid = sd_v1_gid(sd);
6641- inode->i_uid = sd_v1_uid(sd); 6725- inode->i_uid = sd_v1_uid(sd);
6642- inode->i_gid = sd_v1_gid(sd); 6726- inode->i_gid = sd_v1_gid(sd);
6643 inode->i_size = sd_v1_size(sd); 6727 inode->i_size = sd_v1_size(sd);
6644 inode->i_atime.tv_sec = sd_v1_atime(sd); 6728 inode->i_atime.tv_sec = sd_v1_atime(sd);
6645 inode->i_mtime.tv_sec = sd_v1_mtime(sd); 6729 inode->i_mtime.tv_sec = sd_v1_mtime(sd);
6646@@ -1200,11 +1206,12 @@ static void init_inode(struct inode *ino 6730@@ -1196,11 +1202,12 @@ static void init_inode(struct inode *ino
6647 // (directories and symlinks) 6731 // (directories and symlinks)
6648 struct stat_data *sd = (struct stat_data *)B_I_PITEM(bh, ih); 6732 struct stat_data *sd = (struct stat_data *)B_I_PITEM(bh, ih);
6649 6733
6650+ uid = sd_v2_uid(sd); 6734+ uid = sd_v2_uid(sd);
6651+ gid = sd_v2_gid(sd); 6735+ gid = sd_v2_gid(sd);
6656 inode->i_size = sd_v2_size(sd); 6740 inode->i_size = sd_v2_size(sd);
6657- inode->i_gid = sd_v2_gid(sd); 6741- inode->i_gid = sd_v2_gid(sd);
6658 inode->i_mtime.tv_sec = sd_v2_mtime(sd); 6742 inode->i_mtime.tv_sec = sd_v2_mtime(sd);
6659 inode->i_atime.tv_sec = sd_v2_atime(sd); 6743 inode->i_atime.tv_sec = sd_v2_atime(sd);
6660 inode->i_ctime.tv_sec = sd_v2_ctime(sd); 6744 inode->i_ctime.tv_sec = sd_v2_ctime(sd);
6661@@ -1234,6 +1241,10 @@ static void init_inode(struct inode *ino 6745@@ -1230,6 +1237,10 @@ static void init_inode(struct inode *ino
6662 sd_attrs_to_i_attrs(sd_v2_attrs(sd), inode); 6746 sd_attrs_to_i_attrs(sd_v2_attrs(sd), inode);
6663 } 6747 }
6664 6748
6665+ inode->i_uid = INOXID_UID(XID_TAG(inode), uid, gid); 6749+ inode->i_uid = INOXID_UID(XID_TAG(inode), uid, gid);
6666+ inode->i_gid = INOXID_GID(XID_TAG(inode), uid, gid); 6750+ inode->i_gid = INOXID_GID(XID_TAG(inode), uid, gid);
6667+ inode->i_xid = INOXID_XID(XID_TAG(inode), uid, gid, 0); 6751+ inode->i_xid = INOXID_XID(XID_TAG(inode), uid, gid, 0);
6668+ 6752+
6669 pathrelse(path); 6753 pathrelse(path);
6670 if (S_ISREG(inode->i_mode)) { 6754 if (S_ISREG(inode->i_mode)) {
6671 inode->i_op = &reiserfs_file_inode_operations; 6755 inode->i_op = &reiserfs_file_inode_operations;
6672@@ -1256,13 +1267,15 @@ static void init_inode(struct inode *ino 6756@@ -1252,13 +1263,15 @@ static void init_inode(struct inode *ino
6673 static void inode2sd(void *sd, struct inode *inode, loff_t size) 6757 static void inode2sd(void *sd, struct inode *inode, loff_t size)
6674 { 6758 {
6675 struct stat_data *sd_v2 = (struct stat_data *)sd; 6759 struct stat_data *sd_v2 = (struct stat_data *)sd;
6676+ uid_t uid = XIDINO_UID(XID_TAG(inode), inode->i_uid, inode->i_xid); 6760+ uid_t uid = XIDINO_UID(XID_TAG(inode), inode->i_uid, inode->i_xid);
6677+ gid_t gid = XIDINO_GID(XID_TAG(inode), inode->i_gid, inode->i_xid); 6761+ gid_t gid = XIDINO_GID(XID_TAG(inode), inode->i_gid, inode->i_xid);
6685 set_sd_v2_size(sd_v2, size); 6769 set_sd_v2_size(sd_v2, size);
6686- set_sd_v2_gid(sd_v2, inode->i_gid); 6770- set_sd_v2_gid(sd_v2, inode->i_gid);
6687 set_sd_v2_mtime(sd_v2, inode->i_mtime.tv_sec); 6771 set_sd_v2_mtime(sd_v2, inode->i_mtime.tv_sec);
6688 set_sd_v2_atime(sd_v2, inode->i_atime.tv_sec); 6772 set_sd_v2_atime(sd_v2, inode->i_atime.tv_sec);
6689 set_sd_v2_ctime(sd_v2, inode->i_ctime.tv_sec); 6773 set_sd_v2_ctime(sd_v2, inode->i_ctime.tv_sec);
6690@@ -1793,6 +1806,10 @@ int reiserfs_new_inode(struct reiserfs_t 6774@@ -1789,6 +1802,10 @@ int reiserfs_new_inode(struct reiserfs_t
6691 6775
6692 BUG_ON(!th->t_trans_id); 6776 BUG_ON(!th->t_trans_id);
6693 6777
6694+ if (DLIMIT_ALLOC_INODE(inode)) { 6778+ if (DLIMIT_ALLOC_INODE(inode)) {
6695+ err = -ENOSPC; 6779+ err = -ENOSPC;
6696+ goto out_bad_dlimit; 6780+ goto out_bad_dlimit;
6697+ } 6781+ }
6698 if (DQUOT_ALLOC_INODE(inode)) { 6782 if (DQUOT_ALLOC_INODE(inode)) {
6699 err = -EDQUOT; 6783 err = -EDQUOT;
6700 goto out_end_trans; 6784 goto out_end_trans;
6701@@ -1978,6 +1995,9 @@ int reiserfs_new_inode(struct reiserfs_t 6785@@ -1974,6 +1991,9 @@ int reiserfs_new_inode(struct reiserfs_t
6702 DQUOT_FREE_INODE(inode); 6786 DQUOT_FREE_INODE(inode);
6703 6787
6704 out_end_trans: 6788 out_end_trans:
6705+ DLIMIT_FREE_INODE(inode); 6789+ DLIMIT_FREE_INODE(inode);
6706+ 6790+
6707+ out_bad_dlimit: 6791+ out_bad_dlimit:
6708 journal_end(th, th->t_super, th->t_blocks_allocated); 6792 journal_end(th, th->t_super, th->t_blocks_allocated);
6709 /* Drop can be outside and it needs more credits so it's better to have it outside */ 6793 /* Drop can be outside and it needs more credits so it's better to have it outside */
6710 DQUOT_DROP(inode); 6794 DQUOT_DROP(inode);
6711@@ -2698,6 +2718,14 @@ void sd_attrs_to_i_attrs(__u16 sd_attrs, 6795@@ -2701,6 +2721,14 @@ void sd_attrs_to_i_attrs(__u16 sd_attrs,
6712 inode->i_flags |= S_IMMUTABLE; 6796 inode->i_flags |= S_IMMUTABLE;
6713 else 6797 else
6714 inode->i_flags &= ~S_IMMUTABLE; 6798 inode->i_flags &= ~S_IMMUTABLE;
6715+ if (sd_attrs & REISERFS_IUNLINK_FL) 6799+ if (sd_attrs & REISERFS_IUNLINK_FL)
6716+ inode->i_flags |= S_IUNLINK; 6800+ inode->i_flags |= S_IUNLINK;
6721+ else 6805+ else
6722+ inode->i_flags &= ~S_BARRIER; 6806+ inode->i_flags &= ~S_BARRIER;
6723 if (sd_attrs & REISERFS_APPEND_FL) 6807 if (sd_attrs & REISERFS_APPEND_FL)
6724 inode->i_flags |= S_APPEND; 6808 inode->i_flags |= S_APPEND;
6725 else 6809 else
6726@@ -2720,6 +2748,14 @@ void i_attrs_to_sd_attrs(struct inode *i 6810@@ -2723,6 +2751,14 @@ void i_attrs_to_sd_attrs(struct inode *i
6727 *sd_attrs |= REISERFS_IMMUTABLE_FL; 6811 *sd_attrs |= REISERFS_IMMUTABLE_FL;
6728 else 6812 else
6729 *sd_attrs &= ~REISERFS_IMMUTABLE_FL; 6813 *sd_attrs &= ~REISERFS_IMMUTABLE_FL;
6730+ if (inode->i_flags & S_IUNLINK) 6814+ if (inode->i_flags & S_IUNLINK)
6731+ *sd_attrs |= REISERFS_IUNLINK_FL; 6815+ *sd_attrs |= REISERFS_IUNLINK_FL;
6736+ else 6820+ else
6737+ *sd_attrs &= ~REISERFS_BARRIER_FL; 6821+ *sd_attrs &= ~REISERFS_BARRIER_FL;
6738 if (inode->i_flags & S_SYNC) 6822 if (inode->i_flags & S_SYNC)
6739 *sd_attrs |= REISERFS_SYNC_FL; 6823 *sd_attrs |= REISERFS_SYNC_FL;
6740 else 6824 else
6741@@ -2895,6 +2931,22 @@ static ssize_t reiserfs_direct_IO(int rw 6825@@ -2900,6 +2936,22 @@ static ssize_t reiserfs_direct_IO(int rw
6742 reiserfs_get_blocks_direct_io, NULL); 6826 reiserfs_get_blocks_direct_io, NULL);
6743 } 6827 }
6744 6828
6745+int reiserfs_sync_flags(struct inode *inode) 6829+int reiserfs_sync_flags(struct inode *inode)
6746+{ 6830+{
6759+} 6843+}
6760+ 6844+
6761 int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) 6845 int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
6762 { 6846 {
6763 struct inode *inode = dentry->d_inode; 6847 struct inode *inode = dentry->d_inode;
6764@@ -2939,9 +2991,11 @@ int reiserfs_setattr(struct dentry *dent 6848@@ -2944,9 +2996,11 @@ int reiserfs_setattr(struct dentry *dent
6765 } 6849 }
6766 6850
6767 error = inode_change_ok(inode, attr); 6851 error = inode_change_ok(inode, attr);
6768+ 6852+
6769 if (!error) { 6853 if (!error) {
6772+ (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid) || 6856+ (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid) ||
6773+ (ia_valid & ATTR_XID && attr->ia_xid != inode->i_xid)) { 6857+ (ia_valid & ATTR_XID && attr->ia_xid != inode->i_xid)) {
6774 error = reiserfs_chown_xattrs(inode, attr); 6858 error = reiserfs_chown_xattrs(inode, attr);
6775 6859
6776 if (!error) { 6860 if (!error) {
6777@@ -2971,6 +3025,9 @@ int reiserfs_setattr(struct dentry *dent 6861@@ -2976,6 +3030,9 @@ int reiserfs_setattr(struct dentry *dent
6778 inode->i_uid = attr->ia_uid; 6862 inode->i_uid = attr->ia_uid;
6779 if (attr->ia_valid & ATTR_GID) 6863 if (attr->ia_valid & ATTR_GID)
6780 inode->i_gid = attr->ia_gid; 6864 inode->i_gid = attr->ia_gid;
6781+ if ((attr->ia_valid & ATTR_XID) && 6865+ if ((attr->ia_valid & ATTR_XID) &&
6782+ IS_TAGXID(inode)) 6866+ IS_TAGXID(inode))
6783+ inode->i_xid = attr->ia_xid; 6867+ inode->i_xid = attr->ia_xid;
6784 mark_inode_dirty(inode); 6868 mark_inode_dirty(inode);
6785 error = 6869 error =
6786 journal_end(&th, inode->i_sb, jbegin_count); 6870 journal_end(&th, inode->i_sb, jbegin_count);
6787Index: vserver-sources-2.0.2_2.6.15/fs/reiserfs/ioctl.c 6871Index: linux-2.6.16/fs/reiserfs/ioctl.c
6788=================================================================== 6872===================================================================
6789--- vserver-sources-2.0.2_2.6.15.orig/fs/reiserfs/ioctl.c 6873--- linux-2.6.16.orig/fs/reiserfs/ioctl.c
6790+++ vserver-sources-2.0.2_2.6.15/fs/reiserfs/ioctl.c 6874+++ linux-2.6.16/fs/reiserfs/ioctl.c
6791@@ -3,6 +3,7 @@ 6875@@ -4,6 +4,7 @@
6792 */
6793 6876
6877 #include <linux/capability.h>
6794 #include <linux/fs.h> 6878 #include <linux/fs.h>
6795+#include <linux/mount.h> 6879+#include <linux/mount.h>
6796 #include <linux/reiserfs_fs.h> 6880 #include <linux/reiserfs_fs.h>
6797 #include <linux/time.h> 6881 #include <linux/time.h>
6798 #include <asm/uaccess.h> 6882 #include <asm/uaccess.h>
6799@@ -22,7 +23,7 @@ static int reiserfs_unpack(struct inode 6883@@ -23,7 +24,7 @@ static int reiserfs_unpack(struct inode
6800 int reiserfs_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, 6884 int reiserfs_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
6801 unsigned long arg) 6885 unsigned long arg)
6802 { 6886 {
6803- unsigned int flags; 6887- unsigned int flags;
6804+ unsigned int flags, oldflags; 6888+ unsigned int flags, oldflags;
6805 6889
6806 switch (cmd) { 6890 switch (cmd) {
6807 case REISERFS_IOC_UNPACK: 6891 case REISERFS_IOC_UNPACK:
6808@@ -41,12 +42,14 @@ int reiserfs_ioctl(struct inode *inode, 6892@@ -42,12 +43,14 @@ int reiserfs_ioctl(struct inode *inode,
6809 6893
6810 flags = REISERFS_I(inode)->i_attrs; 6894 flags = REISERFS_I(inode)->i_attrs;
6811 i_attrs_to_sd_attrs(inode, (__u16 *) & flags); 6895 i_attrs_to_sd_attrs(inode, (__u16 *) & flags);
6812+ flags &= REISERFS_FL_USER_VISIBLE; 6896+ flags &= REISERFS_FL_USER_VISIBLE;
6813 return put_user(flags, (int __user *)arg); 6897 return put_user(flags, (int __user *)arg);
6819+ if (IS_RDONLY(inode) || 6903+ if (IS_RDONLY(inode) ||
6820+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt))) 6904+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
6821 return -EROFS; 6905 return -EROFS;
6822 6906
6823 if ((current->fsuid != inode->i_uid) 6907 if ((current->fsuid != inode->i_uid)
6824@@ -56,10 +59,12 @@ int reiserfs_ioctl(struct inode *inode, 6908@@ -57,10 +60,12 @@ int reiserfs_ioctl(struct inode *inode,
6825 if (get_user(flags, (int __user *)arg)) 6909 if (get_user(flags, (int __user *)arg))
6826 return -EFAULT; 6910 return -EFAULT;
6827 6911
6828- if (((flags ^ REISERFS_I(inode)-> 6912- if (((flags ^ REISERFS_I(inode)->
6829- i_attrs) & (REISERFS_IMMUTABLE_FL | 6913- i_attrs) & (REISERFS_IMMUTABLE_FL |
6836+ REISERFS_APPEND_FL))) && 6920+ REISERFS_APPEND_FL))) &&
6837+ !capable(CAP_LINUX_IMMUTABLE)) 6921+ !capable(CAP_LINUX_IMMUTABLE))
6838 return -EPERM; 6922 return -EPERM;
6839 6923
6840 if ((flags & REISERFS_NOTAIL_FL) && 6924 if ((flags & REISERFS_NOTAIL_FL) &&
6841@@ -70,6 +75,9 @@ int reiserfs_ioctl(struct inode *inode, 6925@@ -71,6 +76,9 @@ int reiserfs_ioctl(struct inode *inode,
6842 if (result) 6926 if (result)
6843 return result; 6927 return result;
6844 } 6928 }
6845+ 6929+
6846+ flags = flags & REISERFS_FL_USER_MODIFIABLE; 6930+ flags = flags & REISERFS_FL_USER_MODIFIABLE;
6847+ flags |= oldflags & ~REISERFS_FL_USER_MODIFIABLE; 6931+ flags |= oldflags & ~REISERFS_FL_USER_MODIFIABLE;
6848 sd_attrs_to_i_attrs(flags, inode); 6932 sd_attrs_to_i_attrs(flags, inode);
6849 REISERFS_I(inode)->i_attrs = flags; 6933 REISERFS_I(inode)->i_attrs = flags;
6850 inode->i_ctime = CURRENT_TIME_SEC; 6934 inode->i_ctime = CURRENT_TIME_SEC;
6851@@ -81,7 +89,8 @@ int reiserfs_ioctl(struct inode *inode, 6935@@ -82,7 +90,8 @@ int reiserfs_ioctl(struct inode *inode,
6852 case REISERFS_IOC_SETVERSION: 6936 case REISERFS_IOC_SETVERSION:
6853 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER)) 6937 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
6854 return -EPERM; 6938 return -EPERM;
6855- if (IS_RDONLY(inode)) 6939- if (IS_RDONLY(inode))
6856+ if (IS_RDONLY(inode) || 6940+ if (IS_RDONLY(inode) ||
6857+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt))) 6941+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
6858 return -EROFS; 6942 return -EROFS;
6859 if (get_user(inode->i_generation, (int __user *)arg)) 6943 if (get_user(inode->i_generation, (int __user *)arg))
6860 return -EFAULT; 6944 return -EFAULT;
6861Index: vserver-sources-2.0.2_2.6.15/fs/reiserfs/namei.c 6945Index: linux-2.6.16/fs/reiserfs/namei.c
6862=================================================================== 6946===================================================================
6863--- vserver-sources-2.0.2_2.6.15.orig/fs/reiserfs/namei.c 6947--- linux-2.6.16.orig/fs/reiserfs/namei.c
6864+++ vserver-sources-2.0.2_2.6.15/fs/reiserfs/namei.c 6948+++ linux-2.6.16/fs/reiserfs/namei.c
6865@@ -19,6 +19,7 @@ 6949@@ -19,6 +19,7 @@
6866 #include <linux/reiserfs_xattr.h> 6950 #include <linux/reiserfs_xattr.h>
6867 #include <linux/smp_lock.h> 6951 #include <linux/smp_lock.h>
6868 #include <linux/quotaops.h> 6952 #include <linux/quotaops.h>
6869+#include <linux/vserver/xid.h> 6953+#include <linux/vserver/xid.h>
6876 } 6960 }
6877+ vx_propagate_xid(nd, inode); 6961+ vx_propagate_xid(nd, inode);
6878 6962
6879 /* Propogate the priv_object flag so we know we're in the priv tree */ 6963 /* Propogate the priv_object flag so we know we're in the priv tree */
6880 if (is_reiserfs_priv_object(dir)) 6964 if (is_reiserfs_priv_object(dir))
6881@@ -604,6 +606,7 @@ static int new_inode_init(struct inode * 6965@@ -600,6 +602,7 @@ static int new_inode_init(struct inode *
6882 } else { 6966 } else {
6883 inode->i_gid = current->fsgid; 6967 inode->i_gid = current->fsgid;
6884 } 6968 }
6885+ inode->i_xid = vx_current_fsxid(inode->i_sb); 6969+ inode->i_xid = vx_current_fsxid(inode->i_sb);
6886 DQUOT_INIT(inode); 6970 DQUOT_INIT(inode);
6887 return 0; 6971 return 0;
6888 } 6972 }
6889@@ -1550,6 +1553,7 @@ struct inode_operations reiserfs_dir_ino 6973@@ -1546,6 +1549,7 @@ struct inode_operations reiserfs_dir_ino
6890 .listxattr = reiserfs_listxattr, 6974 .listxattr = reiserfs_listxattr,
6891 .removexattr = reiserfs_removexattr, 6975 .removexattr = reiserfs_removexattr,
6892 .permission = reiserfs_permission, 6976 .permission = reiserfs_permission,
6893+ .sync_flags = reiserfs_sync_flags, 6977+ .sync_flags = reiserfs_sync_flags,
6894 }; 6978 };
6895 6979
6896 /* 6980 /*
6897@@ -1566,6 +1570,7 @@ struct inode_operations reiserfs_symlink 6981@@ -1562,6 +1566,7 @@ struct inode_operations reiserfs_symlink
6898 .listxattr = reiserfs_listxattr, 6982 .listxattr = reiserfs_listxattr,
6899 .removexattr = reiserfs_removexattr, 6983 .removexattr = reiserfs_removexattr,
6900 .permission = reiserfs_permission, 6984 .permission = reiserfs_permission,
6901+ .sync_flags = reiserfs_sync_flags, 6985+ .sync_flags = reiserfs_sync_flags,
6902 6986
6903 }; 6987 };
6904 6988
6905@@ -1579,5 +1584,6 @@ struct inode_operations reiserfs_special 6989@@ -1575,5 +1580,6 @@ struct inode_operations reiserfs_special
6906 .listxattr = reiserfs_listxattr, 6990 .listxattr = reiserfs_listxattr,
6907 .removexattr = reiserfs_removexattr, 6991 .removexattr = reiserfs_removexattr,
6908 .permission = reiserfs_permission, 6992 .permission = reiserfs_permission,
6909+ .sync_flags = reiserfs_sync_flags, 6993+ .sync_flags = reiserfs_sync_flags,
6910 6994
6911 }; 6995 };
6912Index: vserver-sources-2.0.2_2.6.15/fs/reiserfs/stree.c 6996Index: linux-2.6.16/fs/reiserfs/stree.c
6913=================================================================== 6997===================================================================
6914--- vserver-sources-2.0.2_2.6.15.orig/fs/reiserfs/stree.c 6998--- linux-2.6.16.orig/fs/reiserfs/stree.c
6915+++ vserver-sources-2.0.2_2.6.15/fs/reiserfs/stree.c 6999+++ linux-2.6.16/fs/reiserfs/stree.c
6916@@ -57,6 +57,7 @@ 7000@@ -57,6 +57,7 @@
6917 #include <linux/smp_lock.h> 7001 #include <linux/smp_lock.h>
6918 #include <linux/buffer_head.h> 7002 #include <linux/buffer_head.h>
6919 #include <linux/quotaops.h> 7003 #include <linux/quotaops.h>
6920+#include <linux/vs_dlimit.h> 7004+#include <linux/vs_dlimit.h>
6986+ DLIMIT_FREE_SPACE(inode, quota_bytes); 7070+ DLIMIT_FREE_SPACE(inode, quota_bytes);
6987 DQUOT_FREE_SPACE_NODIRTY(inode, quota_bytes); 7071 DQUOT_FREE_SPACE_NODIRTY(inode, quota_bytes);
6988+ } 7072+ }
6989 return retval; 7073 return retval;
6990 } 7074 }
6991Index: vserver-sources-2.0.2_2.6.15/fs/reiserfs/super.c 7075Index: linux-2.6.16/fs/reiserfs/super.c
6992=================================================================== 7076===================================================================
6993--- vserver-sources-2.0.2_2.6.15.orig/fs/reiserfs/super.c 7077--- linux-2.6.16.orig/fs/reiserfs/super.c
6994+++ vserver-sources-2.0.2_2.6.15/fs/reiserfs/super.c 7078+++ linux-2.6.16/fs/reiserfs/super.c
6995@@ -888,6 +888,9 @@ static int reiserfs_parse_options(struct 7079@@ -882,6 +882,9 @@ static int reiserfs_parse_options(struct
6996 {"user_xattr",.setmask = 1 << REISERFS_UNSUPPORTED_OPT}, 7080 {"user_xattr",.setmask = 1 << REISERFS_UNSUPPORTED_OPT},
6997 {"nouser_xattr",.clrmask = 1 << REISERFS_UNSUPPORTED_OPT}, 7081 {"nouser_xattr",.clrmask = 1 << REISERFS_UNSUPPORTED_OPT},
6998 #endif 7082 #endif
6999+#ifndef CONFIG_INOXID_NONE 7083+#ifndef CONFIG_INOXID_NONE
7000+ {"tagxid",.setmask = 1 << REISERFS_TAGXID}, 7084+ {"tagxid",.setmask = 1 << REISERFS_TAGXID},
7001+#endif 7085+#endif
7002 #ifdef CONFIG_REISERFS_FS_POSIX_ACL 7086 #ifdef CONFIG_REISERFS_FS_POSIX_ACL
7003 {"acl",.setmask = 1 << REISERFS_POSIXACL}, 7087 {"acl",.setmask = 1 << REISERFS_POSIXACL},
7004 {"noacl",.clrmask = 1 << REISERFS_POSIXACL}, 7088 {"noacl",.clrmask = 1 << REISERFS_POSIXACL},
7005@@ -1162,6 +1165,12 @@ static int reiserfs_remount(struct super 7089@@ -1154,6 +1157,12 @@ static int reiserfs_remount(struct super
7006 return -EINVAL; 7090 return -EINVAL;
7007 } 7091 }
7008 7092
7009+ if ((mount_options & (1 << REISERFS_TAGXID)) && 7093+ if ((mount_options & (1 << REISERFS_TAGXID)) &&
7010+ !(s->s_flags & MS_TAGXID)) { 7094+ !(s->s_flags & MS_TAGXID)) {
7013+ } 7097+ }
7014+ 7098+
7015 handle_attrs(s); 7099 handle_attrs(s);
7016 7100
7017 /* Add options that are safe here */ 7101 /* Add options that are safe here */
7018@@ -1737,6 +1746,10 @@ static int reiserfs_fill_super(struct su 7102@@ -1729,6 +1738,10 @@ static int reiserfs_fill_super(struct su
7019 goto error; 7103 goto error;
7020 } 7104 }
7021 7105
7022+ /* map mount option tagxid */ 7106+ /* map mount option tagxid */
7023+ if (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_TAGXID)) 7107+ if (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_TAGXID))
7024+ s->s_flags |= MS_TAGXID; 7108+ s->s_flags |= MS_TAGXID;
7025+ 7109+
7026 rs = SB_DISK_SUPER_BLOCK(s); 7110 rs = SB_DISK_SUPER_BLOCK(s);
7027 /* Let's do basic sanity check to verify that underlying device is not 7111 /* Let's do basic sanity check to verify that underlying device is not
7028 smaller than the filesystem. If the check fails then abort and scream, 7112 smaller than the filesystem. If the check fails then abort and scream,
7029Index: vserver-sources-2.0.2_2.6.15/fs/reiserfs/xattr.c 7113Index: linux-2.6.16/fs/reiserfs/xattr.c
7030=================================================================== 7114===================================================================
7031--- vserver-sources-2.0.2_2.6.15.orig/fs/reiserfs/xattr.c 7115--- linux-2.6.16.orig/fs/reiserfs/xattr.c
7032+++ vserver-sources-2.0.2_2.6.15/fs/reiserfs/xattr.c 7116+++ linux-2.6.16/fs/reiserfs/xattr.c
7033@@ -34,6 +34,7 @@ 7117@@ -35,6 +35,7 @@
7034 #include <linux/namei.h> 7118 #include <linux/namei.h>
7035 #include <linux/errno.h> 7119 #include <linux/errno.h>
7036 #include <linux/fs.h> 7120 #include <linux/fs.h>
7037+#include <linux/mount.h> 7121+#include <linux/mount.h>
7038 #include <linux/file.h> 7122 #include <linux/file.h>
7039 #include <linux/pagemap.h> 7123 #include <linux/pagemap.h>
7040 #include <linux/xattr.h> 7124 #include <linux/xattr.h>
7041@@ -835,7 +836,7 @@ int reiserfs_delete_xattrs(struct inode 7125@@ -824,7 +825,7 @@ int reiserfs_delete_xattrs(struct inode
7042 if (dir->d_inode->i_nlink <= 2) { 7126 if (dir->d_inode->i_nlink <= 2) {
7043 root = get_xa_root(inode->i_sb); 7127 root = get_xa_root(inode->i_sb);
7044 reiserfs_write_lock_xattrs(inode->i_sb); 7128 reiserfs_write_lock_xattrs(inode->i_sb);
7045- err = vfs_rmdir(root->d_inode, dir); 7129- err = vfs_rmdir(root->d_inode, dir);
7046+ err = vfs_rmdir(root->d_inode, dir, NULL); 7130+ err = vfs_rmdir(root->d_inode, dir, NULL);
7047 reiserfs_write_unlock_xattrs(inode->i_sb); 7131 reiserfs_write_unlock_xattrs(inode->i_sb);
7048 dput(root); 7132 dput(root);
7049 } else { 7133 } else {
7050@@ -1352,7 +1353,7 @@ __reiserfs_permission(struct inode *inod 7134Index: linux-2.6.16/fs/stat.c
7051 /*
7052 * Nobody gets write access to a read-only fs.
7053 */
7054- if (IS_RDONLY(inode) &&
7055+ if ((IS_RDONLY(inode) || (nd && MNT_IS_RDONLY(nd->mnt))) &&
7056 (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)))
7057 return -EROFS;
7058
7059Index: vserver-sources-2.0.2_2.6.15/fs/stat.c
7060=================================================================== 7135===================================================================
7061--- vserver-sources-2.0.2_2.6.15.orig/fs/stat.c 7136--- linux-2.6.16.orig/fs/stat.c
7062+++ vserver-sources-2.0.2_2.6.15/fs/stat.c 7137+++ linux-2.6.16/fs/stat.c
7063@@ -27,6 +27,7 @@ void generic_fillattr(struct inode *inod 7138@@ -27,6 +27,7 @@ void generic_fillattr(struct inode *inod
7064 stat->nlink = inode->i_nlink; 7139 stat->nlink = inode->i_nlink;
7065 stat->uid = inode->i_uid; 7140 stat->uid = inode->i_uid;
7066 stat->gid = inode->i_gid; 7141 stat->gid = inode->i_gid;
7067+ stat->xid = inode->i_xid; 7142+ stat->xid = inode->i_xid;
7068 stat->rdev = inode->i_rdev; 7143 stat->rdev = inode->i_rdev;
7069 stat->atime = inode->i_atime; 7144 stat->atime = inode->i_atime;
7070 stat->mtime = inode->i_mtime; 7145 stat->mtime = inode->i_mtime;
7071Index: vserver-sources-2.0.2_2.6.15/fs/super.c 7146Index: linux-2.6.16/fs/super.c
7072=================================================================== 7147===================================================================
7073--- vserver-sources-2.0.2_2.6.15.orig/fs/super.c 7148--- linux-2.6.16.orig/fs/super.c
7074+++ vserver-sources-2.0.2_2.6.15/fs/super.c 7149+++ linux-2.6.16/fs/super.c
7075@@ -37,6 +37,8 @@ 7150@@ -37,6 +37,8 @@
7076 #include <linux/writeback.h> /* for the emergency remount stuff */ 7151 #include <linux/writeback.h> /* for the emergency remount stuff */
7077 #include <linux/idr.h> 7152 #include <linux/idr.h>
7078 #include <linux/kobject.h> 7153 #include <linux/kobject.h>
7079+#include <linux/devpts_fs.h> 7154+#include <linux/devpts_fs.h>
7115+ goto out_sb; 7190+ goto out_sb;
7116+ 7191+
7117 error = security_sb_kern_mount(sb, secdata); 7192 error = security_sb_kern_mount(sb, secdata);
7118 if (error) 7193 if (error)
7119 goto out_sb; 7194 goto out_sb;
7120Index: vserver-sources-2.0.2_2.6.15/fs/sysfs/mount.c 7195Index: linux-2.6.16/fs/sysfs/mount.c
7121=================================================================== 7196===================================================================
7122--- vserver-sources-2.0.2_2.6.15.orig/fs/sysfs/mount.c 7197--- linux-2.6.16.orig/fs/sysfs/mount.c
7123+++ vserver-sources-2.0.2_2.6.15/fs/sysfs/mount.c 7198+++ linux-2.6.16/fs/sysfs/mount.c
7124@@ -11,8 +11,6 @@ 7199@@ -11,8 +11,6 @@
7125 7200
7126 #include "sysfs.h" 7201 #include "sysfs.h"
7127 7202
7128-/* Random magic number */ 7203-/* Random magic number */
7137- sb->s_magic = SYSFS_MAGIC; 7212- sb->s_magic = SYSFS_MAGIC;
7138+ sb->s_magic = SYSFS_SUPER_MAGIC; 7213+ sb->s_magic = SYSFS_SUPER_MAGIC;
7139 sb->s_op = &sysfs_ops; 7214 sb->s_op = &sysfs_ops;
7140 sb->s_time_gran = 1; 7215 sb->s_time_gran = 1;
7141 sysfs_sb = sb; 7216 sysfs_sb = sb;
7142Index: vserver-sources-2.0.2_2.6.15/fs/xattr.c 7217Index: linux-2.6.16/fs/xattr.c
7143=================================================================== 7218===================================================================
7144--- vserver-sources-2.0.2_2.6.15.orig/fs/xattr.c 7219--- linux-2.6.16.orig/fs/xattr.c
7145+++ vserver-sources-2.0.2_2.6.15/fs/xattr.c 7220+++ linux-2.6.16/fs/xattr.c
7146@@ -17,6 +17,7 @@ 7221@@ -17,6 +17,7 @@
7147 #include <linux/syscalls.h> 7222 #include <linux/syscalls.h>
7148 #include <linux/module.h> 7223 #include <linux/module.h>
7149 #include <linux/fsnotify.h> 7224 #include <linux/fsnotify.h>
7150+#include <linux/mount.h> 7225+#include <linux/mount.h>
7151 #include <asm/uaccess.h> 7226 #include <asm/uaccess.h>
7152 7227
7153 /* 7228
7154@@ -24,7 +25,7 @@ 7229@@ -167,7 +168,7 @@ EXPORT_SYMBOL_GPL(vfs_removexattr);
7155 */ 7230 */
7156 static long 7231 static long
7157 setxattr(struct dentry *d, char __user *name, void __user *value, 7232 setxattr(struct dentry *d, char __user *name, void __user *value,
7158- size_t size, int flags) 7233- size_t size, int flags)
7159+ size_t size, int flags, struct vfsmount *mnt) 7234+ size_t size, int flags, struct vfsmount *mnt)
7160 { 7235 {
7161 int error; 7236 int error;
7162 void *kvalue = NULL; 7237 void *kvalue = NULL;
7163@@ -51,6 +52,9 @@ setxattr(struct dentry *d, char __user * 7238@@ -194,6 +195,9 @@ setxattr(struct dentry *d, char __user *
7164 } 7239 }
7165 } 7240 }
7166 7241
7167+ if (MNT_IS_RDONLY(mnt)) 7242+ if (MNT_IS_RDONLY(mnt))
7168+ return -EROFS; 7243+ return -EROFS;
7169+ 7244+
7170 down(&d->d_inode->i_sem);
7171 error = security_inode_setxattr(d, kname, kvalue, size, flags); 7245 error = vfs_setxattr(d, kname, kvalue, size, flags);
7172 if (error) 7246 kfree(kvalue);
7247 return error;
7173@@ -88,7 +92,7 @@ sys_setxattr(char __user *path, char __u 7248@@ -209,7 +213,7 @@ sys_setxattr(char __user *path, char __u
7174 error = user_path_walk(path, &nd); 7249 error = user_path_walk(path, &nd);
7175 if (error) 7250 if (error)
7176 return error; 7251 return error;
7177- error = setxattr(nd.dentry, name, value, size, flags); 7252- error = setxattr(nd.dentry, name, value, size, flags);
7178+ error = setxattr(nd.dentry, name, value, size, flags, nd.mnt); 7253+ error = setxattr(nd.dentry, name, value, size, flags, nd.mnt);
7179 path_release(&nd); 7254 path_release(&nd);
7180 return error; 7255 return error;
7181 } 7256 }
7182@@ -103,7 +107,7 @@ sys_lsetxattr(char __user *path, char __ 7257@@ -224,7 +228,7 @@ sys_lsetxattr(char __user *path, char __
7183 error = user_path_walk_link(path, &nd); 7258 error = user_path_walk_link(path, &nd);
7184 if (error) 7259 if (error)
7185 return error; 7260 return error;
7186- error = setxattr(nd.dentry, name, value, size, flags); 7261- error = setxattr(nd.dentry, name, value, size, flags);
7187+ error = setxattr(nd.dentry, name, value, size, flags, nd.mnt); 7262+ error = setxattr(nd.dentry, name, value, size, flags, nd.mnt);
7188 path_release(&nd); 7263 path_release(&nd);
7189 return error; 7264 return error;
7190 } 7265 }
7191@@ -118,7 +122,7 @@ sys_fsetxattr(int fd, char __user *name, 7266@@ -239,7 +243,7 @@ sys_fsetxattr(int fd, char __user *name,
7192 f = fget(fd); 7267 f = fget(fd);
7193 if (!f) 7268 if (!f)
7194 return error; 7269 return error;
7195- error = setxattr(f->f_dentry, name, value, size, flags); 7270- error = setxattr(f->f_dentry, name, value, size, flags);
7196+ error = setxattr(f->f_dentry, name, value, size, flags, f->f_vfsmnt); 7271+ error = setxattr(f->f_dentry, name, value, size, flags, f->f_vfsmnt);
7197 fput(f); 7272 fput(f);
7198 return error; 7273 return error;
7199 } 7274 }
7200@@ -307,7 +311,7 @@ sys_flistxattr(int fd, char __user *list 7275@@ -412,7 +416,7 @@ sys_flistxattr(int fd, char __user *list
7201 * Extended attribute REMOVE operations 7276 * Extended attribute REMOVE operations
7202 */ 7277 */
7203 static long 7278 static long
7204-removexattr(struct dentry *d, char __user *name) 7279-removexattr(struct dentry *d, char __user *name)
7205+removexattr(struct dentry *d, char __user *name, struct vfsmount *mnt) 7280+removexattr(struct dentry *d, char __user *name, struct vfsmount *mnt)
7206 { 7281 {
7207 int error; 7282 int error;
7208 char kname[XATTR_NAME_MAX + 1]; 7283 char kname[XATTR_NAME_MAX + 1];
7209@@ -318,6 +322,9 @@ removexattr(struct dentry *d, char __use 7284@@ -423,6 +427,9 @@ removexattr(struct dentry *d, char __use
7210 if (error < 0) 7285 if (error < 0)
7211 return error; 7286 return error;
7212 7287
7213+ if (MNT_IS_RDONLY(mnt)) 7288+ if (MNT_IS_RDONLY(mnt))
7214+ return -EROFS; 7289+ return -EROFS;
7215+ 7290+
7216 error = -EOPNOTSUPP; 7291 return vfs_removexattr(d, kname);
7217 if (d->d_inode->i_op && d->d_inode->i_op->removexattr) { 7292 }
7218 error = security_inode_removexattr(d, kname); 7293
7219@@ -342,7 +349,7 @@ sys_removexattr(char __user *path, char 7294@@ -435,7 +442,7 @@ sys_removexattr(char __user *path, char
7220 error = user_path_walk(path, &nd); 7295 error = user_path_walk(path, &nd);
7221 if (error) 7296 if (error)
7222 return error; 7297 return error;
7223- error = removexattr(nd.dentry, name); 7298- error = removexattr(nd.dentry, name);
7224+ error = removexattr(nd.dentry, name, nd.mnt); 7299+ error = removexattr(nd.dentry, name, nd.mnt);
7225 path_release(&nd); 7300 path_release(&nd);
7226 return error; 7301 return error;
7227 } 7302 }
7228@@ -356,7 +363,7 @@ sys_lremovexattr(char __user *path, char 7303@@ -449,7 +456,7 @@ sys_lremovexattr(char __user *path, char
7229 error = user_path_walk_link(path, &nd); 7304 error = user_path_walk_link(path, &nd);
7230 if (error) 7305 if (error)
7231 return error; 7306 return error;
7232- error = removexattr(nd.dentry, name); 7307- error = removexattr(nd.dentry, name);
7233+ error = removexattr(nd.dentry, name, nd.mnt); 7308+ error = removexattr(nd.dentry, name, nd.mnt);
7234 path_release(&nd); 7309 path_release(&nd);
7235 return error; 7310 return error;
7236 } 7311 }
7237@@ -370,7 +377,7 @@ sys_fremovexattr(int fd, char __user *na 7312@@ -463,7 +470,7 @@ sys_fremovexattr(int fd, char __user *na
7238 f = fget(fd); 7313 f = fget(fd);
7239 if (!f) 7314 if (!f)
7240 return error; 7315 return error;
7241- error = removexattr(f->f_dentry, name); 7316- error = removexattr(f->f_dentry, name);
7242+ error = removexattr(f->f_dentry, name, f->f_vfsmnt); 7317+ error = removexattr(f->f_dentry, name, f->f_vfsmnt);
7243 fput(f); 7318 fput(f);
7244 return error; 7319 return error;
7245 } 7320 }
7246Index: vserver-sources-2.0.2_2.6.15/fs/xfs/linux-2.6/xfs_ioctl.c 7321Index: linux-2.6.16/fs/xfs/linux-2.6/xfs_ioctl.c
7247=================================================================== 7322===================================================================
7248--- vserver-sources-2.0.2_2.6.15.orig/fs/xfs/linux-2.6/xfs_ioctl.c 7323--- linux-2.6.16.orig/fs/xfs/linux-2.6/xfs_ioctl.c
7249+++ vserver-sources-2.0.2_2.6.15/fs/xfs/linux-2.6/xfs_ioctl.c 7324+++ linux-2.6.16/fs/xfs/linux-2.6/xfs_ioctl.c
7250@@ -1098,6 +1098,8 @@ xfs_ioc_fsgeometry( 7325@@ -1100,6 +1100,8 @@ xfs_ioc_fsgeometry(
7251 #define LINUX_XFLAG_APPEND 0x00000020 /* writes to file may only append */ 7326 #define LINUX_XFLAG_APPEND 0x00000020 /* writes to file may only append */
7252 #define LINUX_XFLAG_NODUMP 0x00000040 /* do not dump file */ 7327 #define LINUX_XFLAG_NODUMP 0x00000040 /* do not dump file */
7253 #define LINUX_XFLAG_NOATIME 0x00000080 /* do not update atime */ 7328 #define LINUX_XFLAG_NOATIME 0x00000080 /* do not update atime */
7254+#define LINUX_XFLAG_BARRIER 0x04000000 /* chroot() barrier */ 7329+#define LINUX_XFLAG_BARRIER 0x04000000 /* chroot() barrier */
7255+#define LINUX_XFLAG_IUNLINK 0x08000000 /* immutable unlink */ 7330+#define LINUX_XFLAG_IUNLINK 0x08000000 /* immutable unlink */
7256 7331
7257 STATIC unsigned int 7332 STATIC unsigned int
7258 xfs_merge_ioc_xflags( 7333 xfs_merge_ioc_xflags(
7259@@ -1138,6 +1140,10 @@ xfs_di2lxflags( 7334@@ -1140,6 +1142,10 @@ xfs_di2lxflags(
7260 7335
7261 if (di_flags & XFS_DIFLAG_IMMUTABLE) 7336 if (di_flags & XFS_DIFLAG_IMMUTABLE)
7262 flags |= LINUX_XFLAG_IMMUTABLE; 7337 flags |= LINUX_XFLAG_IMMUTABLE;
7263+ if (di_flags & XFS_DIFLAG_IUNLINK) 7338+ if (di_flags & XFS_DIFLAG_IUNLINK)
7264+ flags |= LINUX_XFLAG_IUNLINK; 7339+ flags |= LINUX_XFLAG_IUNLINK;
7265+ if (di_flags & XFS_DIFLAG_BARRIER) 7340+ if (di_flags & XFS_DIFLAG_BARRIER)
7266+ flags |= LINUX_XFLAG_BARRIER; 7341+ flags |= LINUX_XFLAG_BARRIER;
7267 if (di_flags & XFS_DIFLAG_APPEND) 7342 if (di_flags & XFS_DIFLAG_APPEND)
7268 flags |= LINUX_XFLAG_APPEND; 7343 flags |= LINUX_XFLAG_APPEND;
7269 if (di_flags & XFS_DIFLAG_SYNC) 7344 if (di_flags & XFS_DIFLAG_SYNC)
7270Index: vserver-sources-2.0.2_2.6.15/fs/xfs/linux-2.6/xfs_iops.c 7345Index: linux-2.6.16/fs/xfs/linux-2.6/xfs_iops.c
7271=================================================================== 7346===================================================================
7272--- vserver-sources-2.0.2_2.6.15.orig/fs/xfs/linux-2.6/xfs_iops.c 7347--- linux-2.6.16.orig/fs/xfs/linux-2.6/xfs_iops.c
7273+++ vserver-sources-2.0.2_2.6.15/fs/xfs/linux-2.6/xfs_iops.c 7348+++ linux-2.6.16/fs/xfs/linux-2.6/xfs_iops.c
7274@@ -53,6 +53,7 @@ 7349@@ -55,6 +55,7 @@
7275
7276 #include <linux/xattr.h> 7350 #include <linux/xattr.h>
7277 #include <linux/namei.h> 7351 #include <linux/namei.h>
7352 #include <linux/security.h>
7278+#include <linux/vserver/xid.h> 7353+#include <linux/vserver/xid.h>
7279 7354
7280 /* 7355 /*
7281 * Change the requested timestamp in the given inode. 7356 * Get a XFS inode from a given vnode.
7282@@ -354,6 +355,7 @@ linvfs_lookup( 7357@@ -410,6 +411,7 @@ linvfs_lookup(
7283 d_add(dentry, NULL); 7358 d_add(dentry, NULL);
7284 return NULL; 7359 return NULL;
7285 } 7360 }
7286+ vx_propagate_xid(nd, LINVFS_GET_IP(cvp)); 7361+ vx_propagate_xid(nd, LINVFS_GET_IP(cvp));
7287 7362
7288 return d_splice_alias(LINVFS_GET_IP(cvp), dentry); 7363 return d_splice_alias(LINVFS_GET_IP(cvp), dentry);
7289 } 7364 }
7290@@ -587,6 +589,41 @@ linvfs_getattr( 7365@@ -646,6 +648,41 @@ linvfs_getattr(
7291 } 7366 }
7292 7367
7293 STATIC int 7368 STATIC int
7294+linvfs_sync_flags(struct inode *inode) 7369+linvfs_sync_flags(struct inode *inode)
7295+{ 7370+{
7327+ 7402+
7328+STATIC int 7403+STATIC int
7329 linvfs_setattr( 7404 linvfs_setattr(
7330 struct dentry *dentry, 7405 struct dentry *dentry,
7331 struct iattr *attr) 7406 struct iattr *attr)
7332@@ -598,6 +635,10 @@ linvfs_setattr( 7407@@ -657,6 +694,10 @@ linvfs_setattr(
7333 int flags = 0; 7408 int flags = 0;
7334 int error; 7409 int error;
7335 7410
7336+ error = inode_change_ok(inode, attr); 7411+ error = inode_change_ok(inode, attr);
7337+ if (error) 7412+ if (error)
7338+ return error; 7413+ return error;
7339+ 7414+
7340 memset(&vattr, 0, sizeof(vattr_t)); 7415 memset(&vattr, 0, sizeof(vattr_t));
7341 if (ia_valid & ATTR_UID) { 7416 if (ia_valid & ATTR_UID) {
7342 vattr.va_mask |= XFS_AT_UID; 7417 vattr.va_mask |= XFS_AT_UID;
7343@@ -607,6 +648,10 @@ linvfs_setattr( 7418@@ -666,6 +707,10 @@ linvfs_setattr(
7344 vattr.va_mask |= XFS_AT_GID; 7419 vattr.va_mask |= XFS_AT_GID;
7345 vattr.va_gid = attr->ia_gid; 7420 vattr.va_gid = attr->ia_gid;
7346 } 7421 }
7347+ if ((ia_valid & ATTR_XID) && IS_TAGXID(inode)) { 7422+ if ((ia_valid & ATTR_XID) && IS_TAGXID(inode)) {
7348+ vattr.va_mask |= XFS_AT_XID; 7423+ vattr.va_mask |= XFS_AT_XID;
7349+ vattr.va_xid = attr->ia_xid; 7424+ vattr.va_xid = attr->ia_xid;
7350+ } 7425+ }
7351 if (ia_valid & ATTR_SIZE) { 7426 if (ia_valid & ATTR_SIZE) {
7352 vattr.va_mask |= XFS_AT_SIZE; 7427 vattr.va_mask |= XFS_AT_SIZE;
7353 vattr.va_size = attr->ia_size; 7428 vattr.va_size = attr->ia_size;
7354@@ -764,6 +809,7 @@ struct inode_operations linvfs_file_inod 7429@@ -825,6 +870,7 @@ struct inode_operations linvfs_file_inod
7355 .getxattr = linvfs_getxattr, 7430 .getxattr = linvfs_getxattr,
7356 .listxattr = linvfs_listxattr, 7431 .listxattr = linvfs_listxattr,
7357 .removexattr = linvfs_removexattr, 7432 .removexattr = linvfs_removexattr,
7358+ .sync_flags = linvfs_sync_flags, 7433+ .sync_flags = linvfs_sync_flags,
7359 }; 7434 };
7360 7435
7361 struct inode_operations linvfs_dir_inode_operations = { 7436 struct inode_operations linvfs_dir_inode_operations = {
7362@@ -783,6 +829,7 @@ struct inode_operations linvfs_dir_inode 7437@@ -844,6 +890,7 @@ struct inode_operations linvfs_dir_inode
7363 .getxattr = linvfs_getxattr, 7438 .getxattr = linvfs_getxattr,
7364 .listxattr = linvfs_listxattr, 7439 .listxattr = linvfs_listxattr,
7365 .removexattr = linvfs_removexattr, 7440 .removexattr = linvfs_removexattr,
7366+ .sync_flags = linvfs_sync_flags, 7441+ .sync_flags = linvfs_sync_flags,
7367 }; 7442 };
7368 7443
7369 struct inode_operations linvfs_symlink_inode_operations = { 7444 struct inode_operations linvfs_symlink_inode_operations = {
7370@@ -796,4 +843,5 @@ struct inode_operations linvfs_symlink_i 7445@@ -857,4 +904,5 @@ struct inode_operations linvfs_symlink_i
7371 .getxattr = linvfs_getxattr, 7446 .getxattr = linvfs_getxattr,
7372 .listxattr = linvfs_listxattr, 7447 .listxattr = linvfs_listxattr,
7373 .removexattr = linvfs_removexattr, 7448 .removexattr = linvfs_removexattr,
7374+ .sync_flags = linvfs_sync_flags, 7449+ .sync_flags = linvfs_sync_flags,
7375 }; 7450 };
7376Index: vserver-sources-2.0.2_2.6.15/fs/xfs/linux-2.6/xfs_linux.h 7451Index: linux-2.6.16/fs/xfs/linux-2.6/xfs_linux.h
7377=================================================================== 7452===================================================================
7378--- vserver-sources-2.0.2_2.6.15.orig/fs/xfs/linux-2.6/xfs_linux.h 7453--- linux-2.6.16.orig/fs/xfs/linux-2.6/xfs_linux.h
7379+++ vserver-sources-2.0.2_2.6.15/fs/xfs/linux-2.6/xfs_linux.h 7454+++ linux-2.6.16/fs/xfs/linux-2.6/xfs_linux.h
7380@@ -137,6 +137,7 @@ static inline void set_buffer_unwritten_ 7455@@ -133,6 +133,7 @@ BUFFER_FNS(PrivateStart, unwritten);
7381 #define current_pid() (current->pid) 7456 #define current_pid() (current->pid)
7382 #define current_fsuid(cred) (current->fsuid) 7457 #define current_fsuid(cred) (current->fsuid)
7383 #define current_fsgid(cred) (current->fsgid) 7458 #define current_fsgid(cred) (current->fsgid)
7384+#define current_fsxid(cred,vp) (vx_current_fsxid(LINVFS_GET_IP(vp)->i_sb)) 7459+#define current_fsxid(cred,vp) (vx_current_fsxid(LINVFS_GET_IP(vp)->i_sb))
7385 7460
7386 #define NBPP PAGE_SIZE 7461 #define NBPP PAGE_SIZE
7387 #define DPPSHFT (PAGE_SHIFT - 9) 7462 #define DPPSHFT (PAGE_SHIFT - 9)
7388Index: vserver-sources-2.0.2_2.6.15/fs/xfs/linux-2.6/xfs_super.c 7463Index: linux-2.6.16/fs/xfs/linux-2.6/xfs_super.c
7389=================================================================== 7464===================================================================
7390--- vserver-sources-2.0.2_2.6.15.orig/fs/xfs/linux-2.6/xfs_super.c 7465--- linux-2.6.16.orig/fs/xfs/linux-2.6/xfs_super.c
7391+++ vserver-sources-2.0.2_2.6.15/fs/xfs/linux-2.6/xfs_super.c 7466+++ linux-2.6.16/fs/xfs/linux-2.6/xfs_super.c
7392@@ -161,6 +161,7 @@ xfs_revalidate_inode( 7467@@ -161,6 +161,7 @@ xfs_revalidate_inode(
7393 inode->i_nlink = ip->i_d.di_nlink; 7468 inode->i_nlink = ip->i_d.di_nlink;
7394 inode->i_uid = ip->i_d.di_uid; 7469 inode->i_uid = ip->i_d.di_uid;
7395 inode->i_gid = ip->i_d.di_gid; 7470 inode->i_gid = ip->i_d.di_gid;
7396+ inode->i_xid = ip->i_d.di_xid; 7471+ inode->i_xid = ip->i_d.di_xid;
7410+ else 7485+ else
7411+ inode->i_flags &= ~S_BARRIER; 7486+ inode->i_flags &= ~S_BARRIER;
7412 if (ip->i_d.di_flags & XFS_DIFLAG_APPEND) 7487 if (ip->i_d.di_flags & XFS_DIFLAG_APPEND)
7413 inode->i_flags |= S_APPEND; 7488 inode->i_flags |= S_APPEND;
7414 else 7489 else
7415@@ -726,6 +735,12 @@ linvfs_remount( 7490@@ -729,6 +738,12 @@ linvfs_remount(
7416 int error; 7491 int error;
7417 7492
7418 VFS_PARSEARGS(vfsp, options, args, 1, error); 7493 VFS_PARSEARGS(vfsp, options, args, 1, error);
7419+ if ((args->flags2 & XFSMNT2_TAGXID) && 7494+ if ((args->flags2 & XFSMNT2_TAGXID) &&
7420+ !(sb->s_flags & MS_TAGXID)) { 7495+ !(sb->s_flags & MS_TAGXID)) {
7423+ error = EINVAL; 7498+ error = EINVAL;
7424+ } 7499+ }
7425 if (!error) 7500 if (!error)
7426 VFS_MNTUPDATE(vfsp, flags, args, error); 7501 VFS_MNTUPDATE(vfsp, flags, args, error);
7427 kmem_free(args, sizeof(*args)); 7502 kmem_free(args, sizeof(*args));
7428Index: vserver-sources-2.0.2_2.6.15/fs/xfs/linux-2.6/xfs_sysctl.c 7503Index: linux-2.6.16/fs/xfs/linux-2.6/xfs_sysctl.c
7429=================================================================== 7504===================================================================
7430--- vserver-sources-2.0.2_2.6.15.orig/fs/xfs/linux-2.6/xfs_sysctl.c 7505--- linux-2.6.16.orig/fs/xfs/linux-2.6/xfs_sysctl.c
7431+++ vserver-sources-2.0.2_2.6.15/fs/xfs/linux-2.6/xfs_sysctl.c 7506+++ linux-2.6.16/fs/xfs/linux-2.6/xfs_sysctl.c
7432@@ -58,74 +58,74 @@ xfs_stats_clear_proc_handler( 7507@@ -58,74 +58,74 @@ xfs_stats_clear_proc_handler(
7433 STATIC ctl_table xfs_table[] = { 7508 STATIC ctl_table xfs_table[] = {
7434 {XFS_RESTRICT_CHOWN, "restrict_chown", &xfs_params.restrict_chown.val, 7509 {XFS_RESTRICT_CHOWN, "restrict_chown", &xfs_params.restrict_chown.val,
7435 sizeof(int), 0644, NULL, &proc_dointvec_minmax, 7510 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
7436- &sysctl_intvec, NULL, 7511- &sysctl_intvec, NULL,
7516- &sysctl_intvec, NULL, 7591- &sysctl_intvec, NULL,
7517+ NULL, &sysctl_intvec, NULL, 7592+ NULL, &sysctl_intvec, NULL,
7518 &xfs_params.stats_clear.min, &xfs_params.stats_clear.max}, 7593 &xfs_params.stats_clear.min, &xfs_params.stats_clear.max},
7519 #endif /* CONFIG_PROC_FS */ 7594 #endif /* CONFIG_PROC_FS */
7520 7595
7521Index: vserver-sources-2.0.2_2.6.15/fs/xfs/linux-2.6/xfs_vnode.c 7596Index: linux-2.6.16/fs/xfs/linux-2.6/xfs_vnode.c
7522=================================================================== 7597===================================================================
7523--- vserver-sources-2.0.2_2.6.15.orig/fs/xfs/linux-2.6/xfs_vnode.c 7598--- linux-2.6.16.orig/fs/xfs/linux-2.6/xfs_vnode.c
7524+++ vserver-sources-2.0.2_2.6.15/fs/xfs/linux-2.6/xfs_vnode.c 7599+++ linux-2.6.16/fs/xfs/linux-2.6/xfs_vnode.c
7525@@ -103,6 +103,7 @@ vn_revalidate_core( 7600@@ -103,6 +103,7 @@ vn_revalidate_core(
7526 inode->i_nlink = vap->va_nlink; 7601 inode->i_nlink = vap->va_nlink;
7527 inode->i_uid = vap->va_uid; 7602 inode->i_uid = vap->va_uid;
7528 inode->i_gid = vap->va_gid; 7603 inode->i_gid = vap->va_gid;
7529+ inode->i_xid = vap->va_xid; 7604+ inode->i_xid = vap->va_xid;
7530 inode->i_blocks = vap->va_nblocks; 7605 inode->i_blocks = vap->va_nblocks;
7531 inode->i_mtime = vap->va_mtime; 7606 inode->i_mtime = vap->va_mtime;
7532 inode->i_ctime = vap->va_ctime; 7607 inode->i_ctime = vap->va_ctime;
7533@@ -112,6 +113,14 @@ vn_revalidate_core( 7608@@ -111,6 +112,14 @@ vn_revalidate_core(
7534 inode->i_flags |= S_IMMUTABLE; 7609 inode->i_flags |= S_IMMUTABLE;
7535 else 7610 else
7536 inode->i_flags &= ~S_IMMUTABLE; 7611 inode->i_flags &= ~S_IMMUTABLE;
7537+ if (vap->va_xflags & XFS_XFLAG_IUNLINK) 7612+ if (vap->va_xflags & XFS_XFLAG_IUNLINK)
7538+ inode->i_flags |= S_IUNLINK; 7613+ inode->i_flags |= S_IUNLINK;
7543+ else 7618+ else
7544+ inode->i_flags &= ~S_BARRIER; 7619+ inode->i_flags &= ~S_BARRIER;
7545 if (vap->va_xflags & XFS_XFLAG_APPEND) 7620 if (vap->va_xflags & XFS_XFLAG_APPEND)
7546 inode->i_flags |= S_APPEND; 7621 inode->i_flags |= S_APPEND;
7547 else 7622 else
7548Index: vserver-sources-2.0.2_2.6.15/fs/xfs/linux-2.6/xfs_vnode.h 7623Index: linux-2.6.16/fs/xfs/linux-2.6/xfs_vnode.h
7549=================================================================== 7624===================================================================
7550--- vserver-sources-2.0.2_2.6.15.orig/fs/xfs/linux-2.6/xfs_vnode.h 7625--- linux-2.6.16.orig/fs/xfs/linux-2.6/xfs_vnode.h
7551+++ vserver-sources-2.0.2_2.6.15/fs/xfs/linux-2.6/xfs_vnode.h 7626+++ linux-2.6.16/fs/xfs/linux-2.6/xfs_vnode.h
7552@@ -386,6 +386,7 @@ typedef struct vattr { 7627@@ -386,6 +386,7 @@ typedef struct vattr {
7553 xfs_nlink_t va_nlink; /* number of references to file */ 7628 xfs_nlink_t va_nlink; /* number of references to file */
7554 uid_t va_uid; /* owner user id */ 7629 uid_t va_uid; /* owner user id */
7555 gid_t va_gid; /* owner group id */ 7630 gid_t va_gid; /* owner group id */
7556+ xid_t va_xid; /* owner group id */ 7631+ xid_t va_xid; /* owner group id */
7572+ XFS_AT_NEXTENTS|XFS_AT_ANEXTENTS|XFS_AT_PROJID|XFS_AT_GENCOUNT\ 7647+ XFS_AT_NEXTENTS|XFS_AT_ANEXTENTS|XFS_AT_PROJID|XFS_AT_GENCOUNT\
7573+ XFS_AT_XID) 7648+ XFS_AT_XID)
7574 7649
7575 #define XFS_AT_STAT (XFS_AT_TYPE|XFS_AT_MODE|XFS_AT_UID|XFS_AT_GID|\ 7650 #define XFS_AT_STAT (XFS_AT_TYPE|XFS_AT_MODE|XFS_AT_UID|XFS_AT_GID|\
7576 XFS_AT_FSID|XFS_AT_NODEID|XFS_AT_NLINK|XFS_AT_SIZE|\ 7651 XFS_AT_FSID|XFS_AT_NODEID|XFS_AT_NLINK|XFS_AT_SIZE|\
7577Index: vserver-sources-2.0.2_2.6.15/fs/xfs/quota/xfs_qm_syscalls.c 7652Index: linux-2.6.16/fs/xfs/quota/xfs_qm_syscalls.c
7578=================================================================== 7653===================================================================
7579--- vserver-sources-2.0.2_2.6.15.orig/fs/xfs/quota/xfs_qm_syscalls.c 7654--- linux-2.6.16.orig/fs/xfs/quota/xfs_qm_syscalls.c
7580+++ vserver-sources-2.0.2_2.6.15/fs/xfs/quota/xfs_qm_syscalls.c 7655+++ linux-2.6.16/fs/xfs/quota/xfs_qm_syscalls.c
7581@@ -212,7 +212,7 @@ xfs_qm_scall_quotaoff( 7656@@ -215,7 +215,7 @@ xfs_qm_scall_quotaoff(
7582 xfs_qoff_logitem_t *qoffstart; 7657 xfs_qoff_logitem_t *qoffstart;
7583 int nculprits; 7658 int nculprits;
7584 7659
7585- if (!force && !capable(CAP_SYS_ADMIN)) 7660- if (!force && !capable(CAP_SYS_ADMIN))
7586+ if (!force && !capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_QUOTA_CTL)) 7661+ if (!force && !capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_QUOTA_CTL))
7587 return XFS_ERROR(EPERM); 7662 return XFS_ERROR(EPERM);
7588 /* 7663 /*
7589 * No file system can have quotas enabled on disk but not in core. 7664 * No file system can have quotas enabled on disk but not in core.
7590@@ -381,7 +381,7 @@ xfs_qm_scall_trunc_qfiles( 7665@@ -384,7 +384,7 @@ xfs_qm_scall_trunc_qfiles(
7591 int error; 7666 int error;
7592 xfs_inode_t *qip; 7667 xfs_inode_t *qip;
7593 7668
7594- if (!capable(CAP_SYS_ADMIN)) 7669- if (!capable(CAP_SYS_ADMIN))
7595+ if (!capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_QUOTA_CTL)) 7670+ if (!capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_QUOTA_CTL))
7596 return XFS_ERROR(EPERM); 7671 return XFS_ERROR(EPERM);
7597 error = 0; 7672 error = 0;
7598 if (!XFS_SB_VERSION_HASQUOTA(&mp->m_sb) || flags == 0) { 7673 if (!XFS_SB_VERSION_HASQUOTA(&mp->m_sb) || flags == 0) {
7599@@ -426,7 +426,7 @@ xfs_qm_scall_quotaon( 7674@@ -429,7 +429,7 @@ xfs_qm_scall_quotaon(
7600 uint accflags; 7675 uint accflags;
7601 __int64_t sbflags; 7676 __int64_t sbflags;
7602 7677
7603- if (!capable(CAP_SYS_ADMIN)) 7678- if (!capable(CAP_SYS_ADMIN))
7604+ if (!capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_QUOTA_CTL)) 7679+ if (!capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_QUOTA_CTL))
7605 return XFS_ERROR(EPERM); 7680 return XFS_ERROR(EPERM);
7606 7681
7607 flags &= (XFS_ALL_QUOTA_ACCT | XFS_ALL_QUOTA_ENFD); 7682 flags &= (XFS_ALL_QUOTA_ACCT | XFS_ALL_QUOTA_ENFD);
7608@@ -597,7 +597,7 @@ xfs_qm_scall_setqlim( 7683@@ -600,7 +600,7 @@ xfs_qm_scall_setqlim(
7609 int error; 7684 int error;
7610 xfs_qcnt_t hard, soft; 7685 xfs_qcnt_t hard, soft;
7611 7686
7612- if (!capable(CAP_SYS_ADMIN)) 7687- if (!capable(CAP_SYS_ADMIN))
7613+ if (!capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_QUOTA_CTL)) 7688+ if (!capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_QUOTA_CTL))
7614 return XFS_ERROR(EPERM); 7689 return XFS_ERROR(EPERM);
7615 7690
7616 if ((newlim->d_fieldmask & 7691 if ((newlim->d_fieldmask &
7617Index: vserver-sources-2.0.2_2.6.15/fs/xfs/xfs_clnt.h 7692Index: linux-2.6.16/fs/xfs/xfs_clnt.h
7618=================================================================== 7693===================================================================
7619--- vserver-sources-2.0.2_2.6.15.orig/fs/xfs/xfs_clnt.h 7694--- linux-2.6.16.orig/fs/xfs/xfs_clnt.h
7620+++ vserver-sources-2.0.2_2.6.15/fs/xfs/xfs_clnt.h 7695+++ linux-2.6.16/fs/xfs/xfs_clnt.h
7621@@ -100,5 +100,7 @@ struct xfs_mount_args { 7696@@ -100,5 +100,7 @@ struct xfs_mount_args {
7622 */ 7697 */
7623 #define XFSMNT2_COMPAT_IOSIZE 0x00000001 /* don't report large preferred 7698 #define XFSMNT2_COMPAT_IOSIZE 0x00000001 /* don't report large preferred
7624 * I/O size in stat(2) */ 7699 * I/O size in stat(2) */
7625+#define XFSMNT2_TAGXID 0x80000000 /* context xid tagging */ 7700+#define XFSMNT2_TAGXID 0x80000000 /* context xid tagging */
7626+ 7701+
7627 7702
7628 #endif /* __XFS_CLNT_H__ */ 7703 #endif /* __XFS_CLNT_H__ */
7629Index: vserver-sources-2.0.2_2.6.15/fs/xfs/xfs_dinode.h 7704Index: linux-2.6.16/fs/xfs/xfs_dinode.h
7630=================================================================== 7705===================================================================
7631--- vserver-sources-2.0.2_2.6.15.orig/fs/xfs/xfs_dinode.h 7706--- linux-2.6.16.orig/fs/xfs/xfs_dinode.h
7632+++ vserver-sources-2.0.2_2.6.15/fs/xfs/xfs_dinode.h 7707+++ linux-2.6.16/fs/xfs/xfs_dinode.h
7633@@ -53,7 +53,8 @@ typedef struct xfs_dinode_core 7708@@ -53,7 +53,8 @@ typedef struct xfs_dinode_core
7634 __uint32_t di_gid; /* owner's group id */ 7709 __uint32_t di_gid; /* owner's group id */
7635 __uint32_t di_nlink; /* number of links to file */ 7710 __uint32_t di_nlink; /* number of links to file */
7636 __uint16_t di_projid; /* owner's project id */ 7711 __uint16_t di_projid; /* owner's project id */
7637- __uint8_t di_pad[8]; /* unused, zeroed space */ 7712- __uint8_t di_pad[8]; /* unused, zeroed space */
7638+ __uint16_t di_xid; /* vserver context id */ 7713+ __uint16_t di_xid; /* vserver context id */
7639+ __uint8_t di_pad[6]; /* unused, zeroed space */ 7714+ __uint8_t di_pad[6]; /* unused, zeroed space */
7640 __uint16_t di_flushiter; /* incremented on flush */ 7715 __uint16_t di_flushiter; /* incremented on flush */
7641 xfs_timestamp_t di_atime; /* time last accessed */ 7716 xfs_timestamp_t di_atime; /* time last accessed */
7642 xfs_timestamp_t di_mtime; /* time last modified */ 7717 xfs_timestamp_t di_mtime; /* time last modified */
7643@@ -248,6 +249,9 @@ typedef enum xfs_dinode_fmt 7718@@ -257,6 +258,9 @@ typedef enum xfs_dinode_fmt
7644 #define XFS_DIFLAG_RTINHERIT_BIT 8 /* create with realtime bit set */
7645 #define XFS_DIFLAG_PROJINHERIT_BIT 9 /* create with parents projid */
7646 #define XFS_DIFLAG_NOSYMLINKS_BIT 10 /* disallow symlink creation */ 7719 #define XFS_DIFLAG_NOSYMLINKS_BIT 10 /* disallow symlink creation */
7720 #define XFS_DIFLAG_EXTSIZE_BIT 11 /* inode extent size allocator hint */
7721 #define XFS_DIFLAG_EXTSZINHERIT_BIT 12 /* inherit inode extent size */
7647+#define XFS_DIFLAG_BARRIER_BIT 12 /* chroot() barrier */ 7722+#define XFS_DIFLAG_BARRIER_BIT 13 /* chroot() barrier */
7648+#define XFS_DIFLAG_IUNLINK_BIT 13 /* immutable unlink */ 7723+#define XFS_DIFLAG_IUNLINK_BIT 14 /* immutable unlink */
7649+ 7724+
7650 #define XFS_DIFLAG_REALTIME (1 << XFS_DIFLAG_REALTIME_BIT) 7725 #define XFS_DIFLAG_REALTIME (1 << XFS_DIFLAG_REALTIME_BIT)
7651 #define XFS_DIFLAG_PREALLOC (1 << XFS_DIFLAG_PREALLOC_BIT) 7726 #define XFS_DIFLAG_PREALLOC (1 << XFS_DIFLAG_PREALLOC_BIT)
7652 #define XFS_DIFLAG_NEWRTBM (1 << XFS_DIFLAG_NEWRTBM_BIT) 7727 #define XFS_DIFLAG_NEWRTBM (1 << XFS_DIFLAG_NEWRTBM_BIT)
7653@@ -259,11 +263,15 @@ typedef enum xfs_dinode_fmt 7728@@ -270,12 +274,14 @@ typedef enum xfs_dinode_fmt
7654 #define XFS_DIFLAG_RTINHERIT (1 << XFS_DIFLAG_RTINHERIT_BIT)
7655 #define XFS_DIFLAG_PROJINHERIT (1 << XFS_DIFLAG_PROJINHERIT_BIT)
7656 #define XFS_DIFLAG_NOSYMLINKS (1 << XFS_DIFLAG_NOSYMLINKS_BIT) 7729 #define XFS_DIFLAG_NOSYMLINKS (1 << XFS_DIFLAG_NOSYMLINKS_BIT)
7730 #define XFS_DIFLAG_EXTSIZE (1 << XFS_DIFLAG_EXTSIZE_BIT)
7731 #define XFS_DIFLAG_EXTSZINHERIT (1 << XFS_DIFLAG_EXTSZINHERIT_BIT)
7657+#define XFS_DIFLAG_BARRIER (1 << XFS_DIFLAG_BARRIER_BIT) 7732+#define XFS_DIFLAG_BARRIER (1 << XFS_DIFLAG_BARRIER_BIT)
7658+#define XFS_DIFLAG_IUNLINK (1 << XFS_DIFLAG_IUNLINK_BIT) 7733+#define XFS_DIFLAG_IUNLINK (1 << XFS_DIFLAG_IUNLINK_BIT)
7659+
7660 7734
7661 #define XFS_DIFLAG_ANY \ 7735 #define XFS_DIFLAG_ANY \
7662 (XFS_DIFLAG_REALTIME | XFS_DIFLAG_PREALLOC | XFS_DIFLAG_NEWRTBM | \ 7736 (XFS_DIFLAG_REALTIME | XFS_DIFLAG_PREALLOC | XFS_DIFLAG_NEWRTBM | \
7663 XFS_DIFLAG_IMMUTABLE | XFS_DIFLAG_APPEND | XFS_DIFLAG_SYNC | \ 7737 XFS_DIFLAG_IMMUTABLE | XFS_DIFLAG_APPEND | XFS_DIFLAG_SYNC | \
7664 XFS_DIFLAG_NOATIME | XFS_DIFLAG_NODUMP | XFS_DIFLAG_RTINHERIT | \ 7738 XFS_DIFLAG_NOATIME | XFS_DIFLAG_NODUMP | XFS_DIFLAG_RTINHERIT | \
7665- XFS_DIFLAG_PROJINHERIT | XFS_DIFLAG_NOSYMLINKS)
7666+ XFS_DIFLAG_PROJINHERIT | XFS_DIFLAG_NOSYMLINKS | \ 7739 XFS_DIFLAG_PROJINHERIT | XFS_DIFLAG_NOSYMLINKS | XFS_DIFLAG_EXTSIZE | \
7740- XFS_DIFLAG_EXTSZINHERIT)
7667+ XFS_DIFLAG_BARRIER | XFS_DIFLAG_IUNLINK) 7741+ XFS_DIFLAG_EXTSZINHERIT | XFS_DIFLAG_BARRIER | XFS_DIFLAG_IUNLINK)
7668 7742
7669 #endif /* __XFS_DINODE_H__ */ 7743 #endif /* __XFS_DINODE_H__ */
7670Index: vserver-sources-2.0.2_2.6.15/fs/xfs/xfs_fs.h 7744Index: linux-2.6.16/fs/xfs/xfs_fs.h
7671=================================================================== 7745===================================================================
7672--- vserver-sources-2.0.2_2.6.15.orig/fs/xfs/xfs_fs.h 7746--- linux-2.6.16.orig/fs/xfs/xfs_fs.h
7673+++ vserver-sources-2.0.2_2.6.15/fs/xfs/xfs_fs.h 7747+++ linux-2.6.16/fs/xfs/xfs_fs.h
7674@@ -65,6 +65,8 @@ struct fsxattr { 7748@@ -67,6 +67,8 @@ struct fsxattr {
7675 #define XFS_XFLAG_RTINHERIT 0x00000100 /* create with rt bit set */
7676 #define XFS_XFLAG_PROJINHERIT 0x00000200 /* create with parents projid */
7677 #define XFS_XFLAG_NOSYMLINKS 0x00000400 /* disallow symlink creation */ 7749 #define XFS_XFLAG_NOSYMLINKS 0x00000400 /* disallow symlink creation */
7750 #define XFS_XFLAG_EXTSIZE 0x00000800 /* extent size allocator hint */
7751 #define XFS_XFLAG_EXTSZINHERIT 0x00001000 /* inherit inode extent size */
7678+#define XFS_XFLAG_BARRIER 0x00004000 /* chroot() barrier */ 7752+#define XFS_XFLAG_BARRIER 0x00004000 /* chroot() barrier */
7679+#define XFS_XFLAG_IUNLINK 0x00008000 /* immutable unlink */ 7753+#define XFS_XFLAG_IUNLINK 0x00008000 /* immutable unlink */
7680 #define XFS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */ 7754 #define XFS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */
7681 7755
7682 /* 7756 /*
7683@@ -293,7 +295,8 @@ typedef struct xfs_bstat { 7757@@ -295,7 +297,8 @@ typedef struct xfs_bstat {
7684 __s32 bs_extents; /* number of extents */ 7758 __s32 bs_extents; /* number of extents */
7685 __u32 bs_gen; /* generation count */ 7759 __u32 bs_gen; /* generation count */
7686 __u16 bs_projid; /* project id */ 7760 __u16 bs_projid; /* project id */
7687- unsigned char bs_pad[14]; /* pad space, unused */ 7761- unsigned char bs_pad[14]; /* pad space, unused */
7688+ __u16 bs_xid; /* context id */ 7762+ __u16 bs_xid; /* context id */
7689+ unsigned char bs_pad[12]; /* pad space, unused */ 7763+ unsigned char bs_pad[12]; /* pad space, unused */
7690 __u32 bs_dmevmask; /* DMIG event mask */ 7764 __u32 bs_dmevmask; /* DMIG event mask */
7691 __u16 bs_dmstate; /* DMIG state info */ 7765 __u16 bs_dmstate; /* DMIG state info */
7692 __u16 bs_aextents; /* attribute number of extents */ 7766 __u16 bs_aextents; /* attribute number of extents */
7693Index: vserver-sources-2.0.2_2.6.15/fs/xfs/xfs_inode.c 7767Index: linux-2.6.16/fs/xfs/xfs_inode.c
7694=================================================================== 7768===================================================================
7695--- vserver-sources-2.0.2_2.6.15.orig/fs/xfs/xfs_inode.c 7769--- linux-2.6.16.orig/fs/xfs/xfs_inode.c
7696+++ vserver-sources-2.0.2_2.6.15/fs/xfs/xfs_inode.c 7770+++ linux-2.6.16/fs/xfs/xfs_inode.c
7697@@ -52,6 +52,7 @@ 7771@@ -52,6 +52,7 @@
7698 #include "xfs_mac.h" 7772 #include "xfs_mac.h"
7699 #include "xfs_acl.h" 7773 #include "xfs_acl.h"
7700 7774
7701+#include <linux/vserver/xid.h> 7775+#include <linux/vserver/xid.h>
7702 7776
7703 kmem_zone_t *xfs_ifork_zone; 7777 kmem_zone_t *xfs_ifork_zone;
7704 kmem_zone_t *xfs_inode_zone; 7778 kmem_zone_t *xfs_inode_zone;
7705@@ -733,20 +734,35 @@ xfs_xlate_dinode_core( 7779@@ -734,20 +735,35 @@ xfs_xlate_dinode_core(
7706 xfs_dinode_core_t *buf_core = (xfs_dinode_core_t *)buf; 7780 xfs_dinode_core_t *buf_core = (xfs_dinode_core_t *)buf;
7707 xfs_dinode_core_t *mem_core = (xfs_dinode_core_t *)dip; 7781 xfs_dinode_core_t *mem_core = (xfs_dinode_core_t *)dip;
7708 xfs_arch_t arch = ARCH_CONVERT; 7782 xfs_arch_t arch = ARCH_CONVERT;
7709+ uint32_t uid = 0, gid = 0; 7783+ uint32_t uid = 0, gid = 0;
7710+ uint16_t xid = 0; 7784+ uint16_t xid = 0;
7738+ mem_core->di_gid = INOXID_GID(1, uid, gid); 7812+ mem_core->di_gid = INOXID_GID(1, uid, gid);
7739+ mem_core->di_xid = INOXID_XID(1, uid, gid, xid); 7813+ mem_core->di_xid = INOXID_XID(1, uid, gid, xid);
7740 memcpy(mem_core->di_pad, buf_core->di_pad, 7814 memcpy(mem_core->di_pad, buf_core->di_pad,
7741 sizeof(buf_core->di_pad)); 7815 sizeof(buf_core->di_pad));
7742 } else { 7816 } else {
7743@@ -795,6 +811,10 @@ _xfs_dic2xflags( 7817@@ -796,6 +812,10 @@ _xfs_dic2xflags(
7744 flags |= XFS_XFLAG_PREALLOC; 7818 flags |= XFS_XFLAG_PREALLOC;
7745 if (di_flags & XFS_DIFLAG_IMMUTABLE) 7819 if (di_flags & XFS_DIFLAG_IMMUTABLE)
7746 flags |= XFS_XFLAG_IMMUTABLE; 7820 flags |= XFS_XFLAG_IMMUTABLE;
7747+ if (di_flags & XFS_DIFLAG_IUNLINK) 7821+ if (di_flags & XFS_DIFLAG_IUNLINK)
7748+ flags |= XFS_XFLAG_IUNLINK; 7822+ flags |= XFS_XFLAG_IUNLINK;
7749+ if (di_flags & XFS_DIFLAG_BARRIER) 7823+ if (di_flags & XFS_DIFLAG_BARRIER)
7750+ flags |= XFS_XFLAG_BARRIER; 7824+ flags |= XFS_XFLAG_BARRIER;
7751 if (di_flags & XFS_DIFLAG_APPEND) 7825 if (di_flags & XFS_DIFLAG_APPEND)
7752 flags |= XFS_XFLAG_APPEND; 7826 flags |= XFS_XFLAG_APPEND;
7753 if (di_flags & XFS_DIFLAG_SYNC) 7827 if (di_flags & XFS_DIFLAG_SYNC)
7754@@ -1120,6 +1140,7 @@ xfs_ialloc( 7828@@ -1125,6 +1145,7 @@ xfs_ialloc(
7755 ASSERT(ip->i_d.di_nlink == nlink); 7829 ASSERT(ip->i_d.di_nlink == nlink);
7756 ip->i_d.di_uid = current_fsuid(cr); 7830 ip->i_d.di_uid = current_fsuid(cr);
7757 ip->i_d.di_gid = current_fsgid(cr); 7831 ip->i_d.di_gid = current_fsgid(cr);
7758+ ip->i_d.di_xid = current_fsxid(cr, vp); 7832+ ip->i_d.di_xid = current_fsxid(cr, vp);
7759 ip->i_d.di_projid = prid; 7833 ip->i_d.di_projid = prid;
7760 memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad)); 7834 memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad));
7761 7835
7762Index: vserver-sources-2.0.2_2.6.15/fs/xfs/xfs_itable.c 7836Index: linux-2.6.16/fs/xfs/xfs_itable.c
7763=================================================================== 7837===================================================================
7764--- vserver-sources-2.0.2_2.6.15.orig/fs/xfs/xfs_itable.c 7838--- linux-2.6.16.orig/fs/xfs/xfs_itable.c
7765+++ vserver-sources-2.0.2_2.6.15/fs/xfs/xfs_itable.c 7839+++ linux-2.6.16/fs/xfs/xfs_itable.c
7766@@ -83,6 +83,7 @@ xfs_bulkstat_one_iget( 7840@@ -85,6 +85,7 @@ xfs_bulkstat_one_iget(
7767 buf->bs_mode = dic->di_mode; 7841 buf->bs_mode = dic->di_mode;
7768 buf->bs_uid = dic->di_uid; 7842 buf->bs_uid = dic->di_uid;
7769 buf->bs_gid = dic->di_gid; 7843 buf->bs_gid = dic->di_gid;
7770+ buf->bs_xid = dic->di_xid; 7844+ buf->bs_xid = dic->di_xid;
7771 buf->bs_size = dic->di_size; 7845 buf->bs_size = dic->di_size;
7846 vn_atime_to_bstime(vp, &buf->bs_atime);
7772 buf->bs_atime.tv_sec = dic->di_atime.t_sec; 7847 buf->bs_mtime.tv_sec = dic->di_mtime.t_sec;
7773 buf->bs_atime.tv_nsec = dic->di_atime.t_nsec;
7774@@ -158,6 +159,7 @@ xfs_bulkstat_one_dinode( 7848@@ -159,6 +160,7 @@ xfs_bulkstat_one_dinode(
7775 buf->bs_mode = INT_GET(dic->di_mode, ARCH_CONVERT); 7849 buf->bs_mode = INT_GET(dic->di_mode, ARCH_CONVERT);
7776 buf->bs_uid = INT_GET(dic->di_uid, ARCH_CONVERT); 7850 buf->bs_uid = INT_GET(dic->di_uid, ARCH_CONVERT);
7777 buf->bs_gid = INT_GET(dic->di_gid, ARCH_CONVERT); 7851 buf->bs_gid = INT_GET(dic->di_gid, ARCH_CONVERT);
7778+ buf->bs_xid = INT_GET(dic->di_xid, ARCH_CONVERT); 7852+ buf->bs_xid = INT_GET(dic->di_xid, ARCH_CONVERT);
7779 buf->bs_size = INT_GET(dic->di_size, ARCH_CONVERT); 7853 buf->bs_size = INT_GET(dic->di_size, ARCH_CONVERT);
7780 buf->bs_atime.tv_sec = INT_GET(dic->di_atime.t_sec, ARCH_CONVERT); 7854 buf->bs_atime.tv_sec = INT_GET(dic->di_atime.t_sec, ARCH_CONVERT);
7781 buf->bs_atime.tv_nsec = INT_GET(dic->di_atime.t_nsec, ARCH_CONVERT); 7855 buf->bs_atime.tv_nsec = INT_GET(dic->di_atime.t_nsec, ARCH_CONVERT);
7782Index: vserver-sources-2.0.2_2.6.15/fs/xfs/xfs_mount.h 7856Index: linux-2.6.16/fs/xfs/xfs_mount.h
7783=================================================================== 7857===================================================================
7784--- vserver-sources-2.0.2_2.6.15.orig/fs/xfs/xfs_mount.h 7858--- linux-2.6.16.orig/fs/xfs/xfs_mount.h
7785+++ vserver-sources-2.0.2_2.6.15/fs/xfs/xfs_mount.h 7859+++ linux-2.6.16/fs/xfs/xfs_mount.h
7786@@ -413,6 +413,7 @@ typedef struct xfs_mount { 7860@@ -412,6 +412,7 @@ typedef struct xfs_mount {
7787 #define XFS_MOUNT_COMPAT_IOSIZE (1ULL << 22) /* don't report large preferred 7861 #define XFS_MOUNT_COMPAT_IOSIZE (1ULL << 22) /* don't report large preferred
7788 * I/O size in stat() */ 7862 * I/O size in stat() */
7789 7863
7790+#define XFS_MOUNT_TAGXID (1ULL << 31) /* context xid tagging */ 7864+#define XFS_MOUNT_TAGXID (1ULL << 31) /* context xid tagging */
7791 7865
7792 /* 7866 /*
7793 * Default minimum read and write sizes. 7867 * Default minimum read and write sizes.
7794Index: vserver-sources-2.0.2_2.6.15/fs/xfs/xfs_vfsops.c 7868Index: linux-2.6.16/fs/xfs/xfs_vfsops.c
7795=================================================================== 7869===================================================================
7796--- vserver-sources-2.0.2_2.6.15.orig/fs/xfs/xfs_vfsops.c 7870--- linux-2.6.16.orig/fs/xfs/xfs_vfsops.c
7797+++ vserver-sources-2.0.2_2.6.15/fs/xfs/xfs_vfsops.c 7871+++ linux-2.6.16/fs/xfs/xfs_vfsops.c
7798@@ -295,6 +295,8 @@ xfs_start_flags( 7872@@ -296,6 +296,8 @@ xfs_start_flags(
7799 7873
7800 if (ap->flags2 & XFSMNT2_COMPAT_IOSIZE) 7874 if (ap->flags2 & XFSMNT2_COMPAT_IOSIZE)
7801 mp->m_flags |= XFS_MOUNT_COMPAT_IOSIZE; 7875 mp->m_flags |= XFS_MOUNT_COMPAT_IOSIZE;
7802+ if (ap->flags2 & XFSMNT2_TAGXID) 7876+ if (ap->flags2 & XFSMNT2_TAGXID)
7803+ mp->m_flags |= XFS_MOUNT_TAGXID; 7877+ mp->m_flags |= XFS_MOUNT_TAGXID;
7804 7878
7805 /* 7879 /*
7806 * no recovery flag requires a read-only mount 7880 * no recovery flag requires a read-only mount
7807@@ -386,6 +388,8 @@ xfs_finish_flags( 7881@@ -390,6 +392,8 @@ xfs_finish_flags(
7808 mp->m_flags &= ~XFS_MOUNT_COMPAT_ATTR; 7882 return XFS_ERROR(EINVAL);
7809 } 7883 }
7810 7884
7811+ if (ap->flags2 & XFSMNT2_TAGXID) 7885+ if (ap->flags2 & XFSMNT2_TAGXID)
7812+ vfs->vfs_super->s_flags |= MS_TAGXID; 7886+ vfs->vfs_super->s_flags |= MS_TAGXID;
7813 return 0; 7887 return 0;
7814 } 7888 }
7815 7889
7816@@ -1643,6 +1647,7 @@ xfs_vget( 7890@@ -1653,6 +1657,7 @@ xfs_vget(
7817 * in stat(). */ 7891 * in stat(). */
7818 #define MNTOPT_ATTR2 "attr2" /* do use attr2 attribute format */ 7892 #define MNTOPT_ATTR2 "attr2" /* do use attr2 attribute format */
7819 #define MNTOPT_NOATTR2 "noattr2" /* do not use attr2 attribute format */ 7893 #define MNTOPT_NOATTR2 "noattr2" /* do not use attr2 attribute format */
7820+#define MNTOPT_TAGXID "tagxid" /* context xid tagging for inodes */ 7894+#define MNTOPT_TAGXID "tagxid" /* context xid tagging for inodes */
7821 7895
7822 STATIC unsigned long 7896 STATIC unsigned long
7823 suffix_strtoul(const char *cp, char **endp, unsigned int base) 7897 suffix_strtoul(const char *cp, char **endp, unsigned int base)
7824@@ -1818,6 +1823,10 @@ xfs_parseargs( 7898@@ -1829,6 +1834,10 @@ xfs_parseargs(
7825 args->flags &= ~XFSMNT_COMPAT_ATTR; 7899 args->flags |= XFSMNT_ATTR2;
7826 } else if (!strcmp(this_char, MNTOPT_NOATTR2)) { 7900 } else if (!strcmp(this_char, MNTOPT_NOATTR2)) {
7827 args->flags |= XFSMNT_COMPAT_ATTR; 7901 args->flags &= ~XFSMNT_ATTR2;
7828+#ifndef CONFIG_INOXID_NONE 7902+#ifndef CONFIG_INOXID_NONE
7829+ } else if (!strcmp(this_char, MNTOPT_TAGXID)) { 7903+ } else if (!strcmp(this_char, MNTOPT_TAGXID)) {
7830+ args->flags2 |= XFSMNT2_TAGXID; 7904+ args->flags2 |= XFSMNT2_TAGXID;
7831+#endif 7905+#endif
7832 } else if (!strcmp(this_char, "osyncisdsync")) { 7906 } else if (!strcmp(this_char, "osyncisdsync")) {
7833 /* no-op, this is now the default */ 7907 /* no-op, this is now the default */
7834 printk("XFS: osyncisdsync is now the default, option is deprecated.\n"); 7908 printk("XFS: osyncisdsync is now the default, option is deprecated.\n");
7835Index: vserver-sources-2.0.2_2.6.15/fs/xfs/xfs_vnodeops.c 7909Index: linux-2.6.16/fs/xfs/xfs_vnodeops.c
7836=================================================================== 7910===================================================================
7837--- vserver-sources-2.0.2_2.6.15.orig/fs/xfs/xfs_vnodeops.c 7911--- linux-2.6.16.orig/fs/xfs/xfs_vnodeops.c
7838+++ vserver-sources-2.0.2_2.6.15/fs/xfs/xfs_vnodeops.c 7912+++ linux-2.6.16/fs/xfs/xfs_vnodeops.c
7839@@ -151,6 +151,7 @@ xfs_getattr( 7913@@ -154,6 +154,7 @@ xfs_getattr(
7840 vap->va_mode = ip->i_d.di_mode; 7914 vap->va_mode = ip->i_d.di_mode;
7841 vap->va_uid = ip->i_d.di_uid; 7915 vap->va_uid = ip->i_d.di_uid;
7842 vap->va_gid = ip->i_d.di_gid; 7916 vap->va_gid = ip->i_d.di_gid;
7843+ vap->va_xid = ip->i_d.di_xid; 7917+ vap->va_xid = ip->i_d.di_xid;
7844 vap->va_projid = ip->i_d.di_projid; 7918 vap->va_projid = ip->i_d.di_projid;
7845 7919
7846 /* 7920 /*
7847@@ -252,6 +253,7 @@ xfs_setattr( 7921@@ -254,6 +255,7 @@ xfs_setattr(
7848 uint commit_flags=0; 7922 uint commit_flags=0;
7849 uid_t uid=0, iuid=0; 7923 uid_t uid=0, iuid=0;
7850 gid_t gid=0, igid=0; 7924 gid_t gid=0, igid=0;
7851+ xid_t xid=0, ixid=0; 7925+ xid_t xid=0, ixid=0;
7852 int timeflags = 0; 7926 int timeflags = 0;
7853 vnode_t *vp; 7927 vnode_t *vp;
7854 xfs_prid_t projid=0, iprojid=0; 7928 xfs_prid_t projid=0, iprojid=0;
7855@@ -308,6 +310,7 @@ xfs_setattr( 7929@@ -310,6 +312,7 @@ xfs_setattr(
7856 (mask & (XFS_AT_UID|XFS_AT_GID|XFS_AT_PROJID))) { 7930 (mask & (XFS_AT_UID|XFS_AT_GID|XFS_AT_PROJID))) {
7857 uint qflags = 0; 7931 uint qflags = 0;
7858 7932
7859+ /* FIXME: handle xid? */ 7933+ /* FIXME: handle xid? */
7860 if ((mask & XFS_AT_UID) && XFS_IS_UQUOTA_ON(mp)) { 7934 if ((mask & XFS_AT_UID) && XFS_IS_UQUOTA_ON(mp)) {
7861 uid = vap->va_uid; 7935 uid = vap->va_uid;
7862 qflags |= XFS_QMOPT_UQUOTA; 7936 qflags |= XFS_QMOPT_UQUOTA;
7863@@ -388,6 +391,8 @@ xfs_setattr( 7937@@ -390,6 +393,8 @@ xfs_setattr(
7864 if (mask & 7938 if (mask &
7865 (XFS_AT_MODE|XFS_AT_XFLAGS|XFS_AT_EXTSIZE|XFS_AT_UID| 7939 (XFS_AT_MODE|XFS_AT_XFLAGS|XFS_AT_EXTSIZE|XFS_AT_UID|
7866 XFS_AT_GID|XFS_AT_PROJID)) { 7940 XFS_AT_GID|XFS_AT_PROJID)) {
7867+ /* FIXME: handle xid? */ 7941+ /* FIXME: handle xid? */
7868+ 7942+
7869 /* 7943 /*
7870 * CAP_FOWNER overrides the following restrictions: 7944 * CAP_FOWNER overrides the following restrictions:
7871 * 7945 *
7872@@ -436,7 +441,7 @@ xfs_setattr( 7946@@ -438,7 +443,7 @@ xfs_setattr(
7873 * and can change the group id only to a group of which he 7947 * and can change the group id only to a group of which he
7874 * or she is a member. 7948 * or she is a member.
7875 */ 7949 */
7876- if (mask & (XFS_AT_UID|XFS_AT_GID|XFS_AT_PROJID)) { 7950- if (mask & (XFS_AT_UID|XFS_AT_GID|XFS_AT_PROJID)) {
7877+ if (mask & (XFS_AT_UID|XFS_AT_GID|XFS_AT_XID|XFS_AT_PROJID)) { 7951+ if (mask & (XFS_AT_UID|XFS_AT_GID|XFS_AT_XID|XFS_AT_PROJID)) {
7878 /* 7952 /*
7879 * These IDs could have changed since we last looked at them. 7953 * These IDs could have changed since we last looked at them.
7880 * But, we're assured that if the ownership did change 7954 * But, we're assured that if the ownership did change
7881@@ -444,10 +449,12 @@ xfs_setattr( 7955@@ -446,10 +451,12 @@ xfs_setattr(
7882 * would have changed also. 7956 * would have changed also.
7883 */ 7957 */
7884 iuid = ip->i_d.di_uid; 7958 iuid = ip->i_d.di_uid;
7885- iprojid = ip->i_d.di_projid; 7959- iprojid = ip->i_d.di_projid;
7886 igid = ip->i_d.di_gid; 7960 igid = ip->i_d.di_gid;
7891+ gid = (mask & XFS_AT_GID) ? vap->va_gid : igid; 7965+ gid = (mask & XFS_AT_GID) ? vap->va_gid : igid;
7892+ xid = (mask & XFS_AT_XID) ? vap->va_xid : ixid; 7966+ xid = (mask & XFS_AT_XID) ? vap->va_xid : ixid;
7893 projid = (mask & XFS_AT_PROJID) ? (xfs_prid_t)vap->va_projid : 7967 projid = (mask & XFS_AT_PROJID) ? (xfs_prid_t)vap->va_projid :
7894 iprojid; 7968 iprojid;
7895 7969
7896@@ -475,6 +482,7 @@ xfs_setattr( 7970@@ -477,6 +484,7 @@ xfs_setattr(
7897 if ((XFS_IS_UQUOTA_ON(mp) && iuid != uid) || 7971 if ((XFS_IS_UQUOTA_ON(mp) && iuid != uid) ||
7898 (XFS_IS_PQUOTA_ON(mp) && iprojid != projid) || 7972 (XFS_IS_PQUOTA_ON(mp) && iprojid != projid) ||
7899 (XFS_IS_GQUOTA_ON(mp) && igid != gid)) { 7973 (XFS_IS_GQUOTA_ON(mp) && igid != gid)) {
7900+ /* FIXME: handle xid? */ 7974+ /* FIXME: handle xid? */
7901 ASSERT(tp); 7975 ASSERT(tp);
7902 code = XFS_QM_DQVOPCHOWNRESV(mp, tp, ip, udqp, gdqp, 7976 code = XFS_QM_DQVOPCHOWNRESV(mp, tp, ip, udqp, gdqp,
7903 capable(CAP_FOWNER) ? 7977 capable(CAP_FOWNER) ?
7904@@ -709,7 +717,7 @@ xfs_setattr( 7978@@ -693,7 +701,7 @@ xfs_setattr(
7905 * and can change the group id only to a group of which he 7979 * and can change the group id only to a group of which he
7906 * or she is a member. 7980 * or she is a member.
7907 */ 7981 */
7908- if (mask & (XFS_AT_UID|XFS_AT_GID|XFS_AT_PROJID)) { 7982- if (mask & (XFS_AT_UID|XFS_AT_GID|XFS_AT_PROJID)) {
7909+ if (mask & (XFS_AT_UID|XFS_AT_GID|XFS_AT_XID|XFS_AT_PROJID)) { 7983+ if (mask & (XFS_AT_UID|XFS_AT_GID|XFS_AT_XID|XFS_AT_PROJID)) {
7910 /* 7984 /*
7911 * CAP_FSETID overrides the following restrictions: 7985 * CAP_FSETID overrides the following restrictions:
7912 * 7986 *
7913@@ -725,6 +733,12 @@ xfs_setattr( 7987@@ -709,6 +717,12 @@ xfs_setattr(
7914 * Change the ownerships and register quota modifications 7988 * Change the ownerships and register quota modifications
7915 * in the transaction. 7989 * in the transaction.
7916 */ 7990 */
7917+ if (ixid != xid) { 7991+ if (ixid != xid) {
7918+ if (XFS_IS_GQUOTA_ON(mp)) { 7992+ if (XFS_IS_GQUOTA_ON(mp)) {
7921+ ip->i_d.di_xid = xid; 7995+ ip->i_d.di_xid = xid;
7922+ } 7996+ }
7923 if (iuid != uid) { 7997 if (iuid != uid) {
7924 if (XFS_IS_UQUOTA_ON(mp)) { 7998 if (XFS_IS_UQUOTA_ON(mp)) {
7925 ASSERT(mask & XFS_AT_UID); 7999 ASSERT(mask & XFS_AT_UID);
7926@@ -805,6 +819,10 @@ xfs_setattr( 8000@@ -789,6 +803,10 @@ xfs_setattr(
7927 di_flags = (ip->i_d.di_flags & XFS_DIFLAG_PREALLOC); 8001 di_flags = (ip->i_d.di_flags & XFS_DIFLAG_PREALLOC);
7928 if (vap->va_xflags & XFS_XFLAG_IMMUTABLE) 8002 if (vap->va_xflags & XFS_XFLAG_IMMUTABLE)
7929 di_flags |= XFS_DIFLAG_IMMUTABLE; 8003 di_flags |= XFS_DIFLAG_IMMUTABLE;
7930+ if (vap->va_xflags & XFS_XFLAG_IUNLINK) 8004+ if (vap->va_xflags & XFS_XFLAG_IUNLINK)
7931+ di_flags |= XFS_DIFLAG_IUNLINK; 8005+ di_flags |= XFS_DIFLAG_IUNLINK;
7932+ if (vap->va_xflags & XFS_XFLAG_BARRIER) 8006+ if (vap->va_xflags & XFS_XFLAG_BARRIER)
7933+ di_flags |= XFS_DIFLAG_BARRIER; 8007+ di_flags |= XFS_DIFLAG_BARRIER;
7934 if (vap->va_xflags & XFS_XFLAG_APPEND) 8008 if (vap->va_xflags & XFS_XFLAG_APPEND)
7935 di_flags |= XFS_DIFLAG_APPEND; 8009 di_flags |= XFS_DIFLAG_APPEND;
7936 if (vap->va_xflags & XFS_XFLAG_SYNC) 8010 if (vap->va_xflags & XFS_XFLAG_SYNC)
7937Index: vserver-sources-2.0.2_2.6.15/include/asm-arm/tlb.h 8011Index: linux-2.6.16/include/asm-arm/tlb.h
7938=================================================================== 8012===================================================================
7939--- vserver-sources-2.0.2_2.6.15.orig/include/asm-arm/tlb.h 8013--- linux-2.6.16.orig/include/asm-arm/tlb.h
7940+++ vserver-sources-2.0.2_2.6.15/include/asm-arm/tlb.h 8014+++ linux-2.6.16/include/asm-arm/tlb.h
7941@@ -20,6 +20,7 @@ 8015@@ -20,6 +20,7 @@
7942 #include <asm/cacheflush.h> 8016 #include <asm/cacheflush.h>
7943 #include <asm/tlbflush.h> 8017 #include <asm/tlbflush.h>
7944 #include <asm/pgalloc.h> 8018 #include <asm/pgalloc.h>
7945+#include <linux/vs_memory.h> 8019+#include <linux/vs_memory.h>
7946 8020
7947 /* 8021 /*
7948 * TLB handling. This allows us to remove pages from the page 8022 * TLB handling. This allows us to remove pages from the page
7949Index: vserver-sources-2.0.2_2.6.15/include/asm-arm26/tlb.h 8023Index: linux-2.6.16/include/asm-arm26/tlb.h
7950=================================================================== 8024===================================================================
7951--- vserver-sources-2.0.2_2.6.15.orig/include/asm-arm26/tlb.h 8025--- linux-2.6.16.orig/include/asm-arm26/tlb.h
7952+++ vserver-sources-2.0.2_2.6.15/include/asm-arm26/tlb.h 8026+++ linux-2.6.16/include/asm-arm26/tlb.h
7953@@ -3,6 +3,7 @@ 8027@@ -3,6 +3,7 @@
7954 8028
7955 #include <asm/pgalloc.h> 8029 #include <asm/pgalloc.h>
7956 #include <asm/tlbflush.h> 8030 #include <asm/tlbflush.h>
7957+#include <linux/vs_memory.h> 8031+#include <linux/vs_memory.h>
7958 8032
7959 /* 8033 /*
7960 * TLB handling. This allows us to remove pages from the page 8034 * TLB handling. This allows us to remove pages from the page
7961Index: vserver-sources-2.0.2_2.6.15/include/asm-arm26/unistd.h 8035Index: linux-2.6.16/include/asm-arm26/unistd.h
7962=================================================================== 8036===================================================================
7963--- vserver-sources-2.0.2_2.6.15.orig/include/asm-arm26/unistd.h 8037--- linux-2.6.16.orig/include/asm-arm26/unistd.h
7964+++ vserver-sources-2.0.2_2.6.15/include/asm-arm26/unistd.h 8038+++ linux-2.6.16/include/asm-arm26/unistd.h
7965@@ -304,6 +304,8 @@ 8039@@ -304,6 +304,8 @@
7966 #define __NR_mq_getsetattr (__NR_SYSCALL_BASE+279) 8040 #define __NR_mq_getsetattr (__NR_SYSCALL_BASE+279)
7967 #define __NR_waitid (__NR_SYSCALL_BASE+280) 8041 #define __NR_waitid (__NR_SYSCALL_BASE+280)
7968 8042
7969+#define __NR_vserver (__NR_SYSCALL_BASE+313) 8043+#define __NR_vserver (__NR_SYSCALL_BASE+313)
7970+ 8044+
7971 /* 8045 /*
7972 * The following SWIs are ARM private. FIXME - make appropriate for arm26 8046 * The following SWIs are ARM private. FIXME - make appropriate for arm26
7973 */ 8047 */
7974Index: vserver-sources-2.0.2_2.6.15/include/asm-generic/tlb.h 8048Index: linux-2.6.16/include/asm-generic/tlb.h
7975=================================================================== 8049===================================================================
7976--- vserver-sources-2.0.2_2.6.15.orig/include/asm-generic/tlb.h 8050--- linux-2.6.16.orig/include/asm-generic/tlb.h
7977+++ vserver-sources-2.0.2_2.6.15/include/asm-generic/tlb.h 8051+++ linux-2.6.16/include/asm-generic/tlb.h
7978@@ -15,6 +15,7 @@ 8052@@ -15,6 +15,7 @@
7979 8053
7980 #include <linux/config.h> 8054 #include <linux/config.h>
7981 #include <linux/swap.h> 8055 #include <linux/swap.h>
7982+#include <linux/vs_memory.h> 8056+#include <linux/vs_memory.h>
7983 #include <asm/pgalloc.h> 8057 #include <asm/pgalloc.h>
7984 #include <asm/tlbflush.h> 8058 #include <asm/tlbflush.h>
7985 8059
7986Index: vserver-sources-2.0.2_2.6.15/include/asm-i386/elf.h 8060Index: linux-2.6.16/include/asm-i386/elf.h
7987=================================================================== 8061===================================================================
7988--- vserver-sources-2.0.2_2.6.15.orig/include/asm-i386/elf.h 8062--- linux-2.6.16.orig/include/asm-i386/elf.h
7989+++ vserver-sources-2.0.2_2.6.15/include/asm-i386/elf.h 8063+++ linux-2.6.16/include/asm-i386/elf.h
7990@@ -71,7 +71,7 @@ typedef struct user_fxsr_struct elf_fpxr 8064@@ -71,7 +71,7 @@ typedef struct user_fxsr_struct elf_fpxr
7991 the loader. We need to make sure that it is out of the way of the program 8065 the loader. We need to make sure that it is out of the way of the program
7992 that it will "exec", and that there is sufficient room for the brk. */ 8066 that it will "exec", and that there is sufficient room for the brk. */
7993 8067
7994-#define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2) 8068-#define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2)
7995+#define ELF_ET_DYN_BASE ((TASK_UNMAPPED_BASE) * 2) 8069+#define ELF_ET_DYN_BASE ((TASK_UNMAPPED_BASE) * 2)
7996 8070
7997 /* regs is struct pt_regs, pr_reg is elf_gregset_t (which is 8071 /* regs is struct pt_regs, pr_reg is elf_gregset_t (which is
7998 now struct_user_regs, they are different) */ 8072 now struct_user_regs, they are different) */
7999Index: vserver-sources-2.0.2_2.6.15/include/asm-i386/page.h 8073Index: linux-2.6.16/include/asm-i386/page.h
8000=================================================================== 8074===================================================================
8001--- vserver-sources-2.0.2_2.6.15.orig/include/asm-i386/page.h 8075--- linux-2.6.16.orig/include/asm-i386/page.h
8002+++ vserver-sources-2.0.2_2.6.15/include/asm-i386/page.h 8076+++ linux-2.6.16/include/asm-i386/page.h
8003@@ -109,19 +109,27 @@ extern int page_is_ram(unsigned long pag 8077@@ -109,19 +109,15 @@ extern int page_is_ram(unsigned long pag
8004 8078
8005 #endif /* __ASSEMBLY__ */ 8079 #endif /* __ASSEMBLY__ */
8006 8080
8007-#ifdef __ASSEMBLY__ 8081-#ifdef __ASSEMBLY__
8008+#if defined(CONFIG_SPLIT_3GB) 8082 #define __PAGE_OFFSET CONFIG_PAGE_OFFSET
8009 #define __PAGE_OFFSET (0xC0000000)
8010-#define __PHYSICAL_START CONFIG_PHYSICAL_START 8083 #define __PHYSICAL_START CONFIG_PHYSICAL_START
8011-#else 8084-#else
8012-#define __PAGE_OFFSET (0xC0000000UL) 8085-#define __PAGE_OFFSET ((unsigned long)CONFIG_PAGE_OFFSET)
8013-#define __PHYSICAL_START ((unsigned long)CONFIG_PHYSICAL_START) 8086-#define __PHYSICAL_START ((unsigned long)CONFIG_PHYSICAL_START)
8014+#elif defined(CONFIG_SPLIT_25GB)
8015+#define __PAGE_OFFSET (0xA0000000)
8016+#elif defined(CONFIG_SPLIT_2GB)
8017+#define __PAGE_OFFSET (0x80000000)
8018+#elif defined(CONFIG_SPLIT_15GB)
8019+#define __PAGE_OFFSET (0x60000000)
8020+#elif defined(CONFIG_SPLIT_1GB)
8021+#define __PAGE_OFFSET (0x40000000)
8022 #endif 8087-#endif
8023+
8024+#define __PHYSICAL_START CONFIG_PHYSICAL_START
8025 #define __KERNEL_START (__PAGE_OFFSET + __PHYSICAL_START) 8088 #define __KERNEL_START (__PAGE_OFFSET + __PHYSICAL_START)
8089-
8026+#define __MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE) 8090+#define __MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE)
8027
8028 8091
8029 #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) 8092 #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
8030+#define PHYSICAL_START ((unsigned long)__PHYSICAL_START) 8093+#define PHYSICAL_START ((unsigned long)__PHYSICAL_START)
8031 #define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE) 8094 #define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE)
8032-#define MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE) 8095-#define MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE)
8033+#define MAXMEM ((unsigned long)__MAXMEM) 8096+#define MAXMEM ((unsigned long)__MAXMEM)
8034 #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) 8097 #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
8035 #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) 8098 #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
8036 #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) 8099 #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
8037Index: vserver-sources-2.0.2_2.6.15/include/asm-i386/processor.h 8100Index: linux-2.6.16/include/asm-i386/processor.h
8038=================================================================== 8101===================================================================
8039--- vserver-sources-2.0.2_2.6.15.orig/include/asm-i386/processor.h 8102--- linux-2.6.16.orig/include/asm-i386/processor.h
8040+++ vserver-sources-2.0.2_2.6.15/include/asm-i386/processor.h 8103+++ linux-2.6.16/include/asm-i386/processor.h
8041@@ -312,9 +312,10 @@ extern unsigned int mca_pentium_flag; 8104@@ -316,9 +316,10 @@ extern unsigned int mca_pentium_flag;
8042 extern int bootloader_type; 8105 extern int bootloader_type;
8043 8106
8044 /* 8107 /*
8045- * User space process size: 3GB (default). 8108- * User space process size: 3GB (default).
8046+ * User space process size: (3GB default). 8109+ * User space process size: (3GB default).
8049+#define __TASK_SIZE (__PAGE_OFFSET) 8112+#define __TASK_SIZE (__PAGE_OFFSET)
8050+#define TASK_SIZE ((unsigned long)__TASK_SIZE) 8113+#define TASK_SIZE ((unsigned long)__TASK_SIZE)
8051 8114
8052 /* This decides where the kernel will search for a free chunk of vm 8115 /* This decides where the kernel will search for a free chunk of vm
8053 * space during mmap's. 8116 * space during mmap's.
8054Index: vserver-sources-2.0.2_2.6.15/include/asm-ia64/tlb.h 8117Index: linux-2.6.16/include/asm-ia64/tlb.h
8055=================================================================== 8118===================================================================
8056--- vserver-sources-2.0.2_2.6.15.orig/include/asm-ia64/tlb.h 8119--- linux-2.6.16.orig/include/asm-ia64/tlb.h
8057+++ vserver-sources-2.0.2_2.6.15/include/asm-ia64/tlb.h 8120+++ linux-2.6.16/include/asm-ia64/tlb.h
8058@@ -41,6 +41,7 @@ 8121@@ -41,6 +41,7 @@
8059 #include <linux/mm.h> 8122 #include <linux/mm.h>
8060 #include <linux/pagemap.h> 8123 #include <linux/pagemap.h>
8061 #include <linux/swap.h> 8124 #include <linux/swap.h>
8062+#include <linux/vs_memory.h> 8125+#include <linux/vs_memory.h>
8063 8126
8064 #include <asm/pgalloc.h> 8127 #include <asm/pgalloc.h>
8065 #include <asm/processor.h> 8128 #include <asm/processor.h>
8066Index: vserver-sources-2.0.2_2.6.15/include/asm-powerpc/unistd.h 8129Index: linux-2.6.16/include/asm-powerpc/unistd.h
8067=================================================================== 8130===================================================================
8068--- vserver-sources-2.0.2_2.6.15.orig/include/asm-powerpc/unistd.h 8131--- linux-2.6.16.orig/include/asm-powerpc/unistd.h
8069+++ vserver-sources-2.0.2_2.6.15/include/asm-powerpc/unistd.h 8132+++ linux-2.6.16/include/asm-powerpc/unistd.h
8070@@ -275,7 +275,7 @@ 8133@@ -275,7 +275,7 @@
8071 #endif 8134 #endif
8072 #define __NR_rtas 255 8135 #define __NR_rtas 255
8073 #define __NR_sys_debug_setcontext 256 8136 #define __NR_sys_debug_setcontext 256
8074-/* Number 257 is reserved for vserver */ 8137-/* Number 257 is reserved for vserver */
8075+#define __NR_vserver 257 8138+#define __NR_vserver 257
8076 /* 258 currently unused */ 8139 /* 258 currently unused */
8077 #define __NR_mbind 259 8140 #define __NR_mbind 259
8078 #define __NR_get_mempolicy 260 8141 #define __NR_get_mempolicy 260
8079Index: vserver-sources-2.0.2_2.6.15/include/asm-s390/unistd.h 8142Index: linux-2.6.16/include/asm-s390/unistd.h
8080=================================================================== 8143===================================================================
8081--- vserver-sources-2.0.2_2.6.15.orig/include/asm-s390/unistd.h 8144--- linux-2.6.16.orig/include/asm-s390/unistd.h
8082+++ vserver-sources-2.0.2_2.6.15/include/asm-s390/unistd.h 8145+++ linux-2.6.16/include/asm-s390/unistd.h
8083@@ -255,7 +255,7 @@ 8146@@ -255,7 +255,7 @@
8084 #define __NR_clock_gettime (__NR_timer_create+6) 8147 #define __NR_clock_gettime (__NR_timer_create+6)
8085 #define __NR_clock_getres (__NR_timer_create+7) 8148 #define __NR_clock_getres (__NR_timer_create+7)
8086 #define __NR_clock_nanosleep (__NR_timer_create+8) 8149 #define __NR_clock_nanosleep (__NR_timer_create+8)
8087-/* Number 263 is reserved for vserver */ 8150-/* Number 263 is reserved for vserver */
8088+#define __NR_vserver 263 8151+#define __NR_vserver 263
8089 #define __NR_fadvise64_64 264 8152 #define __NR_fadvise64_64 264
8090 #define __NR_statfs64 265 8153 #define __NR_statfs64 265
8091 #define __NR_fstatfs64 266 8154 #define __NR_fstatfs64 266
8092Index: vserver-sources-2.0.2_2.6.15/include/asm-sparc/unistd.h 8155Index: linux-2.6.16/include/asm-sparc/unistd.h
8093=================================================================== 8156===================================================================
8094--- vserver-sources-2.0.2_2.6.15.orig/include/asm-sparc/unistd.h 8157--- linux-2.6.16.orig/include/asm-sparc/unistd.h
8095+++ vserver-sources-2.0.2_2.6.15/include/asm-sparc/unistd.h 8158+++ linux-2.6.16/include/asm-sparc/unistd.h
8096@@ -283,7 +283,7 @@ 8159@@ -283,7 +283,7 @@
8097 #define __NR_timer_getoverrun 264 8160 #define __NR_timer_getoverrun 264
8098 #define __NR_timer_delete 265 8161 #define __NR_timer_delete 265
8099 #define __NR_timer_create 266 8162 #define __NR_timer_create 266
8100-/* #define __NR_vserver 267 Reserved for VSERVER */ 8163-/* #define __NR_vserver 267 Reserved for VSERVER */
8101+#define __NR_vserver 267 8164+#define __NR_vserver 267
8102 #define __NR_io_setup 268 8165 #define __NR_io_setup 268
8103 #define __NR_io_destroy 269 8166 #define __NR_io_destroy 269
8104 #define __NR_io_submit 270 8167 #define __NR_io_submit 270
8105Index: vserver-sources-2.0.2_2.6.15/include/asm-sparc64/tlb.h 8168Index: linux-2.6.16/include/asm-sparc64/tlb.h
8106=================================================================== 8169===================================================================
8107--- vserver-sources-2.0.2_2.6.15.orig/include/asm-sparc64/tlb.h 8170--- linux-2.6.16.orig/include/asm-sparc64/tlb.h
8108+++ vserver-sources-2.0.2_2.6.15/include/asm-sparc64/tlb.h 8171+++ linux-2.6.16/include/asm-sparc64/tlb.h
8109@@ -3,6 +3,7 @@ 8172@@ -3,6 +3,7 @@
8110 8173
8111 #include <linux/config.h> 8174 #include <linux/config.h>
8112 #include <linux/swap.h> 8175 #include <linux/swap.h>
8113+#include <linux/vs_memory.h> 8176+#include <linux/vs_memory.h>
8114 #include <asm/pgalloc.h> 8177 #include <asm/pgalloc.h>
8115 #include <asm/tlbflush.h> 8178 #include <asm/tlbflush.h>
8116 #include <asm/mmu_context.h> 8179 #include <asm/mmu_context.h>
8117Index: vserver-sources-2.0.2_2.6.15/include/asm-sparc64/unistd.h 8180Index: linux-2.6.16/include/asm-sparc64/unistd.h
8118=================================================================== 8181===================================================================
8119--- vserver-sources-2.0.2_2.6.15.orig/include/asm-sparc64/unistd.h 8182--- linux-2.6.16.orig/include/asm-sparc64/unistd.h
8120+++ vserver-sources-2.0.2_2.6.15/include/asm-sparc64/unistd.h 8183+++ linux-2.6.16/include/asm-sparc64/unistd.h
8121@@ -285,7 +285,7 @@ 8184@@ -285,7 +285,7 @@
8122 #define __NR_timer_getoverrun 264 8185 #define __NR_timer_getoverrun 264
8123 #define __NR_timer_delete 265 8186 #define __NR_timer_delete 265
8124 #define __NR_timer_create 266 8187 #define __NR_timer_create 266
8125-/* #define __NR_vserver 267 Reserved for VSERVER */ 8188-/* #define __NR_vserver 267 Reserved for VSERVER */
8126+#define __NR_vserver 267 8189+#define __NR_vserver 267
8127 #define __NR_io_setup 268 8190 #define __NR_io_setup 268
8128 #define __NR_io_destroy 269 8191 #define __NR_io_destroy 269
8129 #define __NR_io_submit 270 8192 #define __NR_io_submit 270
8130Index: vserver-sources-2.0.2_2.6.15/include/asm-x86_64/unistd.h 8193Index: linux-2.6.16/include/asm-x86_64/unistd.h
8131=================================================================== 8194===================================================================
8132--- vserver-sources-2.0.2_2.6.15.orig/include/asm-x86_64/unistd.h 8195--- linux-2.6.16.orig/include/asm-x86_64/unistd.h
8133+++ vserver-sources-2.0.2_2.6.15/include/asm-x86_64/unistd.h 8196+++ linux-2.6.16/include/asm-x86_64/unistd.h
8134@@ -532,7 +532,7 @@ __SYSCALL(__NR_tgkill, sys_tgkill) 8197@@ -532,7 +532,7 @@ __SYSCALL(__NR_tgkill, sys_tgkill)
8135 #define __NR_utimes 235 8198 #define __NR_utimes 235
8136 __SYSCALL(__NR_utimes, sys_utimes) 8199 __SYSCALL(__NR_utimes, sys_utimes)
8137 #define __NR_vserver 236 8200 #define __NR_vserver 236
8138-__SYSCALL(__NR_vserver, sys_ni_syscall) 8201-__SYSCALL(__NR_vserver, sys_ni_syscall)
8139+__SYSCALL(__NR_vserver, sys_vserver) 8202+__SYSCALL(__NR_vserver, sys_vserver)
8140 #define __NR_mbind 237 8203 #define __NR_mbind 237
8141 __SYSCALL(__NR_mbind, sys_mbind) 8204 __SYSCALL(__NR_mbind, sys_mbind)
8142 #define __NR_set_mempolicy 238 8205 #define __NR_set_mempolicy 238
8143Index: vserver-sources-2.0.2_2.6.15/include/linux/capability.h 8206Index: linux-2.6.16/include/linux/capability.h
8144=================================================================== 8207===================================================================
8145--- vserver-sources-2.0.2_2.6.15.orig/include/linux/capability.h 8208--- linux-2.6.16.orig/include/linux/capability.h
8146+++ vserver-sources-2.0.2_2.6.15/include/linux/capability.h 8209+++ linux-2.6.16/include/linux/capability.h
8147@@ -234,6 +234,7 @@ typedef __u32 kernel_cap_t; 8210@@ -235,6 +235,7 @@ typedef __u32 kernel_cap_t;
8148 arbitrary SCSI commands */ 8211 arbitrary SCSI commands */
8149 /* Allow setting encryption key on loopback filesystem */ 8212 /* Allow setting encryption key on loopback filesystem */
8150 /* Allow setting zone reclaim policy */ 8213 /* Allow setting zone reclaim policy */
8151+/* Allow the selection of a security context */ 8214+/* Allow the selection of a security context */
8152 8215
8153 #define CAP_SYS_ADMIN 21 8216 #define CAP_SYS_ADMIN 21
8154 8217
8155@@ -287,6 +288,11 @@ typedef __u32 kernel_cap_t; 8218@@ -288,6 +289,11 @@ typedef __u32 kernel_cap_t;
8156 8219
8157 #define CAP_AUDIT_CONTROL 30 8220 #define CAP_AUDIT_CONTROL 30
8158 8221
8159+/* Allow context manipulations */ 8222+/* Allow context manipulations */
8160+/* Allow changing context info on files */ 8223+/* Allow changing context info on files */
8162+#define CAP_CONTEXT 31 8225+#define CAP_CONTEXT 31
8163+ 8226+
8164 #ifdef __KERNEL__ 8227 #ifdef __KERNEL__
8165 /* 8228 /*
8166 * Bounding set 8229 * Bounding set
8167Index: vserver-sources-2.0.2_2.6.15/include/linux/devpts_fs.h 8230Index: linux-2.6.16/include/linux/devpts_fs.h
8168=================================================================== 8231===================================================================
8169--- vserver-sources-2.0.2_2.6.15.orig/include/linux/devpts_fs.h 8232--- linux-2.6.16.orig/include/linux/devpts_fs.h
8170+++ vserver-sources-2.0.2_2.6.15/include/linux/devpts_fs.h 8233+++ linux-2.6.16/include/linux/devpts_fs.h
8171@@ -30,5 +30,7 @@ static inline void devpts_pty_kill(int n 8234@@ -30,5 +30,7 @@ static inline void devpts_pty_kill(int n
8172 8235
8173 #endif 8236 #endif
8174 8237
8175+#define DEVPTS_SUPER_MAGIC 0x00001cd1 8238+#define DEVPTS_SUPER_MAGIC 0x00001cd1
8176+ 8239+
8177 8240
8178 #endif /* _LINUX_DEVPTS_FS_H */ 8241 #endif /* _LINUX_DEVPTS_FS_H */
8179Index: vserver-sources-2.0.2_2.6.15/include/linux/ext2_fs.h 8242Index: linux-2.6.16/include/linux/ext2_fs.h
8180=================================================================== 8243===================================================================
8181--- vserver-sources-2.0.2_2.6.15.orig/include/linux/ext2_fs.h 8244--- linux-2.6.16.orig/include/linux/ext2_fs.h
8182+++ vserver-sources-2.0.2_2.6.15/include/linux/ext2_fs.h 8245+++ linux-2.6.16/include/linux/ext2_fs.h
8183@@ -192,10 +192,17 @@ struct ext2_group_desc 8246@@ -192,10 +192,17 @@ struct ext2_group_desc
8184 #define EXT2_NOTAIL_FL 0x00008000 /* file tail should not be merged */ 8247 #define EXT2_NOTAIL_FL 0x00008000 /* file tail should not be merged */
8185 #define EXT2_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */ 8248 #define EXT2_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */
8186 #define EXT2_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ 8249 #define EXT2_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
8187+#define EXT2_BARRIER_FL 0x04000000 /* Barrier for chroot() */ 8250+#define EXT2_BARRIER_FL 0x04000000 /* Barrier for chroot() */
8225+#define EXT2_MOUNT_GRPQUOTA 0x040000 /* group quota */ 8288+#define EXT2_MOUNT_GRPQUOTA 0x040000 /* group quota */
8226+#define EXT2_MOUNT_TAGXID (1<<24) /* Enable Context Tags */ 8289+#define EXT2_MOUNT_TAGXID (1<<24) /* Enable Context Tags */
8227 8290
8228 8291
8229 #define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt 8292 #define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt
8230Index: vserver-sources-2.0.2_2.6.15/include/linux/ext3_fs.h 8293Index: linux-2.6.16/include/linux/ext3_fs.h
8231=================================================================== 8294===================================================================
8232--- vserver-sources-2.0.2_2.6.15.orig/include/linux/ext3_fs.h 8295--- linux-2.6.16.orig/include/linux/ext3_fs.h
8233+++ vserver-sources-2.0.2_2.6.15/include/linux/ext3_fs.h 8296+++ linux-2.6.16/include/linux/ext3_fs.h
8234@@ -185,10 +185,20 @@ struct ext3_group_desc 8297@@ -185,10 +185,20 @@ struct ext3_group_desc
8235 #define EXT3_NOTAIL_FL 0x00008000 /* file tail should not be merged */ 8298 #define EXT3_NOTAIL_FL 0x00008000 /* file tail should not be merged */
8236 #define EXT3_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */ 8299 #define EXT3_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */
8237 #define EXT3_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ 8300 #define EXT3_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
8238+#define EXT3_BARRIER_FL 0x04000000 /* Barrier for chroot() */ 8301+#define EXT3_BARRIER_FL 0x04000000 /* Barrier for chroot() */
8283 extern struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *); 8346 extern struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *);
8284+extern int ext3_sync_flags(struct inode *inode); 8347+extern int ext3_sync_flags(struct inode *inode);
8285 8348
8286 extern void ext3_read_inode (struct inode *); 8349 extern void ext3_read_inode (struct inode *);
8287 extern int ext3_write_inode (struct inode *, int); 8350 extern int ext3_write_inode (struct inode *, int);
8288Index: vserver-sources-2.0.2_2.6.15/include/linux/fs.h 8351Index: linux-2.6.16/include/linux/fs.h
8289=================================================================== 8352===================================================================
8290--- vserver-sources-2.0.2_2.6.15.orig/include/linux/fs.h 8353--- linux-2.6.16.orig/include/linux/fs.h
8291+++ vserver-sources-2.0.2_2.6.15/include/linux/fs.h 8354+++ linux-2.6.16/include/linux/fs.h
8292@@ -10,6 +10,7 @@
8293 #include <linux/limits.h>
8294 #include <linux/ioctl.h>
8295 #include <linux/rcuref.h>
8296+#include <linux/mount.h>
8297
8298 /*
8299 * It's silly to have NR_OPEN bigger than NR_FILE, but you can change
8300@@ -109,6 +110,8 @@ extern int dir_notify_enable; 8355@@ -109,6 +109,8 @@ extern int dir_notify_enable;
8356 #define MS_PRIVATE (1<<18) /* change to private */
8301 #define MS_SLAVE (1<<19) /* change to slave */ 8357 #define MS_SLAVE (1<<19) /* change to slave */
8302 #define MS_SHARED (1<<20) /* change to shared */ 8358 #define MS_SHARED (1<<20) /* change to shared */
8303 #define MS_POSIXACL (1<<16) /* VFS does not apply the umask */
8304+#define MS_TAGXID (1<<24) /* tag inodes with context information */ 8359+#define MS_TAGXID (1<<24) /* tag inodes with context information */
8305+#define MS_XID (1<<25) /* use specific xid for this mount */ 8360+#define MS_XID (1<<25) /* use specific xid for this mount */
8306 #define MS_ACTIVE (1<<30) 8361 #define MS_ACTIVE (1<<30)
8307 #define MS_NOUSER (1<<31) 8362 #define MS_NOUSER (1<<31)
8308 8363
8309@@ -136,6 +139,8 @@ extern int dir_notify_enable; 8364@@ -135,6 +137,8 @@ extern int dir_notify_enable;
8310 #define S_NOCMTIME 128 /* Do not update file c/mtime */ 8365 #define S_NOCMTIME 128 /* Do not update file c/mtime */
8311 #define S_SWAPFILE 256 /* Do not truncate: swapon got its bmaps */ 8366 #define S_SWAPFILE 256 /* Do not truncate: swapon got its bmaps */
8312 #define S_PRIVATE 512 /* Inode is fs-internal */ 8367 #define S_PRIVATE 512 /* Inode is fs-internal */
8313+#define S_BARRIER 1024 /* Barrier for chroot() */ 8368+#define S_BARRIER 1024 /* Barrier for chroot() */
8314+#define S_IUNLINK 2048 /* Immutable unlink */ 8369+#define S_IUNLINK 2048 /* Immutable unlink */
8315 8370
8316 /* 8371 /*
8317 * Note that nosuid etc flags are inode-specific: setting some file-system 8372 * Note that nosuid etc flags are inode-specific: setting some file-system
8318@@ -152,20 +157,24 @@ extern int dir_notify_enable; 8373@@ -151,18 +155,22 @@ extern int dir_notify_enable;
8319 */ 8374 */
8320 #define __IS_FLG(inode,flg) ((inode)->i_sb->s_flags & (flg)) 8375 #define __IS_FLG(inode,flg) ((inode)->i_sb->s_flags & (flg))
8321 8376
8322-#define IS_RDONLY(inode) ((inode)->i_sb->s_flags & MS_RDONLY) 8377-#define IS_RDONLY(inode) ((inode)->i_sb->s_flags & MS_RDONLY)
8323+#define IS_RDONLY(inode) __IS_FLG(inode, MS_RDONLY) 8378+#define IS_RDONLY(inode) __IS_FLG(inode, MS_RDONLY)
8331 #define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA) 8386 #define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA)
8332 #define IS_APPEND(inode) ((inode)->i_flags & S_APPEND) 8387 #define IS_APPEND(inode) ((inode)->i_flags & S_APPEND)
8333 #define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE) 8388 #define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE)
8334+#define IS_IUNLINK(inode) ((inode)->i_flags & S_IUNLINK) 8389+#define IS_IUNLINK(inode) ((inode)->i_flags & S_IUNLINK)
8335+#define IS_IXORUNLINK(inode) ((IS_IUNLINK(inode) ? S_IMMUTABLE : 0) ^ IS_IMMUTABLE(inode)) 8390+#define IS_IXORUNLINK(inode) ((IS_IUNLINK(inode) ? S_IMMUTABLE : 0) ^ IS_IMMUTABLE(inode))
8336 #define IS_NOATIME(inode) (__IS_FLG(inode, MS_NOATIME) || ((inode)->i_flags & S_NOATIME))
8337 #define IS_NODIRATIME(inode) __IS_FLG(inode, MS_NODIRATIME)
8338 #define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL) 8391 #define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL)
8339 8392
8340+#define IS_BARRIER(inode) (S_ISDIR((inode)->i_mode) && ((inode)->i_flags & S_BARRIER)) 8393+#define IS_BARRIER(inode) (S_ISDIR((inode)->i_mode) && ((inode)->i_flags & S_BARRIER))
8341 #define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD) 8394 #define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD)
8342 #define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME) 8395 #define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME)
8343 #define IS_SWAPFILE(inode) ((inode)->i_flags & S_SWAPFILE) 8396 #define IS_SWAPFILE(inode) ((inode)->i_flags & S_SWAPFILE)
8344@@ -269,6 +278,7 @@ typedef void (dio_iodone_t)(struct kiocb 8397@@ -265,6 +273,7 @@ typedef void (dio_iodone_t)(struct kiocb
8345 #define ATTR_KILL_SUID 2048 8398 #define ATTR_KILL_SUID 2048
8346 #define ATTR_KILL_SGID 4096 8399 #define ATTR_KILL_SGID 4096
8347 #define ATTR_FILE 8192 8400 #define ATTR_FILE 8192
8348+#define ATTR_XID 16384 8401+#define ATTR_XID 16384
8349 8402
8350 /* 8403 /*
8351 * This is the Inode Attributes structure, used for notify_change(). It 8404 * This is the Inode Attributes structure, used for notify_change(). It
8352@@ -284,6 +294,7 @@ struct iattr { 8405@@ -280,6 +289,7 @@ struct iattr {
8353 umode_t ia_mode; 8406 umode_t ia_mode;
8354 uid_t ia_uid; 8407 uid_t ia_uid;
8355 gid_t ia_gid; 8408 gid_t ia_gid;
8356+ xid_t ia_xid; 8409+ xid_t ia_xid;
8357 loff_t ia_size; 8410 loff_t ia_size;
8358 struct timespec ia_atime; 8411 struct timespec ia_atime;
8359 struct timespec ia_mtime; 8412 struct timespec ia_mtime;
8360@@ -297,6 +308,9 @@ struct iattr { 8413@@ -293,6 +303,9 @@ struct iattr {
8361 struct file *ia_file; 8414 struct file *ia_file;
8362 }; 8415 };
8363 8416
8364+#define ATTR_FLAG_BARRIER 512 /* Barrier for chroot() */ 8417+#define ATTR_FLAG_BARRIER 512 /* Barrier for chroot() */
8365+#define ATTR_FLAG_IUNLINK 1024 /* Immutable unlink */ 8418+#define ATTR_FLAG_IUNLINK 1024 /* Immutable unlink */
8366+ 8419+
8367 /* 8420 /*
8368 * Includes for diskquotas. 8421 * Includes for diskquotas.
8369 */ 8422 */
8370@@ -442,6 +456,7 @@ struct inode { 8423@@ -471,6 +484,7 @@ struct inode {
8371 unsigned int i_nlink; 8424 unsigned int i_nlink;
8372 uid_t i_uid; 8425 uid_t i_uid;
8373 gid_t i_gid; 8426 gid_t i_gid;
8374+ xid_t i_xid; 8427+ xid_t i_xid;
8375 dev_t i_rdev; 8428 dev_t i_rdev;
8376 loff_t i_size; 8429 loff_t i_size;
8377 struct timespec i_atime; 8430 struct timespec i_atime;
8378@@ -604,6 +619,7 @@ struct file { 8431@@ -633,6 +647,7 @@ struct file {
8379 struct fown_struct f_owner; 8432 struct fown_struct f_owner;
8380 unsigned int f_uid, f_gid; 8433 unsigned int f_uid, f_gid;
8381 struct file_ra_state f_ra; 8434 struct file_ra_state f_ra;
8382+ xid_t f_xid; 8435+ xid_t f_xid;
8383 8436
8384 unsigned long f_version; 8437 unsigned long f_version;
8385 void *f_security; 8438 void *f_security;
8386@@ -683,6 +699,7 @@ struct file_lock { 8439@@ -712,6 +727,7 @@ struct file_lock {
8387 unsigned char fl_type; 8440 unsigned char fl_type;
8388 loff_t fl_start; 8441 loff_t fl_start;
8389 loff_t fl_end; 8442 loff_t fl_end;
8390+ xid_t fl_xid; 8443+ xid_t fl_xid;
8391 8444
8392 struct fasync_struct * fl_fasync; /* for lease break notifications */ 8445 struct fasync_struct * fl_fasync; /* for lease break notifications */
8393 unsigned long fl_break_time; /* for nonblocking lease breaks */ 8446 unsigned long fl_break_time; /* for nonblocking lease breaks */
8394@@ -876,12 +893,12 @@ static inline void unlock_super(struct s 8447@@ -904,12 +920,12 @@ static inline void unlock_super(struct s
8395 */ 8448 */
8396 extern int vfs_permission(struct nameidata *, int); 8449 extern int vfs_permission(struct nameidata *, int);
8397 extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *); 8450 extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *);
8398-extern int vfs_mkdir(struct inode *, struct dentry *, int); 8451-extern int vfs_mkdir(struct inode *, struct dentry *, int);
8399-extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t); 8452-extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t);
8408+extern int vfs_rmdir(struct inode *, struct dentry *, struct nameidata *); 8461+extern int vfs_rmdir(struct inode *, struct dentry *, struct nameidata *);
8409+extern int vfs_unlink(struct inode *, struct dentry *, struct nameidata *); 8462+extern int vfs_unlink(struct inode *, struct dentry *, struct nameidata *);
8410 extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); 8463 extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
8411 8464
8412 /* 8465 /*
8413@@ -1019,6 +1036,7 @@ struct inode_operations { 8466@@ -1049,6 +1065,7 @@ struct inode_operations {
8414 ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
8415 ssize_t (*listxattr) (struct dentry *, char *, size_t); 8467 ssize_t (*listxattr) (struct dentry *, char *, size_t);
8416 int (*removexattr) (struct dentry *, const char *); 8468 int (*removexattr) (struct dentry *, const char *);
8469 void (*truncate_range)(struct inode *, loff_t, loff_t);
8417+ int (*sync_flags) (struct inode *); 8470+ int (*sync_flags) (struct inode *);
8418 }; 8471 };
8419 8472
8420 struct seq_file; 8473 struct seq_file;
8421@@ -1087,8 +1105,16 @@ static inline void mark_inode_dirty_sync
8422
8423 static inline void touch_atime(struct vfsmount *mnt, struct dentry *dentry)
8424 {
8425- /* per-mountpoint checks will go here */
8426- update_atime(dentry->d_inode);
8427+ struct inode *inode = dentry->d_inode;
8428+
8429+ if (MNT_IS_NOATIME(mnt))
8430+ return;
8431+ if (S_ISDIR(inode->i_mode) && MNT_IS_NODIRATIME(mnt))
8432+ return;
8433+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(mnt))
8434+ return;
8435+
8436+ update_atime(inode);
8437 }
8438
8439 static inline void file_accessed(struct file *file)
8440@@ -1653,6 +1679,7 @@ extern int dcache_dir_open(struct inode 8474@@ -1695,6 +1712,7 @@ extern int dcache_dir_open(struct inode
8441 extern int dcache_dir_close(struct inode *, struct file *); 8475 extern int dcache_dir_close(struct inode *, struct file *);
8442 extern loff_t dcache_dir_lseek(struct file *, loff_t, int); 8476 extern loff_t dcache_dir_lseek(struct file *, loff_t, int);
8443 extern int dcache_readdir(struct file *, void *, filldir_t); 8477 extern int dcache_readdir(struct file *, void *, filldir_t);
8444+extern int dcache_readdir_filter(struct file *, void *, filldir_t, int (*)(struct dentry *)); 8478+extern int dcache_readdir_filter(struct file *, void *, filldir_t, int (*)(struct dentry *));
8445 extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *); 8479 extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *);
8446 extern int simple_statfs(struct super_block *, struct kstatfs *); 8480 extern int simple_statfs(struct super_block *, struct kstatfs *);
8447 extern int simple_link(struct dentry *, struct inode *, struct dentry *); 8481 extern int simple_link(struct dentry *, struct inode *, struct dentry *);
8448Index: vserver-sources-2.0.2_2.6.15/include/linux/init_task.h 8482Index: linux-2.6.16/include/linux/init_task.h
8449=================================================================== 8483===================================================================
8450--- vserver-sources-2.0.2_2.6.15.orig/include/linux/init_task.h 8484--- linux-2.6.16.orig/include/linux/init_task.h
8451+++ vserver-sources-2.0.2_2.6.15/include/linux/init_task.h 8485+++ linux-2.6.16/include/linux/init_task.h
8452@@ -121,6 +121,10 @@ extern struct group_info init_groups; 8486@@ -121,6 +121,10 @@ extern struct group_info init_groups;
8453 .journal_info = NULL, \ 8487 .journal_info = NULL, \
8454 .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \ 8488 .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \
8455 .fs_excl = ATOMIC_INIT(0), \ 8489 .fs_excl = ATOMIC_INIT(0), \
8456+ .xid = 0, \ 8490+ .xid = 0, \
8458+ .nid = 0, \ 8492+ .nid = 0, \
8459+ .nx_info = NULL, \ 8493+ .nx_info = NULL, \
8460 } 8494 }
8461 8495
8462 8496
8463Index: vserver-sources-2.0.2_2.6.15/include/linux/ip.h 8497Index: linux-2.6.16/include/linux/ipc.h
8464=================================================================== 8498===================================================================
8465--- vserver-sources-2.0.2_2.6.15.orig/include/linux/ip.h 8499--- linux-2.6.16.orig/include/linux/ipc.h
8466+++ vserver-sources-2.0.2_2.6.15/include/linux/ip.h 8500+++ linux-2.6.16/include/linux/ipc.h
8467@@ -139,6 +139,7 @@ struct inet_sock {
8468 /* Socket demultiplex comparisons on incoming packets. */
8469 __u32 daddr; /* Foreign IPv4 addr */
8470 __u32 rcv_saddr; /* Bound local IPv4 addr */
8471+ __u32 rcv_saddr2; /* Second bound ipv4 addr, for ipv4root */
8472 __u16 dport; /* Destination port */
8473 __u16 num; /* Local port */
8474 __u32 saddr; /* Sending source */
8475Index: vserver-sources-2.0.2_2.6.15/include/linux/ipc.h
8476===================================================================
8477--- vserver-sources-2.0.2_2.6.15.orig/include/linux/ipc.h
8478+++ vserver-sources-2.0.2_2.6.15/include/linux/ipc.h
8479@@ -66,6 +66,7 @@ struct kern_ipc_perm 8501@@ -66,6 +66,7 @@ struct kern_ipc_perm
8480 mode_t mode; 8502 mode_t mode;
8481 unsigned long seq; 8503 unsigned long seq;
8482 void *security; 8504 void *security;
8483+ xid_t xid; 8505+ xid_t xid;
8484 }; 8506 };
8485 8507
8486 #endif /* __KERNEL__ */ 8508 #endif /* __KERNEL__ */
8487Index: vserver-sources-2.0.2_2.6.15/include/linux/kernel.h 8509Index: linux-2.6.16/include/linux/kernel.h
8488=================================================================== 8510===================================================================
8489--- vserver-sources-2.0.2_2.6.15.orig/include/linux/kernel.h 8511--- linux-2.6.16.orig/include/linux/kernel.h
8490+++ vserver-sources-2.0.2_2.6.15/include/linux/kernel.h 8512+++ linux-2.6.16/include/linux/kernel.h
8491@@ -17,6 +17,7 @@ 8513@@ -17,6 +17,7 @@
8492 #include <asm/bug.h> 8514 #include <asm/bug.h>
8493 8515
8494 extern const char linux_banner[]; 8516 extern const char linux_banner[];
8495+extern const char vx_linux_banner[]; 8517+extern const char vx_linux_banner[];
8496 8518
8497 #define INT_MAX ((int)(~0U>>1)) 8519 #define INT_MAX ((int)(~0U>>1))
8498 #define INT_MIN (-INT_MAX - 1) 8520 #define INT_MIN (-INT_MAX - 1)
8499Index: vserver-sources-2.0.2_2.6.15/include/linux/major.h 8521Index: linux-2.6.16/include/linux/major.h
8500=================================================================== 8522===================================================================
8501--- vserver-sources-2.0.2_2.6.15.orig/include/linux/major.h 8523--- linux-2.6.16.orig/include/linux/major.h
8502+++ vserver-sources-2.0.2_2.6.15/include/linux/major.h 8524+++ linux-2.6.16/include/linux/major.h
8503@@ -15,6 +15,7 @@ 8525@@ -15,6 +15,7 @@
8504 #define HD_MAJOR IDE0_MAJOR 8526 #define HD_MAJOR IDE0_MAJOR
8505 #define PTY_SLAVE_MAJOR 3 8527 #define PTY_SLAVE_MAJOR 3
8506 #define TTY_MAJOR 4 8528 #define TTY_MAJOR 4
8507+#define VROOT_MAJOR 4 8529+#define VROOT_MAJOR 4
8508 #define TTYAUX_MAJOR 5 8530 #define TTYAUX_MAJOR 5
8509 #define LP_MAJOR 6 8531 #define LP_MAJOR 6
8510 #define VCS_MAJOR 7 8532 #define VCS_MAJOR 7
8511Index: vserver-sources-2.0.2_2.6.15/include/linux/mount.h 8533Index: linux-2.6.16/include/linux/mount.h
8512=================================================================== 8534===================================================================
8513--- vserver-sources-2.0.2_2.6.15.orig/include/linux/mount.h 8535--- linux-2.6.16.orig/include/linux/mount.h
8514+++ vserver-sources-2.0.2_2.6.15/include/linux/mount.h 8536+++ linux-2.6.16/include/linux/mount.h
8515@@ -20,9 +20,13 @@ 8537@@ -22,10 +22,14 @@
8516 #define MNT_NOSUID 0x01
8517 #define MNT_NODEV 0x02
8518 #define MNT_NOEXEC 0x04 8538 #define MNT_NOEXEC 0x04
8539 #define MNT_NOATIME 0x08
8540 #define MNT_NODIRATIME 0x10
8519+#define MNT_RDONLY 0x08 8541+#define MNT_RDONLY 0x20
8542+
8543+#define MNT_IS_RDONLY(m) ((m) && ((m)->mnt_flags & MNT_RDONLY))
8544
8520 #define MNT_SHARED 0x10 /* if the vfsmount is a shared mount */ 8545 #define MNT_SHARED 0x1000 /* if the vfsmount is a shared mount */
8521 #define MNT_UNBINDABLE 0x20 /* if the vfsmount is a unbindable mount */ 8546 #define MNT_UNBINDABLE 0x2000 /* if the vfsmount is a unbindable mount */
8522 #define MNT_PNODE_MASK 0x30 /* propogation flag mask */ 8547 #define MNT_PNODE_MASK 0x3000 /* propogation flag mask */
8523+#define MNT_NOATIME 0x40
8524+#define MNT_NODIRATIME 0x80
8525+#define MNT_XID 0x100 8548+#define MNT_XID 0x8000
8526 8549
8527 struct vfsmount { 8550 struct vfsmount {
8528 struct list_head mnt_hash; 8551 struct list_head mnt_hash;
8529@@ -44,8 +48,13 @@ struct vfsmount { 8552@@ -47,6 +51,7 @@ struct vfsmount {
8530 struct vfsmount *mnt_master; /* slave is on master->mnt_slave_list */ 8553 struct vfsmount *mnt_master; /* slave is on master->mnt_slave_list */
8531 struct namespace *mnt_namespace; /* containing namespace */ 8554 struct namespace *mnt_namespace; /* containing namespace */
8532 int mnt_pinned; 8555 int mnt_pinned;
8533+ xid_t mnt_xid; /* xid tagging used for vfsmount */ 8556+ xid_t mnt_xid; /* xid tagging used for vfsmount */
8534 }; 8557 };
8535 8558
8536+#define MNT_IS_RDONLY(m) ((m) && ((m)->mnt_flags & MNT_RDONLY))
8537+#define MNT_IS_NOATIME(m) ((m) && ((m)->mnt_flags & MNT_NOATIME))
8538+#define MNT_IS_NODIRATIME(m) ((m) && ((m)->mnt_flags & MNT_NODIRATIME))
8539+
8540 static inline struct vfsmount *mntget(struct vfsmount *mnt) 8559 static inline struct vfsmount *mntget(struct vfsmount *mnt)
8541 { 8560Index: linux-2.6.16/include/linux/namespace.h
8542 if (mnt)
8543Index: vserver-sources-2.0.2_2.6.15/include/linux/namespace.h
8544=================================================================== 8561===================================================================
8545--- vserver-sources-2.0.2_2.6.15.orig/include/linux/namespace.h 8562--- linux-2.6.16.orig/include/linux/namespace.h
8546+++ vserver-sources-2.0.2_2.6.15/include/linux/namespace.h 8563+++ linux-2.6.16/include/linux/namespace.h
8547@@ -15,6 +15,7 @@ struct namespace { 8564@@ -16,6 +16,7 @@ struct namespace {
8548
8549 extern int copy_namespace(int, struct task_struct *); 8565 extern int copy_namespace(int, struct task_struct *);
8550 extern void __put_namespace(struct namespace *namespace); 8566 extern void __put_namespace(struct namespace *namespace);
8567 extern struct namespace *dup_namespace(struct task_struct *, struct fs_struct *);
8551+extern void umount_unused(struct vfsmount *, struct fs_struct *); 8568+extern void umount_unused(struct vfsmount *, struct fs_struct *);
8552 8569
8553 static inline void put_namespace(struct namespace *namespace) 8570 static inline void put_namespace(struct namespace *namespace)
8554 { 8571 {
8555Index: vserver-sources-2.0.2_2.6.15/include/linux/net.h 8572Index: linux-2.6.16/include/linux/net.h
8556=================================================================== 8573===================================================================
8557--- vserver-sources-2.0.2_2.6.15.orig/include/linux/net.h 8574--- linux-2.6.16.orig/include/linux/net.h
8558+++ vserver-sources-2.0.2_2.6.15/include/linux/net.h 8575+++ linux-2.6.16/include/linux/net.h
8559@@ -62,6 +62,7 @@ typedef enum { 8576@@ -62,6 +62,7 @@ typedef enum {
8560 #define SOCK_ASYNC_WAITDATA 1 8577 #define SOCK_ASYNC_WAITDATA 1
8561 #define SOCK_NOSPACE 2 8578 #define SOCK_NOSPACE 2
8562 #define SOCK_PASSCRED 3 8579 #define SOCK_PASSCRED 3
8563+#define SOCK_USER_SOCKET 4 8580+#define SOCK_USER_SOCKET 4
8564 8581
8565 #ifndef ARCH_HAS_SOCKET_TYPES 8582 #ifndef ARCH_HAS_SOCKET_TYPES
8566 /** 8583 /**
8567Index: vserver-sources-2.0.2_2.6.15/include/linux/nfs_mount.h 8584Index: linux-2.6.16/include/linux/nfs_mount.h
8568=================================================================== 8585===================================================================
8569--- vserver-sources-2.0.2_2.6.15.orig/include/linux/nfs_mount.h 8586--- linux-2.6.16.orig/include/linux/nfs_mount.h
8570+++ vserver-sources-2.0.2_2.6.15/include/linux/nfs_mount.h 8587+++ linux-2.6.16/include/linux/nfs_mount.h
8571@@ -61,6 +61,7 @@ struct nfs_mount_data { 8588@@ -61,6 +61,7 @@ struct nfs_mount_data {
8572 #define NFS_MOUNT_NOACL 0x0800 /* 4 */ 8589 #define NFS_MOUNT_NOACL 0x0800 /* 4 */
8573 #define NFS_MOUNT_STRICTLOCK 0x1000 /* reserved for NFSv4 */ 8590 #define NFS_MOUNT_STRICTLOCK 0x1000 /* reserved for NFSv4 */
8574 #define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 */ 8591 #define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 */
8575+#define NFS_MOUNT_TAGXID 0x8000 /* tagxid */ 8592+#define NFS_MOUNT_TAGXID 0x8000 /* tagxid */
8576 #define NFS_MOUNT_FLAGMASK 0xFFFF 8593 #define NFS_MOUNT_FLAGMASK 0xFFFF
8577 8594
8578 #endif 8595 #endif
8579Index: vserver-sources-2.0.2_2.6.15/include/linux/percpu.h 8596Index: linux-2.6.16/include/linux/percpu.h
8580=================================================================== 8597===================================================================
8581--- vserver-sources-2.0.2_2.6.15.orig/include/linux/percpu.h 8598--- linux-2.6.16.orig/include/linux/percpu.h
8582+++ vserver-sources-2.0.2_2.6.15/include/linux/percpu.h 8599+++ linux-2.6.16/include/linux/percpu.h
8583@@ -8,7 +8,7 @@ 8600@@ -8,7 +8,7 @@
8584 8601
8585 /* Enough to cover all DEFINE_PER_CPUs in kernel, including modules. */ 8602 /* Enough to cover all DEFINE_PER_CPUs in kernel, including modules. */
8586 #ifndef PERCPU_ENOUGH_ROOM 8603 #ifndef PERCPU_ENOUGH_ROOM
8587-#define PERCPU_ENOUGH_ROOM 32768 8604-#define PERCPU_ENOUGH_ROOM 32768
8588+#define PERCPU_ENOUGH_ROOM 65536 8605+#define PERCPU_ENOUGH_ROOM 65536
8589 #endif 8606 #endif
8590 8607
8591 /* Must be an lvalue. */ 8608 /* Must be an lvalue. */
8592Index: vserver-sources-2.0.2_2.6.15/include/linux/proc_fs.h 8609Index: linux-2.6.16/include/linux/proc_fs.h
8593=================================================================== 8610===================================================================
8594--- vserver-sources-2.0.2_2.6.15.orig/include/linux/proc_fs.h 8611--- linux-2.6.16.orig/include/linux/proc_fs.h
8595+++ vserver-sources-2.0.2_2.6.15/include/linux/proc_fs.h 8612+++ linux-2.6.16/include/linux/proc_fs.h
8596@@ -55,6 +55,7 @@ struct proc_dir_entry { 8613@@ -55,6 +55,7 @@ struct proc_dir_entry {
8597 nlink_t nlink; 8614 nlink_t nlink;
8598 uid_t uid; 8615 uid_t uid;
8599 gid_t gid; 8616 gid_t gid;
8600+ int vx_flags; 8617+ int vx_flags;
8601 unsigned long size; 8618 unsigned long size;
8602 struct inode_operations * proc_iops; 8619 struct inode_operations * proc_iops;
8603 struct file_operations * proc_fops; 8620 struct file_operations * proc_fops;
8604@@ -243,9 +244,11 @@ extern void kclist_add(struct kcore_list 8621@@ -248,9 +249,11 @@ extern void kclist_add(struct kcore_list
8605 struct proc_inode { 8622 struct proc_inode {
8606 struct task_struct *task; 8623 struct task_struct *task;
8607 int type; 8624 int type;
8608+ int vx_flags; 8625+ int vx_flags;
8609 union { 8626 union {
8611 int (*proc_read)(struct task_struct *task, char *page); 8628 int (*proc_read)(struct task_struct *task, char *page);
8612+ int (*proc_vid_read)(int vid, char *page); 8629+ int (*proc_vid_read)(int vid, char *page);
8613 } op; 8630 } op;
8614 struct proc_dir_entry *pde; 8631 struct proc_dir_entry *pde;
8615 struct inode vfs_inode; 8632 struct inode vfs_inode;
8616Index: vserver-sources-2.0.2_2.6.15/include/linux/reiserfs_fs.h 8633Index: linux-2.6.16/include/linux/reiserfs_fs.h
8617=================================================================== 8634===================================================================
8618--- vserver-sources-2.0.2_2.6.15.orig/include/linux/reiserfs_fs.h 8635--- linux-2.6.16.orig/include/linux/reiserfs_fs.h
8619+++ vserver-sources-2.0.2_2.6.15/include/linux/reiserfs_fs.h 8636+++ linux-2.6.16/include/linux/reiserfs_fs.h
8620@@ -829,6 +829,18 @@ struct stat_data_v1 { 8637@@ -829,6 +829,18 @@ struct stat_data_v1 {
8621 #define REISERFS_COMPR_FL EXT2_COMPR_FL 8638 #define REISERFS_COMPR_FL EXT2_COMPR_FL
8622 #define REISERFS_NOTAIL_FL EXT2_NOTAIL_FL 8639 #define REISERFS_NOTAIL_FL EXT2_NOTAIL_FL
8623 8640
8624+/* unfortunately reiserfs sdattr is only 16 bit */ 8641+/* unfortunately reiserfs sdattr is only 16 bit */
8642 int reiserfs_setattr(struct dentry *dentry, struct iattr *attr); 8659 int reiserfs_setattr(struct dentry *dentry, struct iattr *attr);
8643+int reiserfs_sync_flags(struct inode *inode); 8660+int reiserfs_sync_flags(struct inode *inode);
8644 8661
8645 /* namei.c */ 8662 /* namei.c */
8646 void set_de_name_and_namelen(struct reiserfs_dir_entry *de); 8663 void set_de_name_and_namelen(struct reiserfs_dir_entry *de);
8647Index: vserver-sources-2.0.2_2.6.15/include/linux/reiserfs_fs_sb.h 8664Index: linux-2.6.16/include/linux/reiserfs_fs_sb.h
8648=================================================================== 8665===================================================================
8649--- vserver-sources-2.0.2_2.6.15.orig/include/linux/reiserfs_fs_sb.h 8666--- linux-2.6.16.orig/include/linux/reiserfs_fs_sb.h
8650+++ vserver-sources-2.0.2_2.6.15/include/linux/reiserfs_fs_sb.h 8667+++ linux-2.6.16/include/linux/reiserfs_fs_sb.h
8651@@ -457,6 +457,7 @@ enum reiserfs_mount_options { 8668@@ -456,6 +456,7 @@ enum reiserfs_mount_options {
8652 REISERFS_POSIXACL, 8669 REISERFS_POSIXACL,
8653 REISERFS_BARRIER_NONE, 8670 REISERFS_BARRIER_NONE,
8654 REISERFS_BARRIER_FLUSH, 8671 REISERFS_BARRIER_FLUSH,
8655+ REISERFS_TAGXID, 8672+ REISERFS_TAGXID,
8656 8673
8657 /* Actions on error */ 8674 /* Actions on error */
8658 REISERFS_ERROR_PANIC, 8675 REISERFS_ERROR_PANIC,
8659Index: vserver-sources-2.0.2_2.6.15/include/linux/sched.h 8676Index: linux-2.6.16/include/linux/sched.h
8660=================================================================== 8677===================================================================
8661--- vserver-sources-2.0.2_2.6.15.orig/include/linux/sched.h 8678--- linux-2.6.16.orig/include/linux/sched.h
8662+++ vserver-sources-2.0.2_2.6.15/include/linux/sched.h 8679+++ linux-2.6.16/include/linux/sched.h
8663@@ -34,6 +34,7 @@ 8680@@ -15,6 +15,7 @@
8664 #include <linux/percpu.h> 8681 #include <linux/cpumask.h>
8665 #include <linux/topology.h>
8666 #include <linux/seccomp.h> 8682 #include <linux/errno.h>
8683 #include <linux/nodemask.h>
8667+#include <linux/vs_base.h> 8684+#include <linux/vs_base.h>
8668 8685
8669 #include <linux/auxvec.h> /* For AT_VECTOR_SIZE */ 8686 #include <asm/system.h>
8670 8687 #include <asm/semaphore.h>
8671@@ -127,6 +128,7 @@ extern unsigned long nr_iowait(void); 8688@@ -129,6 +130,7 @@ extern unsigned long nr_iowait(void);
8672 #define EXIT_DEAD 32 8689 #define EXIT_DEAD 32
8673 /* in tsk->state again */ 8690 /* in tsk->state again */
8674 #define TASK_NONINTERACTIVE 64 8691 #define TASK_NONINTERACTIVE 64
8675+#define TASK_ONHOLD 128 8692+#define TASK_ONHOLD 128
8676 8693
8677 #define __set_task_state(tsk, state_value) \ 8694 #define __set_task_state(tsk, state_value) \
8678 do { (tsk)->state = (state_value); } while (0) 8695 do { (tsk)->state = (state_value); } while (0)
8679@@ -255,23 +257,21 @@ extern void arch_unmap_area_topdown(stru 8696@@ -257,27 +259,30 @@ extern void arch_unmap_area_topdown(stru
8697 * The mm counters are not protected by its page_table_lock,
8680 * so must be incremented atomically. 8698 * so must be incremented atomically.
8681 */ 8699 */
8682 #ifdef ATOMIC64_INIT
8683-#define set_mm_counter(mm, member, value) atomic64_set(&(mm)->_##member, value) 8700-#define set_mm_counter(mm, member, value) atomic_long_set(&(mm)->_##member, value)
8684-#define get_mm_counter(mm, member) ((unsigned long)atomic64_read(&(mm)->_##member)) 8701-#define get_mm_counter(mm, member) ((unsigned long)atomic_long_read(&(mm)->_##member))
8685-#define add_mm_counter(mm, member, value) atomic64_add(value, &(mm)->_##member) 8702-#define add_mm_counter(mm, member, value) atomic_long_add(value, &(mm)->_##member)
8686-#define inc_mm_counter(mm, member) atomic64_inc(&(mm)->_##member) 8703-#define inc_mm_counter(mm, member) atomic_long_inc(&(mm)->_##member)
8687-#define dec_mm_counter(mm, member) atomic64_dec(&(mm)->_##member) 8704-#define dec_mm_counter(mm, member) atomic_long_dec(&(mm)->_##member)
8688 typedef atomic64_t mm_counter_t; 8705 typedef atomic_long_t mm_counter_t;
8689+#define __set_mm_counter(mm, member, value) \ 8706+#define __set_mm_counter(mm, member, value) \
8690+ atomic64_set(&(mm)->_##member, value) 8707+ atomic_long_set(&(mm)->_##member, value)
8691+#define get_mm_counter(mm, member) \ 8708+#define get_mm_counter(mm, member) \
8692+ ((unsigned long)atomic64_read(&(mm)->_##member)) 8709+ ((unsigned long)atomic_long_read(&(mm)->_##member))
8693 #else /* !ATOMIC64_INIT */ 8710
8711 #else /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */
8694 /* 8712 /*
8695 * The counters wrap back to 0 at 2^32 * PAGE_SIZE,
8696 * that is, at 16TB if using 4kB page size.
8697 */
8698-#define set_mm_counter(mm, member, value) atomic_set(&(mm)->_##member, value)
8699-#define get_mm_counter(mm, member) ((unsigned long)atomic_read(&(mm)->_##member))
8700-#define add_mm_counter(mm, member, value) atomic_add(value, &(mm)->_##member)
8701-#define inc_mm_counter(mm, member) atomic_inc(&(mm)->_##member)
8702-#define dec_mm_counter(mm, member) atomic_dec(&(mm)->_##member)
8703 typedef atomic_t mm_counter_t;
8704+#define __set_mm_counter(mm, member, value) \
8705+ atomic_set(&(mm)->_##member, value)
8706+#define get_mm_counter(mm, member) \
8707+ ((unsigned long)atomic_read(&(mm)->_##member))
8708 #endif /* !ATOMIC64_INIT */
8709
8710 #else /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */
8711@@ -279,15 +279,19 @@ typedef atomic_t mm_counter_t;
8712 * The mm counters are protected by its page_table_lock, 8713 * The mm counters are protected by its page_table_lock,
8713 * so can be incremented directly. 8714 * so can be incremented directly.
8714 */ 8715 */
8715-#define set_mm_counter(mm, member, value) (mm)->_##member = (value) 8716-#define set_mm_counter(mm, member, value) (mm)->_##member = (value)
8716-#define get_mm_counter(mm, member) ((mm)->_##member) 8717-#define get_mm_counter(mm, member) ((mm)->_##member)
8731+#define dec_mm_counter(mm, member) vx_ ## member ## pages_dec((mm)) 8732+#define dec_mm_counter(mm, member) vx_ ## member ## pages_dec((mm))
8732+ 8733+
8733 #define get_mm_rss(mm) \ 8734 #define get_mm_rss(mm) \
8734 (get_mm_counter(mm, file_rss) + get_mm_counter(mm, anon_rss)) 8735 (get_mm_counter(mm, file_rss) + get_mm_counter(mm, anon_rss))
8735 #define update_hiwater_rss(mm) do { \ 8736 #define update_hiwater_rss(mm) do { \
8736@@ -345,6 +349,7 @@ struct mm_struct { 8737@@ -336,6 +341,7 @@ struct mm_struct {
8737 8738
8738 /* Architecture-specific MM context */ 8739 /* Architecture-specific MM context */
8739 mm_context_t context; 8740 mm_context_t context;
8740+ struct vx_info *mm_vx_info; 8741+ struct vx_info *mm_vx_info;
8741 8742
8742 /* Token based thrashing protection. */ 8743 /* Token based thrashing protection. */
8743 unsigned long swap_token_time; 8744 unsigned long swap_token_time;
8744@@ -515,9 +520,10 @@ struct user_struct { 8745@@ -514,9 +520,10 @@ struct user_struct {
8745 /* Hash table maintenance information */ 8746 /* Hash table maintenance information */
8746 struct list_head uidhash_list; 8747 struct list_head uidhash_list;
8747 uid_t uid; 8748 uid_t uid;
8748+ xid_t xid; 8749+ xid_t xid;
8749 }; 8750 };
8751-extern struct user_struct *find_user(uid_t); 8752-extern struct user_struct *find_user(uid_t);
8752+extern struct user_struct *find_user(xid_t, uid_t); 8753+extern struct user_struct *find_user(xid_t, uid_t);
8753 8754
8754 extern struct user_struct root_user; 8755 extern struct user_struct root_user;
8755 #define INIT_USER (&root_user) 8756 #define INIT_USER (&root_user)
8756@@ -812,6 +818,14 @@ struct task_struct { 8757@@ -818,6 +825,14 @@ struct task_struct {
8758
8759 void *security;
8757 struct audit_context *audit_context; 8760 struct audit_context *audit_context;
8761+
8762+/* vserver context data */
8763+ struct vx_info *vx_info;
8764+ struct nx_info *nx_info;
8765+
8766+ xid_t xid;
8767+ nid_t nid;
8768+
8758 seccomp_t seccomp; 8769 seccomp_t seccomp;
8759 8770
8760+/* vserver context data */
8761+ xid_t xid;
8762+ struct vx_info *vx_info;
8763+
8764+/* vserver network data */
8765+ nid_t nid;
8766+ struct nx_info *nx_info;
8767+
8768 /* Thread group tracking */ 8771 /* Thread group tracking */
8769 u32 parent_exec_id;
8770 u32 self_exec_id;
8771@@ -1000,13 +1014,19 @@ extern struct task_struct init_task; 8772@@ -1020,13 +1035,19 @@ extern struct task_struct init_task;
8772 8773
8773 extern struct mm_struct init_mm; 8774 extern struct mm_struct init_mm;
8774 8775
8775-#define find_task_by_pid(nr) find_task_by_pid_type(PIDTYPE_PID, nr) 8776-#define find_task_by_pid(nr) find_task_by_pid_type(PIDTYPE_PID, nr)
8776+ 8777+
8788-extern struct user_struct * alloc_uid(uid_t); 8789-extern struct user_struct * alloc_uid(uid_t);
8789+extern struct user_struct * alloc_uid(xid_t, uid_t); 8790+extern struct user_struct * alloc_uid(xid_t, uid_t);
8790 static inline struct user_struct *get_uid(struct user_struct *u) 8791 static inline struct user_struct *get_uid(struct user_struct *u)
8791 { 8792 {
8792 atomic_inc(&u->__count); 8793 atomic_inc(&u->__count);
8793@@ -1105,15 +1125,28 @@ static inline int sas_ss_flags(unsigned 8794Index: linux-2.6.16/include/linux/shmem_fs.h
8794 #ifdef CONFIG_SECURITY
8795 /* code is in security.c */
8796 extern int capable(int cap);
8797+extern int vx_capable(int cap, int ccap);
8798 #else
8799 static inline int capable(int cap)
8800 {
8801+ if (vx_check_bit(VXC_CAP_MASK, cap) && !vx_mcaps(1L << cap))
8802+ return 0;
8803 if (cap_raised(current->cap_effective, cap)) {
8804 current->flags |= PF_SUPERPRIV;
8805 return 1;
8806 }
8807 return 0;
8808 }
8809+
8810+static inline int vx_capable(int cap, int ccap)
8811+{
8812+ if (cap_raised(current->cap_effective, cap) &&
8813+ vx_ccaps(ccap)) {
8814+ current->flags |= PF_SUPERPRIV;
8815+ return 1;
8816+ }
8817+ return 0;
8818+}
8819 #endif
8820
8821 /*
8822Index: vserver-sources-2.0.2_2.6.15/include/linux/shmem_fs.h
8823=================================================================== 8795===================================================================
8824--- vserver-sources-2.0.2_2.6.15.orig/include/linux/shmem_fs.h 8796--- linux-2.6.16.orig/include/linux/shmem_fs.h
8825+++ vserver-sources-2.0.2_2.6.15/include/linux/shmem_fs.h 8797+++ linux-2.6.16/include/linux/shmem_fs.h
8826@@ -8,6 +8,9 @@ 8798@@ -8,6 +8,9 @@
8827 8799
8828 #define SHMEM_NR_DIRECT 16 8800 #define SHMEM_NR_DIRECT 16
8829 8801
8830+#define TMPFS_SUPER_MAGIC 0x01021994 8802+#define TMPFS_SUPER_MAGIC 0x01021994
8831+ 8803+
8832+ 8804+
8833 struct shmem_inode_info { 8805 struct shmem_inode_info {
8834 spinlock_t lock; 8806 spinlock_t lock;
8835 unsigned long flags; 8807 unsigned long flags;
8836Index: vserver-sources-2.0.2_2.6.15/include/linux/stat.h 8808Index: linux-2.6.16/include/linux/stat.h
8837=================================================================== 8809===================================================================
8838--- vserver-sources-2.0.2_2.6.15.orig/include/linux/stat.h 8810--- linux-2.6.16.orig/include/linux/stat.h
8839+++ vserver-sources-2.0.2_2.6.15/include/linux/stat.h 8811+++ linux-2.6.16/include/linux/stat.h
8840@@ -63,6 +63,7 @@ struct kstat { 8812@@ -63,6 +63,7 @@ struct kstat {
8841 unsigned int nlink; 8813 unsigned int nlink;
8842 uid_t uid; 8814 uid_t uid;
8843 gid_t gid; 8815 gid_t gid;
8844+ xid_t xid; 8816+ xid_t xid;
8845 dev_t rdev; 8817 dev_t rdev;
8846 loff_t size; 8818 loff_t size;
8847 struct timespec atime; 8819 struct timespec atime;
8848Index: vserver-sources-2.0.2_2.6.15/include/linux/sunrpc/auth.h 8820Index: linux-2.6.16/include/linux/sunrpc/auth.h
8849=================================================================== 8821===================================================================
8850--- vserver-sources-2.0.2_2.6.15.orig/include/linux/sunrpc/auth.h 8822--- linux-2.6.16.orig/include/linux/sunrpc/auth.h
8851+++ vserver-sources-2.0.2_2.6.15/include/linux/sunrpc/auth.h 8823+++ linux-2.6.16/include/linux/sunrpc/auth.h
8852@@ -28,6 +28,7 @@ 8824@@ -28,6 +28,7 @@
8853 struct auth_cred { 8825 struct auth_cred {
8854 uid_t uid; 8826 uid_t uid;
8855 gid_t gid; 8827 gid_t gid;
8856+ xid_t xid; 8828+ xid_t xid;
8857 struct group_info *group_info; 8829 struct group_info *group_info;
8858 }; 8830 };
8859 8831
8860Index: vserver-sources-2.0.2_2.6.15/include/linux/sunrpc/clnt.h 8832Index: linux-2.6.16/include/linux/sunrpc/clnt.h
8861=================================================================== 8833===================================================================
8862--- vserver-sources-2.0.2_2.6.15.orig/include/linux/sunrpc/clnt.h 8834--- linux-2.6.16.orig/include/linux/sunrpc/clnt.h
8863+++ vserver-sources-2.0.2_2.6.15/include/linux/sunrpc/clnt.h 8835+++ linux-2.6.16/include/linux/sunrpc/clnt.h
8864@@ -52,7 +52,8 @@ struct rpc_clnt { 8836@@ -51,7 +51,8 @@ struct rpc_clnt {
8865 cl_chatty : 1,/* be verbose */ 8837 cl_intr : 1,/* interruptible */
8866 cl_autobind : 1,/* use getport() */ 8838 cl_autobind : 1,/* use getport() */
8867 cl_oneshot : 1,/* dispose after use */ 8839 cl_oneshot : 1,/* dispose after use */
8868- cl_dead : 1;/* abandoned */ 8840- cl_dead : 1;/* abandoned */
8869+ cl_dead : 1,/* abandoned */ 8841+ cl_dead : 1,/* abandoned */
8870+ cl_tagxid : 1;/* do xid tagging */ 8842+ cl_tagxid : 1;/* do xid tagging */
8871 8843
8872 struct rpc_rtt * cl_rtt; /* RTO estimator data */ 8844 struct rpc_rtt * cl_rtt; /* RTO estimator data */
8873 struct rpc_portmap * cl_pmap; /* port mapping */ 8845 struct rpc_portmap * cl_pmap; /* port mapping */
8874Index: vserver-sources-2.0.2_2.6.15/include/linux/sysctl.h 8846Index: linux-2.6.16/include/linux/sysctl.h
8875=================================================================== 8847===================================================================
8876--- vserver-sources-2.0.2_2.6.15.orig/include/linux/sysctl.h 8848--- linux-2.6.16.orig/include/linux/sysctl.h
8877+++ vserver-sources-2.0.2_2.6.15/include/linux/sysctl.h 8849+++ linux-2.6.16/include/linux/sysctl.h
8878@@ -150,6 +150,7 @@ enum 8850@@ -152,6 +152,7 @@ enum
8879 #ifdef CONFIG_ALPHA_UAC_SYSCTL 8851 #ifdef CONFIG_ALPHA_UAC_SYSCTL
8880 KERN_UAC_POLICY=72, /* int: Alpha unaligned access control policy flags */ 8852 KERN_UAC_POLICY=74, /* int: Alpha unaligned access control policy flags */
8881 #endif /* CONFIG_ALPHA_UAC_SYSCTL */ 8853 #endif /* CONFIG_ALPHA_UAC_SYSCTL */
8882+ KERN_VSHELPER=73, /* string: path to vshelper policy agent */ 8854+ KERN_VSHELPER=75, /* string: path to vshelper policy agent */
8883 }; 8855 };
8884 8856
8885 8857
8886@@ -890,6 +891,9 @@ typedef int ctl_handler (ctl_table *tabl 8858@@ -897,6 +898,9 @@ typedef int ctl_handler (ctl_table *tabl
8887 typedef int proc_handler (ctl_table *ctl, int write, struct file * filp, 8859 typedef int proc_handler (ctl_table *ctl, int write, struct file * filp,
8888 void __user *buffer, size_t *lenp, loff_t *ppos); 8860 void __user *buffer, size_t *lenp, loff_t *ppos);
8889 8861
8890+typedef int virt_handler (struct ctl_table *ctl, int write, xid_t xid, 8862+typedef int virt_handler (struct ctl_table *ctl, int write, xid_t xid,
8891+ void **datap, size_t *lenp); 8863+ void **datap, size_t *lenp);
8892+ 8864+
8893 extern int proc_dostring(ctl_table *, int, struct file *, 8865 extern int proc_dostring(ctl_table *, int, struct file *,
8894 void __user *, size_t *, loff_t *); 8866 void __user *, size_t *, loff_t *);
8895 extern int proc_dointvec(ctl_table *, int, struct file *, 8867 extern int proc_dointvec(ctl_table *, int, struct file *,
8896@@ -971,6 +975,7 @@ struct ctl_table 8868@@ -978,6 +982,7 @@ struct ctl_table
8897 mode_t mode; 8869 mode_t mode;
8898 ctl_table *child; 8870 ctl_table *child;
8899 proc_handler *proc_handler; /* Callback for text formatting */ 8871 proc_handler *proc_handler; /* Callback for text formatting */
8900+ virt_handler *virt_handler; /* Context virtualization */ 8872+ virt_handler *virt_handler; /* Context virtualization */
8901 ctl_handler *strategy; /* Callback function for all r/w */ 8873 ctl_handler *strategy; /* Callback function for all r/w */
8902 struct proc_dir_entry *de; /* /proc control block */ 8874 struct proc_dir_entry *de; /* /proc control block */
8903 void *extra1; 8875 void *extra1;
8904Index: vserver-sources-2.0.2_2.6.15/include/linux/sysfs.h 8876Index: linux-2.6.16/include/linux/sysfs.h
8905=================================================================== 8877===================================================================
8906--- vserver-sources-2.0.2_2.6.15.orig/include/linux/sysfs.h 8878--- linux-2.6.16.orig/include/linux/sysfs.h
8907+++ vserver-sources-2.0.2_2.6.15/include/linux/sysfs.h 8879+++ linux-2.6.16/include/linux/sysfs.h
8908@@ -12,6 +12,8 @@ 8880@@ -12,6 +12,8 @@
8909 8881
8910 #include <asm/atomic.h> 8882 #include <asm/atomic.h>
8911 8883
8912+#define SYSFS_SUPER_MAGIC 0x62656572 8884+#define SYSFS_SUPER_MAGIC 0x62656572
8913+ 8885+
8914 struct kobject; 8886 struct kobject;
8915 struct module; 8887 struct module;
8916 8888
8917Index: vserver-sources-2.0.2_2.6.15/include/linux/types.h 8889Index: linux-2.6.16/include/linux/types.h
8918=================================================================== 8890===================================================================
8919--- vserver-sources-2.0.2_2.6.15.orig/include/linux/types.h 8891--- linux-2.6.16.orig/include/linux/types.h
8920+++ vserver-sources-2.0.2_2.6.15/include/linux/types.h 8892+++ linux-2.6.16/include/linux/types.h
8921@@ -36,6 +36,8 @@ typedef __kernel_uid32_t uid_t; 8893@@ -38,6 +38,8 @@ typedef __kernel_uid32_t uid_t;
8922 typedef __kernel_gid32_t gid_t; 8894 typedef __kernel_gid32_t gid_t;
8923 typedef __kernel_uid16_t uid16_t; 8895 typedef __kernel_uid16_t uid16_t;
8924 typedef __kernel_gid16_t gid16_t; 8896 typedef __kernel_gid16_t gid16_t;
8925+typedef unsigned int xid_t; 8897+typedef unsigned int xid_t;
8926+typedef unsigned int nid_t; 8898+typedef unsigned int nid_t;
8927 8899
8928 #ifdef CONFIG_UID16 8900 #ifdef CONFIG_UID16
8929 /* This is defined by include/asm-{arch}/posix_types.h */ 8901 /* This is defined by include/asm-{arch}/posix_types.h */
8930Index: vserver-sources-2.0.2_2.6.15/include/linux/vroot.h 8902Index: linux-2.6.16/include/linux/vroot.h
8931=================================================================== 8903===================================================================
8932--- /dev/null 8904--- /dev/null
8933+++ vserver-sources-2.0.2_2.6.15/include/linux/vroot.h 8905+++ linux-2.6.16/include/linux/vroot.h
8934@@ -0,0 +1,51 @@ 8906@@ -0,0 +1,51 @@
8935+ 8907+
8936+/* 8908+/*
8937+ * include/linux/vroot.h 8909+ * include/linux/vroot.h
8938+ * 8910+ *
8981+ 8953+
8982+#define VROOT_SET_DEV 0x5600 8954+#define VROOT_SET_DEV 0x5600
8983+#define VROOT_CLR_DEV 0x5601 8955+#define VROOT_CLR_DEV 0x5601
8984+ 8956+
8985+#endif /* _LINUX_VROOT_H */ 8957+#endif /* _LINUX_VROOT_H */
8986Index: vserver-sources-2.0.2_2.6.15/include/linux/vs_base.h 8958Index: linux-2.6.16/include/linux/vs_base.h
8987=================================================================== 8959===================================================================
8988--- /dev/null 8960--- /dev/null
8989+++ vserver-sources-2.0.2_2.6.15/include/linux/vs_base.h 8961+++ linux-2.6.16/include/linux/vs_base.h
8990@@ -0,0 +1,103 @@ 8962@@ -0,0 +1,103 @@
8991+#ifndef _VX_VS_BASE_H 8963+#ifndef _VX_VS_BASE_H
8992+#define _VX_VS_BASE_H 8964+#define _VX_VS_BASE_H
8993+ 8965+
8994+#include "vserver/context.h" 8966+#include "vserver/context.h"
9089+ 9061+
9090+ 9062+
9091+#else 9063+#else
9092+#warning duplicate inclusion 9064+#warning duplicate inclusion
9093+#endif 9065+#endif
9094Index: vserver-sources-2.0.2_2.6.15/include/linux/vs_context.h 9066Index: linux-2.6.16/include/linux/vs_context.h
9095=================================================================== 9067===================================================================
9096--- /dev/null 9068--- /dev/null
9097+++ vserver-sources-2.0.2_2.6.15/include/linux/vs_context.h 9069+++ linux-2.6.16/include/linux/vs_context.h
9098@@ -0,0 +1,198 @@ 9070@@ -0,0 +1,198 @@
9099+#ifndef _VX_VS_CONTEXT_H 9071+#ifndef _VX_VS_CONTEXT_H
9100+#define _VX_VS_CONTEXT_H 9072+#define _VX_VS_CONTEXT_H
9101+ 9073+
9102+#include <linux/kernel.h> 9074+#include <linux/kernel.h>
9292+ 9264+
9293+ 9265+
9294+#else 9266+#else
9295+#warning duplicate inclusion 9267+#warning duplicate inclusion
9296+#endif 9268+#endif
9297Index: vserver-sources-2.0.2_2.6.15/include/linux/vs_cvirt.h 9269Index: linux-2.6.16/include/linux/vs_cvirt.h
9298=================================================================== 9270===================================================================
9299--- /dev/null 9271--- /dev/null
9300+++ vserver-sources-2.0.2_2.6.15/include/linux/vs_cvirt.h 9272+++ linux-2.6.16/include/linux/vs_cvirt.h
9301@@ -0,0 +1,108 @@ 9273@@ -0,0 +1,108 @@
9302+#ifndef _VX_VS_CVIRT_H 9274+#ifndef _VX_VS_CVIRT_H
9303+#define _VX_VS_CVIRT_H 9275+#define _VX_VS_CVIRT_H
9304+ 9276+
9305+#include "vserver/cvirt.h" 9277+#include "vserver/cvirt.h"
9405+ 9377+
9406+ 9378+
9407+#else 9379+#else
9408+#warning duplicate inclusion 9380+#warning duplicate inclusion
9409+#endif 9381+#endif
9410Index: vserver-sources-2.0.2_2.6.15/include/linux/vs_dlimit.h 9382Index: linux-2.6.16/include/linux/vs_dlimit.h
9411=================================================================== 9383===================================================================
9412--- /dev/null 9384--- /dev/null
9413+++ vserver-sources-2.0.2_2.6.15/include/linux/vs_dlimit.h 9385+++ linux-2.6.16/include/linux/vs_dlimit.h
9414@@ -0,0 +1,213 @@ 9386@@ -0,0 +1,213 @@
9415+#ifndef _VX_VS_DLIMIT_H 9387+#ifndef _VX_VS_DLIMIT_H
9416+#define _VX_VS_DLIMIT_H 9388+#define _VX_VS_DLIMIT_H
9417+ 9389+
9418+#include "vserver/dlimit.h" 9390+#include "vserver/dlimit.h"
9623+ 9595+
9624+ 9596+
9625+#else 9597+#else
9626+#warning duplicate inclusion 9598+#warning duplicate inclusion
9627+#endif 9599+#endif
9628Index: vserver-sources-2.0.2_2.6.15/include/linux/vs_limit.h 9600Index: linux-2.6.16/include/linux/vs_limit.h
9629=================================================================== 9601===================================================================
9630--- /dev/null 9602--- /dev/null
9631+++ vserver-sources-2.0.2_2.6.15/include/linux/vs_limit.h 9603+++ linux-2.6.16/include/linux/vs_limit.h
9632@@ -0,0 +1,107 @@ 9604@@ -0,0 +1,107 @@
9633+#ifndef _VX_VS_LIMIT_H 9605+#ifndef _VX_VS_LIMIT_H
9634+#define _VX_VS_LIMIT_H 9606+#define _VX_VS_LIMIT_H
9635+ 9607+
9636+#include "vserver/limit.h" 9608+#include "vserver/limit.h"
9735+ 9707+
9736+ 9708+
9737+#else 9709+#else
9738+#warning duplicate inclusion 9710+#warning duplicate inclusion
9739+#endif 9711+#endif
9740Index: vserver-sources-2.0.2_2.6.15/include/linux/vs_memory.h 9712Index: linux-2.6.16/include/linux/vs_memory.h
9741=================================================================== 9713===================================================================
9742--- /dev/null 9714--- /dev/null
9743+++ vserver-sources-2.0.2_2.6.15/include/linux/vs_memory.h 9715+++ linux-2.6.16/include/linux/vs_memory.h
9744@@ -0,0 +1,114 @@ 9716@@ -0,0 +1,108 @@
9745+#ifndef _VX_VS_MEMORY_H 9717+#ifndef _VX_VS_MEMORY_H
9746+#define _VX_VS_MEMORY_H 9718+#define _VX_VS_MEMORY_H
9747+ 9719+
9748+#include <linux/config.h> 9720+#include <linux/config.h>
9749+#include "vserver/limit.h" 9721+#include "vserver/limit.h"
9753+ 9725+
9754+#define __vx_add_long(a,v) (*(v) += (a)) 9726+#define __vx_add_long(a,v) (*(v) += (a))
9755+#define __vx_inc_long(v) (++*(v)) 9727+#define __vx_inc_long(v) (++*(v))
9756+#define __vx_dec_long(v) (--*(v)) 9728+#define __vx_dec_long(v) (--*(v))
9757+ 9729+
9758+#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS 9730+#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
9759+#ifdef ATOMIC64_INIT
9760+#define __vx_add_value(a,v) atomic64_add(a, v)
9761+#define __vx_inc_value(v) atomic64_inc(v)
9762+#define __vx_dec_value(v) atomic64_dec(v)
9763+#else /* !ATOMIC64_INIT */
9764+#define __vx_add_value(a,v) atomic_add(a, v) 9731+#define __vx_add_value(a,v) atomic_long_add(a,v)
9765+#define __vx_inc_value(v) atomic_inc(v) 9732+#define __vx_inc_value(v) atomic_long_inc(v)
9766+#define __vx_dec_value(v) atomic_dec(v) 9733+#define __vx_dec_value(v) atomic_long_dec(v)
9767+#endif /* !ATOMIC64_INIT */
9768+#else /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ 9734+#else /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */
9769+#define __vx_add_value(a,v) __vx_add_long(a,v) 9735+#define __vx_add_value(a,v) __vx_add_long(a,v)
9770+#define __vx_inc_value(v) __vx_inc_long(v) 9736+#define __vx_inc_value(v) __vx_inc_long(v)
9771+#define __vx_dec_value(v) __vx_dec_long(v) 9737+#define __vx_dec_value(v) __vx_dec_long(v)
9772+#endif /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ 9738+#endif /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */
9854+#define vx_anonpages_avail(m,p) vx_pages_avail(m, p, VLIMIT_ANON) 9820+#define vx_anonpages_avail(m,p) vx_pages_avail(m, p, VLIMIT_ANON)
9855+ 9821+
9856+#else 9822+#else
9857+#warning duplicate inclusion 9823+#warning duplicate inclusion
9858+#endif 9824+#endif
9859Index: vserver-sources-2.0.2_2.6.15/include/linux/vs_network.h 9825Index: linux-2.6.16/include/linux/vs_network.h
9860=================================================================== 9826===================================================================
9861--- /dev/null 9827--- /dev/null
9862+++ vserver-sources-2.0.2_2.6.15/include/linux/vs_network.h 9828+++ linux-2.6.16/include/linux/vs_network.h
9863@@ -0,0 +1,215 @@ 9829@@ -0,0 +1,215 @@
9864+#ifndef _NX_VS_NETWORK_H 9830+#ifndef _NX_VS_NETWORK_H
9865+#define _NX_VS_NETWORK_H 9831+#define _NX_VS_NETWORK_H
9866+ 9832+
9867+#include "vserver/network.h" 9833+#include "vserver/network.h"
10074+ 10040+
10075+ 10041+
10076+#else 10042+#else
10077+#warning duplicate inclusion 10043+#warning duplicate inclusion
10078+#endif 10044+#endif
10079Index: vserver-sources-2.0.2_2.6.15/include/linux/vs_sched.h 10045Index: linux-2.6.16/include/linux/vs_sched.h
10080=================================================================== 10046===================================================================
10081--- /dev/null 10047--- /dev/null
10082+++ vserver-sources-2.0.2_2.6.15/include/linux/vs_sched.h 10048+++ linux-2.6.16/include/linux/vs_sched.h
10083@@ -0,0 +1,93 @@ 10049@@ -0,0 +1,93 @@
10084+#ifndef _VX_VS_SCHED_H 10050+#ifndef _VX_VS_SCHED_H
10085+#define _VX_VS_SCHED_H 10051+#define _VX_VS_SCHED_H
10086+ 10052+
10087+#include <linux/config.h> 10053+#include <linux/config.h>
10172+} 10138+}
10173+ 10139+
10174+#else 10140+#else
10175+#warning duplicate inclusion 10141+#warning duplicate inclusion
10176+#endif 10142+#endif
10177Index: vserver-sources-2.0.2_2.6.15/include/linux/vs_socket.h 10143Index: linux-2.6.16/include/linux/vs_socket.h
10178=================================================================== 10144===================================================================
10179--- /dev/null 10145--- /dev/null
10180+++ vserver-sources-2.0.2_2.6.15/include/linux/vs_socket.h 10146+++ linux-2.6.16/include/linux/vs_socket.h
10181@@ -0,0 +1,57 @@ 10147@@ -0,0 +1,57 @@
10182+#ifndef _VX_VS_SOCKET_H 10148+#ifndef _VX_VS_SOCKET_H
10183+#define _VX_VS_SOCKET_H 10149+#define _VX_VS_SOCKET_H
10184+ 10150+
10185+#include "vserver/debug.h" 10151+#include "vserver/debug.h"
10234+ 10200+
10235+ 10201+
10236+#else 10202+#else
10237+#warning duplicate inclusion 10203+#warning duplicate inclusion
10238+#endif 10204+#endif
10239Index: vserver-sources-2.0.2_2.6.15/include/linux/vserver/context.h 10205Index: linux-2.6.16/include/linux/vserver/context.h
10240=================================================================== 10206===================================================================
10241--- /dev/null 10207--- /dev/null
10242+++ vserver-sources-2.0.2_2.6.15/include/linux/vserver/context.h 10208+++ linux-2.6.16/include/linux/vserver/context.h
10243@@ -0,0 +1,170 @@ 10209@@ -0,0 +1,170 @@
10244+#ifndef _VX_CONTEXT_H 10210+#ifndef _VX_CONTEXT_H
10245+#define _VX_CONTEXT_H 10211+#define _VX_CONTEXT_H
10246+ 10212+
10247+#include <linux/config.h> 10213+#include <linux/config.h>
10409+ 10375+
10410+#endif /* __KERNEL__ */ 10376+#endif /* __KERNEL__ */
10411+#else /* _VX_CONTEXT_H */ 10377+#else /* _VX_CONTEXT_H */
10412+#warning duplicate inclusion 10378+#warning duplicate inclusion
10413+#endif /* _VX_CONTEXT_H */ 10379+#endif /* _VX_CONTEXT_H */
10414Index: vserver-sources-2.0.2_2.6.15/include/linux/vserver/context_cmd.h 10380Index: linux-2.6.16/include/linux/vserver/context_cmd.h
10415=================================================================== 10381===================================================================
10416--- /dev/null 10382--- /dev/null
10417+++ vserver-sources-2.0.2_2.6.15/include/linux/vserver/context_cmd.h 10383+++ linux-2.6.16/include/linux/vserver/context_cmd.h
10418@@ -0,0 +1,84 @@ 10384@@ -0,0 +1,84 @@
10419+#ifndef _VX_CONTEXT_CMD_H 10385+#ifndef _VX_CONTEXT_CMD_H
10420+#define _VX_CONTEXT_CMD_H 10386+#define _VX_CONTEXT_CMD_H
10421+ 10387+
10422+ 10388+
10498+extern int vc_get_ccaps(uint32_t, void __user *); 10464+extern int vc_get_ccaps(uint32_t, void __user *);
10499+extern int vc_set_ccaps(uint32_t, void __user *); 10465+extern int vc_set_ccaps(uint32_t, void __user *);
10500+ 10466+
10501+#endif /* __KERNEL__ */ 10467+#endif /* __KERNEL__ */
10502+#endif /* _VX_CONTEXT_CMD_H */ 10468+#endif /* _VX_CONTEXT_CMD_H */
10503Index: vserver-sources-2.0.2_2.6.15/include/linux/vserver/cvirt.h 10469Index: linux-2.6.16/include/linux/vserver/cvirt.h
10504=================================================================== 10470===================================================================
10505--- /dev/null 10471--- /dev/null
10506+++ vserver-sources-2.0.2_2.6.15/include/linux/vserver/cvirt.h 10472+++ linux-2.6.16/include/linux/vserver/cvirt.h
10507@@ -0,0 +1,26 @@ 10473@@ -0,0 +1,26 @@
10508+#ifndef _VX_CVIRT_H 10474+#ifndef _VX_CVIRT_H
10509+#define _VX_CVIRT_H 10475+#define _VX_CVIRT_H
10510+ 10476+
10511+ 10477+
10529+ 10495+
10530+#endif /* __KERNEL__ */ 10496+#endif /* __KERNEL__ */
10531+#else /* _VX_CVIRT_H */ 10497+#else /* _VX_CVIRT_H */
10532+#warning duplicate inclusion 10498+#warning duplicate inclusion
10533+#endif /* _VX_CVIRT_H */ 10499+#endif /* _VX_CVIRT_H */
10534Index: vserver-sources-2.0.2_2.6.15/include/linux/vserver/cvirt_cmd.h 10500Index: linux-2.6.16/include/linux/vserver/cvirt_cmd.h
10535=================================================================== 10501===================================================================
10536--- /dev/null 10502--- /dev/null
10537+++ vserver-sources-2.0.2_2.6.15/include/linux/vserver/cvirt_cmd.h 10503+++ linux-2.6.16/include/linux/vserver/cvirt_cmd.h
10538@@ -0,0 +1,35 @@ 10504@@ -0,0 +1,35 @@
10539+#ifndef _VX_CVIRT_CMD_H 10505+#ifndef _VX_CVIRT_CMD_H
10540+#define _VX_CVIRT_CMD_H 10506+#define _VX_CVIRT_CMD_H
10541+ 10507+
10542+ 10508+
10569+extern int vc_set_vhi_name(uint32_t, void __user *); 10535+extern int vc_set_vhi_name(uint32_t, void __user *);
10570+extern int vc_get_vhi_name(uint32_t, void __user *); 10536+extern int vc_get_vhi_name(uint32_t, void __user *);
10571+ 10537+
10572+#endif /* __KERNEL__ */ 10538+#endif /* __KERNEL__ */
10573+#endif /* _VX_CVIRT_CMD_H */ 10539+#endif /* _VX_CVIRT_CMD_H */
10574Index: vserver-sources-2.0.2_2.6.15/include/linux/vserver/cvirt_def.h 10540Index: linux-2.6.16/include/linux/vserver/cvirt_def.h
10575=================================================================== 10541===================================================================
10576--- /dev/null 10542--- /dev/null
10577+++ vserver-sources-2.0.2_2.6.15/include/linux/vserver/cvirt_def.h 10543+++ linux-2.6.16/include/linux/vserver/cvirt_def.h
10578@@ -0,0 +1,78 @@ 10544@@ -0,0 +1,78 @@
10579+#ifndef _VX_CVIRT_DEF_H 10545+#ifndef _VX_CVIRT_DEF_H
10580+#define _VX_CVIRT_DEF_H 10546+#define _VX_CVIRT_DEF_H
10581+ 10547+
10582+#include <linux/config.h> 10548+#include <linux/config.h>
10652+ 10618+
10653+ struct _vx_sock_acc sock[5][3]; 10619+ struct _vx_sock_acc sock[5][3];
10654+}; 10620+};
10655+ 10621+
10656+#endif /* _VX_CVIRT_DEF_H */ 10622+#endif /* _VX_CVIRT_DEF_H */
10657Index: vserver-sources-2.0.2_2.6.15/include/linux/vserver/debug.h 10623Index: linux-2.6.16/include/linux/vserver/debug.h
10658=================================================================== 10624===================================================================
10659--- /dev/null 10625--- /dev/null
10660+++ vserver-sources-2.0.2_2.6.15/include/linux/vserver/debug.h 10626+++ linux-2.6.16/include/linux/vserver/debug.h
10661@@ -0,0 +1,297 @@ 10627@@ -0,0 +1,297 @@
10662+#ifndef _VX_DEBUG_H 10628+#ifndef _VX_DEBUG_H
10663+#define _VX_DEBUG_H 10629+#define _VX_DEBUG_H
10664+ 10630+
10665+#include <linux/config.h> 10631+#include <linux/config.h>
10954+#define vxd_assert(c,f,x...) do { } while (0) 10920+#define vxd_assert(c,f,x...) do { } while (0)
10955+#endif 10921+#endif
10956+ 10922+
10957+ 10923+
10958+#endif /* _VX_DEBUG_H */ 10924+#endif /* _VX_DEBUG_H */
10959Index: vserver-sources-2.0.2_2.6.15/include/linux/vserver/debug_cmd.h 10925Index: linux-2.6.16/include/linux/vserver/debug_cmd.h
10960=================================================================== 10926===================================================================
10961--- /dev/null 10927--- /dev/null
10962+++ vserver-sources-2.0.2_2.6.15/include/linux/vserver/debug_cmd.h 10928+++ linux-2.6.16/include/linux/vserver/debug_cmd.h
10963@@ -0,0 +1,14 @@ 10929@@ -0,0 +1,14 @@
10964+#ifndef _VX_DEBUG_CMD_H 10930+#ifndef _VX_DEBUG_CMD_H
10965+#define _VX_DEBUG_CMD_H 10931+#define _VX_DEBUG_CMD_H
10966+ 10932+
10967+ 10933+
10973+ 10939+
10974+extern int vc_dump_history(uint32_t); 10940+extern int vc_dump_history(uint32_t);
10975+ 10941+
10976+#endif /* __KERNEL__ */ 10942+#endif /* __KERNEL__ */
10977+#endif /* _VX_DEBUG_CMD_H */ 10943+#endif /* _VX_DEBUG_CMD_H */
10978Index: vserver-sources-2.0.2_2.6.15/include/linux/vserver/dlimit.h 10944Index: linux-2.6.16/include/linux/vserver/dlimit.h
10979=================================================================== 10945===================================================================
10980--- /dev/null 10946--- /dev/null
10981+++ vserver-sources-2.0.2_2.6.15/include/linux/vserver/dlimit.h 10947+++ linux-2.6.16/include/linux/vserver/dlimit.h
10982@@ -0,0 +1,53 @@ 10948@@ -0,0 +1,53 @@
10983+#ifndef _VX_DLIMIT_H 10949+#ifndef _VX_DLIMIT_H
10984+#define _VX_DLIMIT_H 10950+#define _VX_DLIMIT_H
10985+ 10951+
10986+#include "switch.h" 10952+#include "switch.h"
11031+ 10997+
11032+#endif /* __KERNEL__ */ 10998+#endif /* __KERNEL__ */
11033+#else /* _VX_DLIMIT_H */ 10999+#else /* _VX_DLIMIT_H */
11034+#warning duplicate inclusion 11000+#warning duplicate inclusion
11035+#endif /* _VX_DLIMIT_H */ 11001+#endif /* _VX_DLIMIT_H */
11036Index: vserver-sources-2.0.2_2.6.15/include/linux/vserver/dlimit_cmd.h 11002Index: linux-2.6.16/include/linux/vserver/dlimit_cmd.h
11037=================================================================== 11003===================================================================
11038--- /dev/null 11004--- /dev/null
11039+++ vserver-sources-2.0.2_2.6.15/include/linux/vserver/dlimit_cmd.h 11005+++ linux-2.6.16/include/linux/vserver/dlimit_cmd.h
11040@@ -0,0 +1,71 @@ 11006@@ -0,0 +1,71 @@
11041+#ifndef _VX_DLIMIT_CMD_H 11007+#ifndef _VX_DLIMIT_CMD_H
11042+#define _VX_DLIMIT_CMD_H 11008+#define _VX_DLIMIT_CMD_H
11043+ 11009+
11044+#include <linux/config.h> 11010+#include <linux/config.h>
11107+ 11073+
11108+#endif /* CONFIG_COMPAT */ 11074+#endif /* CONFIG_COMPAT */
11109+ 11075+
11110+#endif /* __KERNEL__ */ 11076+#endif /* __KERNEL__ */
11111+#endif /* _VX_DLIMIT_CMD_H */ 11077+#endif /* _VX_DLIMIT_CMD_H */
11112Index: vserver-sources-2.0.2_2.6.15/include/linux/vserver/inode.h 11078Index: linux-2.6.16/include/linux/vserver/inode.h
11113=================================================================== 11079===================================================================
11114--- /dev/null 11080--- /dev/null
11115+++ vserver-sources-2.0.2_2.6.15/include/linux/vserver/inode.h 11081+++ linux-2.6.16/include/linux/vserver/inode.h
11116@@ -0,0 +1,40 @@ 11082@@ -0,0 +1,40 @@
11117+#ifndef _VX_INODE_H 11083+#ifndef _VX_INODE_H
11118+#define _VX_INODE_H 11084+#define _VX_INODE_H
11119+ 11085+
11120+ 11086+
11152+#define FIOC_SETXFLG _IOW('x', 6, long) 11118+#define FIOC_SETXFLG _IOW('x', 6, long)
11153+ 11119+
11154+#else /* _VX_INODE_H */ 11120+#else /* _VX_INODE_H */
11155+#warning duplicate inclusion 11121+#warning duplicate inclusion
11156+#endif /* _VX_INODE_H */ 11122+#endif /* _VX_INODE_H */
11157Index: vserver-sources-2.0.2_2.6.15/include/linux/vserver/inode_cmd.h 11123Index: linux-2.6.16/include/linux/vserver/inode_cmd.h
11158=================================================================== 11124===================================================================
11159--- /dev/null 11125--- /dev/null
11160+++ vserver-sources-2.0.2_2.6.15/include/linux/vserver/inode_cmd.h 11126+++ linux-2.6.16/include/linux/vserver/inode_cmd.h
11161@@ -0,0 +1,61 @@ 11127@@ -0,0 +1,61 @@
11162+#ifndef _VX_INODE_CMD_H 11128+#ifndef _VX_INODE_CMD_H
11163+#define _VX_INODE_CMD_H 11129+#define _VX_INODE_CMD_H
11164+ 11130+
11165+ 11131+
11218+ 11184+
11219+#endif /* CONFIG_COMPAT */ 11185+#endif /* CONFIG_COMPAT */
11220+ 11186+
11221+#endif /* __KERNEL__ */ 11187+#endif /* __KERNEL__ */
11222+#endif /* _VX_INODE_CMD_H */ 11188+#endif /* _VX_INODE_CMD_H */
11223Index: vserver-sources-2.0.2_2.6.15/include/linux/vserver/legacy.h 11189Index: linux-2.6.16/include/linux/vserver/legacy.h
11224=================================================================== 11190===================================================================
11225--- /dev/null 11191--- /dev/null
11226+++ vserver-sources-2.0.2_2.6.15/include/linux/vserver/legacy.h 11192+++ linux-2.6.16/include/linux/vserver/legacy.h
11227@@ -0,0 +1,49 @@ 11193@@ -0,0 +1,49 @@
11228+#ifndef _VX_LEGACY_H 11194+#ifndef _VX_LEGACY_H
11229+#define _VX_LEGACY_H 11195+#define _VX_LEGACY_H
11230+ 11196+
11231+#include "switch.h" 11197+#include "switch.h"
11272+extern int vc_new_s_context(uint32_t, void __user *); 11238+extern int vc_new_s_context(uint32_t, void __user *);
11273+extern int vc_set_ipv4root(uint32_t, void __user *); 11239+extern int vc_set_ipv4root(uint32_t, void __user *);
11274+ 11240+
11275+#endif /* __KERNEL__ */ 11241+#endif /* __KERNEL__ */
11276+#endif /* _VX_LEGACY_H */ 11242+#endif /* _VX_LEGACY_H */
11277Index: vserver-sources-2.0.2_2.6.15/include/linux/vserver/limit.h 11243Index: linux-2.6.16/include/linux/vserver/limit.h
11278=================================================================== 11244===================================================================
11279--- /dev/null 11245--- /dev/null
11280+++ vserver-sources-2.0.2_2.6.15/include/linux/vserver/limit.h 11246+++ linux-2.6.16/include/linux/vserver/limit.h
11281@@ -0,0 +1,20 @@ 11247@@ -0,0 +1,20 @@
11282+#ifndef _VX_LIMIT_H 11248+#ifndef _VX_LIMIT_H
11283+#define _VX_LIMIT_H 11249+#define _VX_LIMIT_H
11284+ 11250+
11285+ 11251+
11297+ 11263+
11298+#define NUM_LIMITS 24 11264+#define NUM_LIMITS 24
11299+ 11265+
11300+#endif /* __KERNEL__ */ 11266+#endif /* __KERNEL__ */
11301+#endif /* _VX_LIMIT_H */ 11267+#endif /* _VX_LIMIT_H */
11302Index: vserver-sources-2.0.2_2.6.15/include/linux/vserver/limit_cmd.h 11268Index: linux-2.6.16/include/linux/vserver/limit_cmd.h
11303=================================================================== 11269===================================================================
11304--- /dev/null 11270--- /dev/null
11305+++ vserver-sources-2.0.2_2.6.15/include/linux/vserver/limit_cmd.h 11271+++ linux-2.6.16/include/linux/vserver/limit_cmd.h
11306@@ -0,0 +1,37 @@ 11272@@ -0,0 +1,37 @@
11307+#ifndef _VX_LIMIT_CMD_H 11273+#ifndef _VX_LIMIT_CMD_H
11308+#define _VX_LIMIT_CMD_H 11274+#define _VX_LIMIT_CMD_H
11309+ 11275+
11310+ 11276+
11339+extern int vc_set_rlimit(uint32_t, void __user *); 11305+extern int vc_set_rlimit(uint32_t, void __user *);
11340+extern int vc_get_rlimit_mask(uint32_t, void __user *); 11306+extern int vc_get_rlimit_mask(uint32_t, void __user *);
11341+ 11307+
11342+#endif /* __KERNEL__ */ 11308+#endif /* __KERNEL__ */
11343+#endif /* _VX_LIMIT_CMD_H */ 11309+#endif /* _VX_LIMIT_CMD_H */
11344Index: vserver-sources-2.0.2_2.6.15/include/linux/vserver/limit_def.h 11310Index: linux-2.6.16/include/linux/vserver/limit_def.h
11345=================================================================== 11311===================================================================
11346--- /dev/null 11312--- /dev/null
11347+++ vserver-sources-2.0.2_2.6.15/include/linux/vserver/limit_def.h 11313+++ linux-2.6.16/include/linux/vserver/limit_def.h
11348@@ -0,0 +1,23 @@ 11314@@ -0,0 +1,23 @@
11349+#ifndef _VX_LIMIT_DEF_H 11315+#ifndef _VX_LIMIT_DEF_H
11350+#define _VX_LIMIT_DEF_H 11316+#define _VX_LIMIT_DEF_H
11351+ 11317+
11352+#include <linux/config.h> 11318+#include <linux/config.h>
11367+ atomic_t lhit[NUM_LIMITS]; /* Limit hits */ 11333+ atomic_t lhit[NUM_LIMITS]; /* Limit hits */
11368+}; 11334+};
11369+ 11335+
11370+ 11336+
11371+#endif /* _VX_LIMIT_DEF_H */ 11337+#endif /* _VX_LIMIT_DEF_H */
11372Index: vserver-sources-2.0.2_2.6.15/include/linux/vserver/limit_int.h 11338Index: linux-2.6.16/include/linux/vserver/limit_int.h
11373=================================================================== 11339===================================================================
11374--- /dev/null 11340--- /dev/null
11375+++ vserver-sources-2.0.2_2.6.15/include/linux/vserver/limit_int.h 11341+++ linux-2.6.16/include/linux/vserver/limit_int.h
11376@@ -0,0 +1,76 @@ 11342@@ -0,0 +1,76 @@
11377+#ifndef _VX_LIMIT_INT_H 11343+#ifndef _VX_LIMIT_INT_H
11378+#define _VX_LIMIT_INT_H 11344+#define _VX_LIMIT_INT_H
11379+ 11345+
11380+ 11346+
11448+ return 0; 11414+ return 0;
11449+} 11415+}
11450+ 11416+
11451+#endif /* __KERNEL__ */ 11417+#endif /* __KERNEL__ */
11452+#endif /* _VX_LIMIT_H */ 11418+#endif /* _VX_LIMIT_H */
11453Index: vserver-sources-2.0.2_2.6.15/include/linux/vserver/namespace.h 11419Index: linux-2.6.16/include/linux/vserver/namespace.h
11454=================================================================== 11420===================================================================
11455--- /dev/null 11421--- /dev/null
11456+++ vserver-sources-2.0.2_2.6.15/include/linux/vserver/namespace.h 11422+++ linux-2.6.16/include/linux/vserver/namespace.h
11457@@ -0,0 +1,15 @@ 11423@@ -0,0 +1,15 @@
11458+#ifndef _VX_NAMESPACE_H 11424+#ifndef _VX_NAMESPACE_H
11459+#define _VX_NAMESPACE_H 11425+#define _VX_NAMESPACE_H
11460+ 11426+
11461+ 11427+
11468+extern int vx_set_namespace(struct vx_info *, struct namespace *, struct fs_struct *); 11434+extern int vx_set_namespace(struct vx_info *, struct namespace *, struct fs_struct *);
11469+ 11435+
11470+#else /* _VX_NAMESPACE_H */ 11436+#else /* _VX_NAMESPACE_H */
11471+#warning duplicate inclusion 11437+#warning duplicate inclusion
11472+#endif /* _VX_NAMESPACE_H */ 11438+#endif /* _VX_NAMESPACE_H */
11473Index: vserver-sources-2.0.2_2.6.15/include/linux/vserver/namespace_cmd.h 11439Index: linux-2.6.16/include/linux/vserver/namespace_cmd.h
11474=================================================================== 11440===================================================================
11475--- /dev/null 11441--- /dev/null
11476+++ vserver-sources-2.0.2_2.6.15/include/linux/vserver/namespace_cmd.h 11442+++ linux-2.6.16/include/linux/vserver/namespace_cmd.h
11477@@ -0,0 +1,19 @@ 11443@@ -0,0 +1,19 @@
11478+#ifndef _VX_NAMESPACE_CMD_H 11444+#ifndef _VX_NAMESPACE_CMD_H
11479+#define _VX_NAMESPACE_CMD_H 11445+#define _VX_NAMESPACE_CMD_H
11480+ 11446+
11481+ 11447+
11492+extern int vc_cleanup_namespace(uint32_t, void __user *); 11458+extern int vc_cleanup_namespace(uint32_t, void __user *);
11493+extern int vc_set_namespace(uint32_t, void __user *); 11459+extern int vc_set_namespace(uint32_t, void __user *);
11494+ 11460+
11495+#endif /* __KERNEL__ */ 11461+#endif /* __KERNEL__ */
11496+#endif /* _VX_NAMESPACE_CMD_H */ 11462+#endif /* _VX_NAMESPACE_CMD_H */
11497Index: vserver-sources-2.0.2_2.6.15/include/linux/vserver/network.h 11463Index: linux-2.6.16/include/linux/vserver/network.h
11498=================================================================== 11464===================================================================
11499--- /dev/null 11465--- /dev/null
11500+++ vserver-sources-2.0.2_2.6.15/include/linux/vserver/network.h 11466+++ linux-2.6.16/include/linux/vserver/network.h
11501@@ -0,0 +1,119 @@ 11467@@ -0,0 +1,119 @@
11502+#ifndef _VX_NETWORK_H 11468+#ifndef _VX_NETWORK_H
11503+#define _VX_NETWORK_H 11469+#define _VX_NETWORK_H
11504+ 11470+
11505+#include <linux/types.h> 11471+#include <linux/types.h>
11616+ 11582+
11617+#endif /* __KERNEL__ */ 11583+#endif /* __KERNEL__ */
11618+#else /* _VX_NETWORK_H */ 11584+#else /* _VX_NETWORK_H */
11619+#warning duplicate inclusion 11585+#warning duplicate inclusion
11620+#endif /* _VX_NETWORK_H */ 11586+#endif /* _VX_NETWORK_H */
11621Index: vserver-sources-2.0.2_2.6.15/include/linux/vserver/network_cmd.h 11587Index: linux-2.6.16/include/linux/vserver/network_cmd.h
11622=================================================================== 11588===================================================================
11623--- /dev/null 11589--- /dev/null
11624+++ vserver-sources-2.0.2_2.6.15/include/linux/vserver/network_cmd.h 11590+++ linux-2.6.16/include/linux/vserver/network_cmd.h
11625@@ -0,0 +1,89 @@ 11591@@ -0,0 +1,89 @@
11626+#ifndef _VX_NETWORK_CMD_H 11592+#ifndef _VX_NETWORK_CMD_H
11627+#define _VX_NETWORK_CMD_H 11593+#define _VX_NETWORK_CMD_H
11628+ 11594+
11629+ 11595+
11710+extern int vc_get_ncaps(uint32_t, void __user *); 11676+extern int vc_get_ncaps(uint32_t, void __user *);
11711+extern int vc_set_ncaps(uint32_t, void __user *); 11677+extern int vc_set_ncaps(uint32_t, void __user *);
11712+ 11678+
11713+#endif /* __KERNEL__ */ 11679+#endif /* __KERNEL__ */
11714+#endif /* _VX_CONTEXT_CMD_H */ 11680+#endif /* _VX_CONTEXT_CMD_H */
11715Index: vserver-sources-2.0.2_2.6.15/include/linux/vserver/sched.h 11681Index: linux-2.6.16/include/linux/vserver/sched.h
11716=================================================================== 11682===================================================================
11717--- /dev/null 11683--- /dev/null
11718+++ vserver-sources-2.0.2_2.6.15/include/linux/vserver/sched.h 11684+++ linux-2.6.16/include/linux/vserver/sched.h
11719@@ -0,0 +1,26 @@ 11685@@ -0,0 +1,26 @@
11720+#ifndef _VX_SCHED_H 11686+#ifndef _VX_SCHED_H
11721+#define _VX_SCHED_H 11687+#define _VX_SCHED_H
11722+ 11688+
11723+ 11689+
11741+ 11707+
11742+#endif /* __KERNEL__ */ 11708+#endif /* __KERNEL__ */
11743+#else /* _VX_SCHED_H */ 11709+#else /* _VX_SCHED_H */
11744+#warning duplicate inclusion 11710+#warning duplicate inclusion
11745+#endif /* _VX_SCHED_H */ 11711+#endif /* _VX_SCHED_H */
11746Index: vserver-sources-2.0.2_2.6.15/include/linux/vserver/sched_cmd.h 11712Index: linux-2.6.16/include/linux/vserver/sched_cmd.h
11747=================================================================== 11713===================================================================
11748--- /dev/null 11714--- /dev/null
11749+++ vserver-sources-2.0.2_2.6.15/include/linux/vserver/sched_cmd.h 11715+++ linux-2.6.16/include/linux/vserver/sched_cmd.h
11750@@ -0,0 +1,48 @@ 11716@@ -0,0 +1,48 @@
11751+#ifndef _VX_SCHED_CMD_H 11717+#ifndef _VX_SCHED_CMD_H
11752+#define _VX_SCHED_CMD_H 11718+#define _VX_SCHED_CMD_H
11753+ 11719+
11754+ 11720+
11794+extern int vc_set_sched_v2(uint32_t, void __user *); 11760+extern int vc_set_sched_v2(uint32_t, void __user *);
11795+extern int vc_set_sched(uint32_t, void __user *); 11761+extern int vc_set_sched(uint32_t, void __user *);
11796+ 11762+
11797+#endif /* __KERNEL__ */ 11763+#endif /* __KERNEL__ */
11798+#endif /* _VX_SCHED_CMD_H */ 11764+#endif /* _VX_SCHED_CMD_H */
11799Index: v