/[vps]/vserver-sources/2.1.1_rc13-r1/4910_vs2.1.1-rc13.patch
Gentoo

Diff of /vserver-sources/2.1.1_rc13-r1/4910_vs2.1.1-rc13.patch

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

vserver-sources/2.1.1_rc13/4910_vs2.1.1-rc13.patch Revision 292 vserver-sources/2.1.1_rc13-r1/4910_vs2.1.1-rc13.patch Revision 293
1diff -NurpP --minimal linux-2.6.15.6/Documentation/vserver/debug.txt linux-2.6.15.6-vs2.1.1-rc13/Documentation/vserver/debug.txt 1Index: linux-2.6.16/Documentation/vserver/debug.txt
2--- linux-2.6.15.6/Documentation/vserver/debug.txt 1970-01-01 01:00:00 +0100 2===================================================================
3+++ linux-2.6.15.6-vs2.1.1-rc13/Documentation/vserver/debug.txt 2006-02-28 14:53:18 +0100 3--- /dev/null
4+++ linux-2.6.16/Documentation/vserver/debug.txt
4@@ -0,0 +1,108 @@ 5@@ -0,0 +1,108 @@
5+ 6+
6+debug_cvirt: 7+debug_cvirt:
7+ 8+
8+ 2 4 "vx_map_tgid: %p/%llx: %d -> %d" 9+ 2 4 "vx_map_tgid: %p/%llx: %d -> %d"
108+ "vx_cres_avail[%5d,%s,%2d]: %5ld > %5d + %5d" 109+ "vx_cres_avail[%5d,%s,%2d]: %5ld > %5d + %5d"
109+ 110+
110+ m 2^m "vx_acc_page[%5d,%s,%2d]: %5d%s" 111+ m 2^m "vx_acc_page[%5d,%s,%2d]: %5d%s"
111+ "vx_acc_pages[%5d,%s,%2d]: %5d += %5d" 112+ "vx_acc_pages[%5d,%s,%2d]: %5d += %5d"
112+ "vx_pages_avail[%5d,%s,%2d]: %5ld > %5d + %5d" 113+ "vx_pages_avail[%5d,%s,%2d]: %5ld > %5d + %5d"
113diff -NurpP --minimal linux-2.6.15.6/Makefile linux-2.6.15.6-vs2.1.1-rc13/Makefile 114Index: linux-2.6.16/Makefile
114--- linux-2.6.15.6/Makefile 2006-03-11 03:08:51 +0100 115===================================================================
115+++ linux-2.6.15.6-vs2.1.1-rc13/Makefile 2006-03-15 02:38:34 +0100 116--- linux-2.6.16.orig/Makefile
117+++ linux-2.6.16/Makefile
116@@ -1,7 +1,7 @@ 118@@ -1,7 +1,7 @@
117 VERSION = 2 119 VERSION = 2
118 PATCHLEVEL = 6 120 PATCHLEVEL = 6
119 SUBLEVEL = 15 121 SUBLEVEL = 16
120-EXTRAVERSION = 122-EXTRAVERSION =
121+EXTRAVERSION = -vs2.1.1-rc13-gentoo 123+EXTRAVERSION = -vs2.1.1-rc13-gentoo
122 NAME=Sliding Snow Leopard 124 NAME=Sliding Snow Leopard
123 125
124 # *DOCUMENTATION* 126 # *DOCUMENTATION*
125diff -NurpP --minimal linux-2.6.15.6/arch/alpha/Kconfig linux-2.6.15.6-vs2.1.1-rc13/arch/alpha/Kconfig 127Index: linux-2.6.16/arch/alpha/Kconfig
126--- linux-2.6.15.6/arch/alpha/Kconfig 2005-10-28 20:49:08 +0200 128===================================================================
127+++ linux-2.6.15.6-vs2.1.1-rc13/arch/alpha/Kconfig 2006-01-04 21:59:59 +0100 129--- linux-2.6.16.orig/arch/alpha/Kconfig
130+++ linux-2.6.16/arch/alpha/Kconfig
128@@ -609,6 +609,8 @@ source "arch/alpha/oprofile/Kconfig" 131@@ -645,6 +645,8 @@ source "arch/alpha/oprofile/Kconfig"
129 132
130 source "arch/alpha/Kconfig.debug" 133 source "arch/alpha/Kconfig.debug"
131 134
132+source "kernel/vserver/Kconfig" 135+source "kernel/vserver/Kconfig"
133+ 136+
134 source "security/Kconfig" 137 source "security/Kconfig"
135 138
136 source "crypto/Kconfig" 139 source "crypto/Kconfig"
137diff -NurpP --minimal linux-2.6.15.6/arch/alpha/kernel/asm-offsets.c linux-2.6.15.6-vs2.1.1-rc13/arch/alpha/kernel/asm-offsets.c 140Index: linux-2.6.16/arch/alpha/kernel/asm-offsets.c
138--- linux-2.6.15.6/arch/alpha/kernel/asm-offsets.c 2004-08-14 12:56:24 +0200 141===================================================================
139+++ linux-2.6.15.6-vs2.1.1-rc13/arch/alpha/kernel/asm-offsets.c 2006-01-04 21:59:59 +0100 142--- linux-2.6.16.orig/arch/alpha/kernel/asm-offsets.c
143+++ linux-2.6.16/arch/alpha/kernel/asm-offsets.c
140@@ -35,6 +35,7 @@ void foo(void) 144@@ -36,6 +36,7 @@ void foo(void)
141 DEFINE(PT_PTRACED, PT_PTRACED); 145 DEFINE(PT_PTRACED, PT_PTRACED);
142 DEFINE(CLONE_VM, CLONE_VM); 146 DEFINE(CLONE_VM, CLONE_VM);
143 DEFINE(CLONE_UNTRACED, CLONE_UNTRACED); 147 DEFINE(CLONE_UNTRACED, CLONE_UNTRACED);
144+ DEFINE(CLONE_KTHREAD, CLONE_KTHREAD); 148+ DEFINE(CLONE_KTHREAD, CLONE_KTHREAD);
145 DEFINE(SIGCHLD, SIGCHLD); 149 DEFINE(SIGCHLD, SIGCHLD);
146 BLANK(); 150 BLANK();
147 151
148diff -NurpP --minimal linux-2.6.15.6/arch/alpha/kernel/entry.S linux-2.6.15.6-vs2.1.1-rc13/arch/alpha/kernel/entry.S 152Index: linux-2.6.16/arch/alpha/kernel/entry.S
149--- linux-2.6.15.6/arch/alpha/kernel/entry.S 2005-10-28 20:49:08 +0200 153===================================================================
150+++ linux-2.6.15.6-vs2.1.1-rc13/arch/alpha/kernel/entry.S 2006-02-14 11:38:22 +0100 154--- linux-2.6.16.orig/arch/alpha/kernel/entry.S
155+++ linux-2.6.16/arch/alpha/kernel/entry.S
151@@ -645,7 +645,7 @@ kernel_thread: 156@@ -645,7 +645,7 @@ kernel_thread:
152 stq $2, 152($sp) /* HAE */ 157 stq $2, 152($sp) /* HAE */
153 158
154 /* Shuffle FLAGS to the front; add CLONE_VM. */ 159 /* Shuffle FLAGS to the front; add CLONE_VM. */
155- ldi $1, CLONE_VM|CLONE_UNTRACED 160- ldi $1, CLONE_VM|CLONE_UNTRACED
156+ ldi $1, CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD; 161+ ldi $1, CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD;
157 or $18, $1, $16 162 or $18, $1, $16
158 bsr $26, sys_clone 163 bsr $26, sys_clone
159 164
160@@ -874,22 +874,15 @@ sys_getxgid: 165@@ -874,24 +874,15 @@ sys_getxgid:
161 .globl sys_getxpid 166 .globl sys_getxpid
162 .ent sys_getxpid 167 .ent sys_getxpid
163 sys_getxpid: 168 sys_getxpid:
164+ lda $sp, -16($sp) 169+ lda $sp, -16($sp)
165+ stq $26, 0($sp) 170+ stq $26, 0($sp)
166 .prologue 0 171 .prologue 0
167- ldq $2, TI_TASK($8) 172- ldq $2, TI_TASK($8)
168 173
169- /* See linux/kernel/timer.c sys_getppid for discussion 174- /* See linux/kernel/timer.c sys_getppid for discussion
170- about this loop. */ 175- about this loop. */
176- ldq $3, TASK_GROUP_LEADER($2)
171- ldq $3, TASK_REAL_PARENT($2) 177- ldq $4, TASK_REAL_PARENT($3)
178- ldl $0, TASK_TGID($2)
172-1: ldl $1, TASK_TGID($3) 179-1: ldl $1, TASK_TGID($4)
173-#ifdef CONFIG_SMP 180-#ifdef CONFIG_SMP
174- mov $3, $4 181- mov $4, $5
175- mb 182- mb
183- ldq $3, TASK_GROUP_LEADER($2)
176- ldq $3, TASK_REAL_PARENT($2) 184- ldq $4, TASK_REAL_PARENT($3)
177- cmpeq $3, $4, $4 185- cmpeq $4, $5, $5
178- beq $4, 1b 186- beq $5, 1b
179-#endif 187-#endif
180- stq $1, 80($sp) 188- stq $1, 80($sp)
181- ldl $0, TASK_TGID($2)
182+ lda $16, 96($sp) 189+ lda $16, 96($sp)
183+ jsr $26, do_getxpid 190+ jsr $26, do_getxpid
184+ ldq $26, 0($sp) 191+ ldq $26, 0($sp)
185+ 192+
186+ lda $sp, 16($sp) 193+ lda $sp, 16($sp)
187 ret 194 ret
188 .end sys_getxpid 195 .end sys_getxpid
189 196
190diff -NurpP --minimal linux-2.6.15.6/arch/alpha/kernel/ptrace.c linux-2.6.15.6-vs2.1.1-rc13/arch/alpha/kernel/ptrace.c 197Index: linux-2.6.16/arch/alpha/kernel/ptrace.c
191--- linux-2.6.15.6/arch/alpha/kernel/ptrace.c 2005-06-22 02:37:51 +0200 198===================================================================
192+++ linux-2.6.15.6-vs2.1.1-rc13/arch/alpha/kernel/ptrace.c 2006-02-14 10:29:09 +0100 199--- linux-2.6.16.orig/arch/alpha/kernel/ptrace.c
200+++ linux-2.6.16/arch/alpha/kernel/ptrace.c
193@@ -15,6 +15,7 @@ 201@@ -15,6 +15,7 @@
194 #include <linux/slab.h> 202 #include <linux/slab.h>
195 #include <linux/security.h> 203 #include <linux/security.h>
196 #include <linux/signal.h> 204 #include <linux/signal.h>
197+#include <linux/vs_pid.h> 205+#include <linux/vs_pid.h>
198 206
199 #include <asm/uaccess.h> 207 #include <asm/uaccess.h>
200 #include <asm/pgtable.h> 208 #include <asm/pgtable.h>
201@@ -289,6 +290,8 @@ do_sys_ptrace(long request, long pid, lo 209@@ -283,6 +284,11 @@ do_sys_ptrace(long request, long pid, lo
202 read_unlock(&tasklist_lock);
203 if (!child)
204 goto out_notsk; 210 goto out_notsk;
211 }
212
205+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT)) 213+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT)) {
214+ ret = -EPERM;
206+ goto out; 215+ goto out;
207 216+ }
217+
208 if (request == PTRACE_ATTACH) { 218 if (request == PTRACE_ATTACH) {
209 ret = ptrace_attach(child); 219 ret = ptrace_attach(child);
210diff -NurpP --minimal linux-2.6.15.6/arch/alpha/kernel/systbls.S linux-2.6.15.6-vs2.1.1-rc13/arch/alpha/kernel/systbls.S 220 goto out;
211--- linux-2.6.15.6/arch/alpha/kernel/systbls.S 2005-08-29 22:24:49 +0200 221Index: linux-2.6.16/arch/alpha/kernel/systbls.S
212+++ linux-2.6.15.6-vs2.1.1-rc13/arch/alpha/kernel/systbls.S 2006-01-04 21:59:59 +0100 222===================================================================
223--- linux-2.6.16.orig/arch/alpha/kernel/systbls.S
224+++ linux-2.6.16/arch/alpha/kernel/systbls.S
213@@ -447,7 +447,7 @@ sys_call_table: 225@@ -447,7 +447,7 @@ sys_call_table:
214 .quad sys_stat64 /* 425 */ 226 .quad sys_stat64 /* 425 */
215 .quad sys_lstat64 227 .quad sys_lstat64
216 .quad sys_fstat64 228 .quad sys_fstat64
217- .quad sys_ni_syscall /* sys_vserver */ 229- .quad sys_ni_syscall /* sys_vserver */
218+ .quad sys_vserver /* sys_vserver */ 230+ .quad sys_vserver /* sys_vserver */
219 .quad sys_ni_syscall /* sys_mbind */ 231 .quad sys_ni_syscall /* sys_mbind */
220 .quad sys_ni_syscall /* sys_get_mempolicy */ 232 .quad sys_ni_syscall /* sys_get_mempolicy */
221 .quad sys_ni_syscall /* sys_set_mempolicy */ 233 .quad sys_ni_syscall /* sys_set_mempolicy */
222diff -NurpP --minimal linux-2.6.15.6/arch/alpha/kernel/traps.c linux-2.6.15.6-vs2.1.1-rc13/arch/alpha/kernel/traps.c 234Index: linux-2.6.16/arch/alpha/kernel/traps.c
223--- linux-2.6.15.6/arch/alpha/kernel/traps.c 2005-10-28 20:49:08 +0200 235===================================================================
224+++ linux-2.6.15.6-vs2.1.1-rc13/arch/alpha/kernel/traps.c 2006-02-12 14:28:46 +0100 236--- linux-2.6.16.orig/arch/alpha/kernel/traps.c
237+++ linux-2.6.16/arch/alpha/kernel/traps.c
225@@ -183,7 +183,8 @@ die_if_kernel(char * str, struct pt_regs 238@@ -216,7 +216,8 @@ die_if_kernel(char * str, struct pt_regs
226 #ifdef CONFIG_SMP 239 #ifdef CONFIG_SMP
227 printk("CPU %d ", hard_smp_processor_id()); 240 printk("CPU %d ", hard_smp_processor_id());
228 #endif 241 #endif
229- printk("%s(%d): %s %ld\n", current->comm, current->pid, str, err); 242- printk("%s(%d): %s %ld\n", current->comm, current->pid, str, err);
230+ printk("%s(%d[#%u]): %s %ld\n", current->comm, 243+ printk("%s(%d[#%u]): %s %ld\n", current->comm,
231+ current->pid, current->xid, str, err); 244+ current->pid, current->xid, str, err);
232 dik_show_regs(regs, r9_15); 245 dik_show_regs(regs, r9_15);
233 dik_show_trace((unsigned long *)(regs+1)); 246 dik_show_trace((unsigned long *)(regs+1));
234 dik_show_code((unsigned int *)regs->pc); 247 dik_show_code((unsigned int *)regs->pc);
235diff -NurpP --minimal linux-2.6.15.6/arch/alpha/mm/init.c linux-2.6.15.6-vs2.1.1-rc13/arch/alpha/mm/init.c 248Index: linux-2.6.16/arch/alpha/mm/init.c
236--- linux-2.6.15.6/arch/alpha/mm/init.c 2005-03-02 12:38:18 +0100 249===================================================================
237+++ linux-2.6.15.6-vs2.1.1-rc13/arch/alpha/mm/init.c 2006-01-04 21:59:59 +0100 250--- linux-2.6.16.orig/arch/alpha/mm/init.c
251+++ linux-2.6.16/arch/alpha/mm/init.c
238@@ -20,6 +20,7 @@ 252@@ -21,6 +21,7 @@
239 #include <linux/init.h> 253 #include <linux/init.h>
240 #include <linux/bootmem.h> /* max_low_pfn */ 254 #include <linux/bootmem.h> /* max_low_pfn */
241 #include <linux/vmalloc.h> 255 #include <linux/vmalloc.h>
242+#include <linux/pagemap.h> 256+#include <linux/pagemap.h>
243 257
244 #include <asm/system.h> 258 #include <asm/system.h>
245 #include <asm/uaccess.h> 259 #include <asm/uaccess.h>
246diff -NurpP --minimal linux-2.6.15.6/arch/arm/Kconfig linux-2.6.15.6-vs2.1.1-rc13/arch/arm/Kconfig 260Index: linux-2.6.16/arch/arm/Kconfig
247--- linux-2.6.15.6/arch/arm/Kconfig 2006-01-03 17:29:06 +0100 261===================================================================
248+++ linux-2.6.15.6-vs2.1.1-rc13/arch/arm/Kconfig 2006-01-04 21:59:59 +0100 262--- linux-2.6.16.orig/arch/arm/Kconfig
263+++ linux-2.6.16/arch/arm/Kconfig
249@@ -756,6 +756,8 @@ source "arch/arm/oprofile/Kconfig" 264@@ -828,6 +828,8 @@ source "arch/arm/oprofile/Kconfig"
250 265
251 source "arch/arm/Kconfig.debug" 266 source "arch/arm/Kconfig.debug"
252 267
253+source "kernel/vserver/Kconfig" 268+source "kernel/vserver/Kconfig"
254+ 269+
255 source "security/Kconfig" 270 source "security/Kconfig"
256 271
257 source "crypto/Kconfig" 272 source "crypto/Kconfig"
258diff -NurpP --minimal linux-2.6.15.6/arch/arm/kernel/calls.S linux-2.6.15.6-vs2.1.1-rc13/arch/arm/kernel/calls.S 273Index: linux-2.6.16/arch/arm/kernel/calls.S
259--- linux-2.6.15.6/arch/arm/kernel/calls.S 2006-01-03 17:29:06 +0100 274===================================================================
260+++ linux-2.6.15.6-vs2.1.1-rc13/arch/arm/kernel/calls.S 2006-01-04 21:59:59 +0100 275--- linux-2.6.16.orig/arch/arm/kernel/calls.S
261@@ -327,7 +327,7 @@ __syscall_start: 276+++ linux-2.6.16/arch/arm/kernel/calls.S
277@@ -322,7 +322,7 @@
262 /* 310 */ .long sys_request_key 278 /* 310 */ CALL(sys_request_key)
263 .long sys_keyctl 279 CALL(sys_keyctl)
264 .long sys_semtimedop 280 CALL(ABI(sys_semtimedop, sys_oabi_semtimedop))
265-/* vserver */ .long sys_ni_syscall 281-/* vserver */ CALL(sys_ni_syscall)
266+ .long sys_vserver 282+ CALL(sys_vserver)
267 .long sys_ioprio_set 283 CALL(sys_ioprio_set)
268 /* 315 */ .long sys_ioprio_get 284 /* 315 */ CALL(sys_ioprio_get)
269 .long sys_inotify_init 285 CALL(sys_inotify_init)
270diff -NurpP --minimal linux-2.6.15.6/arch/arm/kernel/process.c linux-2.6.15.6-vs2.1.1-rc13/arch/arm/kernel/process.c 286Index: linux-2.6.16/arch/arm/kernel/process.c
271--- linux-2.6.15.6/arch/arm/kernel/process.c 2006-01-03 17:29:06 +0100 287===================================================================
272+++ linux-2.6.15.6-vs2.1.1-rc13/arch/arm/kernel/process.c 2006-02-12 14:28:46 +0100 288--- linux-2.6.16.orig/arch/arm/kernel/process.c
289+++ linux-2.6.16/arch/arm/kernel/process.c
273@@ -227,7 +227,8 @@ void __show_regs(struct pt_regs *regs) 290@@ -227,7 +227,8 @@ void __show_regs(struct pt_regs *regs)
274 void show_regs(struct pt_regs * regs) 291 void show_regs(struct pt_regs * regs)
275 { 292 {
276 printk("\n"); 293 printk("\n");
277- printk("Pid: %d, comm: %20s\n", current->pid, current->comm); 294- printk("Pid: %d, comm: %20s\n", current->pid, current->comm);
278+ printk("Pid: %d[#%u], comm: %20s\n", 295+ printk("Pid: %d[#%u], comm: %20s\n",
279+ current->pid, current->xid, current->comm); 296+ current->pid, current->xid, current->comm);
280 __show_regs(regs); 297 __show_regs(regs);
281 __backtrace(); 298 __backtrace();
282 } 299 }
283@@ -449,7 +450,8 @@ pid_t kernel_thread(int (*fn)(void *), v 300@@ -448,7 +449,8 @@ pid_t kernel_thread(int (*fn)(void *), v
284 regs.ARM_pc = (unsigned long)kernel_thread_helper; 301 regs.ARM_pc = (unsigned long)kernel_thread_helper;
285 regs.ARM_cpsr = SVC_MODE; 302 regs.ARM_cpsr = SVC_MODE;
286 303
287- return do_fork(flags|CLONE_VM|CLONE_UNTRACED, 0, &regs, 0, NULL, NULL); 304- return do_fork(flags|CLONE_VM|CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
288+ return do_fork(flags | CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD, 305+ return do_fork(flags | CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD,
289+ 0, &regs, 0, NULL, NULL); 306+ 0, &regs, 0, NULL, NULL);
290 } 307 }
291 EXPORT_SYMBOL(kernel_thread); 308 EXPORT_SYMBOL(kernel_thread);
292 309
293diff -NurpP --minimal linux-2.6.15.6/arch/arm26/Kconfig linux-2.6.15.6-vs2.1.1-rc13/arch/arm26/Kconfig 310Index: linux-2.6.16/arch/arm26/Kconfig
294--- linux-2.6.15.6/arch/arm26/Kconfig 2005-10-28 20:49:09 +0200 311===================================================================
295+++ linux-2.6.15.6-vs2.1.1-rc13/arch/arm26/Kconfig 2006-01-04 21:59:59 +0100 312--- linux-2.6.16.orig/arch/arm26/Kconfig
313+++ linux-2.6.16/arch/arm26/Kconfig
296@@ -232,6 +232,8 @@ source "drivers/usb/Kconfig" 314@@ -230,6 +230,8 @@ source "drivers/usb/Kconfig"
297 315
298 source "arch/arm26/Kconfig.debug" 316 source "arch/arm26/Kconfig.debug"
299 317
300+source "kernel/vserver/Kconfig" 318+source "kernel/vserver/Kconfig"
301+ 319+
302 source "security/Kconfig" 320 source "security/Kconfig"
303 321
304 source "crypto/Kconfig" 322 source "crypto/Kconfig"
305diff -NurpP --minimal linux-2.6.15.6/arch/arm26/kernel/calls.S linux-2.6.15.6-vs2.1.1-rc13/arch/arm26/kernel/calls.S 323Index: linux-2.6.16/arch/arm26/kernel/calls.S
306--- linux-2.6.15.6/arch/arm26/kernel/calls.S 2005-03-02 12:38:19 +0100 324===================================================================
307+++ linux-2.6.15.6-vs2.1.1-rc13/arch/arm26/kernel/calls.S 2006-01-04 21:59:59 +0100 325--- linux-2.6.16.orig/arch/arm26/kernel/calls.S
326+++ linux-2.6.16/arch/arm26/kernel/calls.S
308@@ -257,6 +257,11 @@ __syscall_start: 327@@ -257,6 +257,11 @@ __syscall_start:
309 .long sys_lremovexattr 328 .long sys_lremovexattr
310 .long sys_fremovexattr 329 .long sys_fremovexattr
311 .long sys_tkill 330 .long sys_tkill
312+ 331+
315+ .endr 334+ .endr
316+ .long sys_vserver /* 313 */ 335+ .long sys_vserver /* 313 */
317 __syscall_end: 336 __syscall_end:
318 337
319 .rept NR_syscalls - (__syscall_end - __syscall_start) / 4 338 .rept NR_syscalls - (__syscall_end - __syscall_start) / 4
320diff -NurpP --minimal linux-2.6.15.6/arch/arm26/kernel/process.c linux-2.6.15.6-vs2.1.1-rc13/arch/arm26/kernel/process.c 339Index: linux-2.6.16/arch/arm26/kernel/process.c
321--- linux-2.6.15.6/arch/arm26/kernel/process.c 2006-01-03 17:29:08 +0100 340===================================================================
322+++ linux-2.6.15.6-vs2.1.1-rc13/arch/arm26/kernel/process.c 2006-01-04 21:59:59 +0100 341--- linux-2.6.16.orig/arch/arm26/kernel/process.c
342+++ linux-2.6.16/arch/arm26/kernel/process.c
323@@ -367,7 +367,8 @@ pid_t kernel_thread(int (*fn)(void *), v 343@@ -366,7 +366,8 @@ pid_t kernel_thread(int (*fn)(void *), v
324 regs.ARM_r3 = (unsigned long)do_exit; 344 regs.ARM_r3 = (unsigned long)do_exit;
325 regs.ARM_pc = (unsigned long)kernel_thread_helper | MODE_SVC26; 345 regs.ARM_pc = (unsigned long)kernel_thread_helper | MODE_SVC26;
326 346
327- return do_fork(flags|CLONE_VM|CLONE_UNTRACED, 0, &regs, 0, NULL, NULL); 347- return do_fork(flags|CLONE_VM|CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
328+ return do_fork(flags | CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD, 348+ return do_fork(flags | CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD,
329+ 0, &regs, 0, NULL, NULL); 349+ 0, &regs, 0, NULL, NULL);
330 } 350 }
331 EXPORT_SYMBOL(kernel_thread); 351 EXPORT_SYMBOL(kernel_thread);
332 352
333diff -NurpP --minimal linux-2.6.15.6/arch/arm26/kernel/traps.c linux-2.6.15.6-vs2.1.1-rc13/arch/arm26/kernel/traps.c 353Index: linux-2.6.16/arch/arm26/kernel/traps.c
334--- linux-2.6.15.6/arch/arm26/kernel/traps.c 2005-03-02 12:38:19 +0100 354===================================================================
335+++ linux-2.6.15.6-vs2.1.1-rc13/arch/arm26/kernel/traps.c 2006-02-14 11:37:05 +0100 355--- linux-2.6.16.orig/arch/arm26/kernel/traps.c
356+++ linux-2.6.16/arch/arm26/kernel/traps.c
336@@ -186,8 +186,9 @@ NORET_TYPE void die(const char *str, str 357@@ -186,8 +186,9 @@ NORET_TYPE void die(const char *str, str
337 printk("Internal error: %s: %x\n", str, err); 358 printk("Internal error: %s: %x\n", str, err);
338 printk("CPU: %d\n", smp_processor_id()); 359 printk("CPU: %d\n", smp_processor_id());
339 show_regs(regs); 360 show_regs(regs);
340- printk("Process %s (pid: %d, stack limit = 0x%p)\n", 361- printk("Process %s (pid: %d, stack limit = 0x%p)\n",
341- current->comm, current->pid, tsk->thread_info + 1); 362- current->comm, current->pid, end_of_stack(tsk));
342+ printk("Process %s (pid: %d[#%u], stack limit = 0x%p)\n", 363+ printk("Process %s (pid: %d[#%u], stack limit = 0x%p)\n",
343+ current->comm, current->pid, 364+ current->comm, current->pid,
344+ current->xid, tsk->thread_info + 1); 365+ current->xid, end_of_stack(tsk));
345 366
346 if (!user_mode(regs) || in_interrupt()) { 367 if (!user_mode(regs) || in_interrupt()) {
347 __dump_stack(tsk, (unsigned long)(regs + 1)); 368 __dump_stack(tsk, (unsigned long)(regs + 1));
348diff -NurpP --minimal linux-2.6.15.6/arch/cris/Kconfig linux-2.6.15.6-vs2.1.1-rc13/arch/cris/Kconfig 369Index: linux-2.6.16/arch/cris/Kconfig
349--- linux-2.6.15.6/arch/cris/Kconfig 2005-08-29 22:24:51 +0200 370===================================================================
350+++ linux-2.6.15.6-vs2.1.1-rc13/arch/cris/Kconfig 2006-01-04 21:59:59 +0100 371--- linux-2.6.16.orig/arch/cris/Kconfig
372+++ linux-2.6.16/arch/cris/Kconfig
351@@ -177,6 +177,8 @@ source "drivers/usb/Kconfig" 373@@ -173,6 +173,8 @@ source "drivers/usb/Kconfig"
352 374
353 source "arch/cris/Kconfig.debug" 375 source "arch/cris/Kconfig.debug"
354 376
355+source "kernel/vserver/Kconfig" 377+source "kernel/vserver/Kconfig"
356+ 378+
357 source "security/Kconfig" 379 source "security/Kconfig"
358 380
359 source "crypto/Kconfig" 381 source "crypto/Kconfig"
360diff -NurpP --minimal linux-2.6.15.6/arch/cris/arch-v10/kernel/process.c linux-2.6.15.6-vs2.1.1-rc13/arch/cris/arch-v10/kernel/process.c 382Index: linux-2.6.16/arch/cris/arch-v10/kernel/process.c
383===================================================================
361--- linux-2.6.15.6/arch/cris/arch-v10/kernel/process.c 2005-08-29 22:24:51 +0200 384--- linux-2.6.16.orig/arch/cris/arch-v10/kernel/process.c
362+++ linux-2.6.15.6-vs2.1.1-rc13/arch/cris/arch-v10/kernel/process.c 2006-01-04 21:59:59 +0100 385+++ linux-2.6.16/arch/cris/arch-v10/kernel/process.c
363@@ -104,7 +104,8 @@ int kernel_thread(int (*fn)(void *), voi 386@@ -104,7 +104,8 @@ int kernel_thread(int (*fn)(void *), voi
364 regs.dccr = 1 << I_DCCR_BITNR; 387 regs.dccr = 1 << I_DCCR_BITNR;
365 388
366 /* Ok, create the new process.. */ 389 /* Ok, create the new process.. */
367- return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, NULL); 390- return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
368+ return do_fork(flags | CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD, 391+ return do_fork(flags | CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD,
369+ 0, &regs, 0, NULL, NULL); 392+ 0, &regs, 0, NULL, NULL);
370 } 393 }
371 394
372 /* setup the child's kernel stack with a pt_regs and switch_stack on it. 395 /* setup the child's kernel stack with a pt_regs and switch_stack on it.
373diff -NurpP --minimal linux-2.6.15.6/arch/cris/arch-v32/kernel/process.c linux-2.6.15.6-vs2.1.1-rc13/arch/cris/arch-v32/kernel/process.c 396Index: linux-2.6.16/arch/cris/arch-v32/kernel/process.c
397===================================================================
374--- linux-2.6.15.6/arch/cris/arch-v32/kernel/process.c 2005-08-29 22:24:51 +0200 398--- linux-2.6.16.orig/arch/cris/arch-v32/kernel/process.c
375+++ linux-2.6.15.6-vs2.1.1-rc13/arch/cris/arch-v32/kernel/process.c 2006-01-04 21:59:59 +0100 399+++ linux-2.6.16/arch/cris/arch-v32/kernel/process.c
376@@ -121,7 +121,8 @@ kernel_thread(int (*fn)(void *), void * 400@@ -121,7 +121,8 @@ kernel_thread(int (*fn)(void *), void *
377 regs.ccs = 1 << (I_CCS_BITNR + CCS_SHIFT); 401 regs.ccs = 1 << (I_CCS_BITNR + CCS_SHIFT);
378 402
379 /* Create the new process. */ 403 /* Create the new process. */
380- return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, NULL); 404- return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
381+ return do_fork(flags | CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD, 405+ return do_fork(flags | CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD,
382+ 0, &regs, 0, NULL, NULL); 406+ 0, &regs, 0, NULL, NULL);
383 } 407 }
384 408
385 /* 409 /*
386diff -NurpP --minimal linux-2.6.15.6/arch/frv/kernel/kernel_thread.S linux-2.6.15.6-vs2.1.1-rc13/arch/frv/kernel/kernel_thread.S 410Index: linux-2.6.16/arch/frv/kernel/kernel_thread.S
387--- linux-2.6.15.6/arch/frv/kernel/kernel_thread.S 2005-03-02 12:38:20 +0100 411===================================================================
388+++ linux-2.6.15.6-vs2.1.1-rc13/arch/frv/kernel/kernel_thread.S 2006-01-04 21:59:59 +0100 412--- linux-2.6.16.orig/arch/frv/kernel/kernel_thread.S
413+++ linux-2.6.16/arch/frv/kernel/kernel_thread.S
389@@ -13,6 +13,8 @@ 414@@ -13,6 +13,8 @@
390 #include <asm/unistd.h> 415 #include <asm/unistd.h>
391 416
392 #define CLONE_VM 0x00000100 /* set if VM shared between processes */ 417 #define CLONE_VM 0x00000100 /* set if VM shared between processes */
393+#define CLONE_KTHREAD 0x10000000 /* kernel thread */ 418+#define CLONE_KTHREAD 0x10000000 /* kernel thread */
402- ori gr10,#CLONE_VM,gr8 ; first syscall arg [clone_flags] 427- ori gr10,#CLONE_VM,gr8 ; first syscall arg [clone_flags]
403+ ori gr10,#CLONE_KT,gr8 ; first syscall arg [clone_flags] 428+ ori gr10,#CLONE_KT,gr8 ; first syscall arg [clone_flags]
404 sethi.p #0xe4e4,gr9 ; second syscall arg [newsp] 429 sethi.p #0xe4e4,gr9 ; second syscall arg [newsp]
405 setlo #0xe4e4,gr9 430 setlo #0xe4e4,gr9
406 setlos.p #0,gr10 ; third syscall arg [parent_tidptr] 431 setlos.p #0,gr10 ; third syscall arg [parent_tidptr]
407diff -NurpP --minimal linux-2.6.15.6/arch/frv/mm/mmu-context.c linux-2.6.15.6-vs2.1.1-rc13/arch/frv/mm/mmu-context.c 432Index: linux-2.6.16/arch/frv/mm/mmu-context.c
408--- linux-2.6.15.6/arch/frv/mm/mmu-context.c 2005-03-02 12:38:20 +0100 433===================================================================
409+++ linux-2.6.15.6-vs2.1.1-rc13/arch/frv/mm/mmu-context.c 2006-02-13 16:25:38 +0100 434--- linux-2.6.16.orig/arch/frv/mm/mmu-context.c
435+++ linux-2.6.16/arch/frv/mm/mmu-context.c
410@@ -11,6 +11,7 @@ 436@@ -11,6 +11,7 @@
411 437
412 #include <linux/sched.h> 438 #include <linux/sched.h>
413 #include <linux/mm.h> 439 #include <linux/mm.h>
414+#include <linux/vs_pid.h> 440+#include <linux/vs_pid.h>
415 #include <asm/tlbflush.h> 441 #include <asm/tlbflush.h>
416 442
417 #define NR_CXN 4096 443 #define NR_CXN 4096
418diff -NurpP --minimal linux-2.6.15.6/arch/h8300/Kconfig linux-2.6.15.6-vs2.1.1-rc13/arch/h8300/Kconfig 444Index: linux-2.6.16/arch/h8300/Kconfig
419--- linux-2.6.15.6/arch/h8300/Kconfig 2005-08-29 22:24:52 +0200 445===================================================================
420+++ linux-2.6.15.6-vs2.1.1-rc13/arch/h8300/Kconfig 2006-01-04 21:59:59 +0100 446--- linux-2.6.16.orig/arch/h8300/Kconfig
447+++ linux-2.6.16/arch/h8300/Kconfig
421@@ -191,6 +191,8 @@ source "fs/Kconfig" 448@@ -191,6 +191,8 @@ source "fs/Kconfig"
422 449
423 source "arch/h8300/Kconfig.debug" 450 source "arch/h8300/Kconfig.debug"
424 451
425+source "kernel/vserver/Kconfig" 452+source "kernel/vserver/Kconfig"
426+ 453+
427 source "security/Kconfig" 454 source "security/Kconfig"
428 455
429 source "crypto/Kconfig" 456 source "crypto/Kconfig"
430diff -NurpP --minimal linux-2.6.15.6/arch/h8300/kernel/process.c linux-2.6.15.6-vs2.1.1-rc13/arch/h8300/kernel/process.c 457Index: linux-2.6.16/arch/h8300/kernel/process.c
431--- linux-2.6.15.6/arch/h8300/kernel/process.c 2006-01-03 17:29:08 +0100 458===================================================================
432+++ linux-2.6.15.6-vs2.1.1-rc13/arch/h8300/kernel/process.c 2006-01-04 21:59:59 +0100 459--- linux-2.6.16.orig/arch/h8300/kernel/process.c
460+++ linux-2.6.16/arch/h8300/kernel/process.c
433@@ -132,7 +132,7 @@ int kernel_thread(int (*fn)(void *), voi 461@@ -135,7 +135,7 @@ int kernel_thread(int (*fn)(void *), voi
434 462
435 fs = get_fs(); 463 fs = get_fs();
436 set_fs (KERNEL_DS); 464 set_fs (KERNEL_DS);
437- clone_arg = flags | CLONE_VM; 465- clone_arg = flags | CLONE_VM;
438+ clone_arg = flags | CLONE_VM | CLONE_KTHREAD; 466+ clone_arg = flags | CLONE_VM | CLONE_KTHREAD;
439 __asm__("mov.l sp,er3\n\t" 467 __asm__("mov.l sp,er3\n\t"
440 "sub.l er2,er2\n\t" 468 "sub.l er2,er2\n\t"
441 "mov.l %2,er1\n\t" 469 "mov.l %2,er1\n\t"
442diff -NurpP --minimal linux-2.6.15.6/arch/i386/Kconfig linux-2.6.15.6-vs2.1.1-rc13/arch/i386/Kconfig 470Index: linux-2.6.16/arch/i386/Kconfig
443--- linux-2.6.15.6/arch/i386/Kconfig 2006-01-03 17:29:08 +0100 471===================================================================
444+++ linux-2.6.15.6-vs2.1.1-rc13/arch/i386/Kconfig 2006-01-04 21:59:59 +0100 472--- linux-2.6.16.orig/arch/i386/Kconfig
445@@ -448,6 +448,46 @@ config HIGHMEM64G 473+++ linux-2.6.16/arch/i386/Kconfig
474@@ -466,23 +466,43 @@ choice
475 will also likely make your kernel incompatible with binary-only
476 kernel modules.
446 477
478- If you are not absolutely sure what you are doing, leave this
479- option alone!
480-
481 config VMSPLIT_3G
482- bool "3G/1G user/kernel split"
483- config VMSPLIT_3G_OPT
484- bool "3G/1G user/kernel split (for full 1G low memory)"
485+ bool "3G/1G user/kernel split (Default)"
486+ help
487+ This is the default split of 3GB userspace to 1GB kernel
488+ space, which will result in about 860MB of lowmem.
489+
490+ config VMSPLIT_25G
491+ bool "2.5G/1.5G user/kernel split"
492+ help
493+ This split provides 2.5GB userspace and 1.5GB kernel
494+ space, which will result in about 1370MB of lowmem.
495+
496 config VMSPLIT_2G
497 bool "2G/2G user/kernel split"
498+ help
499+ This split provides 2GB userspace and 2GB kernel
500+ space, which will result in about 1880MB of lowmem.
501+
502+ config VMSPLIT_15G
503+ bool "1.5G/2.5G user/kernel split"
504+ help
505+ This split provides 1.5GB userspace and 2.5GB kernel
506+ space, which will result in about 2390MB of lowmem.
507+
508 config VMSPLIT_1G
509 bool "1G/3G user/kernel split"
510+ help
511+ This split provides 1GB userspace and 3GB kernel
512+ space, which will result in about 2900MB of lowmem.
513+
447 endchoice 514 endchoice
448 515
449+choice 516 config PAGE_OFFSET
450+ prompt "Memory Split User Space" 517 hex
451+ default SPLIT_3GB 518- default 0xB0000000 if VMSPLIT_3G_OPT
452+ help 519- default 0x78000000 if VMSPLIT_2G
453+ A different Userspace/Kernel split allows you to 520+ default 0xA0000000 if VMSPLIT_25G
454+ utilize up to alsmost 3GB of RAM without the requirement 521+ default 0x80000000 if VMSPLIT_2G
455+ for HIGHMEM. It also increases the available lowmem. 522+ default 0x60000000 if VMSPLIT_15G
456+ 523 default 0x40000000 if VMSPLIT_1G
457+config SPLIT_3GB 524 default 0xC0000000
458+ bool "3.0GB/1.0GB Kernel (Default)" 525
459+ help
460+ This is the default split of 3GB userspace to 1GB kernel
461+ space, which will result in about 860MB of lowmem.
462+
463+config SPLIT_25GB
464+ bool "2.5GB/1.5GB Kernel"
465+ help
466+ This split provides 2.5GB userspace and 1.5GB kernel
467+ space, which will result in about 1370MB of lowmem.
468+
469+config SPLIT_2GB
470+ bool "2.0GB/2.0GB Kernel"
471+ help
472+ This split provides 2GB userspace and 2GB kernel
473+ space, which will result in about 1880MB of lowmem.
474+
475+config SPLIT_15GB
476+ bool "1.5GB/2.5GB Kernel"
477+ help
478+ This split provides 1.5GB userspace and 2.5GB kernel
479+ space, which will result in about 2390MB of lowmem.
480+
481+config SPLIT_1GB
482+ bool "1.0GB/3.0GB Kernel"
483+ help
484+ This split provides 1GB userspace and 3GB kernel
485+ space, which will result in about 2900MB of lowmem.
486+
487+endchoice
488+
489 config HIGHMEM
490 bool
491 depends on HIGHMEM64G || HIGHMEM4G
492@@ -1014,6 +1054,8 @@ endmenu 526@@ -1071,6 +1091,8 @@ endmenu
493 527
494 source "arch/i386/Kconfig.debug" 528 source "arch/i386/Kconfig.debug"
495 529
496+source "kernel/vserver/Kconfig" 530+source "kernel/vserver/Kconfig"
497+ 531+
498 source "security/Kconfig" 532 source "security/Kconfig"
499 533
500 source "crypto/Kconfig" 534 source "crypto/Kconfig"
501diff -NurpP --minimal linux-2.6.15.6/arch/i386/boot/compressed/misc.c linux-2.6.15.6-vs2.1.1-rc13/arch/i386/boot/compressed/misc.c 535Index: linux-2.6.16/arch/i386/boot/compressed/misc.c
502--- linux-2.6.15.6/arch/i386/boot/compressed/misc.c 2005-08-29 22:24:52 +0200 536===================================================================
503+++ linux-2.6.15.6-vs2.1.1-rc13/arch/i386/boot/compressed/misc.c 2006-01-04 21:59:59 +0100 537--- linux-2.6.16.orig/arch/i386/boot/compressed/misc.c
538+++ linux-2.6.16/arch/i386/boot/compressed/misc.c
504@@ -309,7 +309,7 @@ static void setup_normal_output_buffer(v 539@@ -309,7 +309,7 @@ static void setup_normal_output_buffer(v
505 #else 540 #else
506 if ((RM_ALT_MEM_K > RM_EXT_MEM_K ? RM_ALT_MEM_K : RM_EXT_MEM_K) < 1024) error("Less than 2MB of memory"); 541 if ((RM_ALT_MEM_K > RM_EXT_MEM_K ? RM_ALT_MEM_K : RM_EXT_MEM_K) < 1024) error("Less than 2MB of memory");
507 #endif 542 #endif
508- output_data = (char *)__PHYSICAL_START; /* Normally Points to 1M */ 543- output_data = (char *)__PHYSICAL_START; /* Normally Points to 1M */
519+ if ((PHYSICAL_START + low_buffer_size) > ((ulg)high_buffer_start)) { 554+ if ((PHYSICAL_START + low_buffer_size) > ((ulg)high_buffer_start)) {
520+ high_buffer_start = (uch *)(PHYSICAL_START + low_buffer_size); 555+ high_buffer_start = (uch *)(PHYSICAL_START + low_buffer_size);
521 mv->hcount = 0; /* say: we need not to move high_buffer */ 556 mv->hcount = 0; /* say: we need not to move high_buffer */
522 } 557 }
523 else mv->hcount = -1; 558 else mv->hcount = -1;
524diff -NurpP --minimal linux-2.6.15.6/arch/i386/kernel/process.c linux-2.6.15.6-vs2.1.1-rc13/arch/i386/kernel/process.c 559Index: linux-2.6.16/arch/i386/kernel/process.c
525--- linux-2.6.15.6/arch/i386/kernel/process.c 2006-01-03 17:29:09 +0100 560===================================================================
526+++ linux-2.6.15.6-vs2.1.1-rc13/arch/i386/kernel/process.c 2006-02-12 14:28:46 +0100 561--- linux-2.6.16.orig/arch/i386/kernel/process.c
562+++ linux-2.6.16/arch/i386/kernel/process.c
527@@ -290,8 +290,10 @@ void show_regs(struct pt_regs * regs) 563@@ -291,8 +291,10 @@ void show_regs(struct pt_regs * regs)
528 unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L; 564 unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L;
529 565
530 printk("\n"); 566 printk("\n");
531- printk("Pid: %d, comm: %20s\n", current->pid, current->comm); 567- printk("Pid: %d, comm: %20s\n", current->pid, current->comm);
532- printk("EIP: %04x:[<%08lx>] CPU: %d\n",0xffff & regs->xcs,regs->eip, smp_processor_id()); 568- printk("EIP: %04x:[<%08lx>] CPU: %d\n",0xffff & regs->xcs,regs->eip, smp_processor_id());
535+ printk("EIP: %04x:[<%08lx>] CPU: %d\n", 571+ printk("EIP: %04x:[<%08lx>] CPU: %d\n",
536+ 0xffff & regs->xcs,regs->eip, smp_processor_id()); 572+ 0xffff & regs->xcs,regs->eip, smp_processor_id());
537 print_symbol("EIP is at %s\n", regs->eip); 573 print_symbol("EIP is at %s\n", regs->eip);
538 574
539 if (user_mode(regs)) 575 if (user_mode(regs))
540@@ -351,7 +353,8 @@ int kernel_thread(int (*fn)(void *), voi 576@@ -352,7 +354,8 @@ int kernel_thread(int (*fn)(void *), voi
541 regs.eflags = X86_EFLAGS_IF | X86_EFLAGS_SF | X86_EFLAGS_PF | 0x2; 577 regs.eflags = X86_EFLAGS_IF | X86_EFLAGS_SF | X86_EFLAGS_PF | 0x2;
542 578
543 /* Ok, create the new process.. */ 579 /* Ok, create the new process.. */
544- return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, NULL); 580- return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
545+ return do_fork(flags | CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD, 581+ return do_fork(flags | CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD,
546+ 0, &regs, 0, NULL, NULL); 582+ 0, &regs, 0, NULL, NULL);
547 } 583 }
548 EXPORT_SYMBOL(kernel_thread); 584 EXPORT_SYMBOL(kernel_thread);
549 585
550diff -NurpP --minimal linux-2.6.15.6/arch/i386/kernel/setup.c linux-2.6.15.6-vs2.1.1-rc13/arch/i386/kernel/setup.c 586Index: linux-2.6.16/arch/i386/kernel/setup.c
551--- linux-2.6.15.6/arch/i386/kernel/setup.c 2006-01-03 17:29:09 +0100 587===================================================================
552+++ linux-2.6.15.6-vs2.1.1-rc13/arch/i386/kernel/setup.c 2006-01-04 21:59:59 +0100 588--- linux-2.6.16.orig/arch/i386/kernel/setup.c
589+++ linux-2.6.16/arch/i386/kernel/setup.c
553@@ -1184,8 +1184,8 @@ void __init setup_bootmem_allocator(void 590@@ -1192,8 +1192,8 @@ void __init setup_bootmem_allocator(void
554 * the (very unlikely) case of us accidentally initializing the 591 * the (very unlikely) case of us accidentally initializing the
555 * bootmem allocator with an invalid RAM area. 592 * bootmem allocator with an invalid RAM area.
556 */ 593 */
557- reserve_bootmem(__PHYSICAL_START, (PFN_PHYS(min_low_pfn) + 594- reserve_bootmem(__PHYSICAL_START, (PFN_PHYS(min_low_pfn) +
558- bootmap_size + PAGE_SIZE-1) - (__PHYSICAL_START)); 595- bootmap_size + PAGE_SIZE-1) - (__PHYSICAL_START));
559+ reserve_bootmem(PHYSICAL_START, (PFN_PHYS(min_low_pfn) + 596+ reserve_bootmem(PHYSICAL_START, (PFN_PHYS(min_low_pfn) +
560+ bootmap_size + PAGE_SIZE-1) - (PHYSICAL_START)); 597+ bootmap_size + PAGE_SIZE-1) - (PHYSICAL_START));
561 598
562 /* 599 /*
563 * reserve physical page 0 - it's a special BIOS page on many boxes, 600 * reserve physical page 0 - it's a special BIOS page on many boxes,
564diff -NurpP --minimal linux-2.6.15.6/arch/i386/kernel/sys_i386.c linux-2.6.15.6-vs2.1.1-rc13/arch/i386/kernel/sys_i386.c 601Index: linux-2.6.16/arch/i386/kernel/sys_i386.c
565--- linux-2.6.15.6/arch/i386/kernel/sys_i386.c 2004-08-14 12:56:23 +0200 602===================================================================
566+++ linux-2.6.15.6-vs2.1.1-rc13/arch/i386/kernel/sys_i386.c 2006-01-04 21:59:59 +0100 603--- linux-2.6.16.orig/arch/i386/kernel/sys_i386.c
604+++ linux-2.6.16/arch/i386/kernel/sys_i386.c
567@@ -19,6 +19,7 @@ 605@@ -19,6 +19,7 @@
568 #include <linux/mman.h> 606 #include <linux/mman.h>
569 #include <linux/file.h> 607 #include <linux/file.h>
570 #include <linux/utsname.h> 608 #include <linux/utsname.h>
571+#include <linux/vs_cvirt.h> 609+#include <linux/vs_cvirt.h>
609- error |= __copy_to_user(&name->machine,&system_utsname.machine,__OLD_UTS_LEN); 647- error |= __copy_to_user(&name->machine,&system_utsname.machine,__OLD_UTS_LEN);
610+ error |= __copy_to_user(&name->machine,ptr->machine,__OLD_UTS_LEN); 648+ error |= __copy_to_user(&name->machine,ptr->machine,__OLD_UTS_LEN);
611 error |= __put_user(0,name->machine+__OLD_UTS_LEN); 649 error |= __put_user(0,name->machine+__OLD_UTS_LEN);
612 650
613 up_read(&uts_sem); 651 up_read(&uts_sem);
614diff -NurpP --minimal linux-2.6.15.6/arch/i386/kernel/syscall_table.S linux-2.6.15.6-vs2.1.1-rc13/arch/i386/kernel/syscall_table.S 652Index: linux-2.6.16/arch/i386/kernel/syscall_table.S
615--- linux-2.6.15.6/arch/i386/kernel/syscall_table.S 2005-08-29 22:24:52 +0200 653===================================================================
616+++ linux-2.6.15.6-vs2.1.1-rc13/arch/i386/kernel/syscall_table.S 2006-01-04 21:59:59 +0100 654--- linux-2.6.16.orig/arch/i386/kernel/syscall_table.S
655+++ linux-2.6.16/arch/i386/kernel/syscall_table.S
617@@ -273,7 +273,7 @@ ENTRY(sys_call_table) 656@@ -272,7 +272,7 @@ ENTRY(sys_call_table)
618 .long sys_tgkill /* 270 */ 657 .long sys_tgkill /* 270 */
619 .long sys_utimes 658 .long sys_utimes
620 .long sys_fadvise64_64 659 .long sys_fadvise64_64
621- .long sys_ni_syscall /* sys_vserver */ 660- .long sys_ni_syscall /* sys_vserver */
622+ .long sys_vserver 661+ .long sys_vserver
623 .long sys_mbind 662 .long sys_mbind
624 .long sys_get_mempolicy 663 .long sys_get_mempolicy
625 .long sys_set_mempolicy 664 .long sys_set_mempolicy
626diff -NurpP --minimal linux-2.6.15.6/arch/i386/kernel/traps.c linux-2.6.15.6-vs2.1.1-rc13/arch/i386/kernel/traps.c 665Index: linux-2.6.16/arch/i386/kernel/traps.c
627--- linux-2.6.15.6/arch/i386/kernel/traps.c 2006-01-03 17:29:09 +0100 666===================================================================
628+++ linux-2.6.15.6-vs2.1.1-rc13/arch/i386/kernel/traps.c 2006-02-14 11:37:05 +0100 667--- linux-2.6.16.orig/arch/i386/kernel/traps.c
668+++ linux-2.6.16/arch/i386/kernel/traps.c
629@@ -53,6 +53,7 @@ 669@@ -53,6 +53,7 @@
630 #include <asm/kdebug.h> 670 #include <asm/kdebug.h>
631 671
632 #include <linux/module.h> 672 #include <linux/module.h>
633+#include <linux/vserver/debug.h> 673+#include <linux/vserver/debug.h>
634 674
635 #include "mach_traps.h" 675 #include "mach_traps.h"
636 676
637@@ -227,8 +228,9 @@ void show_registers(struct pt_regs *regs 677@@ -252,8 +253,9 @@ void show_registers(struct pt_regs *regs
638 regs->esi, regs->edi, regs->ebp, esp); 678 regs->esi, regs->edi, regs->ebp, esp);
639 printk("ds: %04x es: %04x ss: %04x\n", 679 printk(KERN_EMERG "ds: %04x es: %04x ss: %04x\n",
640 regs->xds & 0xffff, regs->xes & 0xffff, ss); 680 regs->xds & 0xffff, regs->xes & 0xffff, ss);
641- printk("Process %s (pid: %d, threadinfo=%p task=%p)", 681- printk(KERN_EMERG "Process %s (pid: %d, threadinfo=%p task=%p)",
642- current->comm, current->pid, current_thread_info(), current); 682- current->comm, current->pid, current_thread_info(), current);
643+ printk("Process %s (pid: %d[#%u], threadinfo=%p task=%p)", 683+ printk(KERN_EMERG "Process %s (pid: %d[#%u], threadinfo=%p task=%p)",
644+ current->comm, current->pid, current->xid, 684+ current->comm, current->pid, current->xid,
645+ current_thread_info(), current); 685+ current_thread_info(), current);
646 /* 686 /*
647 * When in-kernel, we also print out the stack and code at the 687 * When in-kernel, we also print out the stack and code at the
648 * time of the fault.. 688 * time of the fault..
649@@ -307,6 +309,8 @@ void die(const char * str, struct pt_reg 689@@ -333,6 +335,8 @@ void die(const char * str, struct pt_reg
650 };
651 static int die_counter; 690 static int die_counter;
691 unsigned long flags;
652 692
653+ vxh_throw_oops(); 693+ vxh_throw_oops();
654+ 694+
655 if (die.lock_owner != raw_smp_processor_id()) { 695 if (die.lock_owner != raw_smp_processor_id()) {
656 console_verbose(); 696 console_verbose();
657 spin_lock_irq(&die.lock); 697 spin_lock_irqsave(&die.lock, flags);
658@@ -333,8 +337,9 @@ void die(const char * str, struct pt_reg 698@@ -365,8 +369,9 @@ void die(const char * str, struct pt_reg
659 #endif 699 #endif
660 if (nl) 700 if (nl)
661 printk("\n"); 701 printk("\n");
662- notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV); 702- notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV);
663+ notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV); 703+ notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV);
664 show_registers(regs); 704 show_registers(regs);
665+ vxh_dump_history(); 705+ vxh_dump_history();
666 } else 706 } else
667 printk(KERN_ERR "Recursive die() failure, output suppressed\n"); 707 printk(KERN_EMERG "Recursive die() failure, output suppressed\n");
668 708
669diff -NurpP --minimal linux-2.6.15.6/arch/ia64/Kconfig linux-2.6.15.6-vs2.1.1-rc13/arch/ia64/Kconfig 709Index: linux-2.6.16/arch/ia64/Kconfig
670--- linux-2.6.15.6/arch/ia64/Kconfig 2006-01-03 17:29:09 +0100 710===================================================================
671+++ linux-2.6.15.6-vs2.1.1-rc13/arch/ia64/Kconfig 2006-01-04 21:59:59 +0100 711--- linux-2.6.16.orig/arch/ia64/Kconfig
712+++ linux-2.6.16/arch/ia64/Kconfig
672@@ -461,6 +461,8 @@ endmenu 713@@ -464,6 +464,8 @@ endmenu
673 714
674 source "arch/ia64/Kconfig.debug" 715 source "arch/ia64/Kconfig.debug"
675 716
676+source "kernel/vserver/Kconfig" 717+source "kernel/vserver/Kconfig"
677+ 718+
678 source "security/Kconfig" 719 source "security/Kconfig"
679 720
680 source "crypto/Kconfig" 721 source "crypto/Kconfig"
681diff -NurpP --minimal linux-2.6.15.6/arch/ia64/ia32/binfmt_elf32.c linux-2.6.15.6-vs2.1.1-rc13/arch/ia64/ia32/binfmt_elf32.c 722Index: linux-2.6.16/arch/ia64/ia32/binfmt_elf32.c
682--- linux-2.6.15.6/arch/ia64/ia32/binfmt_elf32.c 2006-01-03 17:29:09 +0100 723===================================================================
683+++ linux-2.6.15.6-vs2.1.1-rc13/arch/ia64/ia32/binfmt_elf32.c 2006-02-28 14:53:18 +0100 724--- linux-2.6.16.orig/arch/ia64/ia32/binfmt_elf32.c
725+++ linux-2.6.16/arch/ia64/ia32/binfmt_elf32.c
684@@ -236,7 +236,8 @@ ia32_setup_arg_pages (struct linux_binpr 726@@ -236,7 +236,8 @@ ia32_setup_arg_pages (struct linux_binpr
685 kmem_cache_free(vm_area_cachep, mpnt); 727 kmem_cache_free(vm_area_cachep, mpnt);
686 return ret; 728 return ret;
687 } 729 }
688- current->mm->stack_vm = current->mm->total_vm = vma_pages(mpnt); 730- current->mm->stack_vm = current->mm->total_vm = vma_pages(mpnt);
689+ vx_vmpages_sub(current->mm, current->mm->total_vm - vma_pages(mpnt)); 731+ vx_vmpages_sub(current->mm, current->mm->total_vm - vma_pages(mpnt));
690+ current->mm->stack_vm = current->mm->total_vm; 732+ current->mm->stack_vm = current->mm->total_vm;
691 } 733 }
692 734
693 for (i = 0 ; i < MAX_ARG_PAGES ; i++) { 735 for (i = 0 ; i < MAX_ARG_PAGES ; i++) {
694diff -NurpP --minimal linux-2.6.15.6/arch/ia64/ia32/ia32_entry.S linux-2.6.15.6-vs2.1.1-rc13/arch/ia64/ia32/ia32_entry.S 736Index: linux-2.6.16/arch/ia64/ia32/ia32_entry.S
695--- linux-2.6.15.6/arch/ia64/ia32/ia32_entry.S 2005-10-28 20:49:10 +0200 737===================================================================
696+++ linux-2.6.15.6-vs2.1.1-rc13/arch/ia64/ia32/ia32_entry.S 2006-01-04 21:59:59 +0100 738--- linux-2.6.16.orig/arch/ia64/ia32/ia32_entry.S
739+++ linux-2.6.16/arch/ia64/ia32/ia32_entry.S
697@@ -483,7 +483,7 @@ ia32_syscall_table: 740@@ -483,7 +483,7 @@ ia32_syscall_table:
698 data8 sys_tgkill /* 270 */ 741 data8 sys_tgkill /* 270 */
699 data8 compat_sys_utimes 742 data8 compat_sys_utimes
700 data8 sys32_fadvise64_64 743 data8 sys32_fadvise64_64
701- data8 sys_ni_syscall 744- data8 sys_ni_syscall
702+ data8 sys32_vserver 745+ data8 sys32_vserver
703 data8 sys_ni_syscall 746 data8 sys_ni_syscall
704 data8 sys_ni_syscall /* 275 */ 747 data8 sys_ni_syscall /* 275 */
705 data8 sys_ni_syscall 748 data8 sys_ni_syscall
706diff -NurpP --minimal linux-2.6.15.6/arch/ia64/ia32/sys_ia32.c linux-2.6.15.6-vs2.1.1-rc13/arch/ia64/ia32/sys_ia32.c 749Index: linux-2.6.16/arch/ia64/ia32/sys_ia32.c
707--- linux-2.6.15.6/arch/ia64/ia32/sys_ia32.c 2006-01-03 17:29:09 +0100 750===================================================================
708+++ linux-2.6.15.6-vs2.1.1-rc13/arch/ia64/ia32/sys_ia32.c 2006-02-14 10:30:02 +0100 751--- linux-2.6.16.orig/arch/ia64/ia32/sys_ia32.c
752+++ linux-2.6.16/arch/ia64/ia32/sys_ia32.c
709@@ -51,6 +51,7 @@ 753@@ -52,6 +52,7 @@
710 #include <linux/compat.h> 754 #include <linux/compat.h>
711 #include <linux/vfs.h> 755 #include <linux/vfs.h>
712 #include <linux/mman.h> 756 #include <linux/mman.h>
713+#include <linux/vs_pid.h> 757+#include <linux/vs_pid.h>
758 #include <linux/mutex.h>
714 759
715 #include <asm/intrinsics.h> 760 #include <asm/intrinsics.h>
716 #include <asm/semaphore.h> 761Index: linux-2.6.16/arch/ia64/kernel/asm-offsets.c
717diff -NurpP --minimal linux-2.6.15.6/arch/ia64/kernel/asm-offsets.c linux-2.6.15.6-vs2.1.1-rc13/arch/ia64/kernel/asm-offsets.c 762===================================================================
718--- linux-2.6.15.6/arch/ia64/kernel/asm-offsets.c 2005-10-28 20:49:10 +0200 763--- linux-2.6.16.orig/arch/ia64/kernel/asm-offsets.c
719+++ linux-2.6.15.6-vs2.1.1-rc13/arch/ia64/kernel/asm-offsets.c 2006-01-04 21:59:59 +0100 764+++ linux-2.6.16/arch/ia64/kernel/asm-offsets.c
720@@ -192,6 +192,7 @@ void foo(void) 765@@ -192,6 +192,7 @@ void foo(void)
721 /* for assembly files which can't include sched.h: */ 766 /* for assembly files which can't include sched.h: */
722 DEFINE(IA64_CLONE_VFORK, CLONE_VFORK); 767 DEFINE(IA64_CLONE_VFORK, CLONE_VFORK);
723 DEFINE(IA64_CLONE_VM, CLONE_VM); 768 DEFINE(IA64_CLONE_VM, CLONE_VM);
724+ DEFINE(IA64_CLONE_KTHREAD, CLONE_KTHREAD); 769+ DEFINE(IA64_CLONE_KTHREAD, CLONE_KTHREAD);
725 770
726 BLANK(); 771 BLANK();
727 DEFINE(IA64_CPUINFO_NSEC_PER_CYC_OFFSET, 772 DEFINE(IA64_CPUINFO_NSEC_PER_CYC_OFFSET,
728diff -NurpP --minimal linux-2.6.15.6/arch/ia64/kernel/entry.S linux-2.6.15.6-vs2.1.1-rc13/arch/ia64/kernel/entry.S 773Index: linux-2.6.16/arch/ia64/kernel/entry.S
729--- linux-2.6.15.6/arch/ia64/kernel/entry.S 2005-10-28 20:49:10 +0200 774===================================================================
730+++ linux-2.6.15.6-vs2.1.1-rc13/arch/ia64/kernel/entry.S 2006-01-04 21:59:59 +0100 775--- linux-2.6.16.orig/arch/ia64/kernel/entry.S
776+++ linux-2.6.16/arch/ia64/kernel/entry.S
731@@ -1589,7 +1589,7 @@ sys_call_table: 777@@ -1591,7 +1591,7 @@ sys_call_table:
732 data8 sys_mq_notify 778 data8 sys_mq_notify
733 data8 sys_mq_getsetattr 779 data8 sys_mq_getsetattr
734 data8 sys_ni_syscall // reserved for kexec_load 780 data8 sys_ni_syscall // reserved for kexec_load
735- data8 sys_ni_syscall // reserved for vserver 781- data8 sys_ni_syscall // reserved for vserver
736+ data8 sys_vserver 782+ data8 sys_vserver
737 data8 sys_waitid // 1270 783 data8 sys_waitid // 1270
738 data8 sys_add_key 784 data8 sys_add_key
739 data8 sys_request_key 785 data8 sys_request_key
740diff -NurpP --minimal linux-2.6.15.6/arch/ia64/kernel/perfmon.c linux-2.6.15.6-vs2.1.1-rc13/arch/ia64/kernel/perfmon.c 786Index: linux-2.6.16/arch/ia64/kernel/perfmon.c
741--- linux-2.6.15.6/arch/ia64/kernel/perfmon.c 2006-01-03 17:29:09 +0100 787===================================================================
742+++ linux-2.6.15.6-vs2.1.1-rc13/arch/ia64/kernel/perfmon.c 2006-02-13 16:25:38 +0100 788--- linux-2.6.16.orig/arch/ia64/kernel/perfmon.c
789+++ linux-2.6.16/arch/ia64/kernel/perfmon.c
743@@ -39,6 +39,8 @@ 790@@ -41,6 +41,8 @@
744 #include <linux/mount.h>
745 #include <linux/bitops.h> 791 #include <linux/capability.h>
746 #include <linux/rcupdate.h> 792 #include <linux/rcupdate.h>
793 #include <linux/completion.h>
747+#include <linux/vs_memory.h> 794+#include <linux/vs_memory.h>
748+#include <linux/vs_pid.h> 795+#include <linux/vs_pid.h>
749 796
750 #include <asm/errno.h> 797 #include <asm/errno.h>
751 #include <asm/intrinsics.h> 798 #include <asm/intrinsics.h>
752@@ -2351,7 +2353,7 @@ pfm_smpl_buffer_alloc(struct task_struct 799@@ -2355,7 +2357,7 @@ pfm_smpl_buffer_alloc(struct task_struct
753 */ 800 */
754 insert_vm_struct(mm, vma); 801 insert_vm_struct(mm, vma);
755 802
756- mm->total_vm += size >> PAGE_SHIFT; 803- mm->total_vm += size >> PAGE_SHIFT;
757+ vx_vmpages_add(mm, size >> PAGE_SHIFT); 804+ vx_vmpages_add(mm, size >> PAGE_SHIFT);
758 vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file, 805 vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file,
759 vma_pages(vma)); 806 vma_pages(vma));
760 up_write(&task->mm->mmap_sem); 807 up_write(&task->mm->mmap_sem);
761diff -NurpP --minimal linux-2.6.15.6/arch/ia64/kernel/process.c linux-2.6.15.6-vs2.1.1-rc13/arch/ia64/kernel/process.c 808Index: linux-2.6.16/arch/ia64/kernel/process.c
762--- linux-2.6.15.6/arch/ia64/kernel/process.c 2006-01-03 17:29:09 +0100 809===================================================================
763+++ linux-2.6.15.6-vs2.1.1-rc13/arch/ia64/kernel/process.c 2006-02-12 14:28:46 +0100 810--- linux-2.6.16.orig/arch/ia64/kernel/process.c
811+++ linux-2.6.16/arch/ia64/kernel/process.c
764@@ -109,7 +109,8 @@ show_regs (struct pt_regs *regs) 812@@ -109,7 +109,8 @@ show_regs (struct pt_regs *regs)
765 unsigned long ip = regs->cr_iip + ia64_psr(regs)->ri; 813 unsigned long ip = regs->cr_iip + ia64_psr(regs)->ri;
766 814
767 print_modules(); 815 print_modules();
768- printk("\nPid: %d, CPU %d, comm: %20s\n", current->pid, smp_processor_id(), current->comm); 816- printk("\nPid: %d, CPU %d, comm: %20s\n", current->pid, smp_processor_id(), current->comm);
779+ return do_fork(flags | CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD, 827+ return do_fork(flags | CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD,
780+ 0, &regs.pt, 0, NULL, NULL); 828+ 0, &regs.pt, 0, NULL, NULL);
781 } 829 }
782 EXPORT_SYMBOL(kernel_thread); 830 EXPORT_SYMBOL(kernel_thread);
783 831
784diff -NurpP --minimal linux-2.6.15.6/arch/ia64/kernel/ptrace.c linux-2.6.15.6-vs2.1.1-rc13/arch/ia64/kernel/ptrace.c 832Index: linux-2.6.16/arch/ia64/kernel/ptrace.c
785--- linux-2.6.15.6/arch/ia64/kernel/ptrace.c 2006-01-03 17:29:09 +0100 833===================================================================
786+++ linux-2.6.15.6-vs2.1.1-rc13/arch/ia64/kernel/ptrace.c 2006-02-13 16:25:38 +0100 834--- linux-2.6.16.orig/arch/ia64/kernel/ptrace.c
835+++ linux-2.6.16/arch/ia64/kernel/ptrace.c
787@@ -18,6 +18,7 @@ 836@@ -18,6 +18,7 @@
788 #include <linux/security.h> 837 #include <linux/security.h>
789 #include <linux/audit.h> 838 #include <linux/audit.h>
790 #include <linux/signal.h> 839 #include <linux/signal.h>
791+#include <linux/vs_pid.h> 840+#include <linux/vs_pid.h>
792 841
793 #include <asm/pgtable.h> 842 #include <asm/pgtable.h>
794 #include <asm/processor.h> 843 #include <asm/processor.h>
795@@ -1450,6 +1451,9 @@ sys_ptrace (long request, pid_t pid, uns 844@@ -1443,6 +1444,9 @@ sys_ptrace (long request, pid_t pid, uns
796 read_unlock(&tasklist_lock); 845 read_unlock(&tasklist_lock);
797 if (!child) 846 if (!child)
798 goto out; 847 goto out;
799+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT)) 848+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT))
800+ goto out_tsk; 849+ goto out_tsk;
801+ 850+
802 ret = -EPERM; 851 ret = -EPERM;
803 if (pid == 1) /* no messing around with init! */ 852 if (pid == 1) /* no messing around with init! */
804 goto out_tsk; 853 goto out_tsk;
805diff -NurpP --minimal linux-2.6.15.6/arch/ia64/kernel/signal.c linux-2.6.15.6-vs2.1.1-rc13/arch/ia64/kernel/signal.c 854Index: linux-2.6.16/arch/ia64/kernel/signal.c
806--- linux-2.6.15.6/arch/ia64/kernel/signal.c 2006-01-03 17:29:09 +0100 855===================================================================
807+++ linux-2.6.15.6-vs2.1.1-rc13/arch/ia64/kernel/signal.c 2006-02-13 16:25:38 +0100 856--- linux-2.6.16.orig/arch/ia64/kernel/signal.c
857+++ linux-2.6.16/arch/ia64/kernel/signal.c
808@@ -21,6 +21,7 @@ 858@@ -21,6 +21,7 @@
809 #include <linux/binfmts.h> 859 #include <linux/binfmts.h>
810 #include <linux/unistd.h> 860 #include <linux/unistd.h>
811 #include <linux/wait.h> 861 #include <linux/wait.h>
812+#include <linux/vs_pid.h> 862+#include <linux/vs_pid.h>
813 863
814 #include <asm/ia32.h> 864 #include <asm/ia32.h>
815 #include <asm/intrinsics.h> 865 #include <asm/intrinsics.h>
816diff -NurpP --minimal linux-2.6.15.6/arch/ia64/kernel/traps.c linux-2.6.15.6-vs2.1.1-rc13/arch/ia64/kernel/traps.c 866Index: linux-2.6.16/arch/ia64/kernel/traps.c
817--- linux-2.6.15.6/arch/ia64/kernel/traps.c 2006-01-03 17:29:09 +0100 867===================================================================
818+++ linux-2.6.15.6-vs2.1.1-rc13/arch/ia64/kernel/traps.c 2006-02-12 14:28:46 +0100 868--- linux-2.6.16.orig/arch/ia64/kernel/traps.c
869+++ linux-2.6.16/arch/ia64/kernel/traps.c
819@@ -106,8 +106,9 @@ die (const char *str, struct pt_regs *re 870@@ -107,8 +107,9 @@ die (const char *str, struct pt_regs *re
820 put_cpu(); 871 put_cpu();
821 872
822 if (++die.lock_owner_depth < 3) { 873 if (++die.lock_owner_depth < 3) {
823- printk("%s[%d]: %s %ld [%d]\n", 874- printk("%s[%d]: %s %ld [%d]\n",
824- current->comm, current->pid, str, err, ++die_counter); 875- current->comm, current->pid, str, err, ++die_counter);
826+ current->comm, current->pid, current->xid, 877+ current->comm, current->pid, current->xid,
827+ str, err, ++die_counter); 878+ str, err, ++die_counter);
828 (void) notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV); 879 (void) notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV);
829 show_regs(regs); 880 show_regs(regs);
830 } else 881 } else
831@@ -327,8 +328,9 @@ handle_fpu_swa (int fp_fault, struct pt_ 882@@ -335,8 +336,9 @@ handle_fpu_swa (int fp_fault, struct pt_
832 last_time = jiffies; 883 last_time = jiffies;
833 ++fpu_swa_count; 884 ++fpu_swa_count;
834 printk(KERN_WARNING 885 printk(KERN_WARNING
835- "%s(%d): floating-point assist fault at ip %016lx, isr %016lx\n", 886- "%s(%d): floating-point assist fault at ip %016lx, isr %016lx\n",
836- current->comm, current->pid, regs->cr_iip + ia64_psr(regs)->ri, isr); 887- current->comm, current->pid, regs->cr_iip + ia64_psr(regs)->ri, isr);
838+ current->comm, current->pid, current->xid, 889+ current->comm, current->pid, current->xid,
839+ regs->cr_iip + ia64_psr(regs)->ri, isr); 890+ regs->cr_iip + ia64_psr(regs)->ri, isr);
840 } 891 }
841 892
842 exception = fp_emulate(fp_fault, bundle, &regs->cr_ipsr, &regs->ar_fpsr, &isr, &regs->pr, 893 exception = fp_emulate(fp_fault, bundle, &regs->cr_ipsr, &regs->ar_fpsr, &isr, &regs->pr,
843diff -NurpP --minimal linux-2.6.15.6/arch/ia64/mm/fault.c linux-2.6.15.6-vs2.1.1-rc13/arch/ia64/mm/fault.c 894Index: linux-2.6.16/arch/ia64/mm/fault.c
844--- linux-2.6.15.6/arch/ia64/mm/fault.c 2006-01-03 17:29:09 +0100 895===================================================================
845+++ linux-2.6.15.6-vs2.1.1-rc13/arch/ia64/mm/fault.c 2006-01-04 21:59:59 +0100 896--- linux-2.6.16.orig/arch/ia64/mm/fault.c
897+++ linux-2.6.16/arch/ia64/mm/fault.c
846@@ -10,6 +10,7 @@ 898@@ -10,6 +10,7 @@
847 #include <linux/smp_lock.h> 899 #include <linux/smp_lock.h>
848 #include <linux/interrupt.h> 900 #include <linux/interrupt.h>
849 #include <linux/kprobes.h> 901 #include <linux/kprobes.h>
850+#include <linux/vs_memory.h> 902+#include <linux/vs_memory.h>
851 903
852 #include <asm/pgtable.h> 904 #include <asm/pgtable.h>
853 #include <asm/processor.h> 905 #include <asm/processor.h>
854diff -NurpP --minimal linux-2.6.15.6/arch/ia64/sn/kernel/xpc_main.c linux-2.6.15.6-vs2.1.1-rc13/arch/ia64/sn/kernel/xpc_main.c 906Index: linux-2.6.16/arch/ia64/sn/kernel/xpc_main.c
855--- linux-2.6.15.6/arch/ia64/sn/kernel/xpc_main.c 2006-01-03 17:29:09 +0100 907===================================================================
856+++ linux-2.6.15.6-vs2.1.1-rc13/arch/ia64/sn/kernel/xpc_main.c 2006-02-14 10:30:37 +0100 908--- linux-2.6.16.orig/arch/ia64/sn/kernel/xpc_main.c
909+++ linux-2.6.16/arch/ia64/sn/kernel/xpc_main.c
857@@ -105,6 +105,7 @@ static ctl_table xpc_sys_xpc_hb_dir[] = 910@@ -109,6 +109,7 @@ static ctl_table xpc_sys_xpc_hb_dir[] =
858 0644, 911 0644,
859 NULL, 912 NULL,
860 &proc_dointvec_minmax, 913 &proc_dointvec_minmax,
861+ NULL, 914+ NULL,
862 &sysctl_intvec, 915 &sysctl_intvec,
863 NULL, 916 NULL,
864 &xpc_hb_min_interval, 917 &xpc_hb_min_interval,
865@@ -118,6 +119,7 @@ static ctl_table xpc_sys_xpc_hb_dir[] = 918@@ -122,6 +123,7 @@ static ctl_table xpc_sys_xpc_hb_dir[] =
866 0644, 919 0644,
867 NULL, 920 NULL,
868 &proc_dointvec_minmax, 921 &proc_dointvec_minmax,
869+ NULL, 922+ NULL,
870 &sysctl_intvec, 923 &sysctl_intvec,
871 NULL, 924 NULL,
872 &xpc_hb_check_min_interval, 925 &xpc_hb_check_min_interval,
873@@ -142,6 +144,7 @@ static ctl_table xpc_sys_xpc_dir[] = { 926@@ -146,6 +148,7 @@ static ctl_table xpc_sys_xpc_dir[] = {
874 0644, 927 0644,
875 NULL, 928 NULL,
876 &proc_dointvec_minmax, 929 &proc_dointvec_minmax,
877+ NULL, 930+ NULL,
878 &sysctl_intvec, 931 &sysctl_intvec,
879 NULL, 932 NULL,
880 &xpc_disengage_request_min_timelimit, 933 &xpc_disengage_request_min_timelimit,
881diff -NurpP --minimal linux-2.6.15.6/arch/m32r/kernel/process.c linux-2.6.15.6-vs2.1.1-rc13/arch/m32r/kernel/process.c 934Index: linux-2.6.16/arch/m32r/kernel/process.c
882--- linux-2.6.15.6/arch/m32r/kernel/process.c 2006-01-03 17:29:09 +0100 935===================================================================
883+++ linux-2.6.15.6-vs2.1.1-rc13/arch/m32r/kernel/process.c 2006-01-04 21:59:59 +0100 936--- linux-2.6.16.orig/arch/m32r/kernel/process.c
937+++ linux-2.6.16/arch/m32r/kernel/process.c
884@@ -204,8 +204,8 @@ int kernel_thread(int (*fn)(void *), voi 938@@ -208,8 +208,8 @@ int kernel_thread(int (*fn)(void *), voi
885 regs.psw = M32R_PSW_BIE; 939 regs.psw = M32R_PSW_BIE;
886 940
887 /* Ok, create the new process. */ 941 /* Ok, create the new process. */
888- return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, 942- return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL,
889- NULL); 943- NULL);
890+ return do_fork(flags | CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD, 944+ return do_fork(flags | CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD,
891+ 0, &regs, 0, NULL, NULL); 945+ 0, &regs, 0, NULL, NULL);
892 } 946 }
893 947
894 /* 948 /*
895diff -NurpP --minimal linux-2.6.15.6/arch/m32r/kernel/ptrace.c linux-2.6.15.6-vs2.1.1-rc13/arch/m32r/kernel/ptrace.c 949Index: linux-2.6.16/arch/m32r/kernel/traps.c
896--- linux-2.6.15.6/arch/m32r/kernel/ptrace.c 2006-01-03 17:29:10 +0100 950===================================================================
897+++ linux-2.6.15.6-vs2.1.1-rc13/arch/m32r/kernel/ptrace.c 2006-02-14 12:35:41 +0100 951--- linux-2.6.16.orig/arch/m32r/kernel/traps.c
898@@ -25,6 +25,7 @@ 952+++ linux-2.6.16/arch/m32r/kernel/traps.c
899 #include <linux/user.h>
900 #include <linux/string.h>
901 #include <linux/signal.h>
902+#include <linux/vs_pid.h>
903
904 #include <asm/cacheflush.h>
905 #include <asm/io.h>
906diff -NurpP --minimal linux-2.6.15.6/arch/m32r/kernel/traps.c linux-2.6.15.6-vs2.1.1-rc13/arch/m32r/kernel/traps.c
907--- linux-2.6.15.6/arch/m32r/kernel/traps.c 2005-10-28 20:49:11 +0200
908+++ linux-2.6.15.6-vs2.1.1-rc13/arch/m32r/kernel/traps.c 2006-02-12 14:28:46 +0100
909@@ -196,8 +196,9 @@ static void show_registers(struct pt_reg 953@@ -196,8 +196,9 @@ static void show_registers(struct pt_reg
910 } else { 954 } else {
911 printk("SPI: %08lx\n", sp); 955 printk("SPI: %08lx\n", sp);
912 } 956 }
913- printk("Process %s (pid: %d, process nr: %d, stackpage=%08lx)", 957- printk("Process %s (pid: %d, process nr: %d, stackpage=%08lx)",
916+ current->comm, current->pid, current->xid, 960+ current->comm, current->pid, current->xid,
917+ 0xffff & i, 4096+(unsigned long)current); 961+ 0xffff & i, 4096+(unsigned long)current);
918 962
919 /* 963 /*
920 * When in-kernel, we also print out the stack and code at the 964 * When in-kernel, we also print out the stack and code at the
921diff -NurpP --minimal linux-2.6.15.6/arch/m68k/Kconfig linux-2.6.15.6-vs2.1.1-rc13/arch/m68k/Kconfig 965Index: linux-2.6.16/arch/m68k/Kconfig
922--- linux-2.6.15.6/arch/m68k/Kconfig 2006-01-03 17:29:10 +0100 966===================================================================
923+++ linux-2.6.15.6-vs2.1.1-rc13/arch/m68k/Kconfig 2006-01-04 21:59:59 +0100 967--- linux-2.6.16.orig/arch/m68k/Kconfig
968+++ linux-2.6.16/arch/m68k/Kconfig
924@@ -650,6 +650,8 @@ source "fs/Kconfig" 969@@ -650,6 +650,8 @@ source "fs/Kconfig"
925 970
926 source "arch/m68k/Kconfig.debug" 971 source "arch/m68k/Kconfig.debug"
927 972
928+source "kernel/vserver/Kconfig" 973+source "kernel/vserver/Kconfig"
929+ 974+
930 source "security/Kconfig" 975 source "security/Kconfig"
931 976
932 source "crypto/Kconfig" 977 source "crypto/Kconfig"
933diff -NurpP --minimal linux-2.6.15.6/arch/m68k/kernel/process.c linux-2.6.15.6-vs2.1.1-rc13/arch/m68k/kernel/process.c 978Index: linux-2.6.16/arch/m68k/kernel/process.c
934--- linux-2.6.15.6/arch/m68k/kernel/process.c 2006-01-03 17:29:10 +0100 979===================================================================
935+++ linux-2.6.15.6-vs2.1.1-rc13/arch/m68k/kernel/process.c 2006-01-04 21:59:59 +0100 980--- linux-2.6.16.orig/arch/m68k/kernel/process.c
981+++ linux-2.6.16/arch/m68k/kernel/process.c
936@@ -157,7 +157,8 @@ int kernel_thread(int (*fn)(void *), voi 982@@ -160,7 +160,8 @@ int kernel_thread(int (*fn)(void *), voi
937 983
938 { 984 {
939 register long retval __asm__ ("d0"); 985 register long retval __asm__ ("d0");
940- register long clone_arg __asm__ ("d1") = flags | CLONE_VM | CLONE_UNTRACED; 986- register long clone_arg __asm__ ("d1") = flags | CLONE_VM | CLONE_UNTRACED;
941+ register long clone_arg __asm__ ("d1") = 987+ register long clone_arg __asm__ ("d1") =
942+ flags | CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD; 988+ flags | CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD;
943 989
944 retval = __NR_clone; 990 retval = __NR_clone;
945 __asm__ __volatile__ 991 __asm__ __volatile__
946diff -NurpP --minimal linux-2.6.15.6/arch/m68k/kernel/ptrace.c linux-2.6.15.6-vs2.1.1-rc13/arch/m68k/kernel/ptrace.c 992Index: linux-2.6.16/arch/m68k/kernel/ptrace.c
947--- linux-2.6.15.6/arch/m68k/kernel/ptrace.c 2006-01-03 17:29:10 +0100 993===================================================================
948+++ linux-2.6.15.6-vs2.1.1-rc13/arch/m68k/kernel/ptrace.c 2006-01-04 21:59:59 +0100 994--- linux-2.6.16.orig/arch/m68k/kernel/ptrace.c
995+++ linux-2.6.16/arch/m68k/kernel/ptrace.c
949@@ -280,6 +280,8 @@ long arch_ptrace(struct task_struct *chi 996@@ -280,6 +280,8 @@ long arch_ptrace(struct task_struct *chi
950 ret = ptrace_request(child, request, addr, data); 997 ret = ptrace_request(child, request, addr, data);
951 break; 998 break;
952 } 999 }
953+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT)) 1000+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT))
954+ goto out_tsk; 1001+ goto out_tsk;
955 1002
956 return ret; 1003 return ret;
957 out_eio: 1004 out_eio:
958diff -NurpP --minimal linux-2.6.15.6/arch/m68k/kernel/traps.c linux-2.6.15.6-vs2.1.1-rc13/arch/m68k/kernel/traps.c 1005Index: linux-2.6.16/arch/m68k/kernel/traps.c
959--- linux-2.6.15.6/arch/m68k/kernel/traps.c 2004-08-14 12:56:24 +0200 1006===================================================================
960+++ linux-2.6.15.6-vs2.1.1-rc13/arch/m68k/kernel/traps.c 2006-02-12 14:28:46 +0100 1007--- linux-2.6.16.orig/arch/m68k/kernel/traps.c
1008+++ linux-2.6.16/arch/m68k/kernel/traps.c
961@@ -1198,8 +1198,9 @@ void die_if_kernel (char *str, struct pt 1009@@ -1198,8 +1198,9 @@ void die_if_kernel (char *str, struct pt
962 printk("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n", 1010 printk("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
963 fp->d4, fp->d5, fp->a0, fp->a1); 1011 fp->d4, fp->d5, fp->a0, fp->a1);
964 1012
965- printk("Process %s (pid: %d, stackpage=%08lx)\n", 1013- printk("Process %s (pid: %d, stackpage=%08lx)\n",
968+ current->comm, current->pid, current->xid, 1016+ current->comm, current->pid, current->xid,
969+ PAGE_SIZE+(unsigned long)current); 1017+ PAGE_SIZE+(unsigned long)current);
970 show_stack(NULL, (unsigned long *)fp); 1018 show_stack(NULL, (unsigned long *)fp);
971 do_exit(SIGSEGV); 1019 do_exit(SIGSEGV);
972 } 1020 }
973diff -NurpP --minimal linux-2.6.15.6/arch/m68knommu/Kconfig linux-2.6.15.6-vs2.1.1-rc13/arch/m68knommu/Kconfig 1021Index: linux-2.6.16/arch/m68knommu/Kconfig
974--- linux-2.6.15.6/arch/m68knommu/Kconfig 2006-01-03 17:29:10 +0100 1022===================================================================
975+++ linux-2.6.15.6-vs2.1.1-rc13/arch/m68knommu/Kconfig 2006-01-04 21:59:59 +0100 1023--- linux-2.6.16.orig/arch/m68knommu/Kconfig
1024+++ linux-2.6.16/arch/m68knommu/Kconfig
976@@ -646,6 +646,8 @@ source "fs/Kconfig" 1025@@ -646,6 +646,8 @@ source "fs/Kconfig"
977 1026
978 source "arch/m68knommu/Kconfig.debug" 1027 source "arch/m68knommu/Kconfig.debug"
979 1028
980+source "kernel/vserver/Kconfig" 1029+source "kernel/vserver/Kconfig"
981+ 1030+
982 source "security/Kconfig" 1031 source "security/Kconfig"
983 1032
984 source "crypto/Kconfig" 1033 source "crypto/Kconfig"
985diff -NurpP --minimal linux-2.6.15.6/arch/m68knommu/kernel/process.c linux-2.6.15.6-vs2.1.1-rc13/arch/m68knommu/kernel/process.c 1034Index: linux-2.6.16/arch/m68knommu/kernel/process.c
986--- linux-2.6.15.6/arch/m68knommu/kernel/process.c 2005-08-29 22:24:53 +0200 1035===================================================================
987+++ linux-2.6.15.6-vs2.1.1-rc13/arch/m68knommu/kernel/process.c 2006-01-04 21:59:59 +0100 1036--- linux-2.6.16.orig/arch/m68knommu/kernel/process.c
1037+++ linux-2.6.16/arch/m68knommu/kernel/process.c
988@@ -115,7 +115,7 @@ void show_regs(struct pt_regs * regs) 1038@@ -123,7 +123,7 @@ void show_regs(struct pt_regs * regs)
989 int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) 1039 int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
990 { 1040 {
991 int retval; 1041 int retval;
992- long clone_arg = flags | CLONE_VM; 1042- long clone_arg = flags | CLONE_VM;
993+ long clone_arg = flags | CLONE_VM | CLONE_KTHREAD; 1043+ long clone_arg = flags | CLONE_VM | CLONE_KTHREAD;
994 mm_segment_t fs; 1044 mm_segment_t fs;
995 1045
996 fs = get_fs(); 1046 fs = get_fs();
997diff -NurpP --minimal linux-2.6.15.6/arch/m68knommu/kernel/traps.c linux-2.6.15.6-vs2.1.1-rc13/arch/m68knommu/kernel/traps.c 1047Index: linux-2.6.16/arch/m68knommu/kernel/traps.c
998--- linux-2.6.15.6/arch/m68knommu/kernel/traps.c 2005-10-28 20:49:11 +0200 1048===================================================================
999+++ linux-2.6.15.6-vs2.1.1-rc13/arch/m68knommu/kernel/traps.c 2006-02-12 14:28:46 +0100 1049--- linux-2.6.16.orig/arch/m68knommu/kernel/traps.c
1050+++ linux-2.6.16/arch/m68knommu/kernel/traps.c
1000@@ -81,8 +81,9 @@ void die_if_kernel(char *str, struct pt_ 1051@@ -81,8 +81,9 @@ void die_if_kernel(char *str, struct pt_
1001 printk(KERN_EMERG "d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n", 1052 printk(KERN_EMERG "d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
1002 fp->d4, fp->d5, fp->a0, fp->a1); 1053 fp->d4, fp->d5, fp->a0, fp->a1);
1003 1054
1004- printk(KERN_EMERG "Process %s (pid: %d, stackpage=%08lx)\n", 1055- printk(KERN_EMERG "Process %s (pid: %d, stackpage=%08lx)\n",
1007+ current->comm, current->pid, current->xid, 1058+ current->comm, current->pid, current->xid,
1008+ PAGE_SIZE+(unsigned long)current); 1059+ PAGE_SIZE+(unsigned long)current);
1009 show_stack(NULL, (unsigned long *)fp); 1060 show_stack(NULL, (unsigned long *)fp);
1010 do_exit(SIGSEGV); 1061 do_exit(SIGSEGV);
1011 } 1062 }
1012diff -NurpP --minimal linux-2.6.15.6/arch/mips/Kconfig linux-2.6.15.6-vs2.1.1-rc13/arch/mips/Kconfig 1063Index: linux-2.6.16/arch/mips/Kconfig
1013--- linux-2.6.15.6/arch/mips/Kconfig 2006-01-03 17:29:10 +0100 1064===================================================================
1014+++ linux-2.6.15.6-vs2.1.1-rc13/arch/mips/Kconfig 2006-01-04 21:59:59 +0100 1065--- linux-2.6.16.orig/arch/mips/Kconfig
1066+++ linux-2.6.16/arch/mips/Kconfig
1015@@ -1817,6 +1817,8 @@ source "arch/mips/oprofile/Kconfig" 1067@@ -1814,6 +1814,8 @@ source "arch/mips/oprofile/Kconfig"
1016 1068
1017 source "arch/mips/Kconfig.debug" 1069 source "arch/mips/Kconfig.debug"
1018 1070
1019+source "kernel/vserver/Kconfig" 1071+source "kernel/vserver/Kconfig"
1020+ 1072+
1021 source "security/Kconfig" 1073 source "security/Kconfig"
1022 1074
1023 source "crypto/Kconfig" 1075 source "crypto/Kconfig"
1024diff -NurpP --minimal linux-2.6.15.6/arch/mips/kernel/linux32.c linux-2.6.15.6-vs2.1.1-rc13/arch/mips/kernel/linux32.c 1076Index: linux-2.6.16/arch/mips/kernel/linux32.c
1025--- linux-2.6.15.6/arch/mips/kernel/linux32.c 2006-01-03 17:29:11 +0100 1077===================================================================
1026+++ linux-2.6.15.6-vs2.1.1-rc13/arch/mips/kernel/linux32.c 2006-02-14 11:50:44 +0100 1078--- linux-2.6.16.orig/arch/mips/kernel/linux32.c
1079+++ linux-2.6.16/arch/mips/kernel/linux32.c
1027@@ -37,6 +37,7 @@ 1080@@ -37,6 +37,7 @@
1028 #include <linux/security.h> 1081 #include <linux/security.h>
1029 #include <linux/compat.h> 1082 #include <linux/compat.h>
1030 #include <linux/vfs.h> 1083 #include <linux/vfs.h>
1031+#include <linux/vs_cvirt.h> 1084+#include <linux/vs_cvirt.h>
1032 1085
1033 #include <net/sock.h> 1086 #include <net/sock.h>
1034 #include <net/scm.h> 1087 #include <net/scm.h>
1035@@ -1150,7 +1151,7 @@ asmlinkage long sys32_newuname(struct ne 1088@@ -1099,7 +1100,7 @@ asmlinkage long sys32_newuname(struct ne
1036 int ret = 0; 1089 int ret = 0;
1037 1090
1038 down_read(&uts_sem); 1091 down_read(&uts_sem);
1039- if (copy_to_user(name,&system_utsname,sizeof *name)) 1092- if (copy_to_user(name,&system_utsname,sizeof *name))
1040+ if (copy_to_user(name, vx_new_utsname(), sizeof *name)) 1093+ if (copy_to_user(name, vx_new_utsname(), sizeof *name))
1041 ret = -EFAULT; 1094 ret = -EFAULT;
1042 up_read(&uts_sem); 1095 up_read(&uts_sem);
1043 1096
1044diff -NurpP --minimal linux-2.6.15.6/arch/mips/kernel/process.c linux-2.6.15.6-vs2.1.1-rc13/arch/mips/kernel/process.c 1097Index: linux-2.6.16/arch/mips/kernel/process.c
1045--- linux-2.6.15.6/arch/mips/kernel/process.c 2006-01-03 17:29:11 +0100 1098===================================================================
1046+++ linux-2.6.15.6-vs2.1.1-rc13/arch/mips/kernel/process.c 2006-01-04 21:59:59 +0100 1099--- linux-2.6.16.orig/arch/mips/kernel/process.c
1100+++ linux-2.6.16/arch/mips/kernel/process.c
1047@@ -268,7 +268,8 @@ long kernel_thread(int (*fn)(void *), vo 1101@@ -268,7 +268,8 @@ long kernel_thread(int (*fn)(void *), vo
1048 #endif 1102 #endif
1049 1103
1050 /* Ok, create the new process.. */ 1104 /* Ok, create the new process.. */
1051- return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, NULL); 1105- return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
1052+ return do_fork(flags | CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD, 1106+ return do_fork(flags | CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD,
1053+ 0, &regs, 0, NULL, NULL); 1107+ 0, &regs, 0, NULL, NULL);
1054 } 1108 }
1055 1109
1056 static struct mips_frame_info { 1110 static struct mips_frame_info {
1057diff -NurpP --minimal linux-2.6.15.6/arch/mips/kernel/ptrace.c linux-2.6.15.6-vs2.1.1-rc13/arch/mips/kernel/ptrace.c 1111Index: linux-2.6.16/arch/mips/kernel/ptrace.c
1058--- linux-2.6.15.6/arch/mips/kernel/ptrace.c 2006-01-03 17:29:11 +0100 1112===================================================================
1059+++ linux-2.6.15.6-vs2.1.1-rc13/arch/mips/kernel/ptrace.c 2006-01-04 21:59:59 +0100 1113--- linux-2.6.16.orig/arch/mips/kernel/ptrace.c
1114+++ linux-2.6.16/arch/mips/kernel/ptrace.c
1060@@ -484,6 +484,8 @@ asmlinkage void do_syscall_trace(struct 1115@@ -476,6 +476,8 @@ asmlinkage void do_syscall_trace(struct
1061 goto out; 1116 goto out;
1062 if (!test_thread_flag(TIF_SYSCALL_TRACE)) 1117 if (!test_thread_flag(TIF_SYSCALL_TRACE))
1063 goto out; 1118 goto out;
1064+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT)) 1119+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT))
1065+ goto out_tsk; 1120+ goto out_tsk;
1066 1121
1067 /* The 0x80 provides a way for the tracing parent to distinguish 1122 /* The 0x80 provides a way for the tracing parent to distinguish
1068 between a syscall stop and SIGTRAP delivery */ 1123 between a syscall stop and SIGTRAP delivery */
1069diff -NurpP --minimal linux-2.6.15.6/arch/mips/kernel/ptrace32.c linux-2.6.15.6-vs2.1.1-rc13/arch/mips/kernel/ptrace32.c 1124Index: linux-2.6.16/arch/mips/kernel/scall32-o32.S
1070--- linux-2.6.15.6/arch/mips/kernel/ptrace32.c 2006-01-03 17:29:11 +0100 1125===================================================================
1071+++ linux-2.6.15.6-vs2.1.1-rc13/arch/mips/kernel/ptrace32.c 2006-02-14 12:35:41 +0100 1126--- linux-2.6.16.orig/arch/mips/kernel/scall32-o32.S
1072@@ -24,6 +24,7 @@ 1127+++ linux-2.6.16/arch/mips/kernel/scall32-o32.S
1073 #include <linux/smp_lock.h>
1074 #include <linux/user.h>
1075 #include <linux/security.h>
1076+#include <linux/vs_pid.h>
1077
1078 #include <asm/cpu.h>
1079 #include <asm/dsp.h>
1080diff -NurpP --minimal linux-2.6.15.6/arch/mips/kernel/scall32-o32.S linux-2.6.15.6-vs2.1.1-rc13/arch/mips/kernel/scall32-o32.S
1081--- linux-2.6.15.6/arch/mips/kernel/scall32-o32.S 2006-01-03 17:29:11 +0100
1082+++ linux-2.6.15.6-vs2.1.1-rc13/arch/mips/kernel/scall32-o32.S 2006-01-04 21:59:59 +0100
1083@@ -607,7 +607,7 @@ einval: li v0, -EINVAL 1128@@ -607,7 +607,7 @@ einval: li v0, -EINVAL
1084 sys sys_mq_timedreceive 5 1129 sys sys_mq_timedreceive 5
1085 sys sys_mq_notify 2 /* 4275 */ 1130 sys sys_mq_notify 2 /* 4275 */
1086 sys sys_mq_getsetattr 3 1131 sys sys_mq_getsetattr 3
1087- sys sys_ni_syscall 0 /* sys_vserver */ 1132- sys sys_ni_syscall 0 /* sys_vserver */
1088+ sys sys_vserver 3 1133+ sys sys_vserver 3
1089 sys sys_waitid 5 1134 sys sys_waitid 5
1090 sys sys_ni_syscall 0 /* available, was setaltroot */ 1135 sys sys_ni_syscall 0 /* available, was setaltroot */
1091 sys sys_add_key 5 /* 4280 */ 1136 sys sys_add_key 5 /* 4280 */
1092diff -NurpP --minimal linux-2.6.15.6/arch/mips/kernel/scall64-64.S linux-2.6.15.6-vs2.1.1-rc13/arch/mips/kernel/scall64-64.S 1137Index: linux-2.6.16/arch/mips/kernel/scall64-64.S
1093--- linux-2.6.15.6/arch/mips/kernel/scall64-64.S 2006-01-03 17:29:11 +0100 1138===================================================================
1094+++ linux-2.6.15.6-vs2.1.1-rc13/arch/mips/kernel/scall64-64.S 2006-01-04 21:59:59 +0100 1139--- linux-2.6.16.orig/arch/mips/kernel/scall64-64.S
1140+++ linux-2.6.16/arch/mips/kernel/scall64-64.S
1095@@ -433,7 +433,7 @@ sys_call_table: 1141@@ -433,7 +433,7 @@ sys_call_table:
1096 PTR sys_mq_timedreceive 1142 PTR sys_mq_timedreceive
1097 PTR sys_mq_notify 1143 PTR sys_mq_notify
1098 PTR sys_mq_getsetattr /* 5235 */ 1144 PTR sys_mq_getsetattr /* 5235 */
1099- PTR sys_ni_syscall /* sys_vserver */ 1145- PTR sys_ni_syscall /* sys_vserver */
1100+ PTR sys_vserver 1146+ PTR sys_vserver
1101 PTR sys_waitid 1147 PTR sys_waitid
1102 PTR sys_ni_syscall /* available, was setaltroot */ 1148 PTR sys_ni_syscall /* available, was setaltroot */
1103 PTR sys_add_key 1149 PTR sys_add_key
1104diff -NurpP --minimal linux-2.6.15.6/arch/mips/kernel/scall64-n32.S linux-2.6.15.6-vs2.1.1-rc13/arch/mips/kernel/scall64-n32.S 1150Index: linux-2.6.16/arch/mips/kernel/scall64-n32.S
1105--- linux-2.6.15.6/arch/mips/kernel/scall64-n32.S 2006-01-03 17:29:11 +0100 1151===================================================================
1106+++ linux-2.6.15.6-vs2.1.1-rc13/arch/mips/kernel/scall64-n32.S 2006-01-04 21:59:59 +0100 1152--- linux-2.6.16.orig/arch/mips/kernel/scall64-n32.S
1153+++ linux-2.6.16/arch/mips/kernel/scall64-n32.S
1107@@ -359,7 +359,7 @@ EXPORT(sysn32_call_table) 1154@@ -359,7 +359,7 @@ EXPORT(sysn32_call_table)
1108 PTR compat_sys_mq_timedreceive 1155 PTR compat_sys_mq_timedreceive
1109 PTR compat_sys_mq_notify 1156 PTR compat_sys_mq_notify
1110 PTR compat_sys_mq_getsetattr 1157 PTR compat_sys_mq_getsetattr
1111- PTR sys_ni_syscall /* 6240, sys_vserver */ 1158- PTR sys_ni_syscall /* 6240, sys_vserver */
1112+ PTR sys32_vserver /* 6240 */ 1159+ PTR sys32_vserver /* 6240 */
1113 PTR sysn32_waitid 1160 PTR sysn32_waitid
1114 PTR sys_ni_syscall /* available, was setaltroot */ 1161 PTR sys_ni_syscall /* available, was setaltroot */
1115 PTR sys_add_key 1162 PTR sys_add_key
1116diff -NurpP --minimal linux-2.6.15.6/arch/mips/kernel/scall64-o32.S linux-2.6.15.6-vs2.1.1-rc13/arch/mips/kernel/scall64-o32.S 1163Index: linux-2.6.16/arch/mips/kernel/scall64-o32.S
1117--- linux-2.6.15.6/arch/mips/kernel/scall64-o32.S 2006-01-03 17:29:11 +0100 1164===================================================================
1118+++ linux-2.6.15.6-vs2.1.1-rc13/arch/mips/kernel/scall64-o32.S 2006-01-04 21:59:59 +0100 1165--- linux-2.6.16.orig/arch/mips/kernel/scall64-o32.S
1166+++ linux-2.6.16/arch/mips/kernel/scall64-o32.S
1119@@ -481,7 +481,7 @@ sys_call_table: 1167@@ -481,7 +481,7 @@ sys_call_table:
1120 PTR compat_sys_mq_timedreceive 1168 PTR compat_sys_mq_timedreceive
1121 PTR compat_sys_mq_notify /* 4275 */ 1169 PTR compat_sys_mq_notify /* 4275 */
1122 PTR compat_sys_mq_getsetattr 1170 PTR compat_sys_mq_getsetattr
1123- PTR sys_ni_syscall /* sys_vserver */ 1171- PTR sys_ni_syscall /* sys_vserver */
1124+ PTR sys32_vserver 1172+ PTR sys32_vserver
1125 PTR sys32_waitid 1173 PTR sys32_waitid
1126 PTR sys_ni_syscall /* available, was setaltroot */ 1174 PTR sys_ni_syscall /* available, was setaltroot */
1127 PTR sys_add_key /* 4280 */ 1175 PTR sys_add_key /* 4280 */
1128diff -NurpP --minimal linux-2.6.15.6/arch/mips/kernel/syscall.c linux-2.6.15.6-vs2.1.1-rc13/arch/mips/kernel/syscall.c 1176Index: linux-2.6.16/arch/mips/kernel/syscall.c
1129--- linux-2.6.15.6/arch/mips/kernel/syscall.c 2006-01-03 17:29:11 +0100 1177===================================================================
1130+++ linux-2.6.15.6-vs2.1.1-rc13/arch/mips/kernel/syscall.c 2006-01-04 21:59:59 +0100 1178--- linux-2.6.16.orig/arch/mips/kernel/syscall.c
1179+++ linux-2.6.16/arch/mips/kernel/syscall.c
1131@@ -28,6 +28,7 @@ 1180@@ -29,6 +29,7 @@
1132 #include <linux/shm.h> 1181 #include <linux/shm.h>
1133 #include <linux/compiler.h> 1182 #include <linux/compiler.h>
1134 #include <linux/module.h> 1183 #include <linux/module.h>
1135+#include <linux/vs_cvirt.h> 1184+#include <linux/vs_cvirt.h>
1136 1185
1137 #include <asm/branch.h> 1186 #include <asm/branch.h>
1138 #include <asm/cachectl.h> 1187 #include <asm/cachectl.h>
1139@@ -228,7 +229,7 @@ out: 1188@@ -229,7 +230,7 @@ out:
1140 */ 1189 */
1141 asmlinkage int sys_uname(struct old_utsname * name) 1190 asmlinkage int sys_uname(struct old_utsname __user * name)
1142 { 1191 {
1143- if (name && !copy_to_user(name, &system_utsname, sizeof (*name))) 1192- if (name && !copy_to_user(name, &system_utsname, sizeof (*name)))
1144+ if (name && !copy_to_user(name, vx_new_utsname(), sizeof (*name))) 1193+ if (name && !copy_to_user(name, vx_new_utsname(), sizeof (*name)))
1145 return 0; 1194 return 0;
1146 return -EFAULT; 1195 return -EFAULT;
1147 } 1196 }
1148@@ -239,21 +240,23 @@ asmlinkage int sys_uname(struct old_utsn 1197@@ -240,21 +241,23 @@ asmlinkage int sys_uname(struct old_utsn
1149 asmlinkage int sys_olduname(struct oldold_utsname * name) 1198 asmlinkage int sys_olduname(struct oldold_utsname __user * name)
1150 { 1199 {
1151 int error; 1200 int error;
1152+ struct new_utsname *ptr; 1201+ struct new_utsname *ptr;
1153 1202
1154 if (!name) 1203 if (!name)
1172- error -= __copy_to_user(&name->machine,&system_utsname.machine,__OLD_UTS_LEN); 1221- error -= __copy_to_user(&name->machine,&system_utsname.machine,__OLD_UTS_LEN);
1173+ error -= __copy_to_user(&name->machine,ptr->machine,__OLD_UTS_LEN); 1222+ error -= __copy_to_user(&name->machine,ptr->machine,__OLD_UTS_LEN);
1174 error = __put_user(0,name->machine+__OLD_UTS_LEN); 1223 error = __put_user(0,name->machine+__OLD_UTS_LEN);
1175 error = error ? -EFAULT : 0; 1224 error = error ? -EFAULT : 0;
1176 1225
1177@@ -289,10 +292,10 @@ asmlinkage int _sys_sysmips(int cmd, lon 1226@@ -290,10 +293,10 @@ asmlinkage int _sys_sysmips(int cmd, lon
1178 return -EFAULT; 1227 return -EFAULT;
1179 1228
1180 down_write(&uts_sem); 1229 down_write(&uts_sem);
1181- strncpy(system_utsname.nodename, nodename, len); 1230- strncpy(system_utsname.nodename, nodename, len);
1182+ strncpy(vx_new_uts(nodename), nodename, len); 1231+ strncpy(vx_new_uts(nodename), nodename, len);
1186+ strlcpy(vx_new_uts(nodename), nodename, 1235+ strlcpy(vx_new_uts(nodename), nodename,
1187+ sizeof(vx_new_uts(nodename))); 1236+ sizeof(vx_new_uts(nodename)));
1188 up_write(&uts_sem); 1237 up_write(&uts_sem);
1189 return 0; 1238 return 0;
1190 } 1239 }
1191diff -NurpP --minimal linux-2.6.15.6/arch/mips/kernel/sysirix.c linux-2.6.15.6-vs2.1.1-rc13/arch/mips/kernel/sysirix.c 1240Index: linux-2.6.16/arch/mips/kernel/sysirix.c
1192--- linux-2.6.15.6/arch/mips/kernel/sysirix.c 2006-01-03 17:29:11 +0100 1241===================================================================
1193+++ linux-2.6.15.6-vs2.1.1-rc13/arch/mips/kernel/sysirix.c 2006-02-13 16:25:38 +0100 1242--- linux-2.6.16.orig/arch/mips/kernel/sysirix.c
1243+++ linux-2.6.16/arch/mips/kernel/sysirix.c
1194@@ -30,6 +30,7 @@ 1244@@ -31,6 +31,7 @@
1195 #include <linux/socket.h> 1245 #include <linux/socket.h>
1196 #include <linux/security.h> 1246 #include <linux/security.h>
1197 #include <linux/syscalls.h> 1247 #include <linux/syscalls.h>
1198+#include <linux/vs_pid.h> 1248+#include <linux/vs_pid.h>
1199 1249
1200 #include <asm/ptrace.h> 1250 #include <asm/ptrace.h>
1201 #include <asm/page.h> 1251 #include <asm/page.h>
1202diff -NurpP --minimal linux-2.6.15.6/arch/mips/kernel/traps.c linux-2.6.15.6-vs2.1.1-rc13/arch/mips/kernel/traps.c 1252Index: linux-2.6.16/arch/mips/kernel/traps.c
1203--- linux-2.6.15.6/arch/mips/kernel/traps.c 2006-01-03 17:29:11 +0100 1253===================================================================
1204+++ linux-2.6.15.6-vs2.1.1-rc13/arch/mips/kernel/traps.c 2006-02-12 14:28:46 +0100 1254--- linux-2.6.16.orig/arch/mips/kernel/traps.c
1255+++ linux-2.6.16/arch/mips/kernel/traps.c
1205@@ -266,8 +266,9 @@ void show_registers(struct pt_regs *regs 1256@@ -266,8 +266,9 @@ void show_registers(struct pt_regs *regs
1206 { 1257 {
1207 show_regs(regs); 1258 show_regs(regs);
1208 print_modules(); 1259 print_modules();
1209- printk("Process %s (pid: %d, threadinfo=%p, task=%p)\n", 1260- printk("Process %s (pid: %d, threadinfo=%p, task=%p)\n",
1212+ current->comm, current->pid, current->xid, 1263+ current->comm, current->pid, current->xid,
1213+ current_thread_info(), current); 1264+ current_thread_info(), current);
1214 show_stack(current, (long *) regs->regs[29]); 1265 show_stack(current, (long *) regs->regs[29]);
1215 show_trace(current, (long *) regs->regs[29]); 1266 show_trace(current, (long *) regs->regs[29]);
1216 show_code((unsigned int *) regs->cp0_epc); 1267 show_code((unsigned int *) regs->cp0_epc);
1217diff -NurpP --minimal linux-2.6.15.6/arch/parisc/Kconfig linux-2.6.15.6-vs2.1.1-rc13/arch/parisc/Kconfig 1268Index: linux-2.6.16/arch/parisc/Kconfig
1218--- linux-2.6.15.6/arch/parisc/Kconfig 2006-01-03 17:29:12 +0100 1269===================================================================
1219+++ linux-2.6.15.6-vs2.1.1-rc13/arch/parisc/Kconfig 2006-01-04 21:59:59 +0100 1270--- linux-2.6.16.orig/arch/parisc/Kconfig
1271+++ linux-2.6.16/arch/parisc/Kconfig
1220@@ -205,6 +205,8 @@ source "arch/parisc/oprofile/Kconfig" 1272@@ -213,6 +213,8 @@ source "arch/parisc/oprofile/Kconfig"
1221 1273
1222 source "arch/parisc/Kconfig.debug" 1274 source "arch/parisc/Kconfig.debug"
1223 1275
1224+source "kernel/vserver/Kconfig" 1276+source "kernel/vserver/Kconfig"
1225+ 1277+
1226 source "security/Kconfig" 1278 source "security/Kconfig"
1227 1279
1228 source "crypto/Kconfig" 1280 source "crypto/Kconfig"
1229diff -NurpP --minimal linux-2.6.15.6/arch/parisc/kernel/entry.S linux-2.6.15.6-vs2.1.1-rc13/arch/parisc/kernel/entry.S 1281Index: linux-2.6.16/arch/parisc/kernel/entry.S
1230--- linux-2.6.15.6/arch/parisc/kernel/entry.S 2006-01-03 17:29:13 +0100 1282===================================================================
1231+++ linux-2.6.15.6-vs2.1.1-rc13/arch/parisc/kernel/entry.S 2006-01-04 21:59:59 +0100 1283--- linux-2.6.16.orig/arch/parisc/kernel/entry.S
1284+++ linux-2.6.16/arch/parisc/kernel/entry.S
1232@@ -756,6 +756,7 @@ fault_vector_11: 1285@@ -756,6 +756,7 @@ fault_vector_11:
1233 1286
1234 #define CLONE_VM 0x100 /* Must agree with <linux/sched.h> */ 1287 #define CLONE_VM 0x100 /* Must agree with <linux/sched.h> */
1235 #define CLONE_UNTRACED 0x00800000 1288 #define CLONE_UNTRACED 0x00800000
1236+#define CLONE_KTHREAD 0x10000000 1289+#define CLONE_KTHREAD 0x10000000
1237 1290
1238 .export __kernel_thread, code 1291 .export __kernel_thread, code
1239 .import do_fork 1292 .import do_fork
1240diff -NurpP --minimal linux-2.6.15.6/arch/parisc/kernel/process.c linux-2.6.15.6-vs2.1.1-rc13/arch/parisc/kernel/process.c 1293Index: linux-2.6.16/arch/parisc/kernel/process.c
1241--- linux-2.6.15.6/arch/parisc/kernel/process.c 2006-01-03 17:29:13 +0100 1294===================================================================
1242+++ linux-2.6.15.6-vs2.1.1-rc13/arch/parisc/kernel/process.c 2006-01-04 21:59:59 +0100 1295--- linux-2.6.16.orig/arch/parisc/kernel/process.c
1296+++ linux-2.6.16/arch/parisc/kernel/process.c
1243@@ -201,7 +201,7 @@ pid_t kernel_thread(int (*fn)(void *), v 1297@@ -178,7 +178,7 @@ pid_t kernel_thread(int (*fn)(void *), v
1244 * kernel_thread can become a #define. 1298 * kernel_thread can become a #define.
1245 */ 1299 */
1246 1300
1247- return __kernel_thread(fn, arg, flags); 1301- return __kernel_thread(fn, arg, flags);
1248+ return __kernel_thread(fn, arg, flags | CLONE_KTHREAD); 1302+ return __kernel_thread(fn, arg, flags | CLONE_KTHREAD);
1249 } 1303 }
1250 EXPORT_SYMBOL(kernel_thread); 1304 EXPORT_SYMBOL(kernel_thread);
1251 1305
1252diff -NurpP --minimal linux-2.6.15.6/arch/parisc/kernel/sys_parisc32.c linux-2.6.15.6-vs2.1.1-rc13/arch/parisc/kernel/sys_parisc32.c 1306Index: linux-2.6.16/arch/parisc/kernel/sys_parisc32.c
1307===================================================================
1253--- linux-2.6.15.6/arch/parisc/kernel/sys_parisc32.c 2005-06-22 02:37:56 +0200 1308--- linux-2.6.16.orig/arch/parisc/kernel/sys_parisc32.c
1254+++ linux-2.6.15.6-vs2.1.1-rc13/arch/parisc/kernel/sys_parisc32.c 2006-01-04 21:59:59 +0100 1309+++ linux-2.6.16/arch/parisc/kernel/sys_parisc32.c
1255@@ -657,6 +657,7 @@ asmlinkage int sys32_sysinfo(struct sysi 1310@@ -657,6 +657,7 @@ asmlinkage int sys32_sysinfo(struct sysi
1256 1311
1257 do { 1312 do {
1258 seq = read_seqbegin(&xtime_lock); 1313 seq = read_seqbegin(&xtime_lock);
1259+ /* FIXME: requires vx virtualization */ 1314+ /* FIXME: requires vx virtualization */
1260 val.uptime = jiffies / HZ; 1315 val.uptime = jiffies / HZ;
1261 1316
1262 val.loads[0] = avenrun[0] << (SI_LOAD_SHIFT - FSHIFT); 1317 val.loads[0] = avenrun[0] << (SI_LOAD_SHIFT - FSHIFT);
1263diff -NurpP --minimal linux-2.6.15.6/arch/parisc/kernel/syscall_table.S linux-2.6.15.6-vs2.1.1-rc13/arch/parisc/kernel/syscall_table.S 1318Index: linux-2.6.16/arch/parisc/kernel/syscall_table.S
1319===================================================================
1264--- linux-2.6.15.6/arch/parisc/kernel/syscall_table.S 2006-01-03 17:29:13 +0100 1320--- linux-2.6.16.orig/arch/parisc/kernel/syscall_table.S
1265+++ linux-2.6.15.6-vs2.1.1-rc13/arch/parisc/kernel/syscall_table.S 2006-01-04 21:59:59 +0100 1321+++ linux-2.6.16/arch/parisc/kernel/syscall_table.S
1266@@ -368,7 +368,7 @@ 1322@@ -368,7 +368,7 @@
1267 ENTRY_COMP(mbind) /* 260 */ 1323 ENTRY_COMP(mbind) /* 260 */
1268 ENTRY_COMP(get_mempolicy) 1324 ENTRY_COMP(get_mempolicy)
1269 ENTRY_COMP(set_mempolicy) 1325 ENTRY_COMP(set_mempolicy)
1270- ENTRY_SAME(ni_syscall) /* 263: reserved for vserver */ 1326- ENTRY_SAME(ni_syscall) /* 263: reserved for vserver */
1271+ ENTRY_DIFF(vserver) 1327+ ENTRY_DIFF(vserver)
1272 ENTRY_SAME(add_key) 1328 ENTRY_SAME(add_key)
1273 ENTRY_SAME(request_key) /* 265 */ 1329 ENTRY_SAME(request_key) /* 265 */
1274 ENTRY_SAME(keyctl) 1330 ENTRY_SAME(keyctl)
1275diff -NurpP --minimal linux-2.6.15.6/arch/parisc/kernel/traps.c linux-2.6.15.6-vs2.1.1-rc13/arch/parisc/kernel/traps.c 1331Index: linux-2.6.16/arch/parisc/kernel/traps.c
1276--- linux-2.6.15.6/arch/parisc/kernel/traps.c 2006-01-03 17:29:13 +0100 1332===================================================================
1277+++ linux-2.6.15.6-vs2.1.1-rc13/arch/parisc/kernel/traps.c 2006-02-12 14:28:46 +0100 1333--- linux-2.6.16.orig/arch/parisc/kernel/traps.c
1334+++ linux-2.6.16/arch/parisc/kernel/traps.c
1278@@ -215,8 +215,9 @@ void die_if_kernel(char *str, struct pt_ 1335@@ -214,8 +214,9 @@ void die_if_kernel(char *str, struct pt_
1279 if (err == 0) 1336 if (err == 0)
1280 return; /* STFU */ 1337 return; /* STFU */
1281 1338
1282- printk(KERN_CRIT "%s (pid %d): %s (code %ld) at " RFMT "\n", 1339- printk(KERN_CRIT "%s (pid %d): %s (code %ld) at " RFMT "\n",
1283- current->comm, current->pid, str, err, regs->iaoq[0]); 1340- current->comm, current->pid, str, err, regs->iaoq[0]);
1285+ current->comm, current->pid, current->xid, 1342+ current->comm, current->pid, current->xid,
1286+ str, err, regs->iaoq[0]); 1343+ str, err, regs->iaoq[0]);
1287 #ifdef PRINT_USER_FAULTS 1344 #ifdef PRINT_USER_FAULTS
1288 /* XXX for debugging only */ 1345 /* XXX for debugging only */
1289 show_regs(regs); 1346 show_regs(regs);
1290@@ -247,8 +248,8 @@ void die_if_kernel(char *str, struct pt_ 1347@@ -246,8 +247,8 @@ void die_if_kernel(char *str, struct pt_
1291 if (!console_drivers) 1348 if (!console_drivers)
1292 pdc_console_restart(); 1349 pdc_console_restart();
1293 1350
1294- printk(KERN_CRIT "%s (pid %d): %s (code %ld)\n", 1351- printk(KERN_CRIT "%s (pid %d): %s (code %ld)\n",
1295- current->comm, current->pid, str, err); 1352- current->comm, current->pid, str, err);
1296+ printk(KERN_CRIT "%s (pid %d[#%u]): %s (code %ld)\n", 1353+ printk(KERN_CRIT "%s (pid %d[#%u]): %s (code %ld)\n",
1297+ current->comm, current->pid, current->xid, str, err); 1354+ current->comm, current->pid, current->xid, str, err);
1298 show_regs(regs); 1355 show_regs(regs);
1299 1356
1300 /* Wot's wrong wif bein' racy? */ 1357 /* Wot's wrong wif bein' racy? */
1301diff -NurpP --minimal linux-2.6.15.6/arch/powerpc/Kconfig linux-2.6.15.6-vs2.1.1-rc13/arch/powerpc/Kconfig 1358Index: linux-2.6.16/arch/powerpc/Kconfig
1302--- linux-2.6.15.6/arch/powerpc/Kconfig 2006-01-03 17:29:13 +0100 1359===================================================================
1303+++ linux-2.6.15.6-vs2.1.1-rc13/arch/powerpc/Kconfig 2006-01-06 18:48:42 +0100 1360--- linux-2.6.16.orig/arch/powerpc/Kconfig
1361+++ linux-2.6.16/arch/powerpc/Kconfig
1304@@ -930,6 +930,8 @@ endmenu 1362@@ -974,6 +974,8 @@ endmenu
1305 1363
1306 source "arch/powerpc/Kconfig.debug" 1364 source "arch/powerpc/Kconfig.debug"
1307 1365
1308+source "kernel/vserver/Kconfig" 1366+source "kernel/vserver/Kconfig"
1309+ 1367+
1310 source "security/Kconfig" 1368 source "security/Kconfig"
1311 1369
1312 config KEYS_COMPAT 1370 config KEYS_COMPAT
1313diff -NurpP --minimal linux-2.6.15.6/arch/powerpc/kernel/asm-offsets.c linux-2.6.15.6-vs2.1.1-rc13/arch/powerpc/kernel/asm-offsets.c 1371Index: linux-2.6.16/arch/powerpc/kernel/asm-offsets.c
1372===================================================================
1314--- linux-2.6.15.6/arch/powerpc/kernel/asm-offsets.c 2006-01-03 17:29:13 +0100 1373--- linux-2.6.16.orig/arch/powerpc/kernel/asm-offsets.c
1315+++ linux-2.6.15.6-vs2.1.1-rc13/arch/powerpc/kernel/asm-offsets.c 2006-02-28 18:18:52 +0100 1374+++ linux-2.6.16/arch/powerpc/kernel/asm-offsets.c
1316@@ -232,6 +232,7 @@ int main(void) 1375@@ -229,6 +229,7 @@ int main(void)
1317 1376
1318 DEFINE(CLONE_VM, CLONE_VM); 1377 DEFINE(CLONE_VM, CLONE_VM);
1319 DEFINE(CLONE_UNTRACED, CLONE_UNTRACED); 1378 DEFINE(CLONE_UNTRACED, CLONE_UNTRACED);
1320+ DEFINE(CLONE_KTHREAD, CLONE_KTHREAD); 1379+ DEFINE(CLONE_KTHREAD, CLONE_KTHREAD);
1321 1380
1322 #ifndef CONFIG_PPC64 1381 #ifndef CONFIG_PPC64
1323 DEFINE(MM_PGD, offsetof(struct mm_struct, pgd)); 1382 DEFINE(MM_PGD, offsetof(struct mm_struct, pgd));
1324diff -NurpP --minimal linux-2.6.15.6/arch/powerpc/kernel/misc_32.S linux-2.6.15.6-vs2.1.1-rc13/arch/powerpc/kernel/misc_32.S 1383Index: linux-2.6.16/arch/powerpc/kernel/misc_32.S
1325--- linux-2.6.15.6/arch/powerpc/kernel/misc_32.S 2006-01-03 17:29:13 +0100 1384===================================================================
1326+++ linux-2.6.15.6-vs2.1.1-rc13/arch/powerpc/kernel/misc_32.S 2006-01-17 00:00:10 +0100 1385--- linux-2.6.16.orig/arch/powerpc/kernel/misc_32.S
1386+++ linux-2.6.16/arch/powerpc/kernel/misc_32.S
1327@@ -974,7 +974,7 @@ _GLOBAL(kernel_thread) 1387@@ -980,7 +980,7 @@ _GLOBAL(kernel_thread)
1328 mr r30,r3 /* function */ 1388 mr r30,r3 /* function */
1329 mr r31,r4 /* argument */ 1389 mr r31,r4 /* argument */
1330 ori r3,r5,CLONE_VM /* flags */ 1390 ori r3,r5,CLONE_VM /* flags */
1331- oris r3,r3,CLONE_UNTRACED>>16 1391- oris r3,r3,CLONE_UNTRACED>>16
1332+ oris r3,r3,(CLONE_UNTRACED|CLONE_KTHREAD)>>16 1392+ oris r3,r3,(CLONE_UNTRACED|CLONE_KTHREAD)>>16
1333 li r4,0 /* new sp (unused) */ 1393 li r4,0 /* new sp (unused) */
1334 li r0,__NR_clone 1394 li r0,__NR_clone
1335 sc 1395 sc
1336diff -NurpP --minimal linux-2.6.15.6/arch/powerpc/kernel/misc_64.S linux-2.6.15.6-vs2.1.1-rc13/arch/powerpc/kernel/misc_64.S 1396Index: linux-2.6.16/arch/powerpc/kernel/misc_64.S
1337--- linux-2.6.15.6/arch/powerpc/kernel/misc_64.S 2006-01-03 17:29:13 +0100 1397===================================================================
1338+++ linux-2.6.15.6-vs2.1.1-rc13/arch/powerpc/kernel/misc_64.S 2006-01-17 00:00:38 +0100 1398--- linux-2.6.16.orig/arch/powerpc/kernel/misc_64.S
1399+++ linux-2.6.16/arch/powerpc/kernel/misc_64.S
1339@@ -684,7 +684,7 @@ _GLOBAL(kernel_thread) 1400@@ -684,7 +684,7 @@ _GLOBAL(kernel_thread)
1340 mr r29,r3 1401 mr r29,r3
1341 mr r30,r4 1402 mr r30,r4
1342 ori r3,r5,CLONE_VM /* flags */ 1403 ori r3,r5,CLONE_VM /* flags */
1343- oris r3,r3,(CLONE_UNTRACED>>16) 1404- oris r3,r3,(CLONE_UNTRACED>>16)
1344+ oris r3,r3,(CLONE_UNTRACED|CLONE_KTHREAD)>>16 1405+ oris r3,r3,(CLONE_UNTRACED|CLONE_KTHREAD)>>16
1345 li r4,0 /* new sp (unused) */ 1406 li r4,0 /* new sp (unused) */
1346 li r0,__NR_clone 1407 li r0,__NR_clone
1347 sc 1408 sc
1348diff -NurpP --minimal linux-2.6.15.6/arch/powerpc/kernel/process.c linux-2.6.15.6-vs2.1.1-rc13/arch/powerpc/kernel/process.c 1409Index: linux-2.6.16/arch/powerpc/kernel/process.c
1349--- linux-2.6.15.6/arch/powerpc/kernel/process.c 2006-01-03 17:29:13 +0100 1410===================================================================
1350+++ linux-2.6.15.6-vs2.1.1-rc13/arch/powerpc/kernel/process.c 2006-02-14 11:37:05 +0100 1411--- linux-2.6.16.orig/arch/powerpc/kernel/process.c
1412+++ linux-2.6.16/arch/powerpc/kernel/process.c
1351@@ -423,8 +423,9 @@ void show_regs(struct pt_regs * regs) 1413@@ -425,8 +425,9 @@ void show_regs(struct pt_regs * regs)
1352 trap = TRAP(regs); 1414 trap = TRAP(regs);
1353 if (trap == 0x300 || trap == 0x600) 1415 if (trap == 0x300 || trap == 0x600)
1354 printk("DAR: "REG", DSISR: "REG"\n", regs->dar, regs->dsisr); 1416 printk("DAR: "REG", DSISR: "REG"\n", regs->dar, regs->dsisr);
1355- printk("TASK = %p[%d] '%s' THREAD: %p", 1417- printk("TASK = %p[%d] '%s' THREAD: %p",
1356- current, current->pid, current->comm, current->thread_info); 1418- current, current->pid, current->comm, task_thread_info(current));
1357+ printk("TASK = %p[%d,#%u] '%s' THREAD: %p", 1419+ printk("TASK = %p[%d,#%u] '%s' THREAD: %p",
1358+ current, current->pid, current->xid, 1420+ current, current->pid, current->xid,
1359+ current->comm, current->thread_info); 1421+ current->comm, task_thread_info(current));
1360 1422
1361 #ifdef CONFIG_SMP 1423 #ifdef CONFIG_SMP
1362 printk(" CPU: %d", smp_processor_id()); 1424 printk(" CPU: %d", smp_processor_id());
1363diff -NurpP --minimal linux-2.6.15.6/arch/powerpc/kernel/ptrace32.c linux-2.6.15.6-vs2.1.1-rc13/arch/powerpc/kernel/ptrace32.c 1425Index: linux-2.6.16/arch/powerpc/kernel/syscalls.c
1364--- linux-2.6.15.6/arch/powerpc/kernel/ptrace32.c 2006-01-03 17:29:13 +0100 1426===================================================================
1365+++ linux-2.6.15.6-vs2.1.1-rc13/arch/powerpc/kernel/ptrace32.c 2006-02-14 12:35:41 +0100 1427--- linux-2.6.16.orig/arch/powerpc/kernel/syscalls.c
1366@@ -28,6 +28,7 @@ 1428+++ linux-2.6.16/arch/powerpc/kernel/syscalls.c
1367 #include <linux/user.h>
1368 #include <linux/security.h>
1369 #include <linux/signal.h>
1370+#include <linux/vs_pid.h>
1371
1372 #include <asm/uaccess.h>
1373 #include <asm/page.h>
1374diff -NurpP --minimal linux-2.6.15.6/arch/powerpc/kernel/syscalls.c linux-2.6.15.6-vs2.1.1-rc13/arch/powerpc/kernel/syscalls.c
1375--- linux-2.6.15.6/arch/powerpc/kernel/syscalls.c 2006-01-03 17:29:13 +0100
1376+++ linux-2.6.15.6-vs2.1.1-rc13/arch/powerpc/kernel/syscalls.c 2006-01-06 18:48:19 +0100
1377@@ -36,6 +36,7 @@ 1429@@ -36,6 +36,7 @@
1378 #include <linux/file.h> 1430 #include <linux/file.h>
1379 #include <linux/init.h> 1431 #include <linux/init.h>
1380 #include <linux/personality.h> 1432 #include <linux/personality.h>
1381+#include <linux/vs_cvirt.h> 1433+#include <linux/vs_cvirt.h>
1382 1434
1383 #include <asm/uaccess.h> 1435 #include <asm/uaccess.h>
1384 #include <asm/ipc.h> 1436 #include <asm/ipc.h>
1385@@ -262,7 +263,7 @@ long ppc_newuname(struct new_utsname __u 1437@@ -259,7 +260,7 @@ long ppc_newuname(struct new_utsname __u
1386 int err = 0; 1438 int err = 0;
1387 1439
1388 down_read(&uts_sem); 1440 down_read(&uts_sem);
1389- if (copy_to_user(name, &system_utsname, sizeof(*name))) 1441- if (copy_to_user(name, &system_utsname, sizeof(*name)))
1390+ if (copy_to_user(name, vx_new_utsname(), sizeof(*name))) 1442+ if (copy_to_user(name, vx_new_utsname(), sizeof(*name)))
1391 err = -EFAULT; 1443 err = -EFAULT;
1392 up_read(&uts_sem); 1444 up_read(&uts_sem);
1393 if (!err) 1445 if (!err)
1394@@ -275,7 +276,7 @@ int sys_uname(struct old_utsname __user 1446@@ -272,7 +273,7 @@ int sys_uname(struct old_utsname __user
1395 int err = 0; 1447 int err = 0;
1396 1448
1397 down_read(&uts_sem); 1449 down_read(&uts_sem);
1398- if (copy_to_user(name, &system_utsname, sizeof(*name))) 1450- if (copy_to_user(name, &system_utsname, sizeof(*name)))
1399+ if (copy_to_user(name, vx_new_utsname(), sizeof(*name))) 1451+ if (copy_to_user(name, vx_new_utsname(), sizeof(*name)))
1400 err = -EFAULT; 1452 err = -EFAULT;
1401 up_read(&uts_sem); 1453 up_read(&uts_sem);
1402 if (!err) 1454 if (!err)
1403@@ -286,25 +287,22 @@ int sys_uname(struct old_utsname __user 1455@@ -283,25 +284,22 @@ int sys_uname(struct old_utsname __user
1404 int sys_olduname(struct oldold_utsname __user *name) 1456 int sys_olduname(struct oldold_utsname __user *name)
1405 { 1457 {
1406 int error; 1458 int error;
1407+ struct new_utsname *ptr; 1459+ struct new_utsname *ptr;
1408 1460
1431- __OLD_UTS_LEN); 1483- __OLD_UTS_LEN);
1432+ error |= __copy_to_user(&name->machine, ptr->machine, __OLD_UTS_LEN); 1484+ error |= __copy_to_user(&name->machine, ptr->machine, __OLD_UTS_LEN);
1433 error |= override_machine(name->machine); 1485 error |= override_machine(name->machine);
1434 up_read(&uts_sem); 1486 up_read(&uts_sem);
1435 1487
1436diff -NurpP --minimal linux-2.6.15.6/arch/powerpc/kernel/systbl.S linux-2.6.15.6-vs2.1.1-rc13/arch/powerpc/kernel/systbl.S 1488Index: linux-2.6.16/arch/powerpc/kernel/systbl.S
1437--- linux-2.6.15.6/arch/powerpc/kernel/systbl.S 2006-01-03 17:29:13 +0100 1489===================================================================
1438+++ linux-2.6.15.6-vs2.1.1-rc13/arch/powerpc/kernel/systbl.S 2006-01-06 18:48:19 +0100 1490--- linux-2.6.16.orig/arch/powerpc/kernel/systbl.S
1491+++ linux-2.6.16/arch/powerpc/kernel/systbl.S
1439@@ -298,7 +298,7 @@ COMPAT_SYS(fstatfs64) 1492@@ -296,7 +296,7 @@ COMPAT_SYS(fstatfs64)
1440 SYSX(sys_ni_syscall, ppc_fadvise64_64, ppc_fadvise64_64) 1493 SYSX(sys_ni_syscall, ppc_fadvise64_64, ppc_fadvise64_64)
1441 PPC_SYS(rtas) 1494 PPC_SYS(rtas)
1442 OLDSYS(debug_setcontext) 1495 OLDSYS(debug_setcontext)
1443-SYSCALL(ni_syscall) 1496-SYSCALL(ni_syscall)
1444+SYSX(sys_vserver, sys32_vserver, sys_vserver) 1497+SYSX(sys_vserver, sys32_vserver, sys_vserver)
1445 SYSCALL(ni_syscall) 1498 SYSCALL(ni_syscall)
1446 COMPAT_SYS(mbind) 1499 COMPAT_SYS(mbind)
1447 COMPAT_SYS(get_mempolicy) 1500 COMPAT_SYS(get_mempolicy)
1448diff -NurpP --minimal linux-2.6.15.6/arch/powerpc/kernel/traps.c linux-2.6.15.6-vs2.1.1-rc13/arch/powerpc/kernel/traps.c 1501Index: linux-2.6.16/arch/powerpc/kernel/traps.c
1449--- linux-2.6.15.6/arch/powerpc/kernel/traps.c 2006-01-03 17:29:13 +0100 1502===================================================================
1450+++ linux-2.6.15.6-vs2.1.1-rc13/arch/powerpc/kernel/traps.c 2006-02-12 14:28:46 +0100 1503--- linux-2.6.16.orig/arch/powerpc/kernel/traps.c
1504+++ linux-2.6.16/arch/powerpc/kernel/traps.c
1451@@ -859,8 +859,9 @@ void nonrecoverable_exception(struct pt_ 1505@@ -878,8 +878,9 @@ void nonrecoverable_exception(struct pt_
1452 1506
1453 void trace_syscall(struct pt_regs *regs) 1507 void trace_syscall(struct pt_regs *regs)
1454 { 1508 {
1455- printk("Task: %p(%d), PC: %08lX/%08lX, Syscall: %3ld, Result: %s%ld %s\n", 1509- printk("Task: %p(%d), PC: %08lX/%08lX, Syscall: %3ld, Result: %s%ld %s\n",
1456- current, current->pid, regs->nip, regs->link, regs->gpr[0], 1510- current, current->pid, regs->nip, regs->link, regs->gpr[0],
1458+ current, current->pid, current->xid, 1512+ current, current->pid, current->xid,
1459+ regs->nip, regs->link, regs->gpr[0], 1513+ regs->nip, regs->link, regs->gpr[0],
1460 regs->ccr&0x10000000?"Error=":"", regs->gpr[3], print_tainted()); 1514 regs->ccr&0x10000000?"Error=":"", regs->gpr[3], print_tainted());
1461 } 1515 }
1462 1516
1463diff -NurpP --minimal linux-2.6.15.6/arch/powerpc/kernel/vdso.c linux-2.6.15.6-vs2.1.1-rc13/arch/powerpc/kernel/vdso.c 1517Index: linux-2.6.16/arch/powerpc/kernel/vdso.c
1464--- linux-2.6.15.6/arch/powerpc/kernel/vdso.c 2006-01-03 17:29:13 +0100 1518===================================================================
1465+++ linux-2.6.15.6-vs2.1.1-rc13/arch/powerpc/kernel/vdso.c 2006-01-06 18:48:19 +0100 1519--- linux-2.6.16.orig/arch/powerpc/kernel/vdso.c
1520+++ linux-2.6.16/arch/powerpc/kernel/vdso.c
1466@@ -25,6 +25,7 @@ 1521@@ -25,6 +25,7 @@
1467 #include <linux/elf.h> 1522 #include <linux/elf.h>
1468 #include <linux/security.h> 1523 #include <linux/security.h>
1469 #include <linux/bootmem.h> 1524 #include <linux/bootmem.h>
1470+#include <linux/vs_memory.h> 1525+#include <linux/vs_memory.h>
1478- mm->total_vm += (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; 1533- mm->total_vm += (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
1479+ vx_vmpages_add(mm, (vma->vm_end - vma->vm_start) >> PAGE_SHIFT); 1534+ vx_vmpages_add(mm, (vma->vm_end - vma->vm_start) >> PAGE_SHIFT);
1480 up_write(&mm->mmap_sem); 1535 up_write(&mm->mmap_sem);
1481 1536
1482 return 0; 1537 return 0;
1483diff -NurpP --minimal linux-2.6.15.6/arch/ppc/Kconfig linux-2.6.15.6-vs2.1.1-rc13/arch/ppc/Kconfig 1538Index: linux-2.6.16/arch/ppc/Kconfig
1484--- linux-2.6.15.6/arch/ppc/Kconfig 2006-01-03 17:29:13 +0100 1539===================================================================
1485+++ linux-2.6.15.6-vs2.1.1-rc13/arch/ppc/Kconfig 2006-01-04 21:59:59 +0100 1540--- linux-2.6.16.orig/arch/ppc/Kconfig
1541+++ linux-2.6.16/arch/ppc/Kconfig
1486@@ -1422,6 +1422,8 @@ source "arch/powerpc/oprofile/Kconfig" 1542@@ -1394,6 +1394,8 @@ source "arch/powerpc/oprofile/Kconfig"
1487 1543
1488 source "arch/ppc/Kconfig.debug" 1544 source "arch/ppc/Kconfig.debug"
1489 1545
1490+source "kernel/vserver/Kconfig" 1546+source "kernel/vserver/Kconfig"
1491+ 1547+
1492 source "security/Kconfig" 1548 source "security/Kconfig"
1493 1549
1494 source "crypto/Kconfig" 1550 source "crypto/Kconfig"
1495diff -NurpP --minimal linux-2.6.15.6/arch/ppc/kernel/asm-offsets.c linux-2.6.15.6-vs2.1.1-rc13/arch/ppc/kernel/asm-offsets.c 1551Index: linux-2.6.16/arch/ppc/kernel/asm-offsets.c
1496--- linux-2.6.15.6/arch/ppc/kernel/asm-offsets.c 2006-01-03 17:29:13 +0100 1552===================================================================
1497+++ linux-2.6.15.6-vs2.1.1-rc13/arch/ppc/kernel/asm-offsets.c 2006-01-04 21:59:59 +0100 1553--- linux-2.6.16.orig/arch/ppc/kernel/asm-offsets.c
1554+++ linux-2.6.16/arch/ppc/kernel/asm-offsets.c
1498@@ -122,6 +122,7 @@ main(void) 1555@@ -122,6 +122,7 @@ main(void)
1499 DEFINE(TRAP, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, trap)); 1556 DEFINE(TRAP, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, trap));
1500 DEFINE(CLONE_VM, CLONE_VM); 1557 DEFINE(CLONE_VM, CLONE_VM);
1501 DEFINE(CLONE_UNTRACED, CLONE_UNTRACED); 1558 DEFINE(CLONE_UNTRACED, CLONE_UNTRACED);
1502+ DEFINE(CLONE_KTHREAD, CLONE_KTHREAD); 1559+ DEFINE(CLONE_KTHREAD, CLONE_KTHREAD);
1503 DEFINE(MM_PGD, offsetof(struct mm_struct, pgd)); 1560 DEFINE(MM_PGD, offsetof(struct mm_struct, pgd));
1504 1561
1505 /* About the CPU features table */ 1562 /* About the CPU features table */
1506diff -NurpP --minimal linux-2.6.15.6/arch/ppc/kernel/misc.S linux-2.6.15.6-vs2.1.1-rc13/arch/ppc/kernel/misc.S 1563Index: linux-2.6.16/arch/ppc/kernel/misc.S
1507--- linux-2.6.15.6/arch/ppc/kernel/misc.S 2006-01-03 17:29:14 +0100 1564===================================================================
1508+++ linux-2.6.15.6-vs2.1.1-rc13/arch/ppc/kernel/misc.S 2006-01-04 21:59:59 +0100 1565--- linux-2.6.16.orig/arch/ppc/kernel/misc.S
1566+++ linux-2.6.16/arch/ppc/kernel/misc.S
1509@@ -1083,7 +1083,7 @@ _GLOBAL(kernel_thread) 1567@@ -1011,7 +1011,7 @@ _GLOBAL(kernel_thread)
1510 mr r30,r3 /* function */ 1568 mr r30,r3 /* function */
1511 mr r31,r4 /* argument */ 1569 mr r31,r4 /* argument */
1512 ori r3,r5,CLONE_VM /* flags */ 1570 ori r3,r5,CLONE_VM /* flags */
1513- oris r3,r3,CLONE_UNTRACED>>16 1571- oris r3,r3,CLONE_UNTRACED>>16
1514+ oris r3,r3,(CLONE_UNTRACED|CLONE_KTHREAD)>>16 1572+ oris r3,r3,(CLONE_UNTRACED|CLONE_KTHREAD)>>16
1515 li r4,0 /* new sp (unused) */ 1573 li r4,0 /* new sp (unused) */
1516 li r0,__NR_clone 1574 li r0,__NR_clone
1517 sc 1575 sc
1518@@ -1382,7 +1382,7 @@ _GLOBAL(sys_call_table) 1576Index: linux-2.6.16/arch/ppc/kernel/traps.c
1519 .long ppc_fadvise64_64 1577===================================================================
1520 .long sys_ni_syscall /* 255 - rtas (used on ppc64) */ 1578--- linux-2.6.16.orig/arch/ppc/kernel/traps.c
1521 .long sys_debug_setcontext 1579+++ linux-2.6.16/arch/ppc/kernel/traps.c
1522- .long sys_ni_syscall /* 257 reserved for vserver */
1523+ .long sys_vserver
1524 .long sys_ni_syscall /* 258 reserved for new sys_remap_file_pages */
1525 .long sys_ni_syscall /* 259 reserved for new sys_mbind */
1526 .long sys_ni_syscall /* 260 reserved for new sys_get_mempolicy */
1527diff -NurpP --minimal linux-2.6.15.6/arch/ppc/kernel/traps.c linux-2.6.15.6-vs2.1.1-rc13/arch/ppc/kernel/traps.c
1528--- linux-2.6.15.6/arch/ppc/kernel/traps.c 2006-01-03 17:29:14 +0100
1529+++ linux-2.6.15.6-vs2.1.1-rc13/arch/ppc/kernel/traps.c 2006-02-12 14:28:46 +0100
1530@@ -758,8 +758,9 @@ void nonrecoverable_exception(struct pt_ 1580@@ -749,8 +749,9 @@ void nonrecoverable_exception(struct pt_
1531 1581
1532 void trace_syscall(struct pt_regs *regs) 1582 void trace_syscall(struct pt_regs *regs)
1533 { 1583 {
1534- printk("Task: %p(%d), PC: %08lX/%08lX, Syscall: %3ld, Result: %s%ld %s\n", 1584- printk("Task: %p(%d), PC: %08lX/%08lX, Syscall: %3ld, Result: %s%ld %s\n",
1535- current, current->pid, regs->nip, regs->link, regs->gpr[0], 1585- current, current->pid, regs->nip, regs->link, regs->gpr[0],
1537+ current, current->pid, current->xid, 1587+ current, current->pid, current->xid,
1538+ regs->nip, regs->link, regs->gpr[0], 1588+ regs->nip, regs->link, regs->gpr[0],
1539 regs->ccr&0x10000000?"Error=":"", regs->gpr[3], print_tainted()); 1589 regs->ccr&0x10000000?"Error=":"", regs->gpr[3], print_tainted());
1540 } 1590 }
1541 1591
1542diff -NurpP --minimal linux-2.6.15.6/arch/s390/Kconfig linux-2.6.15.6-vs2.1.1-rc13/arch/s390/Kconfig 1592Index: linux-2.6.16/arch/s390/Kconfig
1543--- linux-2.6.15.6/arch/s390/Kconfig 2005-08-29 22:24:55 +0200 1593===================================================================
1544+++ linux-2.6.15.6-vs2.1.1-rc13/arch/s390/Kconfig 2006-01-04 21:59:59 +0100 1594--- linux-2.6.16.orig/arch/s390/Kconfig
1595+++ linux-2.6.16/arch/s390/Kconfig
1545@@ -485,6 +485,8 @@ source "arch/s390/oprofile/Kconfig" 1596@@ -472,6 +472,8 @@ source "arch/s390/oprofile/Kconfig"
1546 1597
1547 source "arch/s390/Kconfig.debug" 1598 source "arch/s390/Kconfig.debug"
1548 1599
1549+source "kernel/vserver/Kconfig" 1600+source "kernel/vserver/Kconfig"
1550+ 1601+
1551 source "security/Kconfig" 1602 source "security/Kconfig"
1552 1603
1553 source "crypto/Kconfig" 1604 source "crypto/Kconfig"
1554diff -NurpP --minimal linux-2.6.15.6/arch/s390/kernel/process.c linux-2.6.15.6-vs2.1.1-rc13/arch/s390/kernel/process.c 1605Index: linux-2.6.16/arch/s390/kernel/process.c
1555--- linux-2.6.15.6/arch/s390/kernel/process.c 2006-01-03 17:29:18 +0100 1606===================================================================
1556+++ linux-2.6.15.6-vs2.1.1-rc13/arch/s390/kernel/process.c 2006-02-14 11:37:05 +0100 1607--- linux-2.6.16.orig/arch/s390/kernel/process.c
1608+++ linux-2.6.16/arch/s390/kernel/process.c
1557@@ -153,10 +153,10 @@ void show_regs(struct pt_regs *regs) 1609@@ -164,9 +164,9 @@ void show_regs(struct pt_regs *regs)
1558 {
1559 struct task_struct *tsk = current; 1610 struct task_struct *tsk = current;
1560 1611
1561- printk("CPU: %d %s\n", tsk->thread_info->cpu, print_tainted()); 1612 printk("CPU: %d %s\n", task_thread_info(tsk)->cpu, print_tainted());
1562- printk("Process %s (pid: %d, task: %p, ksp: %p)\n", 1613- printk("Process %s (pid: %d, task: %p, ksp: %p)\n",
1563- current->comm, current->pid, (void *) tsk, 1614- current->comm, current->pid, (void *) tsk,
1564- (void *) tsk->thread.ksp); 1615- (void *) tsk->thread.ksp);
1565+ printk("CPU: %d %s\n", tsk->thread_info->cpu, print_tainted());
1566+ printk("Process %s (pid: %d[#%u], task: %p, ksp: %p)\n", 1616+ printk("Process %s (pid: %d[#%u], task: %p, ksp: %p)\n",
1567+ current->comm, current->pid, current->xid, 1617+ current->comm, current->pid, current->xid,
1568+ (void *) tsk, (void *) tsk->thread.ksp); 1618+ (void *) tsk, (void *) tsk->thread.ksp);
1569 1619
1570 show_registers(regs); 1620 show_registers(regs);
1571 /* Show stack backtrace if pt_regs is from kernel mode */ 1621 /* Show stack backtrace if pt_regs is from kernel mode */
1572@@ -186,7 +186,7 @@ int kernel_thread(int (*fn)(void *), voi 1622@@ -196,7 +196,7 @@ int kernel_thread(int (*fn)(void *), voi
1573 regs.orig_gpr2 = -1; 1623 regs.orig_gpr2 = -1;
1574 1624
1575 /* Ok, create the new process.. */ 1625 /* Ok, create the new process.. */
1576- return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 1626- return do_fork(flags | CLONE_VM | CLONE_UNTRACED,
1577+ return do_fork(flags | CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD, 1627+ return do_fork(flags | CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD,
1578 0, &regs, 0, NULL, NULL); 1628 0, &regs, 0, NULL, NULL);
1579 } 1629 }
1580 1630
1581diff -NurpP --minimal linux-2.6.15.6/arch/s390/kernel/ptrace.c linux-2.6.15.6-vs2.1.1-rc13/arch/s390/kernel/ptrace.c 1631Index: linux-2.6.16/arch/s390/kernel/ptrace.c
1582--- linux-2.6.15.6/arch/s390/kernel/ptrace.c 2005-06-22 02:37:59 +0200 1632===================================================================
1583+++ linux-2.6.15.6-vs2.1.1-rc13/arch/s390/kernel/ptrace.c 2006-02-14 12:35:41 +0100 1633--- linux-2.6.16.orig/arch/s390/kernel/ptrace.c
1584@@ -33,6 +33,7 @@ 1634+++ linux-2.6.16/arch/s390/kernel/ptrace.c
1585 #include <linux/security.h>
1586 #include <linux/audit.h>
1587 #include <linux/signal.h>
1588+#include <linux/vs_pid.h>
1589
1590 #include <asm/segment.h>
1591 #include <asm/page.h>
1592@@ -738,9 +739,11 @@ sys_ptrace(long request, long pid, long 1635@@ -723,7 +723,13 @@ sys_ptrace(long request, long pid, long
1593 read_unlock(&tasklist_lock);
1594 if (!child)
1595 goto out; 1636 goto out;
1637 }
1638
1596+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT)) 1639+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT)) {
1640+ ret = -EPERM;
1597+ goto out_tsk; 1641+ goto out_tsk;
1598 1642+ }
1643+
1599 ret = do_ptrace(child, request, addr, data); 1644 ret = do_ptrace(child, request, addr, data);
1600-
1601+out_tsk: 1645+out_tsk:
1602 put_task_struct(child); 1646 put_task_struct(child);
1603 out: 1647 out:
1604 unlock_kernel(); 1648 unlock_kernel();
1605diff -NurpP --minimal linux-2.6.15.6/arch/s390/kernel/syscalls.S linux-2.6.15.6-vs2.1.1-rc13/arch/s390/kernel/syscalls.S 1649Index: linux-2.6.16/arch/s390/kernel/syscalls.S
1606--- linux-2.6.15.6/arch/s390/kernel/syscalls.S 2005-08-29 22:24:55 +0200 1650===================================================================
1607+++ linux-2.6.15.6-vs2.1.1-rc13/arch/s390/kernel/syscalls.S 2006-01-04 21:59:59 +0100 1651--- linux-2.6.16.orig/arch/s390/kernel/syscalls.S
1652+++ linux-2.6.16/arch/s390/kernel/syscalls.S
1608@@ -271,7 +271,7 @@ SYSCALL(sys_clock_settime,sys_clock_sett 1653@@ -271,7 +271,7 @@ SYSCALL(sys_clock_settime,sys_clock_sett
1609 SYSCALL(sys_clock_gettime,sys_clock_gettime,sys32_clock_gettime_wrapper) /* 260 */ 1654 SYSCALL(sys_clock_gettime,sys_clock_gettime,sys32_clock_gettime_wrapper) /* 260 */
1610 SYSCALL(sys_clock_getres,sys_clock_getres,sys32_clock_getres_wrapper) 1655 SYSCALL(sys_clock_getres,sys_clock_getres,sys32_clock_getres_wrapper)
1611 SYSCALL(sys_clock_nanosleep,sys_clock_nanosleep,sys32_clock_nanosleep_wrapper) 1656 SYSCALL(sys_clock_nanosleep,sys_clock_nanosleep,sys32_clock_nanosleep_wrapper)
1612-NI_SYSCALL /* reserved for vserver */ 1657-NI_SYSCALL /* reserved for vserver */
1613+SYSCALL(sys_vserver,sys_vserver,sys32_vserver) 1658+SYSCALL(sys_vserver,sys_vserver,sys32_vserver)
1614 SYSCALL(s390_fadvise64_64,sys_ni_syscall,sys32_fadvise64_64_wrapper) 1659 SYSCALL(s390_fadvise64_64,sys_ni_syscall,sys32_fadvise64_64_wrapper)
1615 SYSCALL(sys_statfs64,sys_statfs64,compat_sys_statfs64_wrapper) 1660 SYSCALL(sys_statfs64,sys_statfs64,compat_sys_statfs64_wrapper)
1616 SYSCALL(sys_fstatfs64,sys_fstatfs64,compat_sys_fstatfs64_wrapper) 1661 SYSCALL(sys_fstatfs64,sys_fstatfs64,compat_sys_fstatfs64_wrapper)
1617diff -NurpP --minimal linux-2.6.15.6/arch/sh/Kconfig linux-2.6.15.6-vs2.1.1-rc13/arch/sh/Kconfig 1662Index: linux-2.6.16/arch/sh/Kconfig
1618--- linux-2.6.15.6/arch/sh/Kconfig 2006-01-03 17:29:18 +0100 1663===================================================================
1619+++ linux-2.6.15.6-vs2.1.1-rc13/arch/sh/Kconfig 2006-01-04 21:59:59 +0100 1664--- linux-2.6.16.orig/arch/sh/Kconfig
1665+++ linux-2.6.16/arch/sh/Kconfig
1620@@ -770,6 +770,8 @@ source "arch/sh/oprofile/Kconfig" 1666@@ -633,6 +633,8 @@ source "arch/sh/oprofile/Kconfig"
1621 1667
1622 source "arch/sh/Kconfig.debug" 1668 source "arch/sh/Kconfig.debug"
1623 1669
1624+source "kernel/vserver/Kconfig" 1670+source "kernel/vserver/Kconfig"
1625+ 1671+
1626 source "security/Kconfig" 1672 source "security/Kconfig"
1627 1673
1628 source "crypto/Kconfig" 1674 source "crypto/Kconfig"
1629diff -NurpP --minimal linux-2.6.15.6/arch/sh/kernel/kgdb_stub.c linux-2.6.15.6-vs2.1.1-rc13/arch/sh/kernel/kgdb_stub.c 1675Index: linux-2.6.16/arch/sh/kernel/kgdb_stub.c
1630--- linux-2.6.15.6/arch/sh/kernel/kgdb_stub.c 2004-08-14 12:54:51 +0200 1676===================================================================
1631+++ linux-2.6.15.6-vs2.1.1-rc13/arch/sh/kernel/kgdb_stub.c 2006-01-04 21:59:59 +0100 1677--- linux-2.6.16.orig/arch/sh/kernel/kgdb_stub.c
1678+++ linux-2.6.16/arch/sh/kernel/kgdb_stub.c
1632@@ -412,7 +412,7 @@ static struct task_struct *get_thread(in 1679@@ -412,7 +412,7 @@ static struct task_struct *get_thread(in
1633 if (pid == PID_MAX) pid = 0; 1680 if (pid == PID_MAX) pid = 0;
1634 1681
1635 /* First check via PID */ 1682 /* First check via PID */
1636- thread = find_task_by_pid(pid); 1683- thread = find_task_by_pid(pid);
1637+ thread = find_task_by_real_pid(pid); 1684+ thread = find_task_by_real_pid(pid);
1638 1685
1639 if (thread) 1686 if (thread)
1640 return thread; 1687 return thread;
1641diff -NurpP --minimal linux-2.6.15.6/arch/sh/kernel/process.c linux-2.6.15.6-vs2.1.1-rc13/arch/sh/kernel/process.c 1688Index: linux-2.6.16/arch/sh/kernel/process.c
1642--- linux-2.6.15.6/arch/sh/kernel/process.c 2006-01-03 17:29:18 +0100 1689===================================================================
1643+++ linux-2.6.15.6-vs2.1.1-rc13/arch/sh/kernel/process.c 2006-02-12 14:28:47 +0100 1690--- linux-2.6.16.orig/arch/sh/kernel/process.c
1691+++ linux-2.6.16/arch/sh/kernel/process.c
1644@@ -105,7 +105,8 @@ void machine_power_off(void) 1692@@ -113,7 +113,8 @@ void machine_power_off(void)
1645 void show_regs(struct pt_regs * regs) 1693 void show_regs(struct pt_regs * regs)
1646 { 1694 {
1647 printk("\n"); 1695 printk("\n");
1648- printk("Pid : %d, Comm: %20s\n", current->pid, current->comm); 1696- printk("Pid : %d, Comm: %20s\n", current->pid, current->comm);
1649+ printk("Pid : %d[#%u], Comm: %20s\n", 1697+ printk("Pid : %d[#%u], Comm: %20s\n",
1650+ current->pid, current->xid, current->comm); 1698+ current->pid, current->xid, current->comm);
1651 print_symbol("PC is at %s\n", regs->pc); 1699 print_symbol("PC is at %s\n", regs->pc);
1652 printk("PC : %08lx SP : %08lx SR : %08lx ", 1700 printk("PC : %08lx SP : %08lx SR : %08lx ",
1653 regs->pc, regs->regs[15], regs->sr); 1701 regs->pc, regs->regs[15], regs->sr);
1654@@ -173,7 +174,8 @@ int kernel_thread(int (*fn)(void *), voi 1702@@ -181,7 +182,8 @@ int kernel_thread(int (*fn)(void *), voi
1655 regs.sr = (1 << 30); 1703 regs.sr = (1 << 30);
1656 1704
1657 /* Ok, create the new process.. */ 1705 /* Ok, create the new process.. */
1658- return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, NULL); 1706- return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
1659+ return do_fork(flags | CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD, 1707+ return do_fork(flags | CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD,
1660+ 0, &regs, 0, NULL, NULL); 1708+ 0, &regs, 0, NULL, NULL);
1661 } 1709 }
1662 1710
1663 /* 1711 /*
1664diff -NurpP --minimal linux-2.6.15.6/arch/sh64/kernel/process.c linux-2.6.15.6-vs2.1.1-rc13/arch/sh64/kernel/process.c 1712Index: linux-2.6.16/arch/sh64/kernel/process.c
1665--- linux-2.6.15.6/arch/sh64/kernel/process.c 2006-01-03 17:29:19 +0100 1713===================================================================
1666+++ linux-2.6.15.6-vs2.1.1-rc13/arch/sh64/kernel/process.c 2006-01-04 21:59:59 +0100 1714--- linux-2.6.16.orig/arch/sh64/kernel/process.c
1715+++ linux-2.6.16/arch/sh64/kernel/process.c
1667@@ -637,7 +637,7 @@ int kernel_thread(int (*fn)(void *), voi 1716@@ -637,7 +637,7 @@ int kernel_thread(int (*fn)(void *), voi
1668 static __inline__ _syscall2(int,clone,unsigned long,flags,unsigned long,newsp) 1717 static __inline__ _syscall2(int,clone,unsigned long,flags,unsigned long,newsp)
1669 static __inline__ _syscall1(int,exit,int,ret) 1718 static __inline__ _syscall1(int,exit,int,ret)
1670 1719
1671- reply = clone(flags | CLONE_VM, 0); 1720- reply = clone(flags | CLONE_VM, 0);
1672+ reply = clone(flags | CLONE_VM | CLONE_KTHREAD, 0); 1721+ reply = clone(flags | CLONE_VM | CLONE_KTHREAD, 0);
1673 if (!reply) { 1722 if (!reply) {
1674 /* Child */ 1723 /* Child */
1675 reply = exit(fn(arg)); 1724 reply = exit(fn(arg));
1676diff -NurpP --minimal linux-2.6.15.6/arch/sparc/Kconfig linux-2.6.15.6-vs2.1.1-rc13/arch/sparc/Kconfig 1725Index: linux-2.6.16/arch/sparc/Kconfig
1677--- linux-2.6.15.6/arch/sparc/Kconfig 2006-01-03 17:29:19 +0100 1726===================================================================
1678+++ linux-2.6.15.6-vs2.1.1-rc13/arch/sparc/Kconfig 2006-01-04 21:59:59 +0100 1727--- linux-2.6.16.orig/arch/sparc/Kconfig
1728+++ linux-2.6.16/arch/sparc/Kconfig
1679@@ -288,6 +288,8 @@ source "fs/Kconfig" 1729@@ -284,6 +284,8 @@ source "fs/Kconfig"
1680 1730
1681 source "arch/sparc/Kconfig.debug" 1731 source "arch/sparc/Kconfig.debug"
1682 1732
1683+source "kernel/vserver/Kconfig" 1733+source "kernel/vserver/Kconfig"
1684+ 1734+
1685 source "security/Kconfig" 1735 source "security/Kconfig"
1686 1736
1687 source "crypto/Kconfig" 1737 source "crypto/Kconfig"
1688diff -NurpP --minimal linux-2.6.15.6/arch/sparc/kernel/process.c linux-2.6.15.6-vs2.1.1-rc13/arch/sparc/kernel/process.c 1738Index: linux-2.6.16/arch/sparc/kernel/process.c
1689--- linux-2.6.15.6/arch/sparc/kernel/process.c 2006-01-03 17:29:19 +0100 1739===================================================================
1690+++ linux-2.6.15.6-vs2.1.1-rc13/arch/sparc/kernel/process.c 2006-01-04 21:59:59 +0100 1740--- linux-2.6.16.orig/arch/sparc/kernel/process.c
1741+++ linux-2.6.16/arch/sparc/kernel/process.c
1691@@ -706,7 +706,8 @@ pid_t kernel_thread(int (*fn)(void *), v 1742@@ -706,7 +706,8 @@ pid_t kernel_thread(int (*fn)(void *), v
1692 /* Notreached by child. */ 1743 /* Notreached by child. */
1693 "1: mov %%o0, %0\n\t" : 1744 "1: mov %%o0, %0\n\t" :
1694 "=r" (retval) : 1745 "=r" (retval) :
1695- "i" (__NR_clone), "r" (flags | CLONE_VM | CLONE_UNTRACED), 1746- "i" (__NR_clone), "r" (flags | CLONE_VM | CLONE_UNTRACED),
1696+ "i" (__NR_clone), "r" (flags | 1747+ "i" (__NR_clone), "r" (flags |
1697+ CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD), 1748+ CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD),
1698 "i" (__NR_exit), "r" (fn), "r" (arg) : 1749 "i" (__NR_exit), "r" (fn), "r" (arg) :
1699 "g1", "g2", "g3", "o0", "o1", "memory", "cc"); 1750 "g1", "g2", "g3", "o0", "o1", "memory", "cc");
1700 return retval; 1751 return retval;
1701diff -NurpP --minimal linux-2.6.15.6/arch/sparc/kernel/ptrace.c linux-2.6.15.6-vs2.1.1-rc13/arch/sparc/kernel/ptrace.c 1752Index: linux-2.6.16/arch/sparc/kernel/ptrace.c
1702--- linux-2.6.15.6/arch/sparc/kernel/ptrace.c 2005-06-22 02:37:59 +0200 1753===================================================================
1703+++ linux-2.6.15.6-vs2.1.1-rc13/arch/sparc/kernel/ptrace.c 2006-02-14 10:31:04 +0100 1754--- linux-2.6.16.orig/arch/sparc/kernel/ptrace.c
1755+++ linux-2.6.16/arch/sparc/kernel/ptrace.c
1704@@ -19,6 +19,7 @@ 1756@@ -19,6 +19,7 @@
1705 #include <linux/smp_lock.h> 1757 #include <linux/smp_lock.h>
1706 #include <linux/security.h> 1758 #include <linux/security.h>
1707 #include <linux/signal.h> 1759 #include <linux/signal.h>
1708+#include <linux/vs_pid.h> 1760+#include <linux/vs_pid.h>
1709 1761
1710 #include <asm/pgtable.h> 1762 #include <asm/pgtable.h>
1711 #include <asm/system.h> 1763 #include <asm/system.h>
1712@@ -322,6 +323,10 @@ asmlinkage void do_ptrace(struct pt_regs 1764@@ -299,6 +300,10 @@ asmlinkage void do_ptrace(struct pt_regs
1713 pt_error_return(regs, ESRCH); 1765 pt_error_return(regs, -ret);
1714 goto out; 1766 goto out;
1715 } 1767 }
1716+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT)) { 1768+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT)) {
1717+ pt_error_return(regs, ESRCH); 1769+ pt_error_return(regs, ESRCH);
1718+ goto out_tsk; 1770+ goto out_tsk;
1719+ } 1771+ }
1720 1772
1721 if ((current->personality == PER_SUNOS && request == PTRACE_SUNATTACH) 1773 if ((current->personality == PER_SUNOS && request == PTRACE_SUNATTACH)
1722 || (current->personality != PER_SUNOS && request == PTRACE_ATTACH)) { 1774 || (current->personality != PER_SUNOS && request == PTRACE_ATTACH)) {
1723diff -NurpP --minimal linux-2.6.15.6/arch/sparc/kernel/sys_sparc.c linux-2.6.15.6-vs2.1.1-rc13/arch/sparc/kernel/sys_sparc.c 1775Index: linux-2.6.16/arch/sparc/kernel/sys_sparc.c
1724--- linux-2.6.15.6/arch/sparc/kernel/sys_sparc.c 2005-06-22 02:37:59 +0200 1776===================================================================
1725+++ linux-2.6.15.6-vs2.1.1-rc13/arch/sparc/kernel/sys_sparc.c 2006-01-04 21:59:59 +0100 1777--- linux-2.6.16.orig/arch/sparc/kernel/sys_sparc.c
1778+++ linux-2.6.16/arch/sparc/kernel/sys_sparc.c
1726@@ -21,6 +21,7 @@ 1779@@ -21,6 +21,7 @@
1727 #include <linux/utsname.h> 1780 #include <linux/utsname.h>
1728 #include <linux/smp.h> 1781 #include <linux/smp.h>
1729 #include <linux/smp_lock.h> 1782 #include <linux/smp_lock.h>
1730+#include <linux/vs_cvirt.h> 1783+#include <linux/vs_cvirt.h>
1745- if (copy_to_user(name, system_utsname.domainname, len)) 1798- if (copy_to_user(name, system_utsname.domainname, len))
1746+ if (copy_to_user(name, vx_new_uts(domainname), len)) 1799+ if (copy_to_user(name, vx_new_uts(domainname), len))
1747 goto done; 1800 goto done;
1748 err = 0; 1801 err = 0;
1749 done: 1802 done:
1750diff -NurpP --minimal linux-2.6.15.6/arch/sparc/kernel/systbls.S linux-2.6.15.6-vs2.1.1-rc13/arch/sparc/kernel/systbls.S 1803Index: linux-2.6.16/arch/sparc/kernel/systbls.S
1751--- linux-2.6.15.6/arch/sparc/kernel/systbls.S 2005-08-29 22:24:56 +0200 1804===================================================================
1752+++ linux-2.6.15.6-vs2.1.1-rc13/arch/sparc/kernel/systbls.S 2006-01-04 21:59:59 +0100 1805--- linux-2.6.16.orig/arch/sparc/kernel/systbls.S
1806+++ linux-2.6.16/arch/sparc/kernel/systbls.S
1753@@ -72,7 +72,7 @@ sys_call_table: 1807@@ -72,7 +72,7 @@ sys_call_table:
1754 /*250*/ .long sparc_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl 1808 /*250*/ .long sparc_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl
1755 /*255*/ .long sys_nis_syscall, sys_clock_settime, sys_clock_gettime, sys_clock_getres, sys_clock_nanosleep 1809 /*255*/ .long sys_nis_syscall, sys_clock_settime, sys_clock_gettime, sys_clock_getres, sys_clock_nanosleep
1756 /*260*/ .long sys_sched_getaffinity, sys_sched_setaffinity, sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun 1810 /*260*/ .long sys_sched_getaffinity, sys_sched_setaffinity, sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun
1757-/*265*/ .long sys_timer_delete, sys_timer_create, sys_nis_syscall, sys_io_setup, sys_io_destroy 1811-/*265*/ .long sys_timer_delete, sys_timer_create, sys_nis_syscall, sys_io_setup, sys_io_destroy
1758+/*265*/ .long sys_timer_delete, sys_timer_create, sys_vserver, sys_io_setup, sys_io_destroy 1812+/*265*/ .long sys_timer_delete, sys_timer_create, sys_vserver, sys_io_setup, sys_io_destroy
1759 /*270*/ .long sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink 1813 /*270*/ .long sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink
1760 /*275*/ .long sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid 1814 /*275*/ .long sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid
1761 /*280*/ .long sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl 1815 /*280*/ .long sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl, sys_openat
1762diff -NurpP --minimal linux-2.6.15.6/arch/sparc/kernel/traps.c linux-2.6.15.6-vs2.1.1-rc13/arch/sparc/kernel/traps.c 1816Index: linux-2.6.16/arch/sparc/kernel/traps.c
1763--- linux-2.6.15.6/arch/sparc/kernel/traps.c 2005-03-02 12:38:25 +0100 1817===================================================================
1764+++ linux-2.6.15.6-vs2.1.1-rc13/arch/sparc/kernel/traps.c 2006-02-12 14:28:47 +0100 1818--- linux-2.6.16.orig/arch/sparc/kernel/traps.c
1819+++ linux-2.6.16/arch/sparc/kernel/traps.c
1765@@ -100,7 +100,8 @@ void die_if_kernel(char *str, struct pt_ 1820@@ -100,7 +100,8 @@ void die_if_kernel(char *str, struct pt_
1766 " /_| \\__/ |_\\\n" 1821 " /_| \\__/ |_\\\n"
1767 " \\__U_/\n"); 1822 " \\__U_/\n");
1768 1823
1769- printk("%s(%d): %s [#%d]\n", current->comm, current->pid, str, ++die_counter); 1824- printk("%s(%d): %s [#%d]\n", current->comm, current->pid, str, ++die_counter);
1770+ printk("%s(%d[#%u]): %s [#%d]\n", current->comm, 1825+ printk("%s(%d[#%u]): %s [#%d]\n", current->comm,
1771+ current->pid, current->xid, str, ++die_counter); 1826+ current->pid, current->xid, str, ++die_counter);
1772 show_regs(regs); 1827 show_regs(regs);
1773 1828
1774 __SAVE; __SAVE; __SAVE; __SAVE; 1829 __SAVE; __SAVE; __SAVE; __SAVE;
1775diff -NurpP --minimal linux-2.6.15.6/arch/sparc64/Kconfig linux-2.6.15.6-vs2.1.1-rc13/arch/sparc64/Kconfig 1830Index: linux-2.6.16/arch/sparc64/Kconfig
1776--- linux-2.6.15.6/arch/sparc64/Kconfig 2006-03-11 03:08:51 +0100 1831===================================================================
1777+++ linux-2.6.15.6-vs2.1.1-rc13/arch/sparc64/Kconfig 2006-02-13 09:54:15 +0100 1832--- linux-2.6.16.orig/arch/sparc64/Kconfig
1833+++ linux-2.6.16/arch/sparc64/Kconfig
1778@@ -398,6 +398,8 @@ endmenu 1834@@ -394,6 +394,8 @@ endmenu
1779 1835
1780 source "arch/sparc64/Kconfig.debug" 1836 source "arch/sparc64/Kconfig.debug"
1781 1837
1782+source "kernel/vserver/Kconfig" 1838+source "kernel/vserver/Kconfig"
1783+ 1839+
1784 source "security/Kconfig" 1840 source "security/Kconfig"
1785 1841
1786 source "crypto/Kconfig" 1842 source "crypto/Kconfig"
1787diff -NurpP --minimal linux-2.6.15.6/arch/sparc64/kernel/binfmt_aout32.c linux-2.6.15.6-vs2.1.1-rc13/arch/sparc64/kernel/binfmt_aout32.c 1843Index: linux-2.6.16/arch/sparc64/kernel/binfmt_aout32.c
1844===================================================================
1788--- linux-2.6.15.6/arch/sparc64/kernel/binfmt_aout32.c 2006-01-03 17:29:19 +0100 1845--- linux-2.6.16.orig/arch/sparc64/kernel/binfmt_aout32.c
1789+++ linux-2.6.15.6-vs2.1.1-rc13/arch/sparc64/kernel/binfmt_aout32.c 2006-01-04 21:59:59 +0100 1846+++ linux-2.6.16/arch/sparc64/kernel/binfmt_aout32.c
1790@@ -27,6 +27,7 @@ 1847@@ -27,6 +27,7 @@
1791 #include <linux/binfmts.h> 1848 #include <linux/binfmts.h>
1792 #include <linux/personality.h> 1849 #include <linux/personality.h>
1793 #include <linux/init.h> 1850 #include <linux/init.h>
1794+#include <linux/vs_memory.h> 1851+#include <linux/vs_memory.h>
1795 1852
1796 #include <asm/system.h> 1853 #include <asm/system.h>
1797 #include <asm/uaccess.h> 1854 #include <asm/uaccess.h>
1798diff -NurpP --minimal linux-2.6.15.6/arch/sparc64/kernel/process.c linux-2.6.15.6-vs2.1.1-rc13/arch/sparc64/kernel/process.c 1855Index: linux-2.6.16/arch/sparc64/kernel/process.c
1799--- linux-2.6.15.6/arch/sparc64/kernel/process.c 2006-01-03 17:29:19 +0100 1856===================================================================
1800+++ linux-2.6.15.6-vs2.1.1-rc13/arch/sparc64/kernel/process.c 2006-01-04 21:59:59 +0100 1857--- linux-2.6.16.orig/arch/sparc64/kernel/process.c
1858+++ linux-2.6.16/arch/sparc64/kernel/process.c
1801@@ -713,7 +713,8 @@ pid_t kernel_thread(int (*fn)(void *), v 1859@@ -717,7 +717,8 @@ pid_t kernel_thread(int (*fn)(void *), v
1802 /* Notreached by child. */ 1860 /* Notreached by child. */
1803 "1:" : 1861 "1:" :
1804 "=r" (retval) : 1862 "=r" (retval) :
1805- "i" (__NR_clone), "r" (flags | CLONE_VM | CLONE_UNTRACED), 1863- "i" (__NR_clone), "r" (flags | CLONE_VM | CLONE_UNTRACED),
1806+ "i" (__NR_clone), "r" (flags | 1864+ "i" (__NR_clone), "r" (flags |
1807+ CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD), 1865+ CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD),
1808 "i" (__NR_exit), "r" (fn), "r" (arg) : 1866 "i" (__NR_exit), "r" (fn), "r" (arg) :
1809 "g1", "g2", "g3", "o0", "o1", "memory", "cc"); 1867 "g1", "g2", "g3", "o0", "o1", "memory", "cc");
1810 return retval; 1868 return retval;
1811diff -NurpP --minimal linux-2.6.15.6/arch/sparc64/kernel/ptrace.c linux-2.6.15.6-vs2.1.1-rc13/arch/sparc64/kernel/ptrace.c 1869Index: linux-2.6.16/arch/sparc64/kernel/ptrace.c
1812--- linux-2.6.15.6/arch/sparc64/kernel/ptrace.c 2005-10-28 20:49:16 +0200 1870===================================================================
1813+++ linux-2.6.15.6-vs2.1.1-rc13/arch/sparc64/kernel/ptrace.c 2006-02-14 10:29:30 +0100 1871--- linux-2.6.16.orig/arch/sparc64/kernel/ptrace.c
1872+++ linux-2.6.16/arch/sparc64/kernel/ptrace.c
1814@@ -22,6 +22,7 @@ 1873@@ -22,6 +22,7 @@
1815 #include <linux/seccomp.h> 1874 #include <linux/seccomp.h>
1816 #include <linux/audit.h> 1875 #include <linux/audit.h>
1817 #include <linux/signal.h> 1876 #include <linux/signal.h>
1818+#include <linux/vs_pid.h> 1877+#include <linux/vs_pid.h>
1819 1878
1820 #include <asm/asi.h> 1879 #include <asm/asi.h>
1821 #include <asm/pgtable.h> 1880 #include <asm/pgtable.h>
1822@@ -233,6 +234,10 @@ asmlinkage void do_ptrace(struct pt_regs 1881@@ -209,6 +210,10 @@ asmlinkage void do_ptrace(struct pt_regs
1823 pt_error_return(regs, ESRCH); 1882 pt_error_return(regs, -ret);
1824 goto out; 1883 goto out;
1825 } 1884 }
1826+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT)) { 1885+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT)) {
1827+ pt_error_return(regs, ESRCH); 1886+ pt_error_return(regs, ESRCH);
1828+ goto out_tsk; 1887+ goto out_tsk;
1829+ } 1888+ }
1830 1889
1831 if ((current->personality == PER_SUNOS && request == PTRACE_SUNATTACH) 1890 if ((current->personality == PER_SUNOS && request == PTRACE_SUNATTACH)
1832 || (current->personality != PER_SUNOS && request == PTRACE_ATTACH)) { 1891 || (current->personality != PER_SUNOS && request == PTRACE_ATTACH)) {
1833diff -NurpP --minimal linux-2.6.15.6/arch/sparc64/kernel/sys_sparc.c linux-2.6.15.6-vs2.1.1-rc13/arch/sparc64/kernel/sys_sparc.c 1892Index: linux-2.6.16/arch/sparc64/kernel/sys_sparc.c
1834--- linux-2.6.15.6/arch/sparc64/kernel/sys_sparc.c 2005-08-29 22:24:56 +0200 1893===================================================================
1835+++ linux-2.6.15.6-vs2.1.1-rc13/arch/sparc64/kernel/sys_sparc.c 2006-01-04 21:59:59 +0100 1894--- linux-2.6.16.orig/arch/sparc64/kernel/sys_sparc.c
1895+++ linux-2.6.16/arch/sparc64/kernel/sys_sparc.c
1836@@ -25,6 +25,7 @@ 1896@@ -25,6 +25,7 @@
1837 #include <linux/syscalls.h> 1897 #include <linux/syscalls.h>
1838 #include <linux/ipc.h> 1898 #include <linux/ipc.h>
1839 #include <linux/personality.h> 1899 #include <linux/personality.h>
1840+#include <linux/vs_cvirt.h> 1900+#include <linux/vs_cvirt.h>
1855- if (copy_to_user(name, system_utsname.domainname, len)) 1915- if (copy_to_user(name, system_utsname.domainname, len))
1856+ if (copy_to_user(name, vx_new_uts(domainname), len)) 1916+ if (copy_to_user(name, vx_new_uts(domainname), len))
1857 goto done; 1917 goto done;
1858 err = 0; 1918 err = 0;
1859 done: 1919 done:
1860diff -NurpP --minimal linux-2.6.15.6/arch/sparc64/kernel/systbls.S linux-2.6.15.6-vs2.1.1-rc13/arch/sparc64/kernel/systbls.S 1920Index: linux-2.6.16/arch/sparc64/kernel/systbls.S
1861--- linux-2.6.15.6/arch/sparc64/kernel/systbls.S 2006-03-11 03:08:51 +0100 1921===================================================================
1862+++ linux-2.6.15.6-vs2.1.1-rc13/arch/sparc64/kernel/systbls.S 2006-02-13 09:54:15 +0100 1922--- linux-2.6.16.orig/arch/sparc64/kernel/systbls.S
1923+++ linux-2.6.16/arch/sparc64/kernel/systbls.S
1863@@ -73,7 +73,7 @@ sys_call_table32: 1924@@ -73,7 +73,7 @@ sys_call_table32:
1864 /*250*/ .word sys32_mremap, sys32_sysctl, sys32_getsid, sys_fdatasync, sys32_nfsservctl 1925 /*250*/ .word sys32_mremap, sys32_sysctl, sys32_getsid, sys_fdatasync, sys32_nfsservctl
1865 .word sys_ni_syscall, compat_sys_clock_settime, compat_sys_clock_gettime, compat_sys_clock_getres, sys32_clock_nanosleep 1926 .word sys_ni_syscall, compat_sys_clock_settime, compat_sys_clock_gettime, compat_sys_clock_getres, sys32_clock_nanosleep
1866 /*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_sys_timer_gettime, sys_timer_getoverrun 1927 /*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_sys_timer_gettime, sys_timer_getoverrun
1867- .word sys_timer_delete, sys32_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy 1928- .word sys_timer_delete, compat_sys_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy
1868+ .word sys_timer_delete, sys32_timer_create, sys32_vserver, compat_sys_io_setup, sys_io_destroy 1929+ .word sys_timer_delete, compat_sys_timer_create, sys32_vserver, compat_sys_io_setup, sys_io_destroy
1869 /*270*/ .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink 1930 /*270*/ .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink
1870 .word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid 1931 .word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid
1871 /*280*/ .word sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl 1932 /*280*/ .word sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl, compat_sys_openat
1872@@ -139,7 +139,7 @@ sys_call_table: 1933@@ -142,7 +142,7 @@ sys_call_table:
1873 /*250*/ .word sys64_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl 1934 /*250*/ .word sys64_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl
1874 .word sys_ni_syscall, sys_clock_settime, sys_clock_gettime, sys_clock_getres, sys_clock_nanosleep 1935 .word sys_ni_syscall, sys_clock_settime, sys_clock_gettime, sys_clock_getres, sys_clock_nanosleep
1875 /*260*/ .word sys_sched_getaffinity, sys_sched_setaffinity, sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun 1936 /*260*/ .word sys_sched_getaffinity, sys_sched_setaffinity, sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun
1876- .word sys_timer_delete, sys_timer_create, sys_ni_syscall, sys_io_setup, sys_io_destroy 1937- .word sys_timer_delete, sys_timer_create, sys_ni_syscall, sys_io_setup, sys_io_destroy
1877+ .word sys_timer_delete, sys_timer_create, sys_vserver, sys_io_setup, sys_io_destroy 1938+ .word sys_timer_delete, sys_timer_create, sys_vserver, sys_io_setup, sys_io_destroy
1878 /*270*/ .word sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink 1939 /*270*/ .word sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink
1879 .word sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid 1940 .word sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid
1880 /*280*/ .word sys_nis_syscall, sys_add_key, sys_request_key, sys_keyctl 1941 /*280*/ .word sys_nis_syscall, sys_add_key, sys_request_key, sys_keyctl, sys_openat
1881diff -NurpP --minimal linux-2.6.15.6/arch/sparc64/kernel/traps.c linux-2.6.15.6-vs2.1.1-rc13/arch/sparc64/kernel/traps.c 1942Index: linux-2.6.16/arch/sparc64/kernel/traps.c
1882--- linux-2.6.15.6/arch/sparc64/kernel/traps.c 2005-10-28 20:49:16 +0200 1943===================================================================
1883+++ linux-2.6.15.6-vs2.1.1-rc13/arch/sparc64/kernel/traps.c 2006-02-12 14:28:47 +0100 1944--- linux-2.6.16.orig/arch/sparc64/kernel/traps.c
1945+++ linux-2.6.16/arch/sparc64/kernel/traps.c
1884@@ -1896,7 +1896,8 @@ void die_if_kernel(char *str, struct pt_ 1946@@ -1896,7 +1896,8 @@ void die_if_kernel(char *str, struct pt_
1885 " /_| \\__/ |_\\\n" 1947 " /_| \\__/ |_\\\n"
1886 " \\__U_/\n"); 1948 " \\__U_/\n");
1887 1949
1888- printk("%s(%d): %s [#%d]\n", current->comm, current->pid, str, ++die_counter); 1950- printk("%s(%d): %s [#%d]\n", current->comm, current->pid, str, ++die_counter);
1889+ printk("%s(%d[#%u]): %s [#%d]\n", current->comm, 1951+ printk("%s(%d[#%u]): %s [#%d]\n", current->comm,
1890+ current->pid, current->xid, str, ++die_counter); 1952+ current->pid, current->xid, str, ++die_counter);
1891 notify_die(DIE_OOPS, str, regs, 0, 255, SIGSEGV); 1953 notify_die(DIE_OOPS, str, regs, 0, 255, SIGSEGV);
1892 __asm__ __volatile__("flushw"); 1954 __asm__ __volatile__("flushw");
1893 __show_regs(regs); 1955 __show_regs(regs);
1894diff -NurpP --minimal linux-2.6.15.6/arch/sparc64/solaris/fs.c linux-2.6.15.6-vs2.1.1-rc13/arch/sparc64/solaris/fs.c 1956Index: linux-2.6.16/arch/sparc64/solaris/fs.c
1895--- linux-2.6.15.6/arch/sparc64/solaris/fs.c 2004-12-25 01:54:50 +0100 1957===================================================================
1896+++ linux-2.6.15.6-vs2.1.1-rc13/arch/sparc64/solaris/fs.c 2006-01-04 21:59:59 +0100 1958--- linux-2.6.16.orig/arch/sparc64/solaris/fs.c
1959+++ linux-2.6.16/arch/sparc64/solaris/fs.c
1897@@ -362,7 +362,7 @@ static int report_statvfs(struct vfsmoun 1960@@ -363,7 +363,7 @@ static int report_statvfs(struct vfsmoun
1898 int j = strlen (p); 1961 int j = strlen (p);
1899 1962
1900 if (j > 15) j = 15; 1963 if (j > 15) j = 15;
1901- if (IS_RDONLY(inode)) i = 1; 1964- if (IS_RDONLY(inode)) i = 1;
1902+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(mnt)) i = 1; 1965+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(mnt)) i = 1;
1903 if (mnt->mnt_flags & MNT_NOSUID) i |= 2; 1966 if (mnt->mnt_flags & MNT_NOSUID) i |= 2;
1904 if (!sysv_valid_dev(inode->i_sb->s_dev)) 1967 if (!sysv_valid_dev(inode->i_sb->s_dev))
1905 return -EOVERFLOW; 1968 return -EOVERFLOW;
1906@@ -398,7 +398,7 @@ static int report_statvfs64(struct vfsmo 1969@@ -399,7 +399,7 @@ static int report_statvfs64(struct vfsmo
1907 int j = strlen (p); 1970 int j = strlen (p);
1908 1971
1909 if (j > 15) j = 15; 1972 if (j > 15) j = 15;
1910- if (IS_RDONLY(inode)) i = 1; 1973- if (IS_RDONLY(inode)) i = 1;
1911+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(mnt)) i = 1; 1974+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(mnt)) i = 1;
1912 if (mnt->mnt_flags & MNT_NOSUID) i |= 2; 1975 if (mnt->mnt_flags & MNT_NOSUID) i |= 2;
1913 if (!sysv_valid_dev(inode->i_sb->s_dev)) 1976 if (!sysv_valid_dev(inode->i_sb->s_dev))
1914 return -EOVERFLOW; 1977 return -EOVERFLOW;
1915diff -NurpP --minimal linux-2.6.15.6/arch/um/Kconfig linux-2.6.15.6-vs2.1.1-rc13/arch/um/Kconfig 1978Index: linux-2.6.16/arch/um/Kconfig
1916--- linux-2.6.15.6/arch/um/Kconfig 2006-01-03 17:29:19 +0100 1979===================================================================
1917+++ linux-2.6.15.6-vs2.1.1-rc13/arch/um/Kconfig 2006-01-04 21:59:59 +0100 1980--- linux-2.6.16.orig/arch/um/Kconfig
1981+++ linux-2.6.16/arch/um/Kconfig
1918@@ -293,6 +293,8 @@ source "drivers/connector/Kconfig" 1982@@ -290,6 +290,8 @@ source "drivers/connector/Kconfig"
1919 1983
1920 source "fs/Kconfig" 1984 source "fs/Kconfig"
1921 1985
1922+source "kernel/vserver/Kconfig" 1986+source "kernel/vserver/Kconfig"
1923+ 1987+
1924 source "security/Kconfig" 1988 source "security/Kconfig"
1925 1989
1926 source "crypto/Kconfig" 1990 source "crypto/Kconfig"
1927diff -NurpP --minimal linux-2.6.15.6/arch/um/drivers/mconsole_kern.c linux-2.6.15.6-vs2.1.1-rc13/arch/um/drivers/mconsole_kern.c 1991Index: linux-2.6.16/arch/um/drivers/mconsole_kern.c
1928--- linux-2.6.15.6/arch/um/drivers/mconsole_kern.c 2005-10-28 20:49:17 +0200 1992===================================================================
1929+++ linux-2.6.15.6-vs2.1.1-rc13/arch/um/drivers/mconsole_kern.c 2006-02-14 11:37:05 +0100 1993--- linux-2.6.16.orig/arch/um/drivers/mconsole_kern.c
1994+++ linux-2.6.16/arch/um/drivers/mconsole_kern.c
1930@@ -20,6 +20,7 @@ 1995@@ -21,6 +21,7 @@
1931 #include "linux/namei.h"
1932 #include "linux/proc_fs.h" 1996 #include "linux/proc_fs.h"
1933 #include "linux/syscalls.h" 1997 #include "linux/syscalls.h"
1998 #include "linux/console.h"
1934+#include "linux/vs_pid.h" 1999+#include "linux/vs_pid.h"
1935 #include "asm/irq.h" 2000 #include "asm/irq.h"
1936 #include "asm/uaccess.h" 2001 #include "asm/uaccess.h"
1937 #include "user_util.h" 2002 #include "user_util.h"
1938diff -NurpP --minimal linux-2.6.15.6/arch/um/kernel/process_kern.c linux-2.6.15.6-vs2.1.1-rc13/arch/um/kernel/process_kern.c 2003Index: linux-2.6.16/arch/um/kernel/process_kern.c
1939--- linux-2.6.15.6/arch/um/kernel/process_kern.c 2006-01-03 17:29:19 +0100 2004===================================================================
1940+++ linux-2.6.15.6-vs2.1.1-rc13/arch/um/kernel/process_kern.c 2006-02-13 16:25:38 +0100 2005--- linux-2.6.16.orig/arch/um/kernel/process_kern.c
2006+++ linux-2.6.16/arch/um/kernel/process_kern.c
1941@@ -23,6 +23,8 @@ 2007@@ -23,6 +23,8 @@
1942 #include "linux/proc_fs.h" 2008 #include "linux/proc_fs.h"
1943 #include "linux/ptrace.h" 2009 #include "linux/ptrace.h"
1944 #include "linux/random.h" 2010 #include "linux/random.h"
1945+#include "linux/vs_pid.h" 2011+#include "linux/vs_pid.h"
1946+ 2012+
1947 #include "asm/unistd.h" 2013 #include "asm/unistd.h"
1948 #include "asm/mman.h" 2014 #include "asm/mman.h"
1949 #include "asm/segment.h" 2015 #include "asm/segment.h"
1950@@ -97,7 +99,7 @@ int kernel_thread(int (*fn)(void *), voi 2016@@ -95,7 +97,7 @@ int kernel_thread(int (*fn)(void *), voi
1951 2017
1952 current->thread.request.u.thread.proc = fn; 2018 current->thread.request.u.thread.proc = fn;
1953 current->thread.request.u.thread.arg = arg; 2019 current->thread.request.u.thread.arg = arg;
1954- pid = do_fork(CLONE_VM | CLONE_UNTRACED | flags, 0, 2020- pid = do_fork(CLONE_VM | CLONE_UNTRACED | flags, 0,
1955+ pid = do_fork(CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD | flags, 0, 2021+ pid = do_fork(CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD | flags, 0,
1956 &current->thread.regs, 0, NULL, NULL); 2022 &current->thread.regs, 0, NULL, NULL);
1957 if(pid < 0) 2023 if(pid < 0)
1958 panic("do_fork failed in kernel_thread, errno = %d", pid); 2024 panic("do_fork failed in kernel_thread, errno = %d", pid);
1959diff -NurpP --minimal linux-2.6.15.6/arch/um/kernel/syscall_kern.c linux-2.6.15.6-vs2.1.1-rc13/arch/um/kernel/syscall_kern.c 2025Index: linux-2.6.16/arch/um/kernel/syscall_kern.c
1960--- linux-2.6.15.6/arch/um/kernel/syscall_kern.c 2005-08-29 22:24:56 +0200 2026===================================================================
1961+++ linux-2.6.15.6-vs2.1.1-rc13/arch/um/kernel/syscall_kern.c 2006-01-04 21:59:59 +0100 2027--- linux-2.6.16.orig/arch/um/kernel/syscall_kern.c
2028+++ linux-2.6.16/arch/um/kernel/syscall_kern.c
1962@@ -15,6 +15,8 @@ 2029@@ -15,6 +15,8 @@
1963 #include "linux/unistd.h" 2030 #include "linux/unistd.h"
1964 #include "linux/slab.h" 2031 #include "linux/slab.h"
1965 #include "linux/utime.h" 2032 #include "linux/utime.h"
1966+#include <linux/vs_cvirt.h> 2033+#include <linux/vs_cvirt.h>
2009- error |= __copy_to_user(&name->machine,&system_utsname.machine, 2076- error |= __copy_to_user(&name->machine,&system_utsname.machine,
2010+ error |= __copy_to_user(&name->machine,ptr->machine, 2077+ error |= __copy_to_user(&name->machine,ptr->machine,
2011 __OLD_UTS_LEN); 2078 __OLD_UTS_LEN);
2012 error |= __put_user(0,name->machine+__OLD_UTS_LEN); 2079 error |= __put_user(0,name->machine+__OLD_UTS_LEN);
2013 2080
2014diff -NurpP --minimal linux-2.6.15.6/arch/v850/Kconfig linux-2.6.15.6-vs2.1.1-rc13/arch/v850/Kconfig 2081Index: linux-2.6.16/arch/v850/Kconfig
2015--- linux-2.6.15.6/arch/v850/Kconfig 2006-01-03 17:29:20 +0100 2082===================================================================
2016+++ linux-2.6.15.6-vs2.1.1-rc13/arch/v850/Kconfig 2006-01-04 21:59:59 +0100 2083--- linux-2.6.16.orig/arch/v850/Kconfig
2084+++ linux-2.6.16/arch/v850/Kconfig
2017@@ -319,6 +319,8 @@ source "drivers/usb/Kconfig" 2085@@ -320,6 +320,8 @@ source "drivers/usb/Kconfig"
2018 2086
2019 source "arch/v850/Kconfig.debug" 2087 source "arch/v850/Kconfig.debug"
2020 2088
2021+source "kernel/vserver/Kconfig" 2089+source "kernel/vserver/Kconfig"
2022+ 2090+
2023 source "security/Kconfig" 2091 source "security/Kconfig"
2024 2092
2025 source "crypto/Kconfig" 2093 source "crypto/Kconfig"
2026diff -NurpP --minimal linux-2.6.15.6/arch/v850/kernel/process.c linux-2.6.15.6-vs2.1.1-rc13/arch/v850/kernel/process.c 2094Index: linux-2.6.16/arch/v850/kernel/process.c
2027--- linux-2.6.15.6/arch/v850/kernel/process.c 2006-01-03 17:29:20 +0100 2095===================================================================
2028+++ linux-2.6.15.6-vs2.1.1-rc13/arch/v850/kernel/process.c 2006-01-04 21:59:59 +0100 2096--- linux-2.6.16.orig/arch/v850/kernel/process.c
2097+++ linux-2.6.16/arch/v850/kernel/process.c
2029@@ -81,7 +81,7 @@ int kernel_thread (int (*fn)(void *), vo 2098@@ -84,7 +84,7 @@ int kernel_thread (int (*fn)(void *), vo
2030 /* Clone this thread. Note that we don't pass the clone syscall's 2099 /* Clone this thread. Note that we don't pass the clone syscall's
2031 second argument -- it's ignored for calls from kernel mode (the 2100 second argument -- it's ignored for calls from kernel mode (the
2032 child's SP is always set to the top of the kernel stack). */ 2101 child's SP is always set to the top of the kernel stack). */
2033- arg0 = flags | CLONE_VM; 2102- arg0 = flags | CLONE_VM;
2034+ arg0 = flags | CLONE_VM | CLONE_KTHREAD; 2103+ arg0 = flags | CLONE_VM | CLONE_KTHREAD;
2035 syscall = __NR_clone; 2104 syscall = __NR_clone;
2036 asm volatile ("trap " SYSCALL_SHORT_TRAP 2105 asm volatile ("trap " SYSCALL_SHORT_TRAP
2037 : "=r" (ret), "=r" (syscall) 2106 : "=r" (ret), "=r" (syscall)
2038diff -NurpP --minimal linux-2.6.15.6/arch/v850/kernel/ptrace.c linux-2.6.15.6-vs2.1.1-rc13/arch/v850/kernel/ptrace.c 2107Index: linux-2.6.16/arch/v850/kernel/ptrace.c
2039--- linux-2.6.15.6/arch/v850/kernel/ptrace.c 2006-01-03 17:29:20 +0100 2108===================================================================
2040+++ linux-2.6.15.6-vs2.1.1-rc13/arch/v850/kernel/ptrace.c 2006-01-04 21:59:59 +0100 2109--- linux-2.6.16.orig/arch/v850/kernel/ptrace.c
2110+++ linux-2.6.16/arch/v850/kernel/ptrace.c
2041@@ -137,6 +137,8 @@ long arch_ptrace(struct task_struct *chi 2111@@ -137,6 +137,8 @@ long arch_ptrace(struct task_struct *chi
2042 break; 2112 break;
2043 rval = -EIO; 2113 rval = -EIO;
2044 goto out; 2114 goto out;
2045+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT)) 2115+ if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT))
2046+ goto out_tsk; 2116+ goto out_tsk;
2047 2117
2048 /* Read/write the word at location ADDR in the registers. */ 2118 /* Read/write the word at location ADDR in the registers. */
2049 case PTRACE_PEEKUSR: 2119 case PTRACE_PEEKUSR:
2050diff -NurpP --minimal linux-2.6.15.6/arch/x86_64/Kconfig linux-2.6.15.6-vs2.1.1-rc13/arch/x86_64/Kconfig 2120Index: linux-2.6.16/arch/x86_64/Kconfig
2051--- linux-2.6.15.6/arch/x86_64/Kconfig 2006-01-03 17:29:20 +0100 2121===================================================================
2052+++ linux-2.6.15.6-vs2.1.1-rc13/arch/x86_64/Kconfig 2006-01-04 21:59:59 +0100 2122--- linux-2.6.16.orig/arch/x86_64/Kconfig
2123+++ linux-2.6.16/arch/x86_64/Kconfig
2053@@ -574,6 +574,8 @@ endmenu 2124@@ -588,6 +588,8 @@ endmenu
2054 2125
2055 source "arch/x86_64/Kconfig.debug" 2126 source "arch/x86_64/Kconfig.debug"
2056 2127
2057+source "kernel/vserver/Kconfig" 2128+source "kernel/vserver/Kconfig"
2058+ 2129+
2059 source "security/Kconfig" 2130 source "security/Kconfig"
2060 2131
2061 source "crypto/Kconfig" 2132 source "crypto/Kconfig"
2062diff -NurpP --minimal linux-2.6.15.6/arch/x86_64/ia32/ia32_aout.c linux-2.6.15.6-vs2.1.1-rc13/arch/x86_64/ia32/ia32_aout.c 2133Index: linux-2.6.16/arch/x86_64/ia32/ia32_aout.c
2063--- linux-2.6.15.6/arch/x86_64/ia32/ia32_aout.c 2006-01-03 17:29:20 +0100 2134===================================================================
2064+++ linux-2.6.15.6-vs2.1.1-rc13/arch/x86_64/ia32/ia32_aout.c 2006-01-04 21:59:59 +0100 2135--- linux-2.6.16.orig/arch/x86_64/ia32/ia32_aout.c
2136+++ linux-2.6.16/arch/x86_64/ia32/ia32_aout.c
2065@@ -25,6 +25,7 @@ 2137@@ -25,6 +25,7 @@
2066 #include <linux/binfmts.h> 2138 #include <linux/binfmts.h>
2067 #include <linux/personality.h> 2139 #include <linux/personality.h>
2068 #include <linux/init.h> 2140 #include <linux/init.h>
2069+#include <linux/vs_memory.h> 2141+#include <linux/vs_memory.h>
2070 2142
2071 #include <asm/system.h> 2143 #include <asm/system.h>
2072 #include <asm/uaccess.h> 2144 #include <asm/uaccess.h>
2073diff -NurpP --minimal linux-2.6.15.6/arch/x86_64/ia32/ia32_binfmt.c linux-2.6.15.6-vs2.1.1-rc13/arch/x86_64/ia32/ia32_binfmt.c 2145Index: linux-2.6.16/arch/x86_64/ia32/ia32_binfmt.c
2074--- linux-2.6.15.6/arch/x86_64/ia32/ia32_binfmt.c 2006-01-03 17:29:20 +0100 2146===================================================================
2075+++ linux-2.6.15.6-vs2.1.1-rc13/arch/x86_64/ia32/ia32_binfmt.c 2006-02-11 01:30:35 +0100 2147--- linux-2.6.16.orig/arch/x86_64/ia32/ia32_binfmt.c
2148+++ linux-2.6.16/arch/x86_64/ia32/ia32_binfmt.c
2076@@ -374,7 +374,8 @@ int ia32_setup_arg_pages(struct linux_bi 2149@@ -371,7 +371,8 @@ int ia32_setup_arg_pages(struct linux_bi
2077 kmem_cache_free(vm_area_cachep, mpnt); 2150 kmem_cache_free(vm_area_cachep, mpnt);
2078 return ret; 2151 return ret;
2079 } 2152 }
2080- mm->stack_vm = mm->total_vm = vma_pages(mpnt); 2153- mm->stack_vm = mm->total_vm = vma_pages(mpnt);
2081+ vx_vmpages_sub(mm, mm->total_vm - vma_pages(mpnt)); 2154+ vx_vmpages_sub(mm, mm->total_vm - vma_pages(mpnt));
2082+ mm->stack_vm = mm->total_vm; 2155+ mm->stack_vm = mm->total_vm;
2083 } 2156 }
2084 2157
2085 for (i = 0 ; i < MAX_ARG_PAGES ; i++) { 2158 for (i = 0 ; i < MAX_ARG_PAGES ; i++) {
2086diff -NurpP --minimal linux-2.6.15.6/arch/x86_64/ia32/ia32entry.S linux-2.6.15.6-vs2.1.1-rc13/arch/x86_64/ia32/ia32entry.S 2159Index: linux-2.6.16/arch/x86_64/ia32/ia32entry.S
2087--- linux-2.6.15.6/arch/x86_64/ia32/ia32entry.S 2005-10-28 20:49:18 +0200 2160===================================================================
2088+++ linux-2.6.15.6-vs2.1.1-rc13/arch/x86_64/ia32/ia32entry.S 2006-01-04 21:59:59 +0100 2161--- linux-2.6.16.orig/arch/x86_64/ia32/ia32entry.S
2162+++ linux-2.6.16/arch/x86_64/ia32/ia32entry.S
2089@@ -622,7 +622,7 @@ ia32_sys_call_table: 2163@@ -650,7 +650,7 @@ ia32_sys_call_table:
2090 .quad sys_tgkill /* 270 */ 2164 .quad sys_tgkill /* 270 */
2091 .quad compat_sys_utimes 2165 .quad compat_sys_utimes
2092 .quad sys32_fadvise64_64 2166 .quad sys32_fadvise64_64
2093- .quad quiet_ni_syscall /* sys_vserver */ 2167- .quad quiet_ni_syscall /* sys_vserver */
2094+ .quad sys32_vserver 2168+ .quad sys32_vserver
2095 .quad sys_mbind 2169 .quad sys_mbind
2096 .quad compat_sys_get_mempolicy /* 275 */ 2170 .quad compat_sys_get_mempolicy /* 275 */
2097 .quad sys_set_mempolicy 2171 .quad sys_set_mempolicy
2098diff -NurpP --minimal linux-2.6.15.6/arch/x86_64/ia32/ptrace32.c linux-2.6.15.6-vs2.1.1-rc13/arch/x86_64/ia32/ptrace32.c 2172Index: linux-2.6.16/arch/x86_64/ia32/ptrace32.c
2099--- linux-2.6.15.6/arch/x86_64/ia32/ptrace32.c 2005-08-29 22:24:57 +0200 2173===================================================================
2100+++ linux-2.6.15.6-vs2.1.1-rc13/arch/x86_64/ia32/ptrace32.c 2006-02-13 20:03:10 +0100 2174--- linux-2.6.16.orig/arch/x86_64/ia32/ptrace32.c
2175+++ linux-2.6.16/arch/x86_64/ia32/ptrace32.c
2101@@ -18,6 +18,7 @@ 2176@@ -18,6 +18,7 @@
2102 #include <linux/unistd.h> 2177 #include <linux/unistd.h>
2103 #include <linux/mm.h> 2178 #include <linux/mm.h>
2104 #include <linux/ptrace.h> 2179 #include <linux/ptrace.h>
2105+#include <linux/vs_pid.h> 2180+#include <linux/vs_pid.h>
2106 #include <asm/ptrace.h> 2181 #include <asm/ptrace.h>
2107 #include <asm/compat.h> 2182 #include <asm/compat.h>
2108 #include <asm/uaccess.h> 2183 #include <asm/uaccess.h>
2109diff -NurpP --minimal linux-2.6.15.6/arch/x86_64/ia32/sys_ia32.c linux-2.6.15.6-vs2.1.1-rc13/arch/x86_64/ia32/sys_ia32.c 2184Index: linux-2.6.16/arch/x86_64/ia32/sys_ia32.c
2110--- linux-2.6.15.6/arch/x86_64/ia32/sys_ia32.c 2005-10-28 20:49:18 +0200 2185===================================================================
2111+++ linux-2.6.15.6-vs2.1.1-rc13/arch/x86_64/ia32/sys_ia32.c 2006-02-13 20:03:10 +0100 2186--- linux-2.6.16.orig/arch/x86_64/ia32/sys_ia32.c
2187+++ linux-2.6.16/arch/x86_64/ia32/sys_ia32.c
2112@@ -62,6 +62,7 @@ 2188@@ -62,6 +62,7 @@
2113 #include <linux/highuid.h> 2189 #include <linux/highuid.h>
2114 #include <linux/vmalloc.h> 2190 #include <linux/vmalloc.h>
2115 #include <linux/fsnotify.h> 2191 #include <linux/fsnotify.h>
2116+#include <linux/vs_cvirt.h> 2192+#include <linux/vs_cvirt.h>
2117 #include <asm/mman.h> 2193 #include <asm/mman.h>
2118 #include <asm/types.h> 2194 #include <asm/types.h>
2119 #include <asm/uaccess.h> 2195 #include <asm/uaccess.h>
2120@@ -860,6 +861,7 @@ asmlinkage long sys32_mmap2(unsigned lon 2196@@ -882,6 +883,7 @@ asmlinkage long sys32_mmap2(unsigned lon
2121 asmlinkage long sys32_olduname(struct oldold_utsname __user * name) 2197 asmlinkage long sys32_olduname(struct oldold_utsname __user * name)
2122 { 2198 {
2123 int error; 2199 int error;
2124+ struct new_utsname *ptr; 2200+ struct new_utsname *ptr;
2125 2201
2126 if (!name) 2202 if (!name)
2127 return -EFAULT; 2203 return -EFAULT;
2128@@ -868,13 +870,14 @@ asmlinkage long sys32_olduname(struct ol 2204@@ -890,13 +892,14 @@ asmlinkage long sys32_olduname(struct ol
2129 2205
2130 down_read(&uts_sem); 2206 down_read(&uts_sem);
2131 2207
2132- error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN); 2208- error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN);
2133+ ptr = vx_new_utsname(); 2209+ ptr = vx_new_utsname();
2142- __copy_to_user(&name->version,&system_utsname.version,__OLD_UTS_LEN); 2218- __copy_to_user(&name->version,&system_utsname.version,__OLD_UTS_LEN);
2143+ __copy_to_user(&name->version,ptr->version,__OLD_UTS_LEN); 2219+ __copy_to_user(&name->version,ptr->version,__OLD_UTS_LEN);
2144 __put_user(0,name->version+__OLD_UTS_LEN); 2220 __put_user(0,name->version+__OLD_UTS_LEN);
2145 { 2221 {
2146 char *arch = "x86_64"; 2222 char *arch = "x86_64";
2147@@ -897,7 +900,7 @@ long sys32_uname(struct old_utsname __us 2223@@ -919,7 +922,7 @@ long sys32_uname(struct old_utsname __us
2148 if (!name) 2224 if (!name)
2149 return -EFAULT; 2225 return -EFAULT;
2150 down_read(&uts_sem); 2226 down_read(&uts_sem);
2151- err=copy_to_user(name, &system_utsname, sizeof (*name)); 2227- err=copy_to_user(name, &system_utsname, sizeof (*name));
2152+ err=copy_to_user(name, vx_new_utsname(), sizeof (*name)); 2228+ err=copy_to_user(name, vx_new_utsname(), sizeof (*name));
2153 up_read(&uts_sem); 2229 up_read(&uts_sem);
2154 if (personality(current->personality) == PER_LINUX32) 2230 if (personality(current->personality) == PER_LINUX32)
2155 err |= copy_to_user(&name->machine, "i686", 5); 2231 err |= copy_to_user(&name->machine, "i686", 5);
2156diff -NurpP --minimal linux-2.6.15.6/arch/x86_64/ia32/syscall32.c linux-2.6.15.6-vs2.1.1-rc13/arch/x86_64/ia32/syscall32.c 2232Index: linux-2.6.16/arch/x86_64/ia32/syscall32.c
2157--- linux-2.6.15.6/arch/x86_64/ia32/syscall32.c 2005-10-28 20:49:18 +0200 2233===================================================================
2158+++ linux-2.6.15.6-vs2.1.1-rc13/arch/x86_64/ia32/syscall32.c 2006-02-13 20:03:10 +0100 2234--- linux-2.6.16.orig/arch/x86_64/ia32/syscall32.c
2235+++ linux-2.6.16/arch/x86_64/ia32/syscall32.c
2159@@ -10,6 +10,7 @@ 2236@@ -10,6 +10,7 @@
2160 #include <linux/init.h> 2237 #include <linux/init.h>
2161 #include <linux/stringify.h> 2238 #include <linux/stringify.h>
2162 #include <linux/security.h> 2239 #include <linux/security.h>
2163+#include <linux/vs_memory.h> 2240+#include <linux/vs_memory.h>
2171- mm->total_vm += npages; 2248- mm->total_vm += npages;
2172+ vx_vmpages_add(mm, npages); 2249+ vx_vmpages_add(mm, npages);
2173 up_write(&mm->mmap_sem); 2250 up_write(&mm->mmap_sem);
2174 return 0; 2251 return 0;
2175 } 2252 }
2176diff -NurpP --minimal linux-2.6.15.6/arch/x86_64/kernel/process.c linux-2.6.15.6-vs2.1.1-rc13/arch/x86_64/kernel/process.c 2253Index: linux-2.6.16/arch/x86_64/kernel/process.c
2177--- linux-2.6.15.6/arch/x86_64/kernel/process.c 2006-01-03 17:29:20 +0100 2254===================================================================
2178+++ linux-2.6.15.6-vs2.1.1-rc13/arch/x86_64/kernel/process.c 2006-02-12 14:28:47 +0100 2255--- linux-2.6.16.orig/arch/x86_64/kernel/process.c
2256+++ linux-2.6.16/arch/x86_64/kernel/process.c
2179@@ -53,7 +53,8 @@ 2257@@ -55,7 +55,8 @@
2180 2258
2181 asmlinkage extern void ret_from_fork(void); 2259 asmlinkage extern void ret_from_fork(void);
2182 2260
2183-unsigned long kernel_thread_flags = CLONE_VM | CLONE_UNTRACED; 2261-unsigned long kernel_thread_flags = CLONE_VM | CLONE_UNTRACED;
2184+unsigned long kernel_thread_flags = 2262+unsigned long kernel_thread_flags =
2185+ CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD; 2263+ CLONE_VM | CLONE_UNTRACED | CLONE_KTHREAD;
2186 2264
2187 static atomic_t hlt_counter = ATOMIC_INIT(0); 2265 unsigned long boot_option_idle_override = 0;
2188 2266 EXPORT_SYMBOL(boot_option_idle_override);
2189@@ -269,8 +270,8 @@ void __show_regs(struct pt_regs * regs) 2267@@ -297,8 +298,8 @@ void __show_regs(struct pt_regs * regs)
2190 2268
2191 printk("\n"); 2269 printk("\n");
2192 print_modules(); 2270 print_modules();
2193- printk("Pid: %d, comm: %.20s %s %s %.*s\n", 2271- printk("Pid: %d, comm: %.20s %s %s %.*s\n",
2194- current->pid, current->comm, print_tainted(), 2272- current->pid, current->comm, print_tainted(),
2195+ printk("Pid: %d[#%u], comm: %.20s %s %s %.*s\n", 2273+ printk("Pid: %d[#%u], comm: %.20s %s %s %.*s\n",
2196+ current->pid, current->xid, current->comm, print_tainted(), 2274+ current->pid, current->xid, current->comm, print_tainted(),
2197 system_utsname.release, 2275 system_utsname.release,
2198 (int)strcspn(system_utsname.version, " "), 2276 (int)strcspn(system_utsname.version, " "),
2199 system_utsname.version); 2277 system_utsname.version);
2200diff -NurpP --minimal linux-2.6.15.6/arch/x86_64/kernel/sys_x86_64.c linux-2.6.15.6-vs2.1.1-rc13/arch/x86_64/kernel/sys_x86_64.c 2278Index: linux-2.6.16/arch/x86_64/kernel/sys_x86_64.c
2201--- linux-2.6.15.6/arch/x86_64/kernel/sys_x86_64.c 2006-01-03 17:29:20 +0100 2279===================================================================
2202+++ linux-2.6.15.6-vs2.1.1-rc13/arch/x86_64/kernel/sys_x86_64.c 2006-01-04 21:59:59 +0100 2280--- linux-2.6.16.orig/arch/x86_64/kernel/sys_x86_64.c
2281+++ linux-2.6.16/arch/x86_64/kernel/sys_x86_64.c
2203@@ -16,6 +16,7 @@ 2282@@ -16,6 +16,7 @@
2204 #include <linux/file.h> 2283 #include <linux/file.h>
2205 #include <linux/utsname.h> 2284 #include <linux/utsname.h>
2206 #include <linux/personality.h> 2285 #include <linux/personality.h>
2207+#include <linux/vs_cvirt.h> 2286+#include <linux/vs_cvirt.h>
2215- err = copy_to_user(name, &system_utsname, sizeof (*name)); 2294- err = copy_to_user(name, &system_utsname, sizeof (*name));
2216+ err = copy_to_user(name, vx_new_utsname(), sizeof (*name)); 2295+ err = copy_to_user(name, vx_new_utsname(), sizeof (*name));
2217 up_read(&uts_sem); 2296 up_read(&uts_sem);
2218 if (personality(current->personality) == PER_LINUX32) 2297 if (personality(current->personality) == PER_LINUX32)
2219 err |= copy_to_user(&name->machine, "i686", 5); 2298 err |= copy_to_user(&name->machine, "i686", 5);
2220diff -NurpP --minimal linux-2.6.15.6/arch/xtensa/kernel/process.c linux-2.6.15.6-vs2.1.1-rc13/arch/xtensa/kernel/process.c 2299Index: linux-2.6.16/arch/x86_64/kernel/traps.c
2221--- linux-2.6.15.6/arch/xtensa/kernel/process.c 2006-01-03 17:29:20 +0100 2300===================================================================
2222+++ linux-2.6.15.6-vs2.1.1-rc13/arch/xtensa/kernel/process.c 2006-01-04 21:59:59 +0100 2301--- linux-2.6.16.orig/arch/x86_64/kernel/traps.c
2302+++ linux-2.6.16/arch/x86_64/kernel/traps.c
2303@@ -321,8 +321,9 @@ void show_registers(struct pt_regs *regs
2304
2305 printk("CPU %d ", cpu);
2306 __show_regs(regs);
2307- printk("Process %s (pid: %d, threadinfo %p, task %p)\n",
2308- cur->comm, cur->pid, task_thread_info(cur), cur);
2309+ printk("Process %s (pid: %d[#%u], threadinfo %p, task %p)\n",
2310+ cur->comm, cur->pid, cur->xid,
2311+ task_thread_info(cur), cur);
2312
2313 /*
2314 * When in-kernel, we also print out the stack and code at the
2315Index: linux-2.6.16/arch/xtensa/kernel/process.c
2316===================================================================
2317--- linux-2.6.16.orig/arch/xtensa/kernel/process.c
2318+++ linux-2.6.16/arch/xtensa/kernel/process.c
2223@@ -204,7 +204,7 @@ int kernel_thread(int (*fn)(void *), voi 2319@@ -207,7 +207,7 @@ int kernel_thread(int (*fn)(void *), voi
2224 :"=r" (retval) 2320 :"=r" (retval)
2225 :"i" (__NR_clone), "i" (__NR_exit), 2321 :"i" (__NR_clone), "i" (__NR_exit),
2226 "r" (arg), "r" (fn), 2322 "r" (arg), "r" (fn),
2227- "r" (flags | CLONE_VM) 2323- "r" (flags | CLONE_VM)
2228+ "r" (flags | CLONE_VM | CLONE_KTHREAD) 2324+ "r" (flags | CLONE_VM | CLONE_KTHREAD)
2229 : "a2", "a3", "a4", "a5", "a6" ); 2325 : "a2", "a3", "a4", "a5", "a6" );
2230 return retval; 2326 return retval;
2231 } 2327 }
2232diff -NurpP --minimal linux-2.6.15.6/drivers/block/Kconfig linux-2.6.15.6-vs2.1.1-rc13/drivers/block/Kconfig 2328Index: linux-2.6.16/drivers/block/Kconfig
2233--- linux-2.6.15.6/drivers/block/Kconfig 2006-01-03 17:29:21 +0100 2329===================================================================
2234+++ linux-2.6.15.6-vs2.1.1-rc13/drivers/block/Kconfig 2006-01-04 21:59:59 +0100 2330--- linux-2.6.16.orig/drivers/block/Kconfig
2331+++ linux-2.6.16/drivers/block/Kconfig
2235@@ -315,6 +315,13 @@ config BLK_DEV_CRYPTOLOOP 2332@@ -315,6 +315,13 @@ config BLK_DEV_CRYPTOLOOP
2236 instead, which can be configured to be on-disk compatible with the 2333 instead, which can be configured to be on-disk compatible with the
2237 cryptoloop device. 2334 cryptoloop device.
2238 2335
2239+config BLK_DEV_VROOT 2336+config BLK_DEV_VROOT
2244+ partition within a virtual server without compromising security. 2341+ partition within a virtual server without compromising security.
2245+ 2342+
2246 config BLK_DEV_NBD 2343 config BLK_DEV_NBD
2247 tristate "Network block device support" 2344 tristate "Network block device support"
2248 depends on NET 2345 depends on NET
2249diff -NurpP --minimal linux-2.6.15.6/drivers/block/Makefile linux-2.6.15.6-vs2.1.1-rc13/drivers/block/Makefile 2346Index: linux-2.6.16/drivers/block/Makefile
2250--- linux-2.6.15.6/drivers/block/Makefile 2006-01-03 17:29:21 +0100 2347===================================================================
2251+++ linux-2.6.15.6-vs2.1.1-rc13/drivers/block/Makefile 2006-01-04 21:59:59 +0100 2348--- linux-2.6.16.orig/drivers/block/Makefile
2349+++ linux-2.6.16/drivers/block/Makefile
2252@@ -30,4 +30,5 @@ obj-$(CONFIG_BLK_DEV_CRYPTOLOOP) += cryp 2350@@ -30,4 +30,5 @@ obj-$(CONFIG_BLK_DEV_CRYPTOLOOP) += cryp
2253 obj-$(CONFIG_VIODASD) += viodasd.o 2351 obj-$(CONFIG_VIODASD) += viodasd.o
2254 obj-$(CONFIG_BLK_DEV_SX8) += sx8.o 2352 obj-$(CONFIG_BLK_DEV_SX8) += sx8.o
2255 obj-$(CONFIG_BLK_DEV_UB) += ub.o 2353 obj-$(CONFIG_BLK_DEV_UB) += ub.o
2256+obj-$(CONFIG_BLK_DEV_VROOT) += vroot.o 2354+obj-$(CONFIG_BLK_DEV_VROOT) += vroot.o
2257 2355
2258diff -NurpP --minimal linux-2.6.15.6/drivers/block/vroot.c linux-2.6.15.6-vs2.1.1-rc13/drivers/block/vroot.c 2356Index: linux-2.6.16/drivers/block/vroot.c
2259--- linux-2.6.15.6/drivers/block/vroot.c 1970-01-01 01:00:00 +0100 2357===================================================================
2260+++ linux-2.6.15.6-vs2.1.1-rc13/drivers/block/vroot.c 2006-01-04 21:59:59 +0100 2358--- /dev/null
2359+++ linux-2.6.16/drivers/block/vroot.c
2261@@ -0,0 +1,289 @@ 2360@@ -0,0 +1,289 @@
2262+/* 2361+/*
2263+ * linux/drivers/block/vroot.c 2362+ * linux/drivers/block/vroot.c
2264+ * 2363+ *
2265+ * written by Herbert P÷tzl, 9/11/2002 2364+ * written by Herbert P÷tzl, 9/11/2002
2546+ 2645+
2547+__setup("max_vroot=", max_vroot_setup); 2646+__setup("max_vroot=", max_vroot_setup);
2548+ 2647+
2549+#endif 2648+#endif
2550+ 2649+
2551diff -NurpP --minimal linux-2.6.15.6/drivers/char/random.c linux-2.6.15.6-vs2.1.1-rc13/drivers/char/random.c 2650Index: linux-2.6.16/drivers/char/random.c
2552--- linux-2.6.15.6/drivers/char/random.c 2005-10-28 20:49:21 +0200 2651===================================================================
2553+++ linux-2.6.15.6-vs2.1.1-rc13/drivers/char/random.c 2006-01-04 21:59:59 +0100 2652--- linux-2.6.16.orig/drivers/char/random.c
2653+++ linux-2.6.16/drivers/char/random.c
2554@@ -1174,7 +1174,7 @@ static char sysctl_bootid[16]; 2654@@ -1174,7 +1174,7 @@ static char sysctl_bootid[16];
2555 static int proc_do_uuid(ctl_table *table, int write, struct file *filp, 2655 static int proc_do_uuid(ctl_table *table, int write, struct file *filp,
2556 void __user *buffer, size_t *lenp, loff_t *ppos) 2656 void __user *buffer, size_t *lenp, loff_t *ppos)
2557 { 2657 {
2558- ctl_table fake_table; 2658- ctl_table fake_table;
2559+ ctl_table fake_table = {0}; 2659+ ctl_table fake_table = {0};
2560 unsigned char buf[64], tmp_uuid[16], *uuid; 2660 unsigned char buf[64], tmp_uuid[16], *uuid;
2561 2661
2562 uuid = table->data; 2662 uuid = table->data;
2563diff -NurpP --minimal linux-2.6.15.6/drivers/char/sysrq.c linux-2.6.15.6-vs2.1.1-rc13/drivers/char/sysrq.c 2663Index: linux-2.6.16/drivers/char/sysrq.c
2564--- linux-2.6.15.6/drivers/char/sysrq.c 2006-01-03 17:29:26 +0100 2664===================================================================
2565+++ linux-2.6.15.6-vs2.1.1-rc13/drivers/char/sysrq.c 2006-01-04 21:59:59 +0100 2665--- linux-2.6.16.orig/drivers/char/sysrq.c
2666+++ linux-2.6.16/drivers/char/sysrq.c
2566@@ -36,6 +36,7 @@ 2667@@ -36,6 +36,7 @@
2567 #include <linux/vt_kern.h> 2668 #include <linux/vt_kern.h>
2568 #include <linux/workqueue.h> 2669 #include <linux/workqueue.h>
2569 #include <linux/kexec.h> 2670 #include <linux/kexec.h>
2570+#include <linux/vserver/debug.h> 2671+#include <linux/vserver/debug.h>
2571 2672
2572 #include <asm/ptrace.h> 2673 #include <asm/ptrace.h>
2573 2674
2574@@ -271,6 +272,21 @@ static struct sysrq_key_op sysrq_unrt_op 2675@@ -286,6 +287,21 @@ static struct sysrq_key_op sysrq_unrt_op
2575 .enable_mask = SYSRQ_ENABLE_RTNICE, 2676 .enable_mask = SYSRQ_ENABLE_RTNICE,
2576 }; 2677 };
2577 2678
2578+ 2679+
2579+#ifdef CONFIG_VSERVER_DEBUG 2680+#ifdef CONFIG_VSERVER_DEBUG
2591+#endif 2692+#endif
2592+ 2693+
2593 /* Key Operations table and lock */ 2694 /* Key Operations table and lock */
2594 static DEFINE_SPINLOCK(sysrq_key_table_lock); 2695 static DEFINE_SPINLOCK(sysrq_key_table_lock);
2595 #define SYSRQ_KEY_TABLE_LENGTH 36 2696 #define SYSRQ_KEY_TABLE_LENGTH 36
2596@@ -323,7 +339,11 @@ static struct sysrq_key_op *sysrq_key_ta 2697@@ -342,7 +358,11 @@ static struct sysrq_key_op *sysrq_key_ta
2597 /* u */ &sysrq_mountro_op, 2698 /* u */ &sysrq_mountro_op,
2598 /* v */ NULL, /* May be assigned at init time by SMP VOYAGER */ 2699 /* v */ NULL, /* May be assigned at init time by SMP VOYAGER */
2599 /* w */ NULL, 2700 /* w */ NULL,
2600+#ifdef CONFIG_VSERVER_DEBUG 2701+#ifdef CONFIG_VSERVER_DEBUG
2601+/* x */ &sysrq_showvxinfo_op, 2702+/* x */ &sysrq_showvxinfo_op,
2603 /* x */ NULL, 2704 /* x */ NULL,
2604+#endif 2705+#endif
2605 /* y */ NULL, 2706 /* y */ NULL,
2606 /* z */ NULL 2707 /* z */ NULL
2607 }; 2708 };
2608@@ -335,6 +355,8 @@ static int sysrq_key_table_key2index(int 2709@@ -354,6 +374,8 @@ static int sysrq_key_table_key2index(int
2609 retval = key - '0'; 2710 retval = key - '0';
2610 } else if ((key >= 'a') && (key <= 'z')) { 2711 } else if ((key >= 'a') && (key <= 'z')) {
2611 retval = key + 10 - 'a'; 2712 retval = key + 10 - 'a';
2612+ } else if ((key >= 'A') && (key <= 'Z')) { 2713+ } else if ((key >= 'A') && (key <= 'Z')) {
2613+ retval = key + 10 - 'A'; 2714+ retval = key + 10 - 'A';
2614 } else { 2715 } else {
2615 retval = -1; 2716 retval = -1;
2616 } 2717 }
2617diff -NurpP --minimal linux-2.6.15.6/drivers/char/tty_io.c linux-2.6.15.6-vs2.1.1-rc13/drivers/char/tty_io.c 2718Index: linux-2.6.16/drivers/char/tty_io.c
2618--- linux-2.6.15.6/drivers/char/tty_io.c 2006-01-03 17:29:26 +0100 2719===================================================================
2619+++ linux-2.6.15.6-vs2.1.1-rc13/drivers/char/tty_io.c 2006-02-13 16:25:38 +0100 2720--- linux-2.6.16.orig/drivers/char/tty_io.c
2721+++ linux-2.6.16/drivers/char/tty_io.c
2620@@ -103,6 +103,7 @@ 2722@@ -103,6 +103,7 @@
2621 #include <linux/vt_kern.h> 2723 #include <linux/vt_kern.h>
2622 #include <linux/selection.h> 2724 #include <linux/selection.h>
2623 #include <linux/devfs_fs_kernel.h> 2725 #include <linux/devfs_fs_kernel.h>
2624+#include <linux/vs_pid.h> 2726+#include <linux/vs_pid.h>
2625 2727
2626 #include <linux/kmod.h> 2728 #include <linux/kmod.h>
2627 2729
2628@@ -2152,13 +2153,16 @@ static int tiocsctty(struct tty_struct * 2730@@ -2381,13 +2382,16 @@ static int tiocsctty(struct tty_struct *
2629 2731
2630 static int tiocgpgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p) 2732 static int tiocgpgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p)
2631 { 2733 {
2632+ pid_t pgrp; 2734+ pid_t pgrp;
2633 /* 2735 /*
2641+ pgrp = vx_map_pid(real_tty->pgrp); 2743+ pgrp = vx_map_pid(real_tty->pgrp);
2642+ return put_user(pgrp, p); 2744+ return put_user(pgrp, p);
2643 } 2745 }
2644 2746
2645 static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p) 2747 static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p)
2646@@ -2176,6 +2180,8 @@ static int tiocspgrp(struct tty_struct * 2748@@ -2405,6 +2409,8 @@ static int tiocspgrp(struct tty_struct *
2647 return -ENOTTY; 2749 return -ENOTTY;
2648 if (get_user(pgrp, p)) 2750 if (get_user(pgrp, p))
2649 return -EFAULT; 2751 return -EFAULT;
2650+ 2752+
2651+ pgrp = vx_rmap_pid(pgrp); 2753+ pgrp = vx_rmap_pid(pgrp);
2652 if (pgrp < 0) 2754 if (pgrp < 0)
2653 return -EINVAL; 2755 return -EINVAL;
2654 if (session_of_pgrp(pgrp) != current->signal->session) 2756 if (session_of_pgrp(pgrp) != current->signal->session)
2655diff -NurpP --minimal linux-2.6.15.6/drivers/infiniband/core/uverbs_mem.c linux-2.6.15.6-vs2.1.1-rc13/drivers/infiniband/core/uverbs_mem.c 2757Index: linux-2.6.16/drivers/infiniband/core/uverbs_mem.c
2758===================================================================
2656--- linux-2.6.15.6/drivers/infiniband/core/uverbs_mem.c 2005-10-28 20:49:23 +0200 2759--- linux-2.6.16.orig/drivers/infiniband/core/uverbs_mem.c
2657+++ linux-2.6.15.6-vs2.1.1-rc13/drivers/infiniband/core/uverbs_mem.c 2006-02-13 05:01:24 +0100 2760+++ linux-2.6.16/drivers/infiniband/core/uverbs_mem.c
2658@@ -36,6 +36,7 @@ 2761@@ -36,6 +36,7 @@
2659 2762
2660 #include <linux/mm.h> 2763 #include <linux/mm.h>
2661 #include <linux/dma-mapping.h> 2764 #include <linux/dma-mapping.h>
2662+#include <linux/vs_memory.h> 2765+#include <linux/vs_memory.h>
2690- work->mm->locked_vm -= work->diff; 2793- work->mm->locked_vm -= work->diff;
2691+ vx_vmlocked_sub(work->mm, work->diff); 2794+ vx_vmlocked_sub(work->mm, work->diff);
2692 up_write(&work->mm->mmap_sem); 2795 up_write(&work->mm->mmap_sem);
2693 mmput(work->mm); 2796 mmput(work->mm);
2694 kfree(work); 2797 kfree(work);
2695diff -NurpP --minimal linux-2.6.15.6/drivers/mtd/devices/blkmtd.c linux-2.6.15.6-vs2.1.1-rc13/drivers/mtd/devices/blkmtd.c 2798Index: linux-2.6.16/drivers/mtd/devices/blkmtd.c
2696--- linux-2.6.15.6/drivers/mtd/devices/blkmtd.c 2006-01-03 17:29:35 +0100 2799===================================================================
2697+++ linux-2.6.15.6-vs2.1.1-rc13/drivers/mtd/devices/blkmtd.c 2006-01-04 21:59:59 +0100 2800--- linux-2.6.16.orig/drivers/mtd/devices/blkmtd.c
2801+++ linux-2.6.16/drivers/mtd/devices/blkmtd.c
2698@@ -614,7 +614,7 @@ static struct mtd_erase_region_info *cal 2802@@ -614,7 +614,7 @@ static struct mtd_erase_region_info *cal
2699 } 2803 }
2700 2804
2701 2805
2702-extern dev_t __init name_to_dev_t(const char *line); 2806-extern dev_t __init name_to_dev_t(const char *line);
2703+extern dev_t __init name_to_dev_t(char *line); 2807+extern dev_t __init name_to_dev_t(char *line);
2704 2808
2705 static struct blkmtd_dev *add_device(char *devname, int readonly, int erase_size) 2809 static struct blkmtd_dev *add_device(char *devname, int readonly, int erase_size)
2706 { 2810 {
2707diff -NurpP --minimal linux-2.6.15.6/fs/attr.c linux-2.6.15.6-vs2.1.1-rc13/fs/attr.c 2811Index: linux-2.6.16/fs/attr.c
2708--- linux-2.6.15.6/fs/attr.c 2006-01-03 17:29:55 +0100 2812===================================================================
2709+++ linux-2.6.15.6-vs2.1.1-rc13/fs/attr.c 2006-02-13 05:26:55 +0100 2813--- linux-2.6.16.orig/fs/attr.c
2814+++ linux-2.6.16/fs/attr.c
2710@@ -15,6 +15,9 @@ 2815@@ -15,6 +15,9 @@
2816 #include <linux/fcntl.h>
2711 #include <linux/quotaops.h> 2817 #include <linux/quotaops.h>
2712 #include <linux/security.h> 2818 #include <linux/security.h>
2713 #include <linux/time.h>
2714+#include <linux/proc_fs.h> 2819+#include <linux/proc_fs.h>
2715+#include <linux/devpts_fs.h> 2820+#include <linux/devpts_fs.h>
2716+#include <linux/vserver/debug.h> 2821+#include <linux/vserver/debug.h>
2717 2822
2718 /* Taken over from the old code... */ 2823 /* Taken over from the old code... */
2746+ goto error; 2851+ goto error;
2747+ } 2852+ }
2748 fine: 2853 fine:
2749 retval = 0; 2854 retval = 0;
2750 error: 2855 error:
2751@@ -87,6 +114,8 @@ int inode_setattr(struct inode * inode, 2856@@ -79,6 +106,8 @@ int inode_setattr(struct inode * inode,
2752 inode->i_uid = attr->ia_uid; 2857 inode->i_uid = attr->ia_uid;
2753 if (ia_valid & ATTR_GID) 2858 if (ia_valid & ATTR_GID)
2754 inode->i_gid = attr->ia_gid; 2859 inode->i_gid = attr->ia_gid;
2755+ if ((ia_valid & ATTR_TAG) && IS_TAGGED(inode)) 2860+ if ((ia_valid & ATTR_TAG) && IS_TAGGED(inode))
2756+ inode->i_tag = attr->ia_tag; 2861+ inode->i_tag = attr->ia_tag;
2757 if (ia_valid & ATTR_ATIME) 2862 if (ia_valid & ATTR_ATIME)
2758 inode->i_atime = timespec_trunc(attr->ia_atime, 2863 inode->i_atime = timespec_trunc(attr->ia_atime,
2759 inode->i_sb->s_time_gran); 2864 inode->i_sb->s_time_gran);
2760@@ -161,7 +190,8 @@ int notify_change(struct dentry * dentry 2865@@ -153,7 +182,8 @@ int notify_change(struct dentry * dentry
2761 error = security_inode_setattr(dentry, attr); 2866 error = security_inode_setattr(dentry, attr);
2762 if (!error) { 2867 if (!error) {
2763 if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || 2868 if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
2764- (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) 2869- (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid))
2765+ (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid) || 2870+ (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid) ||
2766+ (ia_valid & ATTR_TAG && attr->ia_tag != inode->i_tag)) 2871+ (ia_valid & ATTR_TAG && attr->ia_tag != inode->i_tag))
2767 error = DQUOT_TRANSFER(inode, attr) ? -EDQUOT : 0; 2872 error = DQUOT_TRANSFER(inode, attr) ? -EDQUOT : 0;
2768 if (!error) 2873 if (!error)
2769 error = inode_setattr(inode, attr); 2874 error = inode_setattr(inode, attr);
2770diff -NurpP --minimal linux-2.6.15.6/fs/binfmt_aout.c linux-2.6.15.6-vs2.1.1-rc13/fs/binfmt_aout.c 2875Index: linux-2.6.16/fs/binfmt_aout.c
2771--- linux-2.6.15.6/fs/binfmt_aout.c 2006-01-03 17:29:55 +0100 2876===================================================================
2772+++ linux-2.6.15.6-vs2.1.1-rc13/fs/binfmt_aout.c 2006-01-04 21:59:59 +0100 2877--- linux-2.6.16.orig/fs/binfmt_aout.c
2878+++ linux-2.6.16/fs/binfmt_aout.c
2773@@ -24,6 +24,7 @@ 2879@@ -24,6 +24,7 @@
2774 #include <linux/binfmts.h> 2880 #include <linux/binfmts.h>
2775 #include <linux/personality.h> 2881 #include <linux/personality.h>
2776 #include <linux/init.h> 2882 #include <linux/init.h>
2777+#include <linux/vs_memory.h> 2883+#include <linux/vs_memory.h>
2778 2884
2779 #include <asm/system.h> 2885 #include <asm/system.h>
2780 #include <asm/uaccess.h> 2886 #include <asm/uaccess.h>
2781diff -NurpP --minimal linux-2.6.15.6/fs/binfmt_elf.c linux-2.6.15.6-vs2.1.1-rc13/fs/binfmt_elf.c 2887Index: linux-2.6.16/fs/binfmt_elf.c
2782--- linux-2.6.15.6/fs/binfmt_elf.c 2006-03-11 03:09:06 +0100 2888===================================================================
2783+++ linux-2.6.15.6-vs2.1.1-rc13/fs/binfmt_elf.c 2006-03-04 23:52:13 +0100 2889--- linux-2.6.16.orig/fs/binfmt_elf.c
2890+++ linux-2.6.16/fs/binfmt_elf.c
2784@@ -38,6 +38,7 @@ 2891@@ -38,6 +38,7 @@
2785 #include <linux/security.h> 2892 #include <linux/security.h>
2786 #include <linux/syscalls.h> 2893 #include <linux/syscalls.h>
2787 #include <linux/random.h> 2894 #include <linux/random.h>
2788+#include <linux/vs_memory.h> 2895+#include <linux/vs_memory.h>
2789 2896
2790 #include <asm/uaccess.h> 2897 #include <asm/uaccess.h>
2791 #include <asm/param.h> 2898 #include <asm/param.h>
2792diff -NurpP --minimal linux-2.6.15.6/fs/binfmt_flat.c linux-2.6.15.6-vs2.1.1-rc13/fs/binfmt_flat.c 2899Index: linux-2.6.16/fs/binfmt_flat.c
2793--- linux-2.6.15.6/fs/binfmt_flat.c 2006-01-03 17:29:55 +0100 2900===================================================================
2794+++ linux-2.6.15.6-vs2.1.1-rc13/fs/binfmt_flat.c 2006-01-04 21:59:59 +0100 2901--- linux-2.6.16.orig/fs/binfmt_flat.c
2902+++ linux-2.6.16/fs/binfmt_flat.c
2795@@ -36,6 +36,7 @@ 2903@@ -36,6 +36,7 @@
2796 #include <linux/personality.h> 2904 #include <linux/personality.h>
2797 #include <linux/init.h> 2905 #include <linux/init.h>
2798 #include <linux/flat.h> 2906 #include <linux/flat.h>
2799+#include <linux/vs_memory.h> 2907+#include <linux/vs_memory.h>
2800 2908
2801 #include <asm/byteorder.h> 2909 #include <asm/byteorder.h>
2802 #include <asm/system.h> 2910 #include <asm/system.h>
2803diff -NurpP --minimal linux-2.6.15.6/fs/binfmt_som.c linux-2.6.15.6-vs2.1.1-rc13/fs/binfmt_som.c 2911Index: linux-2.6.16/fs/binfmt_som.c
2804--- linux-2.6.15.6/fs/binfmt_som.c 2006-01-03 17:29:55 +0100 2912===================================================================
2805+++ linux-2.6.15.6-vs2.1.1-rc13/fs/binfmt_som.c 2006-01-04 21:59:59 +0100 2913--- linux-2.6.16.orig/fs/binfmt_som.c
2914+++ linux-2.6.16/fs/binfmt_som.c
2806@@ -28,6 +28,7 @@ 2915@@ -28,6 +28,7 @@
2807 #include <linux/shm.h> 2916 #include <linux/shm.h>
2808 #include <linux/personality.h> 2917 #include <linux/personality.h>
2809 #include <linux/init.h> 2918 #include <linux/init.h>
2810+#include <linux/vs_memory.h> 2919+#include <linux/vs_memory.h>
2811 2920
2812 #include <asm/uaccess.h> 2921 #include <asm/uaccess.h>
2813 #include <asm/pgtable.h> 2922 #include <asm/pgtable.h>
2814diff -NurpP --minimal linux-2.6.15.6/fs/buffer.c linux-2.6.15.6-vs2.1.1-rc13/fs/buffer.c 2923Index: linux-2.6.16/fs/buffer.c
2815--- linux-2.6.15.6/fs/buffer.c 2006-01-03 17:29:55 +0100 2924===================================================================
2816+++ linux-2.6.15.6-vs2.1.1-rc13/fs/buffer.c 2006-01-04 21:59:59 +0100 2925--- linux-2.6.16.orig/fs/buffer.c
2926+++ linux-2.6.16/fs/buffer.c
2817@@ -173,7 +173,7 @@ EXPORT_SYMBOL(sync_blockdev); 2927@@ -168,7 +168,7 @@ EXPORT_SYMBOL(sync_blockdev);
2818 int fsync_super(struct super_block *sb) 2928 int fsync_super(struct super_block *sb)
2819 { 2929 {
2820 sync_inodes_sb(sb, 0); 2930 sync_inodes_sb(sb, 0);
2821- DQUOT_SYNC(sb); 2931- DQUOT_SYNC(sb);
2822+ DQUOT_SYNC(sb->s_dqh); 2932+ DQUOT_SYNC(sb->s_dqh);
2823 lock_super(sb); 2933 lock_super(sb);
2824 if (sb->s_dirt && sb->s_op->write_super) 2934 if (sb->s_dirt && sb->s_op->write_super)
2825 sb->s_op->write_super(sb); 2935 sb->s_op->write_super(sb);
2826@@ -222,7 +222,7 @@ struct super_block *freeze_bdev(struct b 2936@@ -217,7 +217,7 @@ struct super_block *freeze_bdev(struct b
2827 smp_wmb(); 2937 smp_wmb();
2828 2938
2829 sync_inodes_sb(sb, 0); 2939 sync_inodes_sb(sb, 0);
2830- DQUOT_SYNC(sb); 2940- DQUOT_SYNC(sb);
2831+ DQUOT_SYNC(sb->s_dqh); 2941+ DQUOT_SYNC(sb->s_dqh);
2832 2942
2833 lock_super(sb); 2943 lock_super(sb);
2834 if (sb->s_dirt && sb->s_op->write_super) 2944 if (sb->s_dirt && sb->s_op->write_super)
2835diff -NurpP --minimal linux-2.6.15.6/fs/devpts/inode.c linux-2.6.15.6-vs2.1.1-rc13/fs/devpts/inode.c 2945Index: linux-2.6.16/fs/devpts/inode.c
2836--- linux-2.6.15.6/fs/devpts/inode.c 2005-10-28 20:49:44 +0200 2946===================================================================
2837+++ linux-2.6.15.6-vs2.1.1-rc13/fs/devpts/inode.c 2006-02-13 05:26:55 +0100 2947--- linux-2.6.16.orig/fs/devpts/inode.c
2948+++ linux-2.6.16/fs/devpts/inode.c
2838@@ -19,7 +19,20 @@ 2949@@ -19,7 +19,20 @@
2839 #include <linux/tty.h> 2950 #include <linux/tty.h>
2840 #include <linux/devpts_fs.h> 2951 #include <linux/devpts_fs.h>
2841 2952
2842-#define DEVPTS_SUPER_MAGIC 0x1cd1 2953-#define DEVPTS_SUPER_MAGIC 0x1cd1
2903+ inode->i_tag = (tag_t)vx_current_xid(); 3014+ inode->i_tag = (tag_t)vx_current_xid();
2904+ inode->i_op = &devpts_file_inode_operations; 3015+ inode->i_op = &devpts_file_inode_operations;
2905 inode->u.generic_ip = tty; 3016 inode->u.generic_ip = tty;
2906 3017
2907 dentry = get_node(number); 3018 dentry = get_node(number);
2908diff -NurpP --minimal linux-2.6.15.6/fs/dquot.c linux-2.6.15.6-vs2.1.1-rc13/fs/dquot.c 3019Index: linux-2.6.16/fs/dquot.c
2909--- linux-2.6.15.6/fs/dquot.c 2006-01-03 17:29:56 +0100 3020===================================================================
2910+++ linux-2.6.15.6-vs2.1.1-rc13/fs/dquot.c 2006-02-13 03:01:05 +0100 3021--- linux-2.6.16.orig/fs/dquot.c
3022+++ linux-2.6.16/fs/dquot.c
2911@@ -78,6 +78,7 @@ 3023@@ -79,6 +79,7 @@
2912 #include <linux/namei.h>
2913 #include <linux/buffer_head.h> 3024 #include <linux/buffer_head.h>
3025 #include <linux/capability.h>
2914 #include <linux/quotaops.h> 3026 #include <linux/quotaops.h>
2915+#include <linux/vserver/debug.h> 3027+#include <linux/vserver/debug.h>
2916 3028
2917 #include <asm/uaccess.h> 3029 #include <asm/uaccess.h>
2918 3030
2919@@ -184,7 +185,7 @@ static void put_quota_format(struct quot 3031@@ -185,7 +186,7 @@ static void put_quota_format(struct quot
2920 /* 3032 /*
2921 * Dquot List Management: 3033 * Dquot List Management:
2922 * The quota code uses three lists for dquot management: the inuse_list, 3034 * The quota code uses three lists for dquot management: the inuse_list,
2923- * free_dquots, and dquot_hash[] array. A single dquot structure may be 3035- * free_dquots, and dquot_hash[] array. A single dquot structure may be
2924+ * free_dquots, and hash->dqh_hash[] array. A single dquot structure may be 3036+ * free_dquots, and hash->dqh_hash[] array. A single dquot structure may be
2925 * on all three lists, depending on its current state. 3037 * on all three lists, depending on its current state.
2926 * 3038 *
2927 * All dquots are placed to the end of inuse_list when first created, and this 3039 * All dquots are placed to the end of inuse_list when first created, and this
2928@@ -197,7 +198,7 @@ static void put_quota_format(struct quot 3040@@ -198,7 +199,7 @@ static void put_quota_format(struct quot
2929 * dquot is invalidated it's completely released from memory. 3041 * dquot is invalidated it's completely released from memory.
2930 * 3042 *
2931 * Dquots with a specific identity (device, type and id) are placed on 3043 * Dquots with a specific identity (device, type and id) are placed on
2932- * one of the dquot_hash[] hash chains. The provides an efficient search 3044- * one of the dquot_hash[] hash chains. The provides an efficient search
2933+ * one of the hash->dqh_hash[] hash chains. The provides an efficient search 3045+ * one of the hash->dqh_hash[] hash chains. The provides an efficient search
2934 * mechanism to locate a specific dquot. 3046 * mechanism to locate a specific dquot.
2935 */ 3047 */
2936 3048
2937@@ -211,36 +212,44 @@ struct dqstats dqstats; 3049@@ -212,36 +213,44 @@ struct dqstats dqstats;
2938 static void dqput(struct dquot *dquot); 3050 static void dqput(struct dquot *dquot);
2939 3051
2940 static inline unsigned int 3052 static inline unsigned int
2941-hashfn(const struct super_block *sb, unsigned int id, int type) 3053-hashfn(const struct super_block *sb, unsigned int id, int type)
2942+hashfn(struct dqhash *hash, unsigned int id, int type) 3054+hashfn(struct dqhash *hash, unsigned int id, int type)
2984- if (dquot->dq_sb == sb && dquot->dq_id == id && dquot->dq_type == type) 3096- if (dquot->dq_sb == sb && dquot->dq_id == id && dquot->dq_type == type)
2985+ if (dquot->dq_dqh == hash && dquot->dq_id == id && dquot->dq_type == type) 3097+ if (dquot->dq_dqh == hash && dquot->dq_id == id && dquot->dq_type == type)
2986 return dquot; 3098 return dquot;
2987 } 3099 }
2988 return NODQUOT; 3100 return NODQUOT;
2989@@ -284,13 +293,13 @@ static void wait_on_dquot(struct dquot * 3101@@ -285,13 +294,13 @@ static void wait_on_dquot(struct dquot *
2990 up(&dquot->dq_lock); 3102 up(&dquot->dq_lock);
2991 } 3103 }
2992 3104
2993-#define mark_dquot_dirty(dquot) ((dquot)->dq_sb->dq_op->mark_dirty(dquot)) 3105-#define mark_dquot_dirty(dquot) ((dquot)->dq_sb->dq_op->mark_dirty(dquot))
2994+#define mark_dquot_dirty(dquot) ((dquot)->dq_dqh->dqh_qop->mark_dirty(dquot)) 3106+#define mark_dquot_dirty(dquot) ((dquot)->dq_dqh->dqh_qop->mark_dirty(dquot))
3000- list_add(&dquot->dq_dirty, &sb_dqopt(dquot->dq_sb)-> 3112- list_add(&dquot->dq_dirty, &sb_dqopt(dquot->dq_sb)->
3001+ list_add(&dquot->dq_dirty, &dqh_dqopt(dquot->dq_dqh)-> 3113+ list_add(&dquot->dq_dirty, &dqh_dqopt(dquot->dq_dqh)->
3002 info[dquot->dq_type].dqi_dirty_list); 3114 info[dquot->dq_type].dqi_dirty_list);
3003 spin_unlock(&dq_list_lock); 3115 spin_unlock(&dq_list_lock);
3004 return 0; 3116 return 0;
3005@@ -305,9 +314,9 @@ static inline int clear_dquot_dirty(stru 3117@@ -306,9 +315,9 @@ static inline int clear_dquot_dirty(stru
3006 return 1; 3118 return 1;
3007 } 3119 }
3008 3120
3009-void mark_info_dirty(struct super_block *sb, int type) 3121-void mark_info_dirty(struct super_block *sb, int type)
3010+void mark_info_dirty(struct dqhash *hash, int type) 3122+void mark_info_dirty(struct dqhash *hash, int type)
3012- set_bit(DQF_INFO_DIRTY_B, &sb_dqopt(sb)->info[type].dqi_flags); 3124- set_bit(DQF_INFO_DIRTY_B, &sb_dqopt(sb)->info[type].dqi_flags);
3013+ set_bit(DQF_INFO_DIRTY_B, &dqh_dqopt(hash)->info[type].dqi_flags); 3125+ set_bit(DQF_INFO_DIRTY_B, &dqh_dqopt(hash)->info[type].dqi_flags);
3014 } 3126 }
3015 EXPORT_SYMBOL(mark_info_dirty); 3127 EXPORT_SYMBOL(mark_info_dirty);
3016 3128
3017@@ -318,7 +327,7 @@ EXPORT_SYMBOL(mark_info_dirty); 3129@@ -319,7 +328,7 @@ EXPORT_SYMBOL(mark_info_dirty);
3018 int dquot_acquire(struct dquot *dquot) 3130 int dquot_acquire(struct dquot *dquot)
3019 { 3131 {
3020 int ret = 0, ret2 = 0; 3132 int ret = 0, ret2 = 0;
3021- struct quota_info *dqopt = sb_dqopt(dquot->dq_sb); 3133- struct quota_info *dqopt = sb_dqopt(dquot->dq_sb);
3022+ struct quota_info *dqopt = dqh_dqopt(dquot->dq_dqh); 3134+ struct quota_info *dqopt = dqh_dqopt(dquot->dq_dqh);
3023 3135
3024 down(&dquot->dq_lock); 3136 down(&dquot->dq_lock);
3025 down(&dqopt->dqio_sem); 3137 down(&dqopt->dqio_sem);
3026@@ -332,7 +341,7 @@ int dquot_acquire(struct dquot *dquot) 3138@@ -333,7 +342,7 @@ int dquot_acquire(struct dquot *dquot)
3027 ret = dqopt->ops[dquot->dq_type]->commit_dqblk(dquot); 3139 ret = dqopt->ops[dquot->dq_type]->commit_dqblk(dquot);
3028 /* Write the info if needed */ 3140 /* Write the info if needed */
3029 if (info_dirty(&dqopt->info[dquot->dq_type])) 3141 if (info_dirty(&dqopt->info[dquot->dq_type]))
3030- ret2 = dqopt->ops[dquot->dq_type]->write_file_info(dquot->dq_sb, dquot->dq_type); 3142- ret2 = dqopt->ops[dquot->dq_type]->write_file_info(dquot->dq_sb, dquot->dq_type);
3031+ ret2 = dqopt->ops[dquot->dq_type]->write_file_info(dquot->dq_dqh, dquot->dq_type); 3143+ ret2 = dqopt->ops[dquot->dq_type]->write_file_info(dquot->dq_dqh, dquot->dq_type);
3032 if (ret < 0) 3144 if (ret < 0)
3033 goto out_iolock; 3145 goto out_iolock;
3034 if (ret2 < 0) { 3146 if (ret2 < 0) {
3035@@ -353,7 +362,7 @@ out_iolock: 3147@@ -354,7 +363,7 @@ out_iolock:
3036 int dquot_commit(struct dquot *dquot) 3148 int dquot_commit(struct dquot *dquot)
3037 { 3149 {
3038 int ret = 0, ret2 = 0; 3150 int ret = 0, ret2 = 0;
3039- struct quota_info *dqopt = sb_dqopt(dquot->dq_sb); 3151- struct quota_info *dqopt = sb_dqopt(dquot->dq_sb);
3040+ struct quota_info *dqopt = dqh_dqopt(dquot->dq_dqh); 3152+ struct quota_info *dqopt = dqh_dqopt(dquot->dq_dqh);
3041 3153
3042 down(&dqopt->dqio_sem); 3154 down(&dqopt->dqio_sem);
3043 spin_lock(&dq_list_lock); 3155 spin_lock(&dq_list_lock);
3044@@ -367,7 +376,7 @@ int dquot_commit(struct dquot *dquot) 3156@@ -368,7 +377,7 @@ int dquot_commit(struct dquot *dquot)
3045 if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) { 3157 if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) {
3046 ret = dqopt->ops[dquot->dq_type]->commit_dqblk(dquot); 3158 ret = dqopt->ops[dquot->dq_type]->commit_dqblk(dquot);
3047 if (info_dirty(&dqopt->info[dquot->dq_type])) 3159 if (info_dirty(&dqopt->info[dquot->dq_type]))
3048- ret2 = dqopt->ops[dquot->dq_type]->write_file_info(dquot->dq_sb, dquot->dq_type); 3160- ret2 = dqopt->ops[dquot->dq_type]->write_file_info(dquot->dq_sb, dquot->dq_type);
3049+ ret2 = dqopt->ops[dquot->dq_type]->write_file_info(dquot->dq_dqh, dquot->dq_type); 3161+ ret2 = dqopt->ops[dquot->dq_type]->write_file_info(dquot->dq_dqh, dquot->dq_type);
3050 if (ret >= 0) 3162 if (ret >= 0)
3051 ret = ret2; 3163 ret = ret2;
3052 } 3164 }
3053@@ -382,7 +391,7 @@ out_sem: 3165@@ -383,7 +392,7 @@ out_sem:
3054 int dquot_release(struct dquot *dquot) 3166 int dquot_release(struct dquot *dquot)
3055 { 3167 {
3056 int ret = 0, ret2 = 0; 3168 int ret = 0, ret2 = 0;
3057- struct quota_info *dqopt = sb_dqopt(dquot->dq_sb); 3169- struct quota_info *dqopt = sb_dqopt(dquot->dq_sb);
3058+ struct quota_info *dqopt = dqh_dqopt(dquot->dq_dqh); 3170+ struct quota_info *dqopt = dqh_dqopt(dquot->dq_dqh);
3059 3171
3060 down(&dquot->dq_lock); 3172 down(&dquot->dq_lock);
3061 /* Check whether we are not racing with some other dqget() */ 3173 /* Check whether we are not racing with some other dqget() */
3062@@ -393,7 +402,7 @@ int dquot_release(struct dquot *dquot) 3174@@ -394,7 +403,7 @@ int dquot_release(struct dquot *dquot)
3063 ret = dqopt->ops[dquot->dq_type]->release_dqblk(dquot); 3175 ret = dqopt->ops[dquot->dq_type]->release_dqblk(dquot);
3064 /* Write the info */ 3176 /* Write the info */
3065 if (info_dirty(&dqopt->info[dquot->dq_type])) 3177 if (info_dirty(&dqopt->info[dquot->dq_type]))
3066- ret2 = dqopt->ops[dquot->dq_type]->write_file_info(dquot->dq_sb, dquot->dq_type); 3178- ret2 = dqopt->ops[dquot->dq_type]->write_file_info(dquot->dq_sb, dquot->dq_type);
3067+ ret2 = dqopt->ops[dquot->dq_type]->write_file_info(dquot->dq_dqh, dquot->dq_type); 3179+ ret2 = dqopt->ops[dquot->dq_type]->write_file_info(dquot->dq_dqh, dquot->dq_type);
3068 if (ret >= 0) 3180 if (ret >= 0)
3069 ret = ret2; 3181 ret = ret2;
3070 } 3182 }
3071@@ -408,13 +417,13 @@ out_dqlock: 3183@@ -409,13 +418,13 @@ out_dqlock:
3072 * quota is disabled and pointers from inodes removed so there cannot be new 3184 * quota is disabled and pointers from inodes removed so there cannot be new
3073 * quota users. Also because we hold dqonoff_sem there can be no quota users 3185 * quota users. Also because we hold dqonoff_sem there can be no quota users
3074 * for this sb+type at all. */ 3186 * for this sb+type at all. */
3075-static void invalidate_dquots(struct super_block *sb, int type) 3187-static void invalidate_dquots(struct super_block *sb, int type)
3076+static void invalidate_dquots(struct dqhash *hash, int type) 3188+static void invalidate_dquots(struct dqhash *hash, int type)
3082- if (dquot->dq_sb != sb) 3194- if (dquot->dq_sb != sb)
3083+ if (dquot->dq_dqh != hash) 3195+ if (dquot->dq_dqh != hash)
3084 continue; 3196 continue;
3085 if (dquot->dq_type != type) 3197 if (dquot->dq_type != type)
3086 continue; 3198 continue;
3087@@ -431,18 +440,94 @@ static void invalidate_dquots(struct sup 3199@@ -432,18 +441,94 @@ static void invalidate_dquots(struct sup
3088 spin_unlock(&dq_list_lock); 3200 spin_unlock(&dq_list_lock);
3089 } 3201 }
3090 3202
3091-int vfs_quota_sync(struct super_block *sb, int type) 3203-int vfs_quota_sync(struct super_block *sb, int type)
3092+ 3204+
3180- if (!sb_has_quota_enabled(sb, cnt)) 3292- if (!sb_has_quota_enabled(sb, cnt))
3181+ if (!dqh_has_quota_enabled(hash, cnt)) 3293+ if (!dqh_has_quota_enabled(hash, cnt))
3182 continue; 3294 continue;
3183 spin_lock(&dq_list_lock); 3295 spin_lock(&dq_list_lock);
3184 dirty = &dqopt->info[cnt].dqi_dirty_list; 3296 dirty = &dqopt->info[cnt].dqi_dirty_list;
3185@@ -459,7 +544,7 @@ int vfs_quota_sync(struct super_block *s 3297@@ -460,7 +545,7 @@ int vfs_quota_sync(struct super_block *s
3186 atomic_inc(&dquot->dq_count); 3298 atomic_inc(&dquot->dq_count);
3187 dqstats.lookups++; 3299 dqstats.lookups++;
3188 spin_unlock(&dq_list_lock); 3300 spin_unlock(&dq_list_lock);
3189- sb->dq_op->write_dquot(dquot); 3301- sb->dq_op->write_dquot(dquot);
3190+ hash->dqh_qop->write_dquot(dquot); 3302+ hash->dqh_qop->write_dquot(dquot);
3191 dqput(dquot); 3303 dqput(dquot);
3192 spin_lock(&dq_list_lock); 3304 spin_lock(&dq_list_lock);
3193 } 3305 }
3194@@ -467,9 +552,10 @@ int vfs_quota_sync(struct super_block *s 3306@@ -468,9 +553,10 @@ int vfs_quota_sync(struct super_block *s
3195 } 3307 }
3196 3308
3197 for (cnt = 0; cnt < MAXQUOTAS; cnt++) 3309 for (cnt = 0; cnt < MAXQUOTAS; cnt++)
3198- if ((cnt == type || type == -1) && sb_has_quota_enabled(sb, cnt) 3310- if ((cnt == type || type == -1) && sb_has_quota_enabled(sb, cnt)
3199+ if ((cnt == type || type == -1) 3311+ if ((cnt == type || type == -1)
3202- sb->dq_op->write_info(sb, cnt); 3314- sb->dq_op->write_info(sb, cnt);
3203+ hash->dqh_qop->write_info(hash, cnt); 3315+ hash->dqh_qop->write_info(hash, cnt);
3204 spin_lock(&dq_list_lock); 3316 spin_lock(&dq_list_lock);
3205 dqstats.syncs++; 3317 dqstats.syncs++;
3206 spin_unlock(&dq_list_lock); 3318 spin_unlock(&dq_list_lock);
3207@@ -524,7 +610,7 @@ static void dqput(struct dquot *dquot) 3319@@ -525,7 +611,7 @@ static void dqput(struct dquot *dquot)
3208 if (!atomic_read(&dquot->dq_count)) { 3320 if (!atomic_read(&dquot->dq_count)) {
3209 printk("VFS: dqput: trying to free free dquot\n"); 3321 printk("VFS: dqput: trying to free free dquot\n");
3210 printk("VFS: device %s, dquot of %s %d\n", 3322 printk("VFS: device %s, dquot of %s %d\n",
3211- dquot->dq_sb->s_id, 3323- dquot->dq_sb->s_id,
3212+ dquot->dq_dqh->dqh_sb->s_id, 3324+ dquot->dq_dqh->dqh_sb->s_id,
3213 quotatypes[dquot->dq_type], 3325 quotatypes[dquot->dq_type],
3214 dquot->dq_id); 3326 dquot->dq_id);
3215 BUG(); 3327 BUG();
3216@@ -546,14 +632,14 @@ we_slept: 3328@@ -547,14 +633,14 @@ we_slept:
3217 if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags) && dquot_dirty(dquot)) { 3329 if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags) && dquot_dirty(dquot)) {
3218 spin_unlock(&dq_list_lock); 3330 spin_unlock(&dq_list_lock);
3219 /* Commit dquot before releasing */ 3331 /* Commit dquot before releasing */
3220- dquot->dq_sb->dq_op->write_dquot(dquot); 3332- dquot->dq_sb->dq_op->write_dquot(dquot);
3221+ dquot->dq_dqh->dqh_qop->write_dquot(dquot); 3333+ dquot->dq_dqh->dqh_qop->write_dquot(dquot);
3228- dquot->dq_sb->dq_op->release_dquot(dquot); 3340- dquot->dq_sb->dq_op->release_dquot(dquot);
3229+ dquot->dq_dqh->dqh_qop->release_dquot(dquot); 3341+ dquot->dq_dqh->dqh_qop->release_dquot(dquot);
3230 goto we_slept; 3342 goto we_slept;
3231 } 3343 }
3232 atomic_dec(&dquot->dq_count); 3344 atomic_dec(&dquot->dq_count);
3233@@ -566,7 +652,7 @@ we_slept: 3345@@ -567,7 +653,7 @@ we_slept:
3234 spin_unlock(&dq_list_lock); 3346 spin_unlock(&dq_list_lock);
3235 } 3347 }
3236 3348
3237-static struct dquot *get_empty_dquot(struct super_block *sb, int type) 3349-static struct dquot *get_empty_dquot(struct super_block *sb, int type)
3238+static struct dquot *get_empty_dquot(int type) 3350+static struct dquot *get_empty_dquot(int type)
3239 { 3351 {
3240 struct dquot *dquot; 3352 struct dquot *dquot;
3241 3353
3242@@ -580,7 +666,7 @@ static struct dquot *get_empty_dquot(str 3354@@ -581,7 +667,7 @@ static struct dquot *get_empty_dquot(str
3243 INIT_LIST_HEAD(&dquot->dq_inuse); 3355 INIT_LIST_HEAD(&dquot->dq_inuse);
3244 INIT_HLIST_NODE(&dquot->dq_hash); 3356 INIT_HLIST_NODE(&dquot->dq_hash);
3245 INIT_LIST_HEAD(&dquot->dq_dirty); 3357 INIT_LIST_HEAD(&dquot->dq_dirty);
3246- dquot->dq_sb = sb; 3358- dquot->dq_sb = sb;
3247+ dquot->dq_dqh = NULL; 3359+ dquot->dq_dqh = NULL;
3248 dquot->dq_type = type; 3360 dquot->dq_type = type;
3249 atomic_set(&dquot->dq_count, 1); 3361 atomic_set(&dquot->dq_count, 1);
3250 3362
3251@@ -591,19 +677,19 @@ static struct dquot *get_empty_dquot(str 3363@@ -592,19 +678,19 @@ static struct dquot *get_empty_dquot(str
3252 * Get reference to dquot 3364 * Get reference to dquot
3253 * MUST be called with either dqptr_sem or dqonoff_sem held 3365 * MUST be called with either dqptr_sem or dqonoff_sem held
3254 */ 3366 */
3255-static struct dquot *dqget(struct super_block *sb, unsigned int id, int type) 3367-static struct dquot *dqget(struct super_block *sb, unsigned int id, int type)
3256+static struct dquot *dqget(struct dqhash *hash, unsigned int id, int type) 3368+static struct dquot *dqget(struct dqhash *hash, unsigned int id, int type)
3271- if ((empty = get_empty_dquot(sb, type)) == NODQUOT) 3383- if ((empty = get_empty_dquot(sb, type)) == NODQUOT)
3272+ if ((empty = get_empty_dquot(type)) == NODQUOT) 3384+ if ((empty = get_empty_dquot(type)) == NODQUOT)
3273 schedule(); /* Try to wait for a moment... */ 3385 schedule(); /* Try to wait for a moment... */
3274 goto we_slept; 3386 goto we_slept;
3275 } 3387 }
3276@@ -612,7 +698,7 @@ we_slept: 3388@@ -613,7 +699,7 @@ we_slept:
3277 /* all dquots go on the inuse_list */ 3389 /* all dquots go on the inuse_list */
3278 put_inuse(dquot); 3390 put_inuse(dquot);
3279 /* hash it first so it can be found */ 3391 /* hash it first so it can be found */
3280- insert_dquot_hash(dquot); 3392- insert_dquot_hash(dquot);
3281+ insert_dquot_hash(hash, dquot); 3393+ insert_dquot_hash(hash, dquot);
3282 dqstats.lookups++; 3394 dqstats.lookups++;
3283 spin_unlock(&dq_list_lock); 3395 spin_unlock(&dq_list_lock);
3284 } else { 3396 } else {
3285@@ -629,12 +715,13 @@ we_slept: 3397@@ -630,12 +716,13 @@ we_slept:
3286 * finished or it will be canceled due to dq_count > 1 test */ 3398 * finished or it will be canceled due to dq_count > 1 test */
3287 wait_on_dquot(dquot); 3399 wait_on_dquot(dquot);
3288 /* Read the dquot and instantiate it (everything done only if needed) */ 3400 /* Read the dquot and instantiate it (everything done only if needed) */
3289- if (!test_bit(DQ_ACTIVE_B, &dquot->dq_flags) && sb->dq_op->acquire_dquot(dquot) < 0) { 3401- if (!test_bit(DQ_ACTIVE_B, &dquot->dq_flags) && sb->dq_op->acquire_dquot(dquot) < 0) {
3290+ if (!test_bit(DQ_ACTIVE_B, &dquot->dq_flags) && 3402+ if (!test_bit(DQ_ACTIVE_B, &dquot->dq_flags) &&
3296- if (!dquot->dq_sb) /* Has somebody invalidated entry under us? */ 3408- if (!dquot->dq_sb) /* Has somebody invalidated entry under us? */
3297+ if (!dquot->dq_dqh) /* Has somebody invalidated entry under us? */ 3409+ if (!dquot->dq_dqh) /* Has somebody invalidated entry under us? */
3298 BUG(); 3410 BUG();
3299 #endif 3411 #endif
3300 3412
3301@@ -656,9 +743,10 @@ static int dqinit_needed(struct inode *i 3413@@ -657,9 +744,10 @@ static int dqinit_needed(struct inode *i
3302 } 3414 }
3303 3415
3304 /* This routine is guarded by dqonoff_sem semaphore */ 3416 /* This routine is guarded by dqonoff_sem semaphore */
3305-static void add_dquot_ref(struct super_block *sb, int type) 3417-static void add_dquot_ref(struct super_block *sb, int type)
3306+static void add_dquot_ref(struct dqhash *hash, int type) 3418+static void add_dquot_ref(struct dqhash *hash, int type)
3308 struct list_head *p; 3420 struct list_head *p;
3309+ struct super_block *sb = hash->dqh_sb; 3421+ struct super_block *sb = hash->dqh_sb;
3310 3422
3311 restart: 3423 restart:
3312 file_list_lock(); 3424 file_list_lock();
3313@@ -668,7 +756,7 @@ restart: 3425@@ -669,7 +757,7 @@ restart:
3314 if (filp->f_mode & FMODE_WRITE && dqinit_needed(inode, type)) { 3426 if (filp->f_mode & FMODE_WRITE && dqinit_needed(inode, type)) {
3315 struct dentry *dentry = dget(filp->f_dentry); 3427 struct dentry *dentry = dget(filp->f_dentry);
3316 file_list_unlock(); 3428 file_list_unlock();
3317- sb->dq_op->initialize(inode, type); 3429- sb->dq_op->initialize(inode, type);
3318+ hash->dqh_qop->initialize(inode, type); 3430+ hash->dqh_qop->initialize(inode, type);
3319 dput(dentry); 3431 dput(dentry);
3320 /* As we may have blocked we had better restart... */ 3432 /* As we may have blocked we had better restart... */
3321 goto restart; 3433 goto restart;
3322@@ -727,16 +815,16 @@ static void put_dquot_list(struct list_h 3434@@ -728,16 +816,16 @@ static void put_dquot_list(struct list_h
3323 } 3435 }
3324 3436
3325 /* Gather all references from inodes and drop them */ 3437 /* Gather all references from inodes and drop them */
3326-static void drop_dquot_ref(struct super_block *sb, int type) 3438-static void drop_dquot_ref(struct super_block *sb, int type)
3327+static void drop_dquot_ref(struct dqhash *hash, int type) 3439+static void drop_dquot_ref(struct dqhash *hash, int type)
3338+ remove_dquot_ref(hash, type, &tofree_head); 3450+ remove_dquot_ref(hash, type, &tofree_head);
3339+ up_write(&dqh_dqopt(hash)->dqptr_sem); 3451+ up_write(&dqh_dqopt(hash)->dqptr_sem);
3340 up(&iprune_sem); 3452 up(&iprune_sem);
3341 put_dquot_list(&tofree_head); 3453 put_dquot_list(&tofree_head);
3342 } 3454 }
3343@@ -808,7 +896,7 @@ static void print_warning(struct dquot * 3455@@ -809,7 +897,7 @@ static void print_warning(struct dquot *
3344 if (!need_print_warning(dquot) || (flag && test_and_set_bit(flag, &dquot->dq_flags))) 3456 if (!need_print_warning(dquot) || (flag && test_and_set_bit(flag, &dquot->dq_flags)))
3345 return; 3457 return;
3346 3458
3347- tty_write_message(current->signal->tty, dquot->dq_sb->s_id); 3459- tty_write_message(current->signal->tty, dquot->dq_sb->s_id);
3348+ tty_write_message(current->signal->tty, dquot->dq_dqh->dqh_sb->s_id); 3460+ tty_write_message(current->signal->tty, dquot->dq_dqh->dqh_sb->s_id);
3349 if (warntype == ISOFTWARN || warntype == BSOFTWARN) 3461 if (warntype == ISOFTWARN || warntype == BSOFTWARN)
3350 tty_write_message(current->signal->tty, ": warning, "); 3462 tty_write_message(current->signal->tty, ": warning, ");
3351 else 3463 else
3352@@ -848,7 +936,7 @@ static inline void flush_warnings(struct 3464@@ -849,7 +937,7 @@ static inline void flush_warnings(struct
3353 3465
3354 static inline char ignore_hardlimit(struct dquot *dquot) 3466 static inline char ignore_hardlimit(struct dquot *dquot)
3355 { 3467 {
3356- struct mem_dqinfo *info = &sb_dqopt(dquot->dq_sb)->info[dquot->dq_type]; 3468- struct mem_dqinfo *info = &sb_dqopt(dquot->dq_sb)->info[dquot->dq_type];
3357+ struct mem_dqinfo *info = &dqh_dqopt(dquot->dq_dqh)->info[dquot->dq_type]; 3469+ struct mem_dqinfo *info = &dqh_dqopt(dquot->dq_dqh)->info[dquot->dq_type];
3358 3470
3359 return capable(CAP_SYS_RESOURCE) && 3471 return capable(CAP_SYS_RESOURCE) &&
3360 (info->dqi_format->qf_fmt_id != QFMT_VFS_OLD || !(info->dqi_flags & V1_DQF_RSQUASH)); 3472 (info->dqi_format->qf_fmt_id != QFMT_VFS_OLD || !(info->dqi_flags & V1_DQF_RSQUASH));
3361@@ -880,7 +968,7 @@ static int check_idq(struct dquot *dquot 3473@@ -881,7 +969,7 @@ static int check_idq(struct dquot *dquot
3362 (dquot->dq_dqb.dqb_curinodes + inodes) > dquot->dq_dqb.dqb_isoftlimit && 3474 (dquot->dq_dqb.dqb_curinodes + inodes) > dquot->dq_dqb.dqb_isoftlimit &&
3363 dquot->dq_dqb.dqb_itime == 0) { 3475 dquot->dq_dqb.dqb_itime == 0) {
3364 *warntype = ISOFTWARN; 3476 *warntype = ISOFTWARN;
3365- dquot->dq_dqb.dqb_itime = get_seconds() + sb_dqopt(dquot->dq_sb)->info[dquot->dq_type].dqi_igrace; 3477- dquot->dq_dqb.dqb_itime = get_seconds() + sb_dqopt(dquot->dq_sb)->info[dquot->dq_type].dqi_igrace;
3366+ dquot->dq_dqb.dqb_itime = get_seconds() + dqh_dqopt(dquot->dq_dqh)->info[dquot->dq_type].dqi_igrace; 3478+ dquot->dq_dqb.dqb_itime = get_seconds() + dqh_dqopt(dquot->dq_dqh)->info[dquot->dq_type].dqi_igrace;
3367 } 3479 }
3368 3480
3369 return QUOTA_OK; 3481 return QUOTA_OK;
3370@@ -915,7 +1003,7 @@ static int check_bdq(struct dquot *dquot 3482@@ -916,7 +1004,7 @@ static int check_bdq(struct dquot *dquot
3371 dquot->dq_dqb.dqb_btime == 0) { 3483 dquot->dq_dqb.dqb_btime == 0) {
3372 if (!prealloc) { 3484 if (!prealloc) {
3373 *warntype = BSOFTWARN; 3485 *warntype = BSOFTWARN;
3374- dquot->dq_dqb.dqb_btime = get_seconds() + sb_dqopt(dquot->dq_sb)->info[dquot->dq_type].dqi_bgrace; 3486- dquot->dq_dqb.dqb_btime = get_seconds() + sb_dqopt(dquot->dq_sb)->info[dquot->dq_type].dqi_bgrace;
3375+ dquot->dq_dqb.dqb_btime = get_seconds() + dqh_dqopt(dquot->dq_dqh)->info[dquot->dq_type].dqi_bgrace; 3487+ dquot->dq_dqb.dqb_btime = get_seconds() + dqh_dqopt(dquot->dq_dqh)->info[dquot->dq_type].dqi_bgrace;
3376 } 3488 }
3377 else 3489 else
3378 /* 3490 /*
3379@@ -941,7 +1029,7 @@ int dquot_initialize(struct inode *inode 3491@@ -942,7 +1030,7 @@ int dquot_initialize(struct inode *inode
3380 * re-enter the quota code and are already holding the semaphore */ 3492 * re-enter the quota code and are already holding the semaphore */
3381 if (IS_NOQUOTA(inode)) 3493 if (IS_NOQUOTA(inode))
3382 return 0; 3494 return 0;
3383- down_write(&sb_dqopt(inode->i_sb)->dqptr_sem); 3495- down_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
3384+ down_write(&dqh_dqopt(inode->i_dqh)->dqptr_sem); 3496+ down_write(&dqh_dqopt(inode->i_dqh)->dqptr_sem);
3385 /* Having dqptr_sem we know NOQUOTA flags can't be altered... */ 3497 /* Having dqptr_sem we know NOQUOTA flags can't be altered... */
3386 if (IS_NOQUOTA(inode)) 3498 if (IS_NOQUOTA(inode))
3387 goto out_err; 3499 goto out_err;
3388@@ -957,11 +1045,11 @@ int dquot_initialize(struct inode *inode 3500@@ -958,11 +1046,11 @@ int dquot_initialize(struct inode *inode
3389 id = inode->i_gid; 3501 id = inode->i_gid;
3390 break; 3502 break;
3391 } 3503 }
3392- inode->i_dquot[cnt] = dqget(inode->i_sb, id, cnt); 3504- inode->i_dquot[cnt] = dqget(inode->i_sb, id, cnt);
3393+ inode->i_dquot[cnt] = dqget(inode->i_dqh, id, cnt); 3505+ inode->i_dquot[cnt] = dqget(inode->i_dqh, id, cnt);
3397- up_write(&sb_dqopt(inode->i_sb)->dqptr_sem); 3509- up_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
3398+ up_write(&dqh_dqopt(inode->i_dqh)->dqptr_sem); 3510+ up_write(&dqh_dqopt(inode->i_dqh)->dqptr_sem);
3399 return ret; 3511 return ret;
3400 } 3512 }
3401 3513
3402@@ -973,14 +1061,14 @@ int dquot_drop(struct inode *inode) 3514@@ -974,14 +1062,14 @@ int dquot_drop(struct inode *inode)
3403 { 3515 {
3404 int cnt; 3516 int cnt;
3405 3517
3406- down_write(&sb_dqopt(inode->i_sb)->dqptr_sem); 3518- down_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
3407+ down_write(&dqh_dqopt(inode->i_dqh)->dqptr_sem); 3519+ down_write(&dqh_dqopt(inode->i_dqh)->dqptr_sem);
3414- up_write(&sb_dqopt(inode->i_sb)->dqptr_sem); 3526- up_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
3415+ up_write(&dqh_dqopt(inode->i_dqh)->dqptr_sem); 3527+ up_write(&dqh_dqopt(inode->i_dqh)->dqptr_sem);
3416 return 0; 3528 return 0;
3417 } 3529 }
3418 3530
3419@@ -1011,9 +1099,9 @@ out_add: 3531@@ -1012,9 +1100,9 @@ out_add:
3420 for (cnt = 0; cnt < MAXQUOTAS; cnt++) 3532 for (cnt = 0; cnt < MAXQUOTAS; cnt++)
3421 warntype[cnt] = NOWARN; 3533 warntype[cnt] = NOWARN;
3422 3534
3423- down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); 3535- down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
3424+ down_read(&dqh_dqopt(inode->i_dqh)->dqptr_sem); 3536+ down_read(&dqh_dqopt(inode->i_dqh)->dqptr_sem);
3426- up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); 3538- up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
3427+ up_read(&dqh_dqopt(inode->i_dqh)->dqptr_sem); 3539+ up_read(&dqh_dqopt(inode->i_dqh)->dqptr_sem);
3428 goto out_add; 3540 goto out_add;
3429 } 3541 }
3430 spin_lock(&dq_data_lock); 3542 spin_lock(&dq_data_lock);
3431@@ -1038,7 +1126,7 @@ warn_put_all: 3543@@ -1039,7 +1127,7 @@ warn_put_all:
3432 if (inode->i_dquot[cnt]) 3544 if (inode->i_dquot[cnt])
3433 mark_dquot_dirty(inode->i_dquot[cnt]); 3545 mark_dquot_dirty(inode->i_dquot[cnt]);
3434 flush_warnings(inode->i_dquot, warntype); 3546 flush_warnings(inode->i_dquot, warntype);
3435- up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); 3547- up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
3436+ up_read(&dqh_dqopt(inode->i_dqh)->dqptr_sem); 3548+ up_read(&dqh_dqopt(inode->i_dqh)->dqptr_sem);
3437 return ret; 3549 return ret;
3438 } 3550 }
3439 3551
3440@@ -1056,9 +1144,9 @@ int dquot_alloc_inode(const struct inode 3552@@ -1057,9 +1145,9 @@ int dquot_alloc_inode(const struct inode
3441 return QUOTA_OK; 3553 return QUOTA_OK;
3442 for (cnt = 0; cnt < MAXQUOTAS; cnt++) 3554 for (cnt = 0; cnt < MAXQUOTAS; cnt++)
3443 warntype[cnt] = NOWARN; 3555 warntype[cnt] = NOWARN;
3444- down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); 3556- down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
3445+ down_read(&dqh_dqopt(inode->i_dqh)->dqptr_sem); 3557+ down_read(&dqh_dqopt(inode->i_dqh)->dqptr_sem);
3447- up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); 3559- up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
3448+ up_read(&dqh_dqopt(inode->i_dqh)->dqptr_sem); 3560+ up_read(&dqh_dqopt(inode->i_dqh)->dqptr_sem);
3449 return QUOTA_OK; 3561 return QUOTA_OK;
3450 } 3562 }
3451 spin_lock(&dq_data_lock); 3563 spin_lock(&dq_data_lock);
3452@@ -1083,7 +1171,7 @@ warn_put_all: 3564@@ -1084,7 +1172,7 @@ warn_put_all:
3453 if (inode->i_dquot[cnt]) 3565 if (inode->i_dquot[cnt])
3454 mark_dquot_dirty(inode->i_dquot[cnt]); 3566 mark_dquot_dirty(inode->i_dquot[cnt]);
3455 flush_warnings((struct dquot **)inode->i_dquot, warntype); 3567 flush_warnings((struct dquot **)inode->i_dquot, warntype);
3456- up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); 3568- up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
3457+ up_read(&dqh_dqopt(inode->i_dqh)->dqptr_sem); 3569+ up_read(&dqh_dqopt(inode->i_dqh)->dqptr_sem);
3458 return ret; 3570 return ret;
3459 } 3571 }
3460 3572
3461@@ -1101,10 +1189,10 @@ out_sub: 3573@@ -1102,10 +1190,10 @@ out_sub:
3462 inode_sub_bytes(inode, number); 3574 inode_sub_bytes(inode, number);
3463 return QUOTA_OK; 3575 return QUOTA_OK;
3464 } 3576 }
3465- down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); 3577- down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
3466+ down_read(&dqh_dqopt(inode->i_dqh)->dqptr_sem); 3578+ down_read(&dqh_dqopt(inode->i_dqh)->dqptr_sem);
3469- up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); 3581- up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
3470+ up_read(&dqh_dqopt(inode->i_dqh)->dqptr_sem); 3582+ up_read(&dqh_dqopt(inode->i_dqh)->dqptr_sem);
3471 goto out_sub; 3583 goto out_sub;
3472 } 3584 }
3473 spin_lock(&dq_data_lock); 3585 spin_lock(&dq_data_lock);
3474@@ -1119,7 +1207,7 @@ out_sub: 3586@@ -1120,7 +1208,7 @@ out_sub:
3475 for (cnt = 0; cnt < MAXQUOTAS; cnt++) 3587 for (cnt = 0; cnt < MAXQUOTAS; cnt++)
3476 if (inode->i_dquot[cnt]) 3588 if (inode->i_dquot[cnt])
3477 mark_dquot_dirty(inode->i_dquot[cnt]); 3589 mark_dquot_dirty(inode->i_dquot[cnt]);
3478- up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); 3590- up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
3479+ up_read(&dqh_dqopt(inode->i_dqh)->dqptr_sem); 3591+ up_read(&dqh_dqopt(inode->i_dqh)->dqptr_sem);
3480 return QUOTA_OK; 3592 return QUOTA_OK;
3481 } 3593 }
3482 3594
3483@@ -1134,10 +1222,10 @@ int dquot_free_inode(const struct inode 3595@@ -1135,10 +1223,10 @@ int dquot_free_inode(const struct inode
3484 * re-enter the quota code and are already holding the semaphore */ 3596 * re-enter the quota code and are already holding the semaphore */
3485 if (IS_NOQUOTA(inode)) 3597 if (IS_NOQUOTA(inode))
3486 return QUOTA_OK; 3598 return QUOTA_OK;
3487- down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); 3599- down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
3488+ down_read(&dqh_dqopt(inode->i_dqh)->dqptr_sem); 3600+ down_read(&dqh_dqopt(inode->i_dqh)->dqptr_sem);
3491- up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); 3603- up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
3492+ up_read(&dqh_dqopt(inode->i_dqh)->dqptr_sem); 3604+ up_read(&dqh_dqopt(inode->i_dqh)->dqptr_sem);
3493 return QUOTA_OK; 3605 return QUOTA_OK;
3494 } 3606 }
3495 spin_lock(&dq_data_lock); 3607 spin_lock(&dq_data_lock);
3496@@ -1151,7 +1239,7 @@ int dquot_free_inode(const struct inode 3608@@ -1152,7 +1240,7 @@ int dquot_free_inode(const struct inode
3497 for (cnt = 0; cnt < MAXQUOTAS; cnt++) 3609 for (cnt = 0; cnt < MAXQUOTAS; cnt++)
3498 if (inode->i_dquot[cnt]) 3610 if (inode->i_dquot[cnt])
3499 mark_dquot_dirty(inode->i_dquot[cnt]); 3611 mark_dquot_dirty(inode->i_dquot[cnt]);
3500- up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); 3612- up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
3501+ up_read(&dqh_dqopt(inode->i_dqh)->dqptr_sem); 3613+ up_read(&dqh_dqopt(inode->i_dqh)->dqptr_sem);
3502 return QUOTA_OK; 3614 return QUOTA_OK;
3503 } 3615 }
3504 3616
3505@@ -1166,6 +1254,7 @@ int dquot_transfer(struct inode *inode, 3617@@ -1167,6 +1255,7 @@ int dquot_transfer(struct inode *inode,
3506 qsize_t space; 3618 qsize_t space;
3507 struct dquot *transfer_from[MAXQUOTAS]; 3619 struct dquot *transfer_from[MAXQUOTAS];
3508 struct dquot *transfer_to[MAXQUOTAS]; 3620 struct dquot *transfer_to[MAXQUOTAS];
3509+ struct dqhash *dqh = inode->i_sb->s_dqh; 3621+ struct dqhash *dqh = inode->i_sb->s_dqh;
3510 int cnt, ret = NO_QUOTA, chuid = (iattr->ia_valid & ATTR_UID) && inode->i_uid != iattr->ia_uid, 3622 int cnt, ret = NO_QUOTA, chuid = (iattr->ia_valid & ATTR_UID) && inode->i_uid != iattr->ia_uid,
3511 chgid = (iattr->ia_valid & ATTR_GID) && inode->i_gid != iattr->ia_gid; 3623 chgid = (iattr->ia_valid & ATTR_GID) && inode->i_gid != iattr->ia_gid;
3512 char warntype[MAXQUOTAS]; 3624 char warntype[MAXQUOTAS];
3513@@ -1179,10 +1268,10 @@ int dquot_transfer(struct inode *inode, 3625@@ -1180,10 +1269,10 @@ int dquot_transfer(struct inode *inode,
3514 transfer_to[cnt] = transfer_from[cnt] = NODQUOT; 3626 transfer_to[cnt] = transfer_from[cnt] = NODQUOT;
3515 warntype[cnt] = NOWARN; 3627 warntype[cnt] = NOWARN;
3516 } 3628 }
3517- down_write(&sb_dqopt(inode->i_sb)->dqptr_sem); 3629- down_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
3518+ down_write(&dqh_dqopt(inode->i_dqh)->dqptr_sem); 3630+ down_write(&dqh_dqopt(inode->i_dqh)->dqptr_sem);
3521- up_write(&sb_dqopt(inode->i_sb)->dqptr_sem); 3633- up_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
3522+ up_write(&dqh_dqopt(inode->i_dqh)->dqptr_sem); 3634+ up_write(&dqh_dqopt(inode->i_dqh)->dqptr_sem);
3523 return QUOTA_OK; 3635 return QUOTA_OK;
3524 } 3636 }
3525 /* First build the transfer_to list - here we can block on 3637 /* First build the transfer_to list - here we can block on
3526@@ -1193,12 +1282,12 @@ int dquot_transfer(struct inode *inode, 3638@@ -1194,12 +1283,12 @@ int dquot_transfer(struct inode *inode,
3527 case USRQUOTA: 3639 case USRQUOTA:
3528 if (!chuid) 3640 if (!chuid)
3529 continue; 3641 continue;
3530- transfer_to[cnt] = dqget(inode->i_sb, iattr->ia_uid, cnt); 3642- transfer_to[cnt] = dqget(inode->i_sb, iattr->ia_uid, cnt);
3531+ transfer_to[cnt] = dqget(dqh, iattr->ia_uid, cnt); 3643+ transfer_to[cnt] = dqget(dqh, iattr->ia_uid, cnt);
3536- transfer_to[cnt] = dqget(inode->i_sb, iattr->ia_gid, cnt); 3648- transfer_to[cnt] = dqget(inode->i_sb, iattr->ia_gid, cnt);
3537+ transfer_to[cnt] = dqget(dqh, iattr->ia_gid, cnt); 3649+ transfer_to[cnt] = dqget(dqh, iattr->ia_gid, cnt);
3538 break; 3650 break;
3539 } 3651 }
3540 } 3652 }
3541@@ -1253,20 +1342,20 @@ warn_put_all: 3653@@ -1254,20 +1343,20 @@ warn_put_all:
3542 if (ret == NO_QUOTA && transfer_to[cnt] != NODQUOT) 3654 if (ret == NO_QUOTA && transfer_to[cnt] != NODQUOT)
3543 dqput(transfer_to[cnt]); 3655 dqput(transfer_to[cnt]);
3544 } 3656 }
3545- up_write(&sb_dqopt(inode->i_sb)->dqptr_sem); 3657- up_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
3546+ up_write(&dqh_dqopt(inode->i_dqh)->dqptr_sem); 3658+ up_write(&dqh_dqopt(inode->i_dqh)->dqptr_sem);
3561- ret = dqopt->ops[type]->write_file_info(sb, type); 3673- ret = dqopt->ops[type]->write_file_info(sb, type);
3562+ ret = dqopt->ops[type]->write_file_info(hash, type); 3674+ ret = dqopt->ops[type]->write_file_info(hash, type);
3563 up(&dqopt->dqio_sem); 3675 up(&dqopt->dqio_sem);
3564 return ret; 3676 return ret;
3565 } 3677 }
3566@@ -1316,10 +1405,10 @@ static inline void reset_enable_flags(st 3678@@ -1317,10 +1406,10 @@ static inline void reset_enable_flags(st
3567 /* 3679 /*
3568 * Turn quota off on a device. type == -1 ==> quotaoff for all types (umount) 3680 * Turn quota off on a device. type == -1 ==> quotaoff for all types (umount)
3569 */ 3681 */
3570-int vfs_quota_off(struct super_block *sb, int type) 3682-int vfs_quota_off(struct super_block *sb, int type)
3571+int vfs_quota_off(struct dqhash *hash, int type) 3683+int vfs_quota_off(struct dqhash *hash, int type)
3574- struct quota_info *dqopt = sb_dqopt(sb); 3686- struct quota_info *dqopt = sb_dqopt(sb);
3575+ struct quota_info *dqopt = dqh_dqopt(hash); 3687+ struct quota_info *dqopt = dqh_dqopt(hash);
3576 struct inode *toputinode[MAXQUOTAS]; 3688 struct inode *toputinode[MAXQUOTAS];
3577 3689
3578 /* We need to serialize quota_off() for device */ 3690 /* We need to serialize quota_off() for device */
3579@@ -1328,21 +1417,21 @@ int vfs_quota_off(struct super_block *sb 3691@@ -1329,21 +1418,21 @@ int vfs_quota_off(struct super_block *sb
3580 toputinode[cnt] = NULL; 3692 toputinode[cnt] = NULL;
3581 if (type != -1 && cnt != type) 3693 if (type != -1 && cnt != type)
3582 continue; 3694 continue;
3583- if (!sb_has_quota_enabled(sb, cnt)) 3695- if (!sb_has_quota_enabled(sb, cnt))
3584+ if (!dqh_has_quota_enabled(hash, cnt)) 3696+ if (!dqh_has_quota_enabled(hash, cnt))
3601- dqopt->ops[cnt]->free_file_info(sb, cnt); 3713- dqopt->ops[cnt]->free_file_info(sb, cnt);
3602+ dqopt->ops[cnt]->free_file_info(hash, cnt); 3714+ dqopt->ops[cnt]->free_file_info(hash, cnt);
3603 put_quota_format(dqopt->info[cnt].dqi_format); 3715 put_quota_format(dqopt->info[cnt].dqi_format);
3604 3716
3605 toputinode[cnt] = dqopt->files[cnt]; 3717 toputinode[cnt] = dqopt->files[cnt];
3606@@ -1355,9 +1444,9 @@ int vfs_quota_off(struct super_block *sb 3718@@ -1356,9 +1445,9 @@ int vfs_quota_off(struct super_block *sb
3607 up(&dqopt->dqonoff_sem); 3719 up(&dqopt->dqonoff_sem);
3608 /* Sync the superblock so that buffers with quota data are written to 3720 /* Sync the superblock so that buffers with quota data are written to
3609 * disk (and so userspace sees correct data afterwards). */ 3721 * disk (and so userspace sees correct data afterwards). */
3610- if (sb->s_op->sync_fs) 3722- if (sb->s_op->sync_fs)
3611- sb->s_op->sync_fs(sb, 1); 3723- sb->s_op->sync_fs(sb, 1);
3614+ hash->dqh_sb->s_op->sync_fs(hash->dqh_sb, 1); 3726+ hash->dqh_sb->s_op->sync_fs(hash->dqh_sb, 1);
3615+ sync_blockdev(hash->dqh_sb->s_bdev); 3727+ sync_blockdev(hash->dqh_sb->s_bdev);
3616 /* Now the quota files are just ordinary files and we can set the 3728 /* Now the quota files are just ordinary files and we can set the
3617 * inode flags back. Moreover we discard the pagecache so that 3729 * inode flags back. Moreover we discard the pagecache so that
3618 * userspace sees the writes we did bypassing the pagecache. We 3730 * userspace sees the writes we did bypassing the pagecache. We
3619@@ -1368,7 +1457,7 @@ int vfs_quota_off(struct super_block *sb 3731@@ -1369,7 +1458,7 @@ int vfs_quota_off(struct super_block *sb
3620 down(&dqopt->dqonoff_sem); 3732 down(&dqopt->dqonoff_sem);
3621 /* If quota was reenabled in the meantime, we have 3733 /* If quota was reenabled in the meantime, we have
3622 * nothing to do */ 3734 * nothing to do */
3623- if (!sb_has_quota_enabled(sb, cnt)) { 3735- if (!sb_has_quota_enabled(sb, cnt)) {
3624+ if (!dqh_has_quota_enabled(hash, cnt)) { 3736+ if (!dqh_has_quota_enabled(hash, cnt)) {
3625 down(&toputinode[cnt]->i_sem); 3737 mutex_lock(&toputinode[cnt]->i_mutex);
3626 toputinode[cnt]->i_flags &= ~(S_IMMUTABLE | 3738 toputinode[cnt]->i_flags &= ~(S_IMMUTABLE |
3627 S_NOATIME | S_NOQUOTA); 3739 S_NOATIME | S_NOQUOTA);
3628@@ -1379,8 +1468,8 @@ int vfs_quota_off(struct super_block *sb 3740@@ -1380,8 +1469,8 @@ int vfs_quota_off(struct super_block *sb
3629 } 3741 }
3630 up(&dqopt->dqonoff_sem); 3742 up(&dqopt->dqonoff_sem);
3631 } 3743 }
3632- if (sb->s_bdev) 3744- if (sb->s_bdev)
3633- invalidate_bdev(sb->s_bdev, 0); 3745- invalidate_bdev(sb->s_bdev, 0);
3634+ if (hash->dqh_sb->s_bdev) 3746+ if (hash->dqh_sb->s_bdev)
3635+ invalidate_bdev(hash->dqh_sb->s_bdev, 0); 3747+ invalidate_bdev(hash->dqh_sb->s_bdev, 0);
3636 return 0; 3748 return 0;
3637 } 3749 }
3638 3750
3639@@ -1393,7 +1482,8 @@ static int vfs_quota_on_inode(struct ino 3751@@ -1394,7 +1483,8 @@ static int vfs_quota_on_inode(struct ino
3640 { 3752 {
3641 struct quota_format_type *fmt = find_quota_format(format_id); 3753 struct quota_format_type *fmt = find_quota_format(format_id);
3642 struct super_block *sb = inode->i_sb; 3754 struct super_block *sb = inode->i_sb;
3643- struct quota_info *dqopt = sb_dqopt(sb); 3755- struct quota_info *dqopt = sb_dqopt(sb);
3644+ struct dqhash *hash = inode->i_dqh; 3756+ struct dqhash *hash = inode->i_dqh;
3645+ struct quota_info *dqopt = dqh_dqopt(hash); 3757+ struct quota_info *dqopt = dqh_dqopt(hash);
3646 int error; 3758 int error;
3647 int oldflags = -1; 3759 int oldflags = -1;
3648 3760
3649@@ -1419,7 +1509,7 @@ static int vfs_quota_on_inode(struct ino 3761@@ -1420,7 +1510,7 @@ static int vfs_quota_on_inode(struct ino
3650 invalidate_bdev(sb->s_bdev, 0); 3762 invalidate_bdev(sb->s_bdev, 0);
3651 down(&inode->i_sem); 3763 mutex_lock(&inode->i_mutex);
3652 down(&dqopt->dqonoff_sem); 3764 down(&dqopt->dqonoff_sem);
3653- if (sb_has_quota_enabled(sb, type)) { 3765- if (sb_has_quota_enabled(sb, type)) {
3654+ if (dqh_has_quota_enabled(hash, type)) { 3766+ if (dqh_has_quota_enabled(hash, type)) {
3655 error = -EBUSY; 3767 error = -EBUSY;
3656 goto out_lock; 3768 goto out_lock;
3657 } 3769 }
3658@@ -1430,21 +1520,21 @@ static int vfs_quota_on_inode(struct ino 3770@@ -1431,21 +1521,21 @@ static int vfs_quota_on_inode(struct ino
3659 oldflags = inode->i_flags & (S_NOATIME | S_IMMUTABLE | S_NOQUOTA); 3771 oldflags = inode->i_flags & (S_NOATIME | S_IMMUTABLE | S_NOQUOTA);
3660 inode->i_flags |= S_NOQUOTA | S_NOATIME | S_IMMUTABLE; 3772 inode->i_flags |= S_NOQUOTA | S_NOATIME | S_IMMUTABLE;
3661 up_write(&dqopt->dqptr_sem); 3773 up_write(&dqopt->dqptr_sem);
3662- sb->dq_op->drop(inode); 3774- sb->dq_op->drop(inode);
3663+ hash->dqh_qop->drop(inode); 3775+ hash->dqh_qop->drop(inode);
3678- if ((error = dqopt->ops[type]->read_file_info(sb, type)) < 0) { 3790- if ((error = dqopt->ops[type]->read_file_info(sb, type)) < 0) {
3679+ if ((error = dqopt->ops[type]->read_file_info(hash, type)) < 0) { 3791+ if ((error = dqopt->ops[type]->read_file_info(hash, type)) < 0) {
3680 up(&dqopt->dqio_sem); 3792 up(&dqopt->dqio_sem);
3681 goto out_file_init; 3793 goto out_file_init;
3682 } 3794 }
3683@@ -1452,7 +1542,7 @@ static int vfs_quota_on_inode(struct ino 3795@@ -1453,7 +1543,7 @@ static int vfs_quota_on_inode(struct ino
3684 up(&inode->i_sem); 3796 mutex_unlock(&inode->i_mutex);
3685 set_enable_flags(dqopt, type); 3797 set_enable_flags(dqopt, type);
3686 3798
3687- add_dquot_ref(sb, type); 3799- add_dquot_ref(sb, type);
3688+ add_dquot_ref(hash, type); 3800+ add_dquot_ref(hash, type);
3689 up(&dqopt->dqonoff_sem); 3801 up(&dqopt->dqonoff_sem);
3690 3802
3691 return 0; 3803 return 0;
3692@@ -1478,7 +1568,7 @@ out_fmt: 3804@@ -1479,7 +1569,7 @@ out_fmt:
3693 } 3805 }
3694 3806
3695 /* Actual function called from quotactl() */ 3807 /* Actual function called from quotactl() */
3696-int vfs_quota_on(struct super_block *sb, int type, int format_id, char *path) 3808-int vfs_quota_on(struct super_block *sb, int type, int format_id, char *path)
3697+int vfs_quota_on(struct dqhash *hash, int type, int format_id, char *path) 3809+int vfs_quota_on(struct dqhash *hash, int type, int format_id, char *path)
3698 { 3810 {
3699 struct nameidata nd; 3811 struct nameidata nd;
3700 int error; 3812 int error;
3701@@ -1490,7 +1580,7 @@ int vfs_quota_on(struct super_block *sb, 3813@@ -1491,7 +1581,7 @@ int vfs_quota_on(struct super_block *sb,
3702 if (error) 3814 if (error)
3703 goto out_path; 3815 goto out_path;
3704 /* Quota file not on the same filesystem? */ 3816 /* Quota file not on the same filesystem? */
3705- if (nd.mnt->mnt_sb != sb) 3817- if (nd.mnt->mnt_sb != sb)
3706+ if (nd.mnt->mnt_sb != hash->dqh_sb) 3818+ if (nd.mnt->mnt_sb != hash->dqh_sb)
3707 error = -EXDEV; 3819 error = -EXDEV;
3708 else 3820 else
3709 error = vfs_quota_on_inode(nd.dentry->d_inode, type, format_id); 3821 error = vfs_quota_on_inode(nd.dentry->d_inode, type, format_id);
3710@@ -1503,13 +1593,13 @@ out_path: 3822@@ -1504,13 +1594,13 @@ out_path:
3711 * This function is used when filesystem needs to initialize quotas 3823 * This function is used when filesystem needs to initialize quotas
3712 * during mount time. 3824 * during mount time.
3713 */ 3825 */
3714-int vfs_quota_on_mount(struct super_block *sb, char *qf_name, 3826-int vfs_quota_on_mount(struct super_block *sb, char *qf_name,
3715+int vfs_quota_on_mount(struct dqhash *hash, char *qf_name, 3827+int vfs_quota_on_mount(struct dqhash *hash, char *qf_name,
3721- dentry = lookup_one_len(qf_name, sb->s_root, strlen(qf_name)); 3833- dentry = lookup_one_len(qf_name, sb->s_root, strlen(qf_name));
3722+ dentry = lookup_one_len(qf_name, hash->dqh_sb->s_root, strlen(qf_name)); 3834+ dentry = lookup_one_len(qf_name, hash->dqh_sb->s_root, strlen(qf_name));
3723 if (IS_ERR(dentry)) 3835 if (IS_ERR(dentry))
3724 return PTR_ERR(dentry); 3836 return PTR_ERR(dentry);
3725 3837
3726@@ -1545,18 +1635,18 @@ static void do_get_dqblk(struct dquot *d 3838@@ -1546,18 +1636,18 @@ static void do_get_dqblk(struct dquot *d
3727 spin_unlock(&dq_data_lock); 3839 spin_unlock(&dq_data_lock);
3728 } 3840 }
3729 3841
3730-int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di) 3842-int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di)
3731+int vfs_get_dqblk(struct dqhash *hash, int type, qid_t id, struct if_dqblk *di) 3843+int vfs_get_dqblk(struct dqhash *hash, int type, qid_t id, struct if_dqblk *di)
3745- up(&sb_dqopt(sb)->dqonoff_sem); 3857- up(&sb_dqopt(sb)->dqonoff_sem);
3746+ up(&dqh_dqopt(hash)->dqonoff_sem); 3858+ up(&dqh_dqopt(hash)->dqonoff_sem);
3747 return 0; 3859 return 0;
3748 } 3860 }
3749 3861
3750@@ -1596,7 +1686,7 @@ static void do_set_dqblk(struct dquot *d 3862@@ -1597,7 +1687,7 @@ static void do_set_dqblk(struct dquot *d
3751 clear_bit(DQ_BLKS_B, &dquot->dq_flags); 3863 clear_bit(DQ_BLKS_B, &dquot->dq_flags);
3752 } 3864 }
3753 else if (!(di->dqb_valid & QIF_BTIME)) /* Set grace only if user hasn't provided his own... */ 3865 else if (!(di->dqb_valid & QIF_BTIME)) /* Set grace only if user hasn't provided his own... */
3754- dm->dqb_btime = get_seconds() + sb_dqopt(dquot->dq_sb)->info[dquot->dq_type].dqi_bgrace; 3866- dm->dqb_btime = get_seconds() + sb_dqopt(dquot->dq_sb)->info[dquot->dq_type].dqi_bgrace;
3755+ dm->dqb_btime = get_seconds() + dqh_dqopt(dquot->dq_dqh)->info[dquot->dq_type].dqi_bgrace; 3867+ dm->dqb_btime = get_seconds() + dqh_dqopt(dquot->dq_dqh)->info[dquot->dq_type].dqi_bgrace;
3756 } 3868 }
3757 if (check_ilim) { 3869 if (check_ilim) {
3758 if (!dm->dqb_isoftlimit || dm->dqb_curinodes < dm->dqb_isoftlimit) { 3870 if (!dm->dqb_isoftlimit || dm->dqb_curinodes < dm->dqb_isoftlimit) {
3759@@ -1604,7 +1694,7 @@ static void do_set_dqblk(struct dquot *d 3871@@ -1605,7 +1695,7 @@ static void do_set_dqblk(struct dquot *d
3760 clear_bit(DQ_INODES_B, &dquot->dq_flags); 3872 clear_bit(DQ_INODES_B, &dquot->dq_flags);
3761 } 3873 }
3762 else if (!(di->dqb_valid & QIF_ITIME)) /* Set grace only if user hasn't provided his own... */ 3874 else if (!(di->dqb_valid & QIF_ITIME)) /* Set grace only if user hasn't provided his own... */
3763- dm->dqb_itime = get_seconds() + sb_dqopt(dquot->dq_sb)->info[dquot->dq_type].dqi_igrace; 3875- dm->dqb_itime = get_seconds() + sb_dqopt(dquot->dq_sb)->info[dquot->dq_type].dqi_igrace;
3764+ dm->dqb_itime = get_seconds() + dqh_dqopt(dquot->dq_dqh)->info[dquot->dq_type].dqi_igrace; 3876+ dm->dqb_itime = get_seconds() + dqh_dqopt(dquot->dq_dqh)->info[dquot->dq_type].dqi_igrace;
3765 } 3877 }
3766 if (dm->dqb_bhardlimit || dm->dqb_bsoftlimit || dm->dqb_ihardlimit || dm->dqb_isoftlimit) 3878 if (dm->dqb_bhardlimit || dm->dqb_bsoftlimit || dm->dqb_ihardlimit || dm->dqb_isoftlimit)
3767 clear_bit(DQ_FAKE_B, &dquot->dq_flags); 3879 clear_bit(DQ_FAKE_B, &dquot->dq_flags);
3768@@ -1614,53 +1704,53 @@ static void do_set_dqblk(struct dquot *d 3880@@ -1615,53 +1705,53 @@ static void do_set_dqblk(struct dquot *d
3769 mark_dquot_dirty(dquot); 3881 mark_dquot_dirty(dquot);
3770 } 3882 }
3771 3883
3772-int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di) 3884-int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di)
3773+int vfs_set_dqblk(struct dqhash *hash, int type, qid_t id, struct if_dqblk *di) 3885+int vfs_set_dqblk(struct dqhash *hash, int type, qid_t id, struct if_dqblk *di)
3833- mi = sb_dqopt(sb)->info + type; 3945- mi = sb_dqopt(sb)->info + type;
3834+ mi = dqh_dqopt(hash)->info + type; 3946+ mi = dqh_dqopt(hash)->info + type;
3835 spin_lock(&dq_data_lock); 3947 spin_lock(&dq_data_lock);
3836 if (ii->dqi_valid & IIF_BGRACE) 3948 if (ii->dqi_valid & IIF_BGRACE)
3837 mi->dqi_bgrace = ii->dqi_bgrace; 3949 mi->dqi_bgrace = ii->dqi_bgrace;
3838@@ -1669,10 +1759,10 @@ int vfs_set_dqinfo(struct super_block *s 3950@@ -1670,10 +1760,10 @@ int vfs_set_dqinfo(struct super_block *s
3839 if (ii->dqi_valid & IIF_FLAGS) 3951 if (ii->dqi_valid & IIF_FLAGS)
3840 mi->dqi_flags = (mi->dqi_flags & ~DQF_MASK) | (ii->dqi_flags & DQF_MASK); 3952 mi->dqi_flags = (mi->dqi_flags & ~DQF_MASK) | (ii->dqi_flags & DQF_MASK);
3841 spin_unlock(&dq_data_lock); 3953 spin_unlock(&dq_data_lock);
3842- mark_info_dirty(sb, type); 3954- mark_info_dirty(sb, type);
3843+ mark_info_dirty(hash, type); 3955+ mark_info_dirty(hash, type);
3847+ hash->dqh_qop->write_info(hash, type); 3959+ hash->dqh_qop->write_info(hash, type);
3848+ up(&dqh_dqopt(hash)->dqonoff_sem); 3960+ up(&dqh_dqopt(hash)->dqonoff_sem);
3849 return 0; 3961 return 0;
3850 } 3962 }
3851 3963
3852diff -NurpP --minimal linux-2.6.15.6/fs/exec.c linux-2.6.15.6-vs2.1.1-rc13/fs/exec.c 3964Index: linux-2.6.16/fs/exec.c
3853--- linux-2.6.15.6/fs/exec.c 2006-03-11 03:09:06 +0100 3965===================================================================
3854+++ linux-2.6.15.6-vs2.1.1-rc13/fs/exec.c 2006-03-04 23:52:13 +0100 3966--- linux-2.6.16.orig/fs/exec.c
3967+++ linux-2.6.16/fs/exec.c
3855@@ -49,6 +49,7 @@ 3968@@ -49,6 +49,7 @@
3856 #include <linux/rmap.h> 3969 #include <linux/rmap.h>
3857 #include <linux/acct.h> 3970 #include <linux/acct.h>
3858 #include <linux/cn_proc.h> 3971 #include <linux/cn_proc.h>
3859+#include <linux/vs_memory.h> 3972+#include <linux/vs_memory.h>
3868+ vx_vmpages_sub(mm, mm->total_vm - vma_pages(mpnt)); 3981+ vx_vmpages_sub(mm, mm->total_vm - vma_pages(mpnt));
3869+ mm->stack_vm = mm->total_vm; 3982+ mm->stack_vm = mm->total_vm;
3870 } 3983 }
3871 3984
3872 for (i = 0 ; i < MAX_ARG_PAGES ; i++) { 3985 for (i = 0 ; i < MAX_ARG_PAGES ; i++) {
3873diff -NurpP --minimal linux-2.6.15.6/fs/ext2/balloc.c linux-2.6.15.6-vs2.1.1-rc13/fs/ext2/balloc.c 3986Index: linux-2.6.16/fs/ext2/balloc.c
3874--- linux-2.6.15.6/fs/ext2/balloc.c 2006-01-03 17:29:56 +0100 3987===================================================================
3875+++ linux-2.6.15.6-vs2.1.1-rc13/fs/ext2/balloc.c 2006-02-13 05:26:55 +0100 3988--- linux-2.6.16.orig/fs/ext2/balloc.c
3989+++ linux-2.6.16/fs/ext2/balloc.c
3876@@ -16,6 +16,8 @@ 3990@@ -17,6 +17,8 @@
3877 #include <linux/quotaops.h>
3878 #include <linux/sched.h> 3991 #include <linux/sched.h>
3879 #include <linux/buffer_head.h> 3992 #include <linux/buffer_head.h>
3993 #include <linux/capability.h>
3880+#include <linux/vs_dlimit.h> 3994+#include <linux/vs_dlimit.h>
3881+#include <linux/vs_tag.h> 3995+#include <linux/vs_tag.h>
3882 3996
3883 /* 3997 /*
3884 * balloc.c contains the blocks allocation and deallocation routines 3998 * balloc.c contains the blocks allocation and deallocation routines
3885@@ -108,6 +110,8 @@ static int reserve_blocks(struct super_b 3999@@ -109,6 +111,8 @@ static int reserve_blocks(struct super_b
3886 free_blocks = percpu_counter_read_positive(&sbi->s_freeblocks_counter); 4000 free_blocks = percpu_counter_read_positive(&sbi->s_freeblocks_counter);
3887 root_blocks = le32_to_cpu(es->s_r_blocks_count); 4001 root_blocks = le32_to_cpu(es->s_r_blocks_count);
3888 4002
3889+ DLIMIT_ADJUST_BLOCK(sb, dx_current_tag(), &free_blocks, &root_blocks); 4003+ DLIMIT_ADJUST_BLOCK(sb, dx_current_tag(), &free_blocks, &root_blocks);
3890+ 4004+
3891 if (free_blocks < count) 4005 if (free_blocks < count)
3892 count = free_blocks; 4006 count = free_blocks;
3893 4007
3894@@ -258,6 +262,7 @@ do_more: 4008@@ -259,6 +263,7 @@ do_more:
3895 } 4009 }
3896 error_return: 4010 error_return:
3897 brelse(bitmap_bh); 4011 brelse(bitmap_bh);
3898+ DLIMIT_FREE_BLOCK(inode, freed); 4012+ DLIMIT_FREE_BLOCK(inode, freed);
3899 release_blocks(sb, freed); 4013 release_blocks(sb, freed);
3900 DQUOT_FREE_BLOCK(inode, freed); 4014 DQUOT_FREE_BLOCK(inode, freed);
3901 } 4015 }
3902@@ -361,6 +366,10 @@ int ext2_new_block(struct inode *inode, 4016@@ -362,6 +367,10 @@ int ext2_new_block(struct inode *inode,
3903 *err = -ENOSPC; 4017 *err = -ENOSPC;
3904 goto out_dquot; 4018 goto out_dquot;
3905 } 4019 }
3906+ if (DLIMIT_ALLOC_BLOCK(inode, es_alloc)) { 4020+ if (DLIMIT_ALLOC_BLOCK(inode, es_alloc)) {
3907+ *err = -ENOSPC; 4021+ *err = -ENOSPC;
3908+ goto out_dlimit; 4022+ goto out_dlimit;
3909+ } 4023+ }
3910 4024
3911 ext2_debug ("goal=%lu.\n", goal); 4025 ext2_debug ("goal=%lu.\n", goal);
3912 4026
3913@@ -508,6 +517,8 @@ got_block: 4027@@ -509,6 +518,8 @@ got_block:
3914 *err = 0; 4028 *err = 0;
3915 out_release: 4029 out_release:
3916 group_release_blocks(sb, group_no, desc, gdp_bh, group_alloc); 4030 group_release_blocks(sb, group_no, desc, gdp_bh, group_alloc);
3917+ DLIMIT_FREE_BLOCK(inode, es_alloc); 4031+ DLIMIT_FREE_BLOCK(inode, es_alloc);
3918+out_dlimit: 4032+out_dlimit:
3919 release_blocks(sb, es_alloc); 4033 release_blocks(sb, es_alloc);
3920 out_dquot: 4034 out_dquot:
3921 DQUOT_FREE_BLOCK(inode, dq_alloc); 4035 DQUOT_FREE_BLOCK(inode, dq_alloc);
3922diff -NurpP --minimal linux-2.6.15.6/fs/ext2/ext2.h linux-2.6.15.6-vs2.1.1-rc13/fs/ext2/ext2.h 4036Index: linux-2.6.16/fs/ext2/ext2.h
3923--- linux-2.6.15.6/fs/ext2/ext2.h 2005-08-29 22:25:30 +0200 4037===================================================================
3924+++ linux-2.6.15.6-vs2.1.1-rc13/fs/ext2/ext2.h 2006-01-04 21:59:59 +0100 4038--- linux-2.6.16.orig/fs/ext2/ext2.h
4039+++ linux-2.6.16/fs/ext2/ext2.h
3925@@ -162,6 +162,7 @@ extern struct file_operations ext2_xip_f 4040@@ -162,6 +162,7 @@ extern struct file_operations ext2_xip_f
3926 extern struct address_space_operations ext2_aops; 4041 extern struct address_space_operations ext2_aops;
3927 extern struct address_space_operations ext2_aops_xip; 4042 extern struct address_space_operations ext2_aops_xip;
3928 extern struct address_space_operations ext2_nobh_aops; 4043 extern struct address_space_operations ext2_nobh_aops;
3929+extern int ext2_sync_flags(struct inode *inode); 4044+extern int ext2_sync_flags(struct inode *inode);
3930 4045
3931 /* namei.c */ 4046 /* namei.c */
3932 extern struct inode_operations ext2_dir_inode_operations; 4047 extern struct inode_operations ext2_dir_inode_operations;
3933diff -NurpP --minimal linux-2.6.15.6/fs/ext2/file.c linux-2.6.15.6-vs2.1.1-rc13/fs/ext2/file.c 4048Index: linux-2.6.16/fs/ext2/file.c
3934--- linux-2.6.15.6/fs/ext2/file.c 2005-08-29 22:25:30 +0200 4049===================================================================
3935+++ linux-2.6.15.6-vs2.1.1-rc13/fs/ext2/file.c 2006-01-04 21:59:59 +0100 4050--- linux-2.6.16.orig/fs/ext2/file.c
4051+++ linux-2.6.16/fs/ext2/file.c
3936@@ -53,6 +53,7 @@ struct file_operations ext2_file_operati 4052@@ -53,6 +53,7 @@ struct file_operations ext2_file_operati
3937 .readv = generic_file_readv, 4053 .readv = generic_file_readv,
3938 .writev = generic_file_writev, 4054 .writev = generic_file_writev,
3939 .sendfile = generic_file_sendfile, 4055 .sendfile = generic_file_sendfile,
3940+ .sendpage = generic_file_sendpage, 4056+ .sendpage = generic_file_sendpage,
3945 #endif 4061 #endif
3946 .setattr = ext2_setattr, 4062 .setattr = ext2_setattr,
3947 .permission = ext2_permission, 4063 .permission = ext2_permission,
3948+ .sync_flags = ext2_sync_flags, 4064+ .sync_flags = ext2_sync_flags,
3949 }; 4065 };
3950diff -NurpP --minimal linux-2.6.15.6/fs/ext2/ialloc.c linux-2.6.15.6-vs2.1.1-rc13/fs/ext2/ialloc.c 4066Index: linux-2.6.16/fs/ext2/ialloc.c
3951--- linux-2.6.15.6/fs/ext2/ialloc.c 2006-01-03 17:29:56 +0100 4067===================================================================
3952+++ linux-2.6.15.6-vs2.1.1-rc13/fs/ext2/ialloc.c 2006-02-13 05:26:55 +0100 4068--- linux-2.6.16.orig/fs/ext2/ialloc.c
4069+++ linux-2.6.16/fs/ext2/ialloc.c
3953@@ -18,6 +18,8 @@ 4070@@ -18,6 +18,8 @@
3954 #include <linux/backing-dev.h> 4071 #include <linux/backing-dev.h>
3955 #include <linux/buffer_head.h> 4072 #include <linux/buffer_head.h>
3956 #include <linux/random.h> 4073 #include <linux/random.h>
3957+#include <linux/vs_dlimit.h> 4074+#include <linux/vs_dlimit.h>
3987+ ei->i_flags = EXT2_I(dir)->i_flags & 4104+ ei->i_flags = EXT2_I(dir)->i_flags &
3988+ ~(EXT2_BTREE_FL|EXT2_IUNLINK_FL|EXT2_BARRIER_FL); 4105+ ~(EXT2_BTREE_FL|EXT2_IUNLINK_FL|EXT2_BARRIER_FL);
3989 if (S_ISLNK(mode)) 4106 if (S_ISLNK(mode))
3990 ei->i_flags &= ~(EXT2_IMMUTABLE_FL|EXT2_APPEND_FL); 4107 ei->i_flags &= ~(EXT2_IMMUTABLE_FL|EXT2_APPEND_FL);
3991 /* dirsync is only applied to directories */ 4108 /* dirsync is only applied to directories */
3992@@ -605,7 +614,7 @@ got:
3993 insert_inode_hash(inode);
3994
3995 if (DQUOT_ALLOC_INODE(inode)) {
3996- err = -ENOSPC;
3997+ err = -EDQUOT;
3998 goto fail_drop;
3999 }
4000
4001@@ -627,12 +636,15 @@ fail_free_drop: 4109@@ -627,12 +636,15 @@ fail_free_drop:
4002 4110
4003 fail_drop: 4111 fail_drop:
4004 DQUOT_DROP(inode); 4112 DQUOT_DROP(inode);
4005+ DLIMIT_FREE_INODE(inode); 4113+ DLIMIT_FREE_INODE(inode);
4012+ DLIMIT_FREE_INODE(inode); 4120+ DLIMIT_FREE_INODE(inode);
4013+fail_dlim: 4121+fail_dlim:
4014 make_bad_inode(inode); 4122 make_bad_inode(inode);
4015 iput(inode); 4123 iput(inode);
4016 return ERR_PTR(err); 4124 return ERR_PTR(err);
4017diff -NurpP --minimal linux-2.6.15.6/fs/ext2/inode.c linux-2.6.15.6-vs2.1.1-rc13/fs/ext2/inode.c 4125Index: linux-2.6.16/fs/ext2/inode.c
4018--- linux-2.6.15.6/fs/ext2/inode.c 2006-01-03 17:29:56 +0100 4126===================================================================
4019+++ linux-2.6.15.6-vs2.1.1-rc13/fs/ext2/inode.c 2006-02-22 18:24:50 +0100 4127--- linux-2.6.16.orig/fs/ext2/inode.c
4128+++ linux-2.6.16/fs/ext2/inode.c
4020@@ -31,6 +31,7 @@ 4129@@ -31,6 +31,7 @@
4021 #include <linux/writeback.h> 4130 #include <linux/writeback.h>
4022 #include <linux/buffer_head.h> 4131 #include <linux/buffer_head.h>
4023 #include <linux/mpage.h> 4132 #include <linux/mpage.h>
4024+#include <linux/vserver/tag.h> 4133+#include <linux/vserver/tag.h>
4025 #include "ext2.h" 4134 #include "ext2.h"
4026 #include "acl.h" 4135 #include "acl.h"
4027 #include "xip.h" 4136 #include "xip.h"
4028@@ -1052,25 +1053,70 @@ void ext2_set_inode_flags(struct inode * 4137@@ -1054,25 +1055,70 @@ void ext2_set_inode_flags(struct inode *
4029 { 4138 {
4030 unsigned int flags = EXT2_I(inode)->i_flags; 4139 unsigned int flags = EXT2_I(inode)->i_flags;
4031 4140
4032- inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC); 4141- inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC);
4033+ inode->i_flags &= ~(S_IMMUTABLE | S_IUNLINK | S_BARRIER | 4142+ inode->i_flags &= ~(S_IMMUTABLE | S_IUNLINK | S_BARRIER |
4097+ uid_t uid; 4206+ uid_t uid;
4098+ gid_t gid; 4207+ gid_t gid;
4099 int n; 4208 int n;
4100 4209
4101 #ifdef CONFIG_EXT2_FS_POSIX_ACL 4210 #ifdef CONFIG_EXT2_FS_POSIX_ACL
4102@@ -1081,12 +1127,17 @@ void ext2_read_inode (struct inode * ino 4211@@ -1083,12 +1129,17 @@ void ext2_read_inode (struct inode * ino
4103 goto bad_inode; 4212 goto bad_inode;
4104 4213
4105 inode->i_mode = le16_to_cpu(raw_inode->i_mode); 4214 inode->i_mode = le16_to_cpu(raw_inode->i_mode);
4106- inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low); 4215- inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
4107- inode->i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low); 4216- inode->i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
4119+ le16_to_cpu(raw_inode->i_raw_tag)); 4228+ le16_to_cpu(raw_inode->i_raw_tag));
4120+ 4229+
4121 inode->i_nlink = le16_to_cpu(raw_inode->i_links_count); 4230 inode->i_nlink = le16_to_cpu(raw_inode->i_links_count);
4122 inode->i_size = le32_to_cpu(raw_inode->i_size); 4231 inode->i_size = le32_to_cpu(raw_inode->i_size);
4123 inode->i_atime.tv_sec = le32_to_cpu(raw_inode->i_atime); 4232 inode->i_atime.tv_sec = le32_to_cpu(raw_inode->i_atime);
4124@@ -1184,8 +1235,8 @@ static int ext2_update_inode(struct inod 4233@@ -1186,8 +1237,8 @@ static int ext2_update_inode(struct inod
4125 struct ext2_inode_info *ei = EXT2_I(inode); 4234 struct ext2_inode_info *ei = EXT2_I(inode);
4126 struct super_block *sb = inode->i_sb; 4235 struct super_block *sb = inode->i_sb;
4127 ino_t ino = inode->i_ino; 4236 ino_t ino = inode->i_ino;
4128- uid_t uid = inode->i_uid; 4237- uid_t uid = inode->i_uid;
4129- gid_t gid = inode->i_gid; 4238- gid_t gid = inode->i_gid;
4130+ uid_t uid = TAGINO_UID(DX_TAG(inode), inode->i_uid, inode->i_tag); 4239+ uid_t uid = TAGINO_UID(DX_TAG(inode), inode->i_uid, inode->i_tag);
4131+ gid_t gid = TAGINO_GID(DX_TAG(inode), inode->i_gid, inode->i_tag); 4240+ gid_t gid = TAGINO_GID(DX_TAG(inode), inode->i_gid, inode->i_tag);
4132 struct buffer_head * bh; 4241 struct buffer_head * bh;
4133 struct ext2_inode * raw_inode = ext2_get_inode(sb, ino, &bh); 4242 struct ext2_inode * raw_inode = ext2_get_inode(sb, ino, &bh);
4134 int n; 4243 int n;
4135@@ -1220,6 +1271,9 @@ static int ext2_update_inode(struct inod 4244@@ -1222,6 +1273,9 @@ static int ext2_update_inode(struct inod
4136 raw_inode->i_uid_high = 0; 4245 raw_inode->i_uid_high = 0;
4137 raw_inode->i_gid_high = 0; 4246 raw_inode->i_gid_high = 0;
4138 } 4247 }
4139+#ifdef CONFIG_TAGGING_INTERN 4248+#ifdef CONFIG_TAGGING_INTERN
4140+ raw_inode->i_raw_tag = cpu_to_le16(inode->i_tag); 4249+ raw_inode->i_raw_tag = cpu_to_le16(inode->i_tag);
4141+#endif 4250+#endif
4142 raw_inode->i_links_count = cpu_to_le16(inode->i_nlink); 4251 raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
4143 raw_inode->i_size = cpu_to_le32(inode->i_size); 4252 raw_inode->i_size = cpu_to_le32(inode->i_size);
4144 raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec); 4253 raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec);
4145@@ -1306,7 +1360,8 @@ int ext2_setattr(struct dentry *dentry, 4254@@ -1308,7 +1362,8 @@ int ext2_setattr(struct dentry *dentry,
4146 if (error) 4255 if (error)
4147 return error; 4256 return error;
4148 if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) || 4257 if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
4149- (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) { 4258- (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
4150+ (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid) || 4259+ (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid) ||
4151+ (iattr->ia_valid & ATTR_TAG && iattr->ia_tag != inode->i_tag)) { 4260+ (iattr->ia_valid & ATTR_TAG && iattr->ia_tag != inode->i_tag)) {
4152 error = DQUOT_TRANSFER(inode, iattr) ? -EDQUOT : 0; 4261 error = DQUOT_TRANSFER(inode, iattr) ? -EDQUOT : 0;
4153 if (error) 4262 if (error)
4154 return error; 4263 return error;
4155diff -NurpP --minimal linux-2.6.15.6/fs/ext2/ioctl.c linux-2.6.15.6-vs2.1.1-rc13/fs/ext2/ioctl.c 4264Index: linux-2.6.16/fs/ext2/ioctl.c
4156--- linux-2.6.15.6/fs/ext2/ioctl.c 2005-03-02 12:38:44 +0100 4265===================================================================
4157+++ linux-2.6.15.6-vs2.1.1-rc13/fs/ext2/ioctl.c 2006-02-13 05:16:01 +0100 4266--- linux-2.6.16.orig/fs/ext2/ioctl.c
4267+++ linux-2.6.16/fs/ext2/ioctl.c
4158@@ -10,6 +10,7 @@ 4268@@ -11,6 +11,7 @@
4159 #include "ext2.h" 4269 #include <linux/capability.h>
4160 #include <linux/time.h> 4270 #include <linux/time.h>
4161 #include <linux/sched.h> 4271 #include <linux/sched.h>
4162+#include <linux/mount.h> 4272+#include <linux/mount.h>
4163 #include <asm/current.h> 4273 #include <asm/current.h>
4164 #include <asm/uaccess.h> 4274 #include <asm/uaccess.h>
4165 4275
4166@@ -29,7 +30,8 @@ int ext2_ioctl (struct inode * inode, st 4276@@ -30,7 +31,8 @@ int ext2_ioctl (struct inode * inode, st
4167 case EXT2_IOC_SETFLAGS: { 4277 case EXT2_IOC_SETFLAGS: {
4168 unsigned int oldflags; 4278 unsigned int oldflags;
4169 4279
4170- if (IS_RDONLY(inode)) 4280- if (IS_RDONLY(inode))
4171+ if (IS_RDONLY(inode) || 4281+ if (IS_RDONLY(inode) ||
4172+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt))) 4282+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
4173 return -EROFS; 4283 return -EROFS;
4174 4284
4175 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER)) 4285 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
4176@@ -49,7 +51,9 @@ int ext2_ioctl (struct inode * inode, st 4286@@ -50,7 +52,9 @@ int ext2_ioctl (struct inode * inode, st
4177 * 4287 *
4178 * This test looks nicer. Thanks to Pauline Middelink 4288 * This test looks nicer. Thanks to Pauline Middelink
4179 */ 4289 */
4180- if ((flags ^ oldflags) & (EXT2_APPEND_FL | EXT2_IMMUTABLE_FL)) { 4290- if ((flags ^ oldflags) & (EXT2_APPEND_FL | EXT2_IMMUTABLE_FL)) {
4181+ if ((oldflags & EXT2_IMMUTABLE_FL) || 4291+ if ((oldflags & EXT2_IMMUTABLE_FL) ||
4182+ ((flags ^ oldflags) & (EXT2_APPEND_FL | 4292+ ((flags ^ oldflags) & (EXT2_APPEND_FL |
4183+ EXT2_IMMUTABLE_FL | EXT2_IUNLINK_FL))) { 4293+ EXT2_IMMUTABLE_FL | EXT2_IUNLINK_FL))) {
4184 if (!capable(CAP_LINUX_IMMUTABLE)) 4294 if (!capable(CAP_LINUX_IMMUTABLE))
4185 return -EPERM; 4295 return -EPERM;
4186 } 4296 }
4187@@ -68,7 +72,8 @@ int ext2_ioctl (struct inode * inode, st 4297@@ -69,7 +73,8 @@ int ext2_ioctl (struct inode * inode, st
4188 case EXT2_IOC_SETVERSION: 4298 case EXT2_IOC_SETVERSION:
4189 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER)) 4299 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
4190 return -EPERM; 4300 return -EPERM;
4191- if (IS_RDONLY(inode)) 4301- if (IS_RDONLY(inode))
4192+ if (IS_RDONLY(inode) || 4302+ if (IS_RDONLY(inode) ||
4193+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt))) 4303+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
4194 return -EROFS; 4304 return -EROFS;
4195 if (get_user(inode->i_generation, (int __user *) arg)) 4305 if (get_user(inode->i_generation, (int __user *) arg))
4196 return -EFAULT; 4306 return -EFAULT;
4197diff -NurpP --minimal linux-2.6.15.6/fs/ext2/namei.c linux-2.6.15.6-vs2.1.1-rc13/fs/ext2/namei.c 4307Index: linux-2.6.16/fs/ext2/namei.c
4198--- linux-2.6.15.6/fs/ext2/namei.c 2005-08-29 22:25:30 +0200 4308===================================================================
4199+++ linux-2.6.15.6-vs2.1.1-rc13/fs/ext2/namei.c 2006-02-13 05:26:55 +0100 4309--- linux-2.6.16.orig/fs/ext2/namei.c
4310+++ linux-2.6.16/fs/ext2/namei.c
4200@@ -31,6 +31,7 @@ 4311@@ -31,6 +31,7 @@
4201 */ 4312 */
4202 4313
4203 #include <linux/pagemap.h> 4314 #include <linux/pagemap.h>
4204+#include <linux/vserver/tag.h> 4315+#include <linux/vserver/tag.h>
4209 inode = iget(dir->i_sb, ino); 4320 inode = iget(dir->i_sb, ino);
4210 if (!inode) 4321 if (!inode)
4211 return ERR_PTR(-EACCES); 4322 return ERR_PTR(-EACCES);
4212+ dx_propagate_tag(nd, inode); 4323+ dx_propagate_tag(nd, inode);
4213 } 4324 }
4214 if (inode)
4215 return d_splice_alias(inode, dentry); 4325 return d_splice_alias(inode, dentry);
4326 }
4216@@ -410,6 +412,7 @@ struct inode_operations ext2_dir_inode_o 4327@@ -407,6 +409,7 @@ struct inode_operations ext2_dir_inode_o
4217 #endif 4328 #endif
4218 .setattr = ext2_setattr, 4329 .setattr = ext2_setattr,
4219 .permission = ext2_permission, 4330 .permission = ext2_permission,
4220+ .sync_flags = ext2_sync_flags, 4331+ .sync_flags = ext2_sync_flags,
4221 }; 4332 };
4222 4333
4223 struct inode_operations ext2_special_inode_operations = { 4334 struct inode_operations ext2_special_inode_operations = {
4224@@ -421,4 +424,5 @@ struct inode_operations ext2_special_ino 4335@@ -418,4 +421,5 @@ struct inode_operations ext2_special_ino
4225 #endif 4336 #endif
4226 .setattr = ext2_setattr, 4337 .setattr = ext2_setattr,
4227 .permission = ext2_permission, 4338 .permission = ext2_permission,
4228+ .sync_flags = ext2_sync_flags, 4339+ .sync_flags = ext2_sync_flags,
4229 }; 4340 };
4230diff -NurpP --minimal linux-2.6.15.6/fs/ext2/super.c linux-2.6.15.6-vs2.1.1-rc13/fs/ext2/super.c 4341Index: linux-2.6.16/fs/ext2/super.c
4231--- linux-2.6.15.6/fs/ext2/super.c 2006-01-03 17:29:56 +0100 4342===================================================================
4232+++ linux-2.6.15.6-vs2.1.1-rc13/fs/ext2/super.c 2006-02-13 05:26:55 +0100 4343--- linux-2.6.16.orig/fs/ext2/super.c
4344+++ linux-2.6.16/fs/ext2/super.c
4233@@ -225,8 +225,8 @@ static int ext2_show_options(struct seq_ 4345@@ -230,8 +230,8 @@ static int ext2_show_options(struct seq_
4234 } 4346 }
4235 4347
4236 #ifdef CONFIG_QUOTA 4348 #ifdef CONFIG_QUOTA
4237-static ssize_t ext2_quota_read(struct super_block *sb, int type, char *data, size_t len, loff_t off); 4349-static ssize_t ext2_quota_read(struct super_block *sb, int type, char *data, size_t len, loff_t off);
4238-static ssize_t ext2_quota_write(struct super_block *sb, int type, const char *data, size_t len, loff_t off); 4350-static ssize_t ext2_quota_write(struct super_block *sb, int type, const char *data, size_t len, loff_t off);
4239+static ssize_t ext2_quota_read(struct dqhash *hash, int type, char *data, size_t len, loff_t off); 4351+static ssize_t ext2_quota_read(struct dqhash *hash, int type, char *data, size_t len, loff_t off);
4240+static ssize_t ext2_quota_write(struct dqhash *hash, int type, const char *data, size_t len, loff_t off); 4352+static ssize_t ext2_quota_write(struct dqhash *hash, int type, const char *data, size_t len, loff_t off);
4241 #endif 4353 #endif
4242 4354
4243 static struct super_operations ext2_sops = { 4355 static struct super_operations ext2_sops = {
4244@@ -284,7 +284,7 @@ enum { 4356@@ -289,7 +289,7 @@ enum {
4245 Opt_err_ro, Opt_nouid32, Opt_nocheck, Opt_debug, 4357 Opt_err_ro, Opt_nouid32, Opt_nocheck, Opt_debug,
4246 Opt_oldalloc, Opt_orlov, Opt_nobh, Opt_user_xattr, Opt_nouser_xattr, 4358 Opt_oldalloc, Opt_orlov, Opt_nobh, Opt_user_xattr, Opt_nouser_xattr,
4247 Opt_acl, Opt_noacl, Opt_xip, Opt_ignore, Opt_err, Opt_quota, 4359 Opt_acl, Opt_noacl, Opt_xip, Opt_ignore, Opt_err, Opt_quota,
4248- Opt_usrquota, Opt_grpquota 4360- Opt_usrquota, Opt_grpquota
4249+ Opt_usrquota, Opt_grpquota, Opt_tag, Opt_notag, Opt_tagid 4361+ Opt_usrquota, Opt_grpquota, Opt_tag, Opt_notag, Opt_tagid
4250 }; 4362 };
4251 4363
4252 static match_table_t tokens = { 4364 static match_table_t tokens = {
4253@@ -312,6 +312,10 @@ static match_table_t tokens = { 4365@@ -317,6 +317,10 @@ static match_table_t tokens = {
4254 {Opt_acl, "acl"}, 4366 {Opt_acl, "acl"},
4255 {Opt_noacl, "noacl"}, 4367 {Opt_noacl, "noacl"},
4256 {Opt_xip, "xip"}, 4368 {Opt_xip, "xip"},
4257+ {Opt_tag, "tag"}, 4369+ {Opt_tag, "tag"},
4258+ {Opt_notag, "notag"}, 4370+ {Opt_notag, "notag"},
4259+ {Opt_tagid, "tagid=%u"}, 4371+ {Opt_tagid, "tagid=%u"},
4260+ {Opt_tag, "tagxid"}, 4372+ {Opt_tag, "tagxid"},
4261 {Opt_grpquota, "grpquota"}, 4373 {Opt_grpquota, "grpquota"},
4262 {Opt_ignore, "noquota"}, 4374 {Opt_ignore, "noquota"},
4263 {Opt_quota, "quota"}, 4375 {Opt_quota, "quota"},
4264@@ -375,6 +379,20 @@ static int parse_options (char * options 4376@@ -380,6 +384,20 @@ static int parse_options (char * options
4265 case Opt_nouid32: 4377 case Opt_nouid32:
4266 set_opt (sbi->s_mount_opt, NO_UID32); 4378 set_opt (sbi->s_mount_opt, NO_UID32);
4267 break; 4379 break;
4268+#ifndef CONFIG_TAGGING_NONE 4380+#ifndef CONFIG_TAGGING_NONE
4269+ case Opt_tag: 4381+ case Opt_tag:
4280+ break; 4392+ break;
4281+#endif 4393+#endif
4282 case Opt_nocheck: 4394 case Opt_nocheck:
4283 clear_opt (sbi->s_mount_opt, CHECK); 4395 clear_opt (sbi->s_mount_opt, CHECK);
4284 break; 4396 break;
4285@@ -676,6 +694,8 @@ static int ext2_fill_super(struct super_ 4397@@ -681,6 +699,8 @@ static int ext2_fill_super(struct super_
4286 if (!parse_options ((char *) data, sbi)) 4398 if (!parse_options ((char *) data, sbi))
4287 goto failed_mount; 4399 goto failed_mount;
4288 4400
4289+ if (EXT2_SB(sb)->s_mount_opt & EXT2_MOUNT_TAGGED) 4401+ if (EXT2_SB(sb)->s_mount_opt & EXT2_MOUNT_TAGGED)
4290+ sb->s_flags |= MS_TAGGED; 4402+ sb->s_flags |= MS_TAGGED;
4291 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | 4403 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
4292 ((EXT2_SB(sb)->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? 4404 ((EXT2_SB(sb)->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ?
4293 MS_POSIXACL : 0); 4405 MS_POSIXACL : 0);
4294@@ -985,6 +1005,13 @@ static int ext2_remount (struct super_bl 4406@@ -990,6 +1010,13 @@ static int ext2_remount (struct super_bl
4295 goto restore_opts; 4407 goto restore_opts;
4296 } 4408 }
4297 4409
4298+ if ((sbi->s_mount_opt & EXT2_MOUNT_TAGGED) && 4410+ if ((sbi->s_mount_opt & EXT2_MOUNT_TAGGED) &&
4299+ !(sb->s_flags & MS_TAGGED)) { 4411+ !(sb->s_flags & MS_TAGGED)) {
4303+ } 4415+ }
4304+ 4416+
4305 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | 4417 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
4306 ((sbi->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); 4418 ((sbi->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0);
4307 4419
4308@@ -1096,10 +1123,11 @@ static struct super_block *ext2_get_sb(s 4420@@ -1101,10 +1128,11 @@ static struct super_block *ext2_get_sb(s
4309 * acquiring the locks... As quota files are never truncated and quota code 4421 * acquiring the locks... As quota files are never truncated and quota code
4310 * itself serializes the operations (and noone else should touch the files) 4422 * itself serializes the operations (and noone else should touch the files)
4311 * we don't have to be afraid of races */ 4423 * we don't have to be afraid of races */
4312-static ssize_t ext2_quota_read(struct super_block *sb, int type, char *data, 4424-static ssize_t ext2_quota_read(struct super_block *sb, int type, char *data,
4313+static ssize_t ext2_quota_read(struct dqhash *hash, int type, char *data, 4425+static ssize_t ext2_quota_read(struct dqhash *hash, int type, char *data,
4317+ struct inode *inode = dqh_dqopt(hash)->files[type]; 4429+ struct inode *inode = dqh_dqopt(hash)->files[type];
4318+ struct super_block *sb = hash->dqh_sb; 4430+ struct super_block *sb = hash->dqh_sb;
4319 sector_t blk = off >> EXT2_BLOCK_SIZE_BITS(sb); 4431 sector_t blk = off >> EXT2_BLOCK_SIZE_BITS(sb);
4320 int err = 0; 4432 int err = 0;
4321 int offset = off & (sb->s_blocksize - 1); 4433 int offset = off & (sb->s_blocksize - 1);
4322@@ -1140,10 +1168,11 @@ static ssize_t ext2_quota_read(struct su 4434@@ -1145,10 +1173,11 @@ static ssize_t ext2_quota_read(struct su
4323 } 4435 }
4324 4436
4325 /* Write to quotafile */ 4437 /* Write to quotafile */
4326-static ssize_t ext2_quota_write(struct super_block *sb, int type, 4438-static ssize_t ext2_quota_write(struct super_block *sb, int type,
4327+static ssize_t ext2_quota_write(struct dqhash *hash, int type, 4439+static ssize_t ext2_quota_write(struct dqhash *hash, int type,
4331+ struct inode *inode = dqh_dqopt(hash)->files[type]; 4443+ struct inode *inode = dqh_dqopt(hash)->files[type];
4332+ struct super_block *sb = hash->dqh_sb; 4444+ struct super_block *sb = hash->dqh_sb;
4333 sector_t blk = off >> EXT2_BLOCK_SIZE_BITS(sb); 4445 sector_t blk = off >> EXT2_BLOCK_SIZE_BITS(sb);
4334 int err = 0; 4446 int err = 0;
4335 int offset = off & (sb->s_blocksize - 1); 4447 int offset = off & (sb->s_blocksize - 1);
4336diff -NurpP --minimal linux-2.6.15.6/fs/ext2/symlink.c linux-2.6.15.6-vs2.1.1-rc13/fs/ext2/symlink.c 4448Index: linux-2.6.16/fs/ext2/symlink.c
4337--- linux-2.6.15.6/fs/ext2/symlink.c 2005-08-29 22:25:30 +0200 4449===================================================================
4338+++ linux-2.6.15.6-vs2.1.1-rc13/fs/ext2/symlink.c 2006-01-04 21:59:59 +0100 4450--- linux-2.6.16.orig/fs/ext2/symlink.c
4451+++ linux-2.6.16/fs/ext2/symlink.c
4339@@ -38,6 +38,7 @@ struct inode_operations ext2_symlink_ino 4452@@ -38,6 +38,7 @@ struct inode_operations ext2_symlink_ino
4340 .listxattr = ext2_listxattr, 4453 .listxattr = ext2_listxattr,
4341 .removexattr = generic_removexattr, 4454 .removexattr = generic_removexattr,
4342 #endif 4455 #endif
4343+ .sync_flags = ext2_sync_flags, 4456+ .sync_flags = ext2_sync_flags,
4348 .listxattr = ext2_listxattr, 4461 .listxattr = ext2_listxattr,
4349 .removexattr = generic_removexattr, 4462 .removexattr = generic_removexattr,
4350 #endif 4463 #endif
4351+ .sync_flags = ext2_sync_flags, 4464+ .sync_flags = ext2_sync_flags,
4352 }; 4465 };
4353diff -NurpP --minimal linux-2.6.15.6/fs/ext2/xattr.c linux-2.6.15.6-vs2.1.1-rc13/fs/ext2/xattr.c 4466Index: linux-2.6.16/fs/ext2/xattr.c
4354--- linux-2.6.15.6/fs/ext2/xattr.c 2006-03-11 03:09:06 +0100 4467===================================================================
4355+++ linux-2.6.15.6-vs2.1.1-rc13/fs/ext2/xattr.c 2006-03-04 23:52:28 +0100 4468--- linux-2.6.16.orig/fs/ext2/xattr.c
4469+++ linux-2.6.16/fs/ext2/xattr.c
4356@@ -60,6 +60,7 @@ 4470@@ -60,6 +60,7 @@
4357 #include <linux/mbcache.h> 4471 #include <linux/mbcache.h>
4358 #include <linux/quotaops.h> 4472 #include <linux/quotaops.h>
4359 #include <linux/rwsem.h> 4473 #include <linux/rwsem.h>
4360+#include <linux/vs_dlimit.h> 4474+#include <linux/vs_dlimit.h>
4361 #include "ext2.h" 4475 #include "ext2.h"
4362 #include "xattr.h" 4476 #include "xattr.h"
4363 #include "acl.h" 4477 #include "acl.h"
4364@@ -649,8 +650,12 @@ ext2_xattr_set2(struct inode *inode, str 4478@@ -645,8 +646,12 @@ ext2_xattr_set2(struct inode *inode, str
4365 the inode. */ 4479 the inode. */
4366 ea_bdebug(new_bh, "reusing block"); 4480 ea_bdebug(new_bh, "reusing block");
4367 4481
4368+ error = -ENOSPC; 4482+ error = -ENOSPC;
4369+ if (DLIMIT_ALLOC_BLOCK(inode, 1)) 4483+ if (DLIMIT_ALLOC_BLOCK(inode, 1))
4372 if (DQUOT_ALLOC_BLOCK(inode, 1)) { 4486 if (DQUOT_ALLOC_BLOCK(inode, 1)) {
4373+ DLIMIT_FREE_BLOCK(inode, 1); 4487+ DLIMIT_FREE_BLOCK(inode, 1);
4374 unlock_buffer(new_bh); 4488 unlock_buffer(new_bh);
4375 goto cleanup; 4489 goto cleanup;
4376 } 4490 }
4377@@ -744,6 +749,7 @@ ext2_xattr_set2(struct inode *inode, str 4491@@ -740,6 +745,7 @@ ext2_xattr_set2(struct inode *inode, str
4378 le32_to_cpu(HDR(old_bh)->h_refcount) - 1); 4492 le32_to_cpu(HDR(old_bh)->h_refcount) - 1);
4379 if (ce) 4493 if (ce)
4380 mb_cache_entry_release(ce); 4494 mb_cache_entry_release(ce);
4381+ DLIMIT_FREE_BLOCK(inode, 1); 4495+ DLIMIT_FREE_BLOCK(inode, 1);
4382 DQUOT_FREE_BLOCK(inode, 1); 4496 DQUOT_FREE_BLOCK(inode, 1);
4383 mark_buffer_dirty(old_bh); 4497 mark_buffer_dirty(old_bh);
4384 ea_bdebug(old_bh, "refcount now=%d", 4498 ea_bdebug(old_bh, "refcount now=%d",
4385@@ -808,6 +814,7 @@ ext2_xattr_delete_inode(struct inode *in 4499@@ -804,6 +810,7 @@ ext2_xattr_delete_inode(struct inode *in
4386 mark_buffer_dirty(bh); 4500 mark_buffer_dirty(bh);
4387 if (IS_SYNC(inode)) 4501 if (IS_SYNC(inode))
4388 sync_dirty_buffer(bh); 4502 sync_dirty_buffer(bh);
4389+ DLIMIT_FREE_BLOCK(inode, 1); 4503+ DLIMIT_FREE_BLOCK(inode, 1);
4390 DQUOT_FREE_BLOCK(inode, 1); 4504 DQUOT_FREE_BLOCK(inode, 1);
4391 } 4505 }
4392 EXT2_I(inode)->i_file_acl = 0; 4506 EXT2_I(inode)->i_file_acl = 0;
4393diff -NurpP --minimal linux-2.6.15.6/fs/ext3/balloc.c linux-2.6.15.6-vs2.1.1-rc13/fs/ext3/balloc.c 4507Index: linux-2.6.16/fs/ext3/balloc.c
4394--- linux-2.6.15.6/fs/ext3/balloc.c 2006-01-03 17:29:56 +0100 4508===================================================================
4395+++ linux-2.6.15.6-vs2.1.1-rc13/fs/ext3/balloc.c 2006-02-13 05:26:55 +0100 4509--- linux-2.6.16.orig/fs/ext3/balloc.c
4510+++ linux-2.6.16/fs/ext3/balloc.c
4396@@ -19,6 +19,8 @@ 4511@@ -20,6 +20,8 @@
4397 #include <linux/ext3_jbd.h> 4512 #include <linux/ext3_jbd.h>
4398 #include <linux/quotaops.h> 4513 #include <linux/quotaops.h>
4399 #include <linux/buffer_head.h> 4514 #include <linux/buffer_head.h>
4400+#include <linux/vs_dlimit.h> 4515+#include <linux/vs_dlimit.h>
4401+#include <linux/vs_tag.h> 4516+#include <linux/vs_tag.h>
4402 4517
4403 #include "bitmap.h" 4518 /*
4404 4519 * balloc.c contains the blocks allocation and deallocation routines
4405@@ -505,8 +507,10 @@ void ext3_free_blocks(handle_t *handle, 4520@@ -504,8 +506,10 @@ void ext3_free_blocks(handle_t *handle,
4406 return; 4521 return;
4407 } 4522 }
4408 ext3_free_blocks_sb(handle, sb, block, count, &dquot_freed_blocks); 4523 ext3_free_blocks_sb(handle, sb, block, count, &dquot_freed_blocks);
4409- if (dquot_freed_blocks) 4524- if (dquot_freed_blocks)
4410+ if (dquot_freed_blocks) { 4525+ if (dquot_freed_blocks) {
4412 DQUOT_FREE_BLOCK(inode, dquot_freed_blocks); 4527 DQUOT_FREE_BLOCK(inode, dquot_freed_blocks);
4413+ } 4528+ }
4414 return; 4529 return;
4415 } 4530 }
4416 4531
4417@@ -1117,18 +1121,32 @@ out: 4532@@ -1116,18 +1120,32 @@ out:
4418 return ret; 4533 return ret;
4419 } 4534 }
4420 4535
4421-static int ext3_has_free_blocks(struct ext3_sb_info *sbi) 4536-static int ext3_has_free_blocks(struct ext3_sb_info *sbi)
4422+static int ext3_has_free_blocks(struct super_block *sb) 4537+static int ext3_has_free_blocks(struct super_block *sb)
4452+ 4567+
4453+ return (cond ? 0 : 1); 4568+ return (cond ? 0 : 1);
4454 } 4569 }
4455 4570
4456 /* 4571 /*
4457@@ -1139,7 +1157,7 @@ static int ext3_has_free_blocks(struct e 4572@@ -1138,7 +1156,7 @@ static int ext3_has_free_blocks(struct e
4458 */ 4573 */
4459 int ext3_should_retry_alloc(struct super_block *sb, int *retries) 4574 int ext3_should_retry_alloc(struct super_block *sb, int *retries)
4460 { 4575 {
4461- if (!ext3_has_free_blocks(EXT3_SB(sb)) || (*retries)++ > 3) 4576- if (!ext3_has_free_blocks(EXT3_SB(sb)) || (*retries)++ > 3)
4462+ if (!ext3_has_free_blocks(sb) || (*retries)++ > 3) 4577+ if (!ext3_has_free_blocks(sb) || (*retries)++ > 3)
4463 return 0; 4578 return 0;
4464 4579
4465 jbd_debug(1, "%s: retrying operation after ENOSPC\n", sb->s_id); 4580 jbd_debug(1, "%s: retrying operation after ENOSPC\n", sb->s_id);
4466@@ -1194,6 +1212,8 @@ int ext3_new_block(handle_t *handle, str 4581@@ -1193,6 +1211,8 @@ int ext3_new_block(handle_t *handle, str
4467 *errp = -EDQUOT; 4582 *errp = -EDQUOT;
4468 return 0; 4583 return 0;
4469 } 4584 }
4470+ if (DLIMIT_ALLOC_BLOCK(inode, 1)) 4585+ if (DLIMIT_ALLOC_BLOCK(inode, 1))
4471+ goto out_dlimit; 4586+ goto out_dlimit;
4472 4587
4473 sbi = EXT3_SB(sb); 4588 sbi = EXT3_SB(sb);
4474 es = EXT3_SB(sb)->s_es; 4589 es = EXT3_SB(sb)->s_es;
4475@@ -1210,7 +1230,7 @@ int ext3_new_block(handle_t *handle, str 4590@@ -1209,7 +1229,7 @@ int ext3_new_block(handle_t *handle, str
4476 if (block_i && ((windowsz = block_i->rsv_window_node.rsv_goal_size) > 0)) 4591 if (block_i && ((windowsz = block_i->rsv_window_node.rsv_goal_size) > 0))
4477 my_rsv = &block_i->rsv_window_node; 4592 my_rsv = &block_i->rsv_window_node;
4478 4593
4479- if (!ext3_has_free_blocks(sbi)) { 4594- if (!ext3_has_free_blocks(sbi)) {
4480+ if (!ext3_has_free_blocks(sb)) { 4595+ if (!ext3_has_free_blocks(sb)) {
4481 *errp = -ENOSPC; 4596 *errp = -ENOSPC;
4482 goto out; 4597 goto out;
4483 } 4598 }
4484@@ -1394,6 +1414,9 @@ allocated: 4599@@ -1393,6 +1413,9 @@ allocated:
4485 io_error: 4600 io_error:
4486 *errp = -EIO; 4601 *errp = -EIO;
4487 out: 4602 out:
4488+ if (!performed_allocation) 4603+ if (!performed_allocation)
4489+ DLIMIT_FREE_BLOCK(inode, 1); 4604+ DLIMIT_FREE_BLOCK(inode, 1);
4490+out_dlimit: 4605+out_dlimit:
4491 if (fatal) { 4606 if (fatal) {
4492 *errp = fatal; 4607 *errp = fatal;
4493 ext3_std_error(sb, fatal); 4608 ext3_std_error(sb, fatal);
4494diff -NurpP --minimal linux-2.6.15.6/fs/ext3/file.c linux-2.6.15.6-vs2.1.1-rc13/fs/ext3/file.c 4609Index: linux-2.6.16/fs/ext3/file.c
4495--- linux-2.6.15.6/fs/ext3/file.c 2005-08-29 22:25:30 +0200 4610===================================================================
4496+++ linux-2.6.15.6-vs2.1.1-rc13/fs/ext3/file.c 2006-01-04 21:59:59 +0100 4611--- linux-2.6.16.orig/fs/ext3/file.c
4612+++ linux-2.6.16/fs/ext3/file.c
4497@@ -119,6 +119,7 @@ struct file_operations ext3_file_operati 4613@@ -119,6 +119,7 @@ struct file_operations ext3_file_operati
4498 .release = ext3_release_file, 4614 .release = ext3_release_file,
4499 .fsync = ext3_sync_file, 4615 .fsync = ext3_sync_file,
4500 .sendfile = generic_file_sendfile, 4616 .sendfile = generic_file_sendfile,
4501+ .sendpage = generic_file_sendpage, 4617+ .sendpage = generic_file_sendpage,
4507 #endif 4623 #endif
4508 .permission = ext3_permission, 4624 .permission = ext3_permission,
4509+ .sync_flags = ext3_sync_flags, 4625+ .sync_flags = ext3_sync_flags,
4510 }; 4626 };
4511 4627
4512diff -NurpP --minimal linux-2.6.15.6/fs/ext3/ialloc.c linux-2.6.15.6-vs2.1.1-rc13/fs/ext3/ialloc.c 4628Index: linux-2.6.16/fs/ext3/ialloc.c
4513--- linux-2.6.15.6/fs/ext3/ialloc.c 2006-01-03 17:29:56 +0100 4629===================================================================
4514+++ linux-2.6.15.6-vs2.1.1-rc13/fs/ext3/ialloc.c 2006-02-13 05:26:55 +0100 4630--- linux-2.6.16.orig/fs/ext3/ialloc.c
4631+++ linux-2.6.16/fs/ext3/ialloc.c
4515@@ -23,6 +23,8 @@ 4632@@ -23,6 +23,8 @@
4516 #include <linux/buffer_head.h> 4633 #include <linux/buffer_head.h>
4517 #include <linux/random.h> 4634 #include <linux/random.h>
4518 #include <linux/bitops.h> 4635 #include <linux/bitops.h>
4519+#include <linux/vs_dlimit.h> 4636+#include <linux/vs_dlimit.h>
4520+#include <linux/vs_tag.h> 4637+#include <linux/vs_tag.h>
4521 4638
4522 #include <asm/byteorder.h> 4639 #include <asm/byteorder.h>
4523 4640
4524@@ -128,6 +130,7 @@ void ext3_free_inode (handle_t *handle, 4641@@ -127,6 +129,7 @@ void ext3_free_inode (handle_t *handle,
4525 ext3_xattr_delete_inode(handle, inode); 4642 ext3_xattr_delete_inode(handle, inode);
4526 DQUOT_FREE_INODE(inode); 4643 DQUOT_FREE_INODE(inode);
4527 DQUOT_DROP(inode); 4644 DQUOT_DROP(inode);
4528+ DLIMIT_FREE_INODE(inode); 4645+ DLIMIT_FREE_INODE(inode);
4529 4646
4530 is_directory = S_ISDIR(inode->i_mode); 4647 is_directory = S_ISDIR(inode->i_mode);
4531 4648
4532@@ -444,6 +447,12 @@ struct inode *ext3_new_inode(handle_t *h 4649@@ -443,6 +446,12 @@ struct inode *ext3_new_inode(handle_t *h
4533 inode = new_inode(sb); 4650 inode = new_inode(sb);
4534 if (!inode) 4651 if (!inode)
4535 return ERR_PTR(-ENOMEM); 4652 return ERR_PTR(-ENOMEM);
4536+ 4653+
4537+ inode->i_tag = dx_current_fstag(sb); 4654+ inode->i_tag = dx_current_fstag(sb);
4540+ goto out_dlimit; 4657+ goto out_dlimit;
4541+ } 4658+ }
4542 ei = EXT3_I(inode); 4659 ei = EXT3_I(inode);
4543 4660
4544 sbi = EXT3_SB(sb); 4661 sbi = EXT3_SB(sb);
4545@@ -566,7 +575,8 @@ got: 4662@@ -565,7 +574,8 @@ got:
4546 ei->i_dir_start_lookup = 0; 4663 ei->i_dir_start_lookup = 0;
4547 ei->i_disksize = 0; 4664 ei->i_disksize = 0;
4548 4665
4549- ei->i_flags = EXT3_I(dir)->i_flags & ~EXT3_INDEX_FL; 4666- ei->i_flags = EXT3_I(dir)->i_flags & ~EXT3_INDEX_FL;
4550+ ei->i_flags = EXT3_I(dir)->i_flags & 4667+ ei->i_flags = EXT3_I(dir)->i_flags &
4551+ ~(EXT3_INDEX_FL|EXT3_IUNLINK_FL|EXT3_BARRIER_FL); 4668+ ~(EXT3_INDEX_FL|EXT3_IUNLINK_FL|EXT3_BARRIER_FL);
4552 if (S_ISLNK(mode)) 4669 if (S_ISLNK(mode))
4553 ei->i_flags &= ~(EXT3_IMMUTABLE_FL|EXT3_APPEND_FL); 4670 ei->i_flags &= ~(EXT3_IMMUTABLE_FL|EXT3_APPEND_FL);
4554 /* dirsync only applies to directories */ 4671 /* dirsync only applies to directories */
4555@@ -621,6 +631,8 @@ got: 4672@@ -620,6 +630,8 @@ got:
4556 fail: 4673 fail:
4557 ext3_std_error(sb, err); 4674 ext3_std_error(sb, err);
4558 out: 4675 out:
4559+ DLIMIT_FREE_INODE(inode); 4676+ DLIMIT_FREE_INODE(inode);
4560+out_dlimit: 4677+out_dlimit:
4561 iput(inode); 4678 iput(inode);
4562 ret = ERR_PTR(err); 4679 ret = ERR_PTR(err);
4563 really_out: 4680 really_out:
4564@@ -632,6 +644,7 @@ fail_free_drop: 4681@@ -631,6 +643,7 @@ fail_free_drop:
4565 4682
4566 fail_drop: 4683 fail_drop:
4567 DQUOT_DROP(inode); 4684 DQUOT_DROP(inode);
4568+ DLIMIT_FREE_INODE(inode); 4685+ DLIMIT_FREE_INODE(inode);
4569 inode->i_flags |= S_NOQUOTA; 4686 inode->i_flags |= S_NOQUOTA;
4570 inode->i_nlink = 0; 4687 inode->i_nlink = 0;
4571 iput(inode); 4688 iput(inode);
4572diff -NurpP --minimal linux-2.6.15.6/fs/ext3/inode.c linux-2.6.15.6-vs2.1.1-rc13/fs/ext3/inode.c 4689Index: linux-2.6.16/fs/ext3/inode.c
4573--- linux-2.6.15.6/fs/ext3/inode.c 2006-01-03 17:29:56 +0100 4690===================================================================
4574+++ linux-2.6.15.6-vs2.1.1-rc13/fs/ext3/inode.c 2006-02-22 18:24:50 +0100 4691--- linux-2.6.16.orig/fs/ext3/inode.c
4692+++ linux-2.6.16/fs/ext3/inode.c
4575@@ -36,6 +36,7 @@ 4693@@ -36,6 +36,7 @@
4576 #include <linux/writeback.h> 4694 #include <linux/writeback.h>
4577 #include <linux/mpage.h> 4695 #include <linux/mpage.h>
4578 #include <linux/uio.h> 4696 #include <linux/uio.h>
4579+#include <linux/vserver/tag.h> 4697+#include <linux/vserver/tag.h>
4580 #include "xattr.h" 4698 #include "xattr.h"
4581 #include "acl.h" 4699 #include "acl.h"
4582 4700
4583@@ -2421,19 +2422,77 @@ void ext3_set_inode_flags(struct inode * 4701@@ -2422,19 +2423,77 @@ void ext3_set_inode_flags(struct inode *
4584 { 4702 {
4585 unsigned int flags = EXT3_I(inode)->i_flags; 4703 unsigned int flags = EXT3_I(inode)->i_flags;
4586 4704
4587- inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC); 4705- inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC);
4588+ inode->i_flags &= ~(S_IMMUTABLE | S_IUNLINK | S_BARRIER | 4706+ inode->i_flags &= ~(S_IMMUTABLE | S_IUNLINK | S_BARRIER |
4659+} 4777+}
4660+ 4778+
4661 void ext3_read_inode(struct inode * inode) 4779 void ext3_read_inode(struct inode * inode)
4662 { 4780 {
4663 struct ext3_iloc iloc; 4781 struct ext3_iloc iloc;
4664@@ -2441,6 +2500,8 @@ void ext3_read_inode(struct inode * inod 4782@@ -2442,6 +2501,8 @@ void ext3_read_inode(struct inode * inod
4665 struct ext3_inode_info *ei = EXT3_I(inode); 4783 struct ext3_inode_info *ei = EXT3_I(inode);
4666 struct buffer_head *bh; 4784 struct buffer_head *bh;
4667 int block; 4785 int block;
4668+ uid_t uid; 4786+ uid_t uid;
4669+ gid_t gid; 4787+ gid_t gid;
4670 4788
4671 #ifdef CONFIG_EXT3_FS_POSIX_ACL 4789 #ifdef CONFIG_EXT3_FS_POSIX_ACL
4672 ei->i_acl = EXT3_ACL_NOT_CACHED; 4790 ei->i_acl = EXT3_ACL_NOT_CACHED;
4673@@ -2453,12 +2514,17 @@ void ext3_read_inode(struct inode * inod 4791@@ -2454,12 +2515,17 @@ void ext3_read_inode(struct inode * inod
4674 bh = iloc.bh; 4792 bh = iloc.bh;
4675 raw_inode = ext3_raw_inode(&iloc); 4793 raw_inode = ext3_raw_inode(&iloc);
4676 inode->i_mode = le16_to_cpu(raw_inode->i_mode); 4794 inode->i_mode = le16_to_cpu(raw_inode->i_mode);
4677- inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low); 4795- inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
4678- inode->i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low); 4796- inode->i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
4690+ le16_to_cpu(raw_inode->i_raw_tag)); 4808+ le16_to_cpu(raw_inode->i_raw_tag));
4691+ 4809+
4692 inode->i_nlink = le16_to_cpu(raw_inode->i_links_count); 4810 inode->i_nlink = le16_to_cpu(raw_inode->i_links_count);
4693 inode->i_size = le32_to_cpu(raw_inode->i_size); 4811 inode->i_size = le32_to_cpu(raw_inode->i_size);
4694 inode->i_atime.tv_sec = le32_to_cpu(raw_inode->i_atime); 4812 inode->i_atime.tv_sec = le32_to_cpu(raw_inode->i_atime);
4695@@ -2585,6 +2651,8 @@ static int ext3_do_update_inode(handle_t 4813@@ -2586,6 +2652,8 @@ static int ext3_do_update_inode(handle_t
4696 struct ext3_inode *raw_inode = ext3_raw_inode(iloc); 4814 struct ext3_inode *raw_inode = ext3_raw_inode(iloc);
4697 struct ext3_inode_info *ei = EXT3_I(inode); 4815 struct ext3_inode_info *ei = EXT3_I(inode);
4698 struct buffer_head *bh = iloc->bh; 4816 struct buffer_head *bh = iloc->bh;
4699+ uid_t uid = TAGINO_UID(DX_TAG(inode), inode->i_uid, inode->i_tag); 4817+ uid_t uid = TAGINO_UID(DX_TAG(inode), inode->i_uid, inode->i_tag);
4700+ gid_t gid = TAGINO_GID(DX_TAG(inode), inode->i_gid, inode->i_tag); 4818+ gid_t gid = TAGINO_GID(DX_TAG(inode), inode->i_gid, inode->i_tag);
4701 int err = 0, rc, block; 4819 int err = 0, rc, block;
4702 4820
4703 /* For fields not not tracking in the in-memory inode, 4821 /* For fields not not tracking in the in-memory inode,
4704@@ -2594,29 +2662,32 @@ static int ext3_do_update_inode(handle_t 4822@@ -2595,29 +2663,32 @@ static int ext3_do_update_inode(handle_t
4705 4823
4706 raw_inode->i_mode = cpu_to_le16(inode->i_mode); 4824 raw_inode->i_mode = cpu_to_le16(inode->i_mode);
4707 if(!(test_opt(inode->i_sb, NO_UID32))) { 4825 if(!(test_opt(inode->i_sb, NO_UID32))) {
4708- raw_inode->i_uid_low = cpu_to_le16(low_16_bits(inode->i_uid)); 4826- raw_inode->i_uid_low = cpu_to_le16(low_16_bits(inode->i_uid));
4709- raw_inode->i_gid_low = cpu_to_le16(low_16_bits(inode->i_gid)); 4827- raw_inode->i_gid_low = cpu_to_le16(low_16_bits(inode->i_gid));
4738+ raw_inode->i_raw_tag = cpu_to_le16(inode->i_tag); 4856+ raw_inode->i_raw_tag = cpu_to_le16(inode->i_tag);
4739+#endif 4857+#endif
4740 raw_inode->i_links_count = cpu_to_le16(inode->i_nlink); 4858 raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
4741 raw_inode->i_size = cpu_to_le32(ei->i_disksize); 4859 raw_inode->i_size = cpu_to_le32(ei->i_disksize);
4742 raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec); 4860 raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec);
4743@@ -2769,7 +2840,8 @@ int ext3_setattr(struct dentry *dentry, 4861@@ -2770,7 +2841,8 @@ int ext3_setattr(struct dentry *dentry,
4744 return error; 4862 return error;
4745 4863
4746 if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || 4864 if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
4747- (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) { 4865- (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
4748+ (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid) || 4866+ (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid) ||
4749+ (ia_valid & ATTR_TAG && attr->ia_tag != inode->i_tag)) { 4867+ (ia_valid & ATTR_TAG && attr->ia_tag != inode->i_tag)) {
4750 handle_t *handle; 4868 handle_t *handle;
4751 4869
4752 /* (user+group)*(old+new) structure, inode write (sb, 4870 /* (user+group)*(old+new) structure, inode write (sb,
4753@@ -2791,6 +2863,8 @@ int ext3_setattr(struct dentry *dentry, 4871@@ -2792,6 +2864,8 @@ int ext3_setattr(struct dentry *dentry,
4754 inode->i_uid = attr->ia_uid; 4872 inode->i_uid = attr->ia_uid;
4755 if (attr->ia_valid & ATTR_GID) 4873 if (attr->ia_valid & ATTR_GID)
4756 inode->i_gid = attr->ia_gid; 4874 inode->i_gid = attr->ia_gid;
4757+ if ((attr->ia_valid & ATTR_TAG) && IS_TAGGED(inode)) 4875+ if ((attr->ia_valid & ATTR_TAG) && IS_TAGGED(inode))
4758+ inode->i_tag = attr->ia_tag; 4876+ inode->i_tag = attr->ia_tag;
4759 error = ext3_mark_inode_dirty(handle, inode); 4877 error = ext3_mark_inode_dirty(handle, inode);
4760 ext3_journal_stop(handle); 4878 ext3_journal_stop(handle);
4761 } 4879 }
4762diff -NurpP --minimal linux-2.6.15.6/fs/ext3/ioctl.c linux-2.6.15.6-vs2.1.1-rc13/fs/ext3/ioctl.c 4880Index: linux-2.6.16/fs/ext3/ioctl.c
4763--- linux-2.6.15.6/fs/ext3/ioctl.c 2005-06-22 02:38:36 +0200 4881===================================================================
4764+++ linux-2.6.15.6-vs2.1.1-rc13/fs/ext3/ioctl.c 2006-02-14 12:35:23 +0100 4882--- linux-2.6.16.orig/fs/ext3/ioctl.c
4765@@ -12,6 +12,7 @@ 4883+++ linux-2.6.16/fs/ext3/ioctl.c
4884@@ -8,11 +8,13 @@
4885 */
4886
4887 #include <linux/fs.h>
4888+#include <linux/mount.h>
4889 #include <linux/jbd.h>
4890 #include <linux/capability.h>
4766 #include <linux/ext3_fs.h> 4891 #include <linux/ext3_fs.h>
4767 #include <linux/ext3_jbd.h> 4892 #include <linux/ext3_jbd.h>
4768 #include <linux/time.h> 4893 #include <linux/time.h>
4769+#include <linux/vserver/tag.h> 4894+#include <linux/vserver/tag.h>
4770 #include <asm/uaccess.h> 4895 #include <asm/uaccess.h>
4771 4896
4772 4897
4773@@ -35,7 +36,8 @@ int ext3_ioctl (struct inode * inode, st 4898@@ -36,7 +38,8 @@ int ext3_ioctl (struct inode * inode, st
4774 unsigned int oldflags; 4899 unsigned int oldflags;
4775 unsigned int jflag; 4900 unsigned int jflag;
4776 4901
4777- if (IS_RDONLY(inode)) 4902- if (IS_RDONLY(inode))
4778+ if (IS_RDONLY(inode) || 4903+ if (IS_RDONLY(inode) ||
4779+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt))) 4904+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
4780 return -EROFS; 4905 return -EROFS;
4781 4906
4782 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER)) 4907 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
4783@@ -58,7 +60,9 @@ int ext3_ioctl (struct inode * inode, st 4908@@ -59,7 +62,9 @@ int ext3_ioctl (struct inode * inode, st
4784 * 4909 *
4785 * This test looks nicer. Thanks to Pauline Middelink 4910 * This test looks nicer. Thanks to Pauline Middelink
4786 */ 4911 */
4787- if ((flags ^ oldflags) & (EXT3_APPEND_FL | EXT3_IMMUTABLE_FL)) { 4912- if ((flags ^ oldflags) & (EXT3_APPEND_FL | EXT3_IMMUTABLE_FL)) {
4788+ if ((oldflags & EXT3_IMMUTABLE_FL) || 4913+ if ((oldflags & EXT3_IMMUTABLE_FL) ||
4789+ ((flags ^ oldflags) & (EXT3_APPEND_FL | 4914+ ((flags ^ oldflags) & (EXT3_APPEND_FL |
4790+ EXT3_IMMUTABLE_FL | EXT3_IUNLINK_FL))) { 4915+ EXT3_IMMUTABLE_FL | EXT3_IUNLINK_FL))) {
4791 if (!capable(CAP_LINUX_IMMUTABLE)) 4916 if (!capable(CAP_LINUX_IMMUTABLE))
4792 return -EPERM; 4917 return -EPERM;
4793 } 4918 }
4794@@ -111,7 +115,8 @@ flags_err: 4919@@ -112,7 +117,8 @@ flags_err:
4795 4920
4796 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER)) 4921 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
4797 return -EPERM; 4922 return -EPERM;
4798- if (IS_RDONLY(inode)) 4923- if (IS_RDONLY(inode))
4799+ if (IS_RDONLY(inode) || 4924+ if (IS_RDONLY(inode) ||
4800+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt))) 4925+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
4801 return -EROFS; 4926 return -EROFS;
4802 if (get_user(generation, (int __user *) arg)) 4927 if (get_user(generation, (int __user *) arg))
4803 return -EFAULT; 4928 return -EFAULT;
4804@@ -165,7 +170,8 @@ flags_err: 4929@@ -166,7 +172,8 @@ flags_err:
4805 if (!test_opt(inode->i_sb, RESERVATION) ||!S_ISREG(inode->i_mode)) 4930 if (!test_opt(inode->i_sb, RESERVATION) ||!S_ISREG(inode->i_mode))
4806 return -ENOTTY; 4931 return -ENOTTY;
4807 4932
4808- if (IS_RDONLY(inode)) 4933- if (IS_RDONLY(inode))
4809+ if (IS_RDONLY(inode) || 4934+ if (IS_RDONLY(inode) ||
4810+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt))) 4935+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
4811 return -EROFS; 4936 return -EROFS;
4812 4937
4813 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER)) 4938 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
4814@@ -200,7 +206,8 @@ flags_err: 4939@@ -201,7 +208,8 @@ flags_err:
4815 if (!capable(CAP_SYS_RESOURCE)) 4940 if (!capable(CAP_SYS_RESOURCE))
4816 return -EPERM; 4941 return -EPERM;
4817 4942
4818- if (IS_RDONLY(inode)) 4943- if (IS_RDONLY(inode))
4819+ if (IS_RDONLY(inode) || 4944+ if (IS_RDONLY(inode) ||
4820+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt))) 4945+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
4821 return -EROFS; 4946 return -EROFS;
4822 4947
4823 if (get_user(n_blocks_count, (__u32 __user *)arg)) 4948 if (get_user(n_blocks_count, (__u32 __user *)arg))
4824@@ -221,7 +228,8 @@ flags_err: 4949@@ -222,7 +230,8 @@ flags_err:
4825 if (!capable(CAP_SYS_RESOURCE)) 4950 if (!capable(CAP_SYS_RESOURCE))
4826 return -EPERM; 4951 return -EPERM;
4827 4952
4828- if (IS_RDONLY(inode)) 4953- if (IS_RDONLY(inode))
4829+ if (IS_RDONLY(inode) || 4954+ if (IS_RDONLY(inode) ||
4830+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt))) 4955+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
4831 return -EROFS; 4956 return -EROFS;
4832 4957
4833 if (copy_from_user(&input, (struct ext3_new_group_input __user *)arg, 4958 if (copy_from_user(&input, (struct ext3_new_group_input __user *)arg,
4834@@ -236,6 +244,38 @@ flags_err: 4959@@ -237,6 +246,38 @@ flags_err:
4835 return err; 4960 return err;
4836 } 4961 }
4837 4962
4838+#if defined(CONFIG_VSERVER_LEGACY) && !defined(CONFIG_TAGGING_NONE) 4963+#if defined(CONFIG_VSERVER_LEGACY) && !defined(CONFIG_TAGGING_NONE)
4839+ case EXT3_IOC_SETTAG: { 4964+ case EXT3_IOC_SETTAG: {
4868+ } 4993+ }
4869+#endif 4994+#endif
4870 4995
4871 default: 4996 default:
4872 return -ENOTTY; 4997 return -ENOTTY;
4873diff -NurpP --minimal linux-2.6.15.6/fs/ext3/namei.c linux-2.6.15.6-vs2.1.1-rc13/fs/ext3/namei.c 4998Index: linux-2.6.16/fs/ext3/namei.c
4874--- linux-2.6.15.6/fs/ext3/namei.c 2006-01-03 17:29:56 +0100 4999===================================================================
4875+++ linux-2.6.15.6-vs2.1.1-rc13/fs/ext3/namei.c 2006-02-13 05:26:55 +0100 5000--- linux-2.6.16.orig/fs/ext3/namei.c
5001+++ linux-2.6.16/fs/ext3/namei.c
4876@@ -36,6 +36,7 @@ 5002@@ -36,6 +36,7 @@
4877 #include <linux/quotaops.h> 5003 #include <linux/quotaops.h>
4878 #include <linux/buffer_head.h> 5004 #include <linux/buffer_head.h>
4879 #include <linux/smp_lock.h> 5005 #include <linux/smp_lock.h>
4880+#include <linux/vserver/tag.h> 5006+#include <linux/vserver/tag.h>
4885 5011
4886 if (!inode) 5012 if (!inode)
4887 return ERR_PTR(-EACCES); 5013 return ERR_PTR(-EACCES);
4888+ dx_propagate_tag(nd, inode); 5014+ dx_propagate_tag(nd, inode);
4889 } 5015 }
4890 if (inode)
4891 return d_splice_alias(inode, dentry); 5016 return d_splice_alias(inode, dentry);
5017 }
4892@@ -2375,6 +2377,7 @@ struct inode_operations ext3_dir_inode_o 5018@@ -2373,6 +2375,7 @@ struct inode_operations ext3_dir_inode_o
4893 .removexattr = generic_removexattr, 5019 .removexattr = generic_removexattr,
4894 #endif 5020 #endif
4895 .permission = ext3_permission, 5021 .permission = ext3_permission,
4896+ .sync_flags = ext3_sync_flags, 5022+ .sync_flags = ext3_sync_flags,
4897 }; 5023 };
4898 5024
4899 struct inode_operations ext3_special_inode_operations = { 5025 struct inode_operations ext3_special_inode_operations = {
4900@@ -2386,4 +2389,5 @@ struct inode_operations ext3_special_ino 5026@@ -2384,4 +2387,5 @@ struct inode_operations ext3_special_ino
4901 .removexattr = generic_removexattr, 5027 .removexattr = generic_removexattr,
4902 #endif 5028 #endif
4903 .permission = ext3_permission, 5029 .permission = ext3_permission,
4904+ .sync_flags = ext3_sync_flags, 5030+ .sync_flags = ext3_sync_flags,
4905 }; 5031 };
4906diff -NurpP --minimal linux-2.6.15.6/fs/ext3/super.c linux-2.6.15.6-vs2.1.1-rc13/fs/ext3/super.c 5032Index: linux-2.6.16/fs/ext3/super.c
4907--- linux-2.6.15.6/fs/ext3/super.c 2006-01-03 17:29:56 +0100 5033===================================================================
4908+++ linux-2.6.15.6-vs2.1.1-rc13/fs/ext3/super.c 2006-02-13 05:26:55 +0100 5034--- linux-2.6.16.orig/fs/ext3/super.c
5035+++ linux-2.6.16/fs/ext3/super.c
4909@@ -562,12 +562,12 @@ static int ext3_write_dquot(struct dquot 5036@@ -563,12 +563,12 @@ static int ext3_write_dquot(struct dquot
4910 static int ext3_acquire_dquot(struct dquot *dquot); 5037 static int ext3_acquire_dquot(struct dquot *dquot);
4911 static int ext3_release_dquot(struct dquot *dquot); 5038 static int ext3_release_dquot(struct dquot *dquot);
4912 static int ext3_mark_dquot_dirty(struct dquot *dquot); 5039 static int ext3_mark_dquot_dirty(struct dquot *dquot);
4913-static int ext3_write_info(struct super_block *sb, int type); 5040-static int ext3_write_info(struct super_block *sb, int type);
4914-static int ext3_quota_on(struct super_block *sb, int type, int format_id, char *path); 5041-static int ext3_quota_on(struct super_block *sb, int type, int format_id, char *path);
4922-static ssize_t ext3_quota_write(struct super_block *sb, int type, 5049-static ssize_t ext3_quota_write(struct super_block *sb, int type,
4923+static ssize_t ext3_quota_write(struct dqhash *hash, int type, 5050+static ssize_t ext3_quota_write(struct dqhash *hash, int type,
4924 const char *data, size_t len, loff_t off); 5051 const char *data, size_t len, loff_t off);
4925 5052
4926 static struct dquot_operations ext3_quota_operations = { 5053 static struct dquot_operations ext3_quota_operations = {
4927@@ -633,7 +633,7 @@ enum { 5054@@ -634,7 +634,7 @@ enum {
4928 Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota, 5055 Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
4929 Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_quota, Opt_noquota, 5056 Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_quota, Opt_noquota,
4930 Opt_ignore, Opt_barrier, Opt_err, Opt_resize, Opt_usrquota, 5057 Opt_ignore, Opt_barrier, Opt_err, Opt_resize, Opt_usrquota,
4931- Opt_grpquota 5058- Opt_grpquota
4932+ Opt_grpquota, Opt_tag, Opt_notag, Opt_tagid 5059+ Opt_grpquota, Opt_tag, Opt_notag, Opt_tagid
4933 }; 5060 };
4934 5061
4935 static match_table_t tokens = { 5062 static match_table_t tokens = {
4936@@ -681,6 +681,10 @@ static match_table_t tokens = { 5063@@ -683,6 +683,10 @@ static match_table_t tokens = {
4937 {Opt_quota, "quota"}, 5064 {Opt_quota, "quota"},
4938 {Opt_usrquota, "usrquota"}, 5065 {Opt_usrquota, "usrquota"},
4939 {Opt_barrier, "barrier=%u"}, 5066 {Opt_barrier, "barrier=%u"},
4940+ {Opt_tag, "tag"}, 5067+ {Opt_tag, "tag"},
4941+ {Opt_notag, "notag"}, 5068+ {Opt_notag, "notag"},
4942+ {Opt_tagid, "tagid=%u"}, 5069+ {Opt_tagid, "tagid=%u"},
4943+ {Opt_tag, "tagxid"}, 5070+ {Opt_tag, "tagxid"},
4944 {Opt_err, NULL}, 5071 {Opt_err, NULL},
4945 {Opt_resize, "resize"}, 5072 {Opt_resize, "resize"},
4946 }; 5073 };
4947@@ -772,6 +776,20 @@ static int parse_options (char * options 5074@@ -775,6 +779,20 @@ static int parse_options (char *options,
4948 case Opt_nouid32: 5075 case Opt_nouid32:
4949 set_opt (sbi->s_mount_opt, NO_UID32); 5076 set_opt (sbi->s_mount_opt, NO_UID32);
4950 break; 5077 break;
4951+#ifndef CONFIG_TAGGING_NONE 5078+#ifndef CONFIG_TAGGING_NONE
4952+ case Opt_tag: 5079+ case Opt_tag:
4963+ break; 5090+ break;
4964+#endif 5091+#endif
4965 case Opt_nocheck: 5092 case Opt_nocheck:
4966 clear_opt (sbi->s_mount_opt, CHECK); 5093 clear_opt (sbi->s_mount_opt, CHECK);
4967 break; 5094 break;
4968@@ -880,7 +898,7 @@ static int parse_options (char * options 5095@@ -893,7 +911,7 @@ static int parse_options (char *options,
4969 case Opt_grpjquota: 5096 case Opt_grpjquota:
4970 qtype = GRPQUOTA; 5097 qtype = GRPQUOTA;
4971 set_qf_name: 5098 set_qf_name:
4972- if (sb_any_quota_enabled(sb)) { 5099- if (sb_any_quota_enabled(sb)) {
4973+ if (dqh_any_quota_enabled(sb->s_dqh)) { 5100+ if (dqh_any_quota_enabled(sb->s_dqh)) {
4974 printk(KERN_ERR 5101 printk(KERN_ERR
4975 "EXT3-fs: Cannot change journalled " 5102 "EXT3-fs: Cannot change journalled "
4976 "quota options when quota turned on.\n"); 5103 "quota options when quota turned on.\n");
4977@@ -918,7 +936,7 @@ set_qf_name: 5104@@ -931,7 +949,7 @@ set_qf_name:
4978 case Opt_offgrpjquota: 5105 case Opt_offgrpjquota:
4979 qtype = GRPQUOTA; 5106 qtype = GRPQUOTA;
4980 clear_qf_name: 5107 clear_qf_name:
4981- if (sb_any_quota_enabled(sb)) { 5108- if (sb_any_quota_enabled(sb)) {
4982+ if (dqh_any_quota_enabled(sb->s_dqh)) { 5109+ if (dqh_any_quota_enabled(sb->s_dqh)) {
4983 printk(KERN_ERR "EXT3-fs: Cannot change " 5110 printk(KERN_ERR "EXT3-fs: Cannot change "
4984 "journalled quota options when " 5111 "journalled quota options when "
4985 "quota turned on.\n"); 5112 "quota turned on.\n");
4986@@ -946,7 +964,7 @@ clear_qf_name: 5113@@ -959,7 +977,7 @@ clear_qf_name:
4987 set_opt(sbi->s_mount_opt, GRPQUOTA); 5114 set_opt(sbi->s_mount_opt, GRPQUOTA);
4988 break; 5115 break;
4989 case Opt_noquota: 5116 case Opt_noquota:
4990- if (sb_any_quota_enabled(sb)) { 5117- if (sb_any_quota_enabled(sb)) {
4991+ if (dqh_any_quota_enabled(sb->s_dqh)) { 5118+ if (dqh_any_quota_enabled(sb->s_dqh)) {
4992 printk(KERN_ERR "EXT3-fs: Cannot change quota " 5119 printk(KERN_ERR "EXT3-fs: Cannot change quota "
4993 "options when quota turned on.\n"); 5120 "options when quota turned on.\n");
4994 return 0; 5121 return 0;
4995@@ -1218,7 +1236,7 @@ static void ext3_orphan_cleanup (struct 5122@@ -1231,7 +1249,7 @@ static void ext3_orphan_cleanup (struct
4996 /* Turn on quotas so that they are updated correctly */ 5123 /* Turn on quotas so that they are updated correctly */
4997 for (i = 0; i < MAXQUOTAS; i++) { 5124 for (i = 0; i < MAXQUOTAS; i++) {
4998 if (EXT3_SB(sb)->s_qf_names[i]) { 5125 if (EXT3_SB(sb)->s_qf_names[i]) {
4999- int ret = ext3_quota_on_mount(sb, i); 5126- int ret = ext3_quota_on_mount(sb, i);
5000+ int ret = ext3_quota_on_mount(sb->s_dqh, i); 5127+ int ret = ext3_quota_on_mount(sb->s_dqh, i);
5001 if (ret < 0) 5128 if (ret < 0)
5002 printk(KERN_ERR 5129 printk(KERN_ERR
5003 "EXT3-fs: Cannot turn on journalled " 5130 "EXT3-fs: Cannot turn on journalled "
5004@@ -1268,8 +1286,8 @@ static void ext3_orphan_cleanup (struct 5131@@ -1281,8 +1299,8 @@ static void ext3_orphan_cleanup (struct
5005 #ifdef CONFIG_QUOTA 5132 #ifdef CONFIG_QUOTA
5006 /* Turn quotas off */ 5133 /* Turn quotas off */
5007 for (i = 0; i < MAXQUOTAS; i++) { 5134 for (i = 0; i < MAXQUOTAS; i++) {
5008- if (sb_dqopt(sb)->files[i]) 5135- if (sb_dqopt(sb)->files[i])
5009- vfs_quota_off(sb, i); 5136- vfs_quota_off(sb, i);
5010+ if (dqh_dqopt(sb->s_dqh)->files[i]) 5137+ if (dqh_dqopt(sb->s_dqh)->files[i])
5011+ vfs_quota_off(sb->s_dqh, i); 5138+ vfs_quota_off(sb->s_dqh, i);
5012 } 5139 }
5013 #endif 5140 #endif
5014 sb->s_flags = s_flags; /* Restore MS_RDONLY status */ 5141 sb->s_flags = s_flags; /* Restore MS_RDONLY status */
5015@@ -1414,6 +1432,9 @@ static int ext3_fill_super (struct super 5142@@ -1429,6 +1447,9 @@ static int ext3_fill_super (struct super
5016 if (!parse_options ((char *) data, sb, &journal_inum, NULL, 0)) 5143 NULL, 0))
5017 goto failed_mount; 5144 goto failed_mount;
5018 5145
5019+ if (EXT3_SB(sb)->s_mount_opt & EXT3_MOUNT_TAGGED) 5146+ if (EXT3_SB(sb)->s_mount_opt & EXT3_MOUNT_TAGGED)
5020+ sb->s_flags |= MS_TAGGED; 5147+ sb->s_flags |= MS_TAGGED;
5021+ 5148+
5022 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | 5149 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
5023 ((sbi->s_mount_opt & EXT3_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); 5150 ((sbi->s_mount_opt & EXT3_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0);
5024 5151
5025@@ -1605,8 +1626,8 @@ static int ext3_fill_super (struct super 5152@@ -1620,8 +1641,8 @@ static int ext3_fill_super (struct super
5026 sb->s_export_op = &ext3_export_ops; 5153 sb->s_export_op = &ext3_export_ops;
5027 sb->s_xattr = ext3_xattr_handlers; 5154 sb->s_xattr = ext3_xattr_handlers;
5028 #ifdef CONFIG_QUOTA 5155 #ifdef CONFIG_QUOTA
5029- sb->s_qcop = &ext3_qctl_operations; 5156- sb->s_qcop = &ext3_qctl_operations;
5030- sb->dq_op = &ext3_quota_operations; 5157- sb->dq_op = &ext3_quota_operations;
5031+ sb->s_dqh->dqh_qop = &ext3_quota_operations; 5158+ sb->s_dqh->dqh_qop = &ext3_quota_operations;
5032+ sb->s_dqh->dqh_qcop = &ext3_qctl_operations; 5159+ sb->s_dqh->dqh_qcop = &ext3_qctl_operations;
5033 #endif 5160 #endif
5034 INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */ 5161 INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */
5035 5162
5036@@ -2204,6 +2225,12 @@ static int ext3_remount (struct super_bl 5163@@ -2238,6 +2259,12 @@ static int ext3_remount (struct super_bl
5037 5164
5038 if (sbi->s_mount_opt & EXT3_MOUNT_ABORT) 5165 if (sbi->s_mount_opt & EXT3_MOUNT_ABORT)
5039 ext3_abort(sb, __FUNCTION__, "Abort forced by user"); 5166 ext3_abort(sb, __FUNCTION__, "Abort forced by user");
5040+ if ((sbi->s_mount_opt & EXT3_MOUNT_TAGGED) && 5167+ if ((sbi->s_mount_opt & EXT3_MOUNT_TAGGED) &&
5041+ !(sb->s_flags & MS_TAGGED)) { 5168+ !(sb->s_flags & MS_TAGGED)) {
5044+ return -EINVAL; 5171+ return -EINVAL;
5045+ } 5172+ }
5046 5173
5047 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | 5174 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
5048 ((sbi->s_mount_opt & EXT3_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); 5175 ((sbi->s_mount_opt & EXT3_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0);
5049@@ -2357,7 +2384,7 @@ static int ext3_statfs (struct super_blo 5176@@ -2391,7 +2418,7 @@ static int ext3_statfs (struct super_blo
5050 5177
5051 static inline struct inode *dquot_to_inode(struct dquot *dquot) 5178 static inline struct inode *dquot_to_inode(struct dquot *dquot)
5052 { 5179 {
5053- return sb_dqopt(dquot->dq_sb)->files[dquot->dq_type]; 5180- return sb_dqopt(dquot->dq_sb)->files[dquot->dq_type];
5054+ return dqh_dqopt(dquot->dq_dqh)->files[dquot->dq_type]; 5181+ return dqh_dqopt(dquot->dq_dqh)->files[dquot->dq_type];
5055 } 5182 }
5056 5183
5057 static int ext3_dquot_initialize(struct inode *inode, int type) 5184 static int ext3_dquot_initialize(struct inode *inode, int type)
5058@@ -2400,7 +2427,7 @@ static int ext3_write_dquot(struct dquot 5185@@ -2434,7 +2461,7 @@ static int ext3_write_dquot(struct dquot
5059 5186
5060 inode = dquot_to_inode(dquot); 5187 inode = dquot_to_inode(dquot);
5061 handle = ext3_journal_start(inode, 5188 handle = ext3_journal_start(inode,
5062- EXT3_QUOTA_TRANS_BLOCKS(dquot->dq_sb)); 5189- EXT3_QUOTA_TRANS_BLOCKS(dquot->dq_sb));
5063+ EXT3_QUOTA_TRANS_BLOCKS(dquot->dq_dqh->dqh_sb)); 5190+ EXT3_QUOTA_TRANS_BLOCKS(dquot->dq_dqh->dqh_sb));
5064 if (IS_ERR(handle)) 5191 if (IS_ERR(handle))
5065 return PTR_ERR(handle); 5192 return PTR_ERR(handle);
5066 ret = dquot_commit(dquot); 5193 ret = dquot_commit(dquot);
5067@@ -2416,7 +2443,7 @@ static int ext3_acquire_dquot(struct dqu 5194@@ -2450,7 +2477,7 @@ static int ext3_acquire_dquot(struct dqu
5068 handle_t *handle; 5195 handle_t *handle;
5069 5196
5070 handle = ext3_journal_start(dquot_to_inode(dquot), 5197 handle = ext3_journal_start(dquot_to_inode(dquot),
5071- EXT3_QUOTA_INIT_BLOCKS(dquot->dq_sb)); 5198- EXT3_QUOTA_INIT_BLOCKS(dquot->dq_sb));
5072+ EXT3_QUOTA_INIT_BLOCKS(dquot->dq_dqh->dqh_sb)); 5199+ EXT3_QUOTA_INIT_BLOCKS(dquot->dq_dqh->dqh_sb));
5073 if (IS_ERR(handle)) 5200 if (IS_ERR(handle))
5074 return PTR_ERR(handle); 5201 return PTR_ERR(handle);
5075 ret = dquot_acquire(dquot); 5202 ret = dquot_acquire(dquot);
5076@@ -2432,7 +2459,7 @@ static int ext3_release_dquot(struct dqu 5203@@ -2466,7 +2493,7 @@ static int ext3_release_dquot(struct dqu
5077 handle_t *handle; 5204 handle_t *handle;
5078 5205
5079 handle = ext3_journal_start(dquot_to_inode(dquot), 5206 handle = ext3_journal_start(dquot_to_inode(dquot),
5080- EXT3_QUOTA_DEL_BLOCKS(dquot->dq_sb)); 5207- EXT3_QUOTA_DEL_BLOCKS(dquot->dq_sb));
5081+ EXT3_QUOTA_DEL_BLOCKS(dquot->dq_dqh->dqh_sb)); 5208+ EXT3_QUOTA_DEL_BLOCKS(dquot->dq_dqh->dqh_sb));
5082 if (IS_ERR(handle)) 5209 if (IS_ERR(handle))
5083 return PTR_ERR(handle); 5210 return PTR_ERR(handle);
5084 ret = dquot_release(dquot); 5211 ret = dquot_release(dquot);
5085@@ -2445,8 +2472,8 @@ static int ext3_release_dquot(struct dqu 5212@@ -2479,8 +2506,8 @@ static int ext3_release_dquot(struct dqu
5086 static int ext3_mark_dquot_dirty(struct dquot *dquot) 5213 static int ext3_mark_dquot_dirty(struct dquot *dquot)
5087 { 5214 {
5088 /* Are we journalling quotas? */ 5215 /* Are we journalling quotas? */
5089- if (EXT3_SB(dquot->dq_sb)->s_qf_names[USRQUOTA] || 5216- if (EXT3_SB(dquot->dq_sb)->s_qf_names[USRQUOTA] ||
5090- EXT3_SB(dquot->dq_sb)->s_qf_names[GRPQUOTA]) { 5217- EXT3_SB(dquot->dq_sb)->s_qf_names[GRPQUOTA]) {
5091+ if (EXT3_SB(dquot->dq_dqh->dqh_sb)->s_qf_names[USRQUOTA] || 5218+ if (EXT3_SB(dquot->dq_dqh->dqh_sb)->s_qf_names[USRQUOTA] ||
5092+ EXT3_SB(dquot->dq_dqh->dqh_sb)->s_qf_names[GRPQUOTA]) { 5219+ EXT3_SB(dquot->dq_dqh->dqh_sb)->s_qf_names[GRPQUOTA]) {
5093 dquot_mark_dquot_dirty(dquot); 5220 dquot_mark_dquot_dirty(dquot);
5094 return ext3_write_dquot(dquot); 5221 return ext3_write_dquot(dquot);
5095 } else { 5222 } else {
5096@@ -2454,8 +2481,9 @@ static int ext3_mark_dquot_dirty(struct 5223@@ -2488,8 +2515,9 @@ static int ext3_mark_dquot_dirty(struct
5097 } 5224 }
5098 } 5225 }
5099 5226
5100-static int ext3_write_info(struct super_block *sb, int type) 5227-static int ext3_write_info(struct super_block *sb, int type)
5101+static int ext3_write_info(struct dqhash *hash, int type) 5228+static int ext3_write_info(struct dqhash *hash, int type)
5102 { 5229 {
5103+ struct super_block *sb = hash->dqh_sb; 5230+ struct super_block *sb = hash->dqh_sb;
5104 int ret, err; 5231 int ret, err;
5105 handle_t *handle; 5232 handle_t *handle;
5106 5233
5107@@ -2463,7 +2491,7 @@ static int ext3_write_info(struct super_ 5234@@ -2497,7 +2525,7 @@ static int ext3_write_info(struct super_
5108 handle = ext3_journal_start(sb->s_root->d_inode, 2); 5235 handle = ext3_journal_start(sb->s_root->d_inode, 2);
5109 if (IS_ERR(handle)) 5236 if (IS_ERR(handle))
5110 return PTR_ERR(handle); 5237 return PTR_ERR(handle);
5111- ret = dquot_commit_info(sb, type); 5238- ret = dquot_commit_info(sb, type);
5112+ ret = dquot_commit_info(hash, type); 5239+ ret = dquot_commit_info(hash, type);
5113 err = ext3_journal_stop(handle); 5240 err = ext3_journal_stop(handle);
5114 if (!ret) 5241 if (!ret)
5115 ret = err; 5242 ret = err;
5116@@ -2474,18 +2502,20 @@ static int ext3_write_info(struct super_ 5243@@ -2508,18 +2536,20 @@ static int ext3_write_info(struct super_
5117 * Turn on quotas during mount time - we need to find 5244 * Turn on quotas during mount time - we need to find
5118 * the quota file and such... 5245 * the quota file and such...
5119 */ 5246 */
5120-static int ext3_quota_on_mount(struct super_block *sb, int type) 5247-static int ext3_quota_on_mount(struct super_block *sb, int type)
5121+static int ext3_quota_on_mount(struct dqhash *hash, int type) 5248+static int ext3_quota_on_mount(struct dqhash *hash, int type)
5136 { 5263 {
5137+ struct super_block *sb = hash->dqh_sb; 5264+ struct super_block *sb = hash->dqh_sb;
5138 int err; 5265 int err;
5139 struct nameidata nd; 5266 struct nameidata nd;
5140 5267
5141@@ -2494,7 +2524,7 @@ static int ext3_quota_on(struct super_bl 5268@@ -2528,7 +2558,7 @@ static int ext3_quota_on(struct super_bl
5142 /* Not journalling quota? */ 5269 /* Not journalling quota? */
5143 if (!EXT3_SB(sb)->s_qf_names[USRQUOTA] && 5270 if (!EXT3_SB(sb)->s_qf_names[USRQUOTA] &&
5144 !EXT3_SB(sb)->s_qf_names[GRPQUOTA]) 5271 !EXT3_SB(sb)->s_qf_names[GRPQUOTA])
5145- return vfs_quota_on(sb, type, format_id, path); 5272- return vfs_quota_on(sb, type, format_id, path);
5146+ return vfs_quota_on(hash, type, format_id, path); 5273+ return vfs_quota_on(hash, type, format_id, path);
5147 err = path_lookup(path, LOOKUP_FOLLOW, &nd); 5274 err = path_lookup(path, LOOKUP_FOLLOW, &nd);
5148 if (err) 5275 if (err)
5149 return err; 5276 return err;
5150@@ -2509,17 +2539,18 @@ static int ext3_quota_on(struct super_bl 5277@@ -2543,17 +2573,18 @@ static int ext3_quota_on(struct super_bl
5151 "EXT3-fs: Quota file not on filesystem root. " 5278 "EXT3-fs: Quota file not on filesystem root. "
5152 "Journalled quota will not work.\n"); 5279 "Journalled quota will not work.\n");
5153 path_release(&nd); 5280 path_release(&nd);
5154- return vfs_quota_on(sb, type, format_id, path); 5281- return vfs_quota_on(sb, type, format_id, path);
5155+ return vfs_quota_on(hash, type, format_id, path); 5282+ return vfs_quota_on(hash, type, format_id, path);
5167+ struct inode *inode = dqh_dqopt(hash)->files[type]; 5294+ struct inode *inode = dqh_dqopt(hash)->files[type];
5168+ struct super_block *sb = hash->dqh_sb; 5295+ struct super_block *sb = hash->dqh_sb;
5169 sector_t blk = off >> EXT3_BLOCK_SIZE_BITS(sb); 5296 sector_t blk = off >> EXT3_BLOCK_SIZE_BITS(sb);
5170 int err = 0; 5297 int err = 0;
5171 int offset = off & (sb->s_blocksize - 1); 5298 int offset = off & (sb->s_blocksize - 1);
5172@@ -2554,10 +2585,11 @@ static ssize_t ext3_quota_read(struct su 5299@@ -2588,10 +2619,11 @@ static ssize_t ext3_quota_read(struct su
5173 5300
5174 /* Write to quotafile (we know the transaction is already started and has 5301 /* Write to quotafile (we know the transaction is already started and has
5175 * enough credits) */ 5302 * enough credits) */
5176-static ssize_t ext3_quota_write(struct super_block *sb, int type, 5303-static ssize_t ext3_quota_write(struct super_block *sb, int type,
5177+static ssize_t ext3_quota_write(struct dqhash *hash, int type, 5304+static ssize_t ext3_quota_write(struct dqhash *hash, int type,
5181+ struct inode *inode = dqh_dqopt(hash)->files[type]; 5308+ struct inode *inode = dqh_dqopt(hash)->files[type];
5182+ struct super_block *sb = hash->dqh_sb; 5309+ struct super_block *sb = hash->dqh_sb;
5183 sector_t blk = off >> EXT3_BLOCK_SIZE_BITS(sb); 5310 sector_t blk = off >> EXT3_BLOCK_SIZE_BITS(sb);
5184 int err = 0; 5311 int err = 0;
5185 int offset = off & (sb->s_blocksize - 1); 5312 int offset = off & (sb->s_blocksize - 1);
5186diff -NurpP --minimal linux-2.6.15.6/fs/ext3/symlink.c linux-2.6.15.6-vs2.1.1-rc13/fs/ext3/symlink.c 5313Index: linux-2.6.16/fs/ext3/symlink.c
5187--- linux-2.6.15.6/fs/ext3/symlink.c 2005-08-29 22:25:30 +0200 5314===================================================================
5188+++ linux-2.6.15.6-vs2.1.1-rc13/fs/ext3/symlink.c 2006-01-04 21:59:59 +0100 5315--- linux-2.6.16.orig/fs/ext3/symlink.c
5316+++ linux-2.6.16/fs/ext3/symlink.c
5189@@ -40,6 +40,7 @@ struct inode_operations ext3_symlink_ino 5317@@ -40,6 +40,7 @@ struct inode_operations ext3_symlink_ino
5190 .listxattr = ext3_listxattr, 5318 .listxattr = ext3_listxattr,
5191 .removexattr = generic_removexattr, 5319 .removexattr = generic_removexattr,
5192 #endif 5320 #endif
5193+ .sync_flags = ext3_sync_flags, 5321+ .sync_flags = ext3_sync_flags,
5198 .listxattr = ext3_listxattr, 5326 .listxattr = ext3_listxattr,
5199 .removexattr = generic_removexattr, 5327 .removexattr = generic_removexattr,
5200 #endif 5328 #endif
5201+ .sync_flags = ext3_sync_flags, 5329+ .sync_flags = ext3_sync_flags,
5202 }; 5330 };
5203diff -NurpP --minimal linux-2.6.15.6/fs/ext3/xattr.c linux-2.6.15.6-vs2.1.1-rc13/fs/ext3/xattr.c 5331Index: linux-2.6.16/fs/ext3/xattr.c
5204--- linux-2.6.15.6/fs/ext3/xattr.c 2006-01-03 17:29:56 +0100 5332===================================================================
5205+++ linux-2.6.15.6-vs2.1.1-rc13/fs/ext3/xattr.c 2006-01-04 21:59:59 +0100 5333--- linux-2.6.16.orig/fs/ext3/xattr.c
5334+++ linux-2.6.16/fs/ext3/xattr.c
5206@@ -58,6 +58,7 @@ 5335@@ -58,6 +58,7 @@
5207 #include <linux/mbcache.h> 5336 #include <linux/mbcache.h>
5208 #include <linux/quotaops.h> 5337 #include <linux/quotaops.h>
5209 #include <linux/rwsem.h> 5338 #include <linux/rwsem.h>
5210+#include <linux/vs_dlimit.h> 5339+#include <linux/vs_dlimit.h>
5242+cleanup_dlimit: 5371+cleanup_dlimit:
5243+ DLIMIT_FREE_BLOCK(inode, 1); 5372+ DLIMIT_FREE_BLOCK(inode, 1);
5244 goto cleanup; 5373 goto cleanup;
5245 5374
5246 bad_block: 5375 bad_block:
5247diff -NurpP --minimal linux-2.6.15.6/fs/fcntl.c linux-2.6.15.6-vs2.1.1-rc13/fs/fcntl.c 5376Index: linux-2.6.16/fs/fcntl.c
5248--- linux-2.6.15.6/fs/fcntl.c 2005-10-28 20:49:44 +0200 5377===================================================================
5249+++ linux-2.6.15.6-vs2.1.1-rc13/fs/fcntl.c 2006-01-04 21:59:59 +0100 5378--- linux-2.6.16.orig/fs/fcntl.c
5379+++ linux-2.6.16/fs/fcntl.c
5250@@ -17,6 +17,7 @@ 5380@@ -18,6 +18,7 @@
5251 #include <linux/ptrace.h> 5381 #include <linux/ptrace.h>
5252 #include <linux/signal.h> 5382 #include <linux/signal.h>
5253 #include <linux/rcupdate.h> 5383 #include <linux/rcupdate.h>
5254+#include <linux/vs_limit.h> 5384+#include <linux/vs_limit.h>
5255 5385
5256 #include <asm/poll.h> 5386 #include <asm/poll.h>
5257 #include <asm/siginfo.h> 5387 #include <asm/siginfo.h>
5258@@ -84,6 +85,8 @@ repeat: 5388@@ -85,6 +86,8 @@ repeat:
5259 error = -EMFILE; 5389 error = -EMFILE;
5260 if (newfd >= current->signal->rlim[RLIMIT_NOFILE].rlim_cur) 5390 if (newfd >= current->signal->rlim[RLIMIT_NOFILE].rlim_cur)
5261 goto out; 5391 goto out;
5262+ if (!vx_files_avail(1)) 5392+ if (!vx_files_avail(1))
5263+ goto out; 5393+ goto out;
5264 5394
5265 error = expand_files(files, newfd); 5395 error = expand_files(files, newfd);
5266 if (error < 0) 5396 if (error < 0)
5267@@ -125,6 +128,7 @@ static int dupfd(struct file *file, unsi 5397@@ -126,6 +129,7 @@ static int dupfd(struct file *file, unsi
5268 FD_SET(fd, fdt->open_fds); 5398 FD_SET(fd, fdt->open_fds);
5269 FD_CLR(fd, fdt->close_on_exec); 5399 FD_CLR(fd, fdt->close_on_exec);
5270 spin_unlock(&files->file_lock); 5400 spin_unlock(&files->file_lock);
5271+ vx_openfd_inc(fd); 5401+ vx_openfd_inc(fd);
5272 fd_install(fd, file); 5402 fd_install(fd, file);
5273 } else { 5403 } else {
5274 spin_unlock(&files->file_lock); 5404 spin_unlock(&files->file_lock);
5275@@ -177,6 +181,9 @@ asmlinkage long sys_dup2(unsigned int ol 5405@@ -178,6 +182,9 @@ asmlinkage long sys_dup2(unsigned int ol
5276 5406
5277 if (tofree) 5407 if (tofree)
5278 filp_close(tofree, files); 5408 filp_close(tofree, files);
5279+ else 5409+ else
5280+ vx_openfd_inc(newfd); /* fd was unused */ 5410+ vx_openfd_inc(newfd); /* fd was unused */
5281+ 5411+
5282 err = newfd; 5412 err = newfd;
5283 out: 5413 out:
5284 return err; 5414 return err;
5285@@ -477,7 +484,7 @@ void send_sigio(struct fown_struct *fown 5415@@ -481,7 +488,7 @@ void send_sigio(struct fown_struct *fown
5286 5416
5287 read_lock(&tasklist_lock); 5417 read_lock(&tasklist_lock);
5288 if (pid > 0) { 5418 if (pid > 0) {
5289- p = find_task_by_pid(pid); 5419- p = find_task_by_pid(pid);
5290+ p = find_task_by_real_pid(pid); 5420+ p = find_task_by_real_pid(pid);
5291 if (p) { 5421 if (p) {
5292 send_sigio_to_task(p, fown, fd, band); 5422 send_sigio_to_task(p, fown, fd, band);
5293 } 5423 }
5294@@ -512,7 +519,7 @@ int send_sigurg(struct fown_struct *fown 5424@@ -516,7 +523,7 @@ int send_sigurg(struct fown_struct *fown
5295 5425
5296 read_lock(&tasklist_lock); 5426 read_lock(&tasklist_lock);
5297 if (pid > 0) { 5427 if (pid > 0) {
5298- p = find_task_by_pid(pid); 5428- p = find_task_by_pid(pid);
5299+ p = find_task_by_real_pid(pid); 5429+ p = find_task_by_real_pid(pid);
5300 if (p) { 5430 if (p) {
5301 send_sigurg_to_task(p, fown); 5431 send_sigurg_to_task(p, fown);
5302 } 5432 }
5303diff -NurpP --minimal linux-2.6.15.6/fs/file_table.c linux-2.6.15.6-vs2.1.1-rc13/fs/file_table.c 5433Index: linux-2.6.16/fs/file_table.c
5304--- linux-2.6.15.6/fs/file_table.c 2006-01-03 17:29:56 +0100 5434===================================================================
5305+++ linux-2.6.15.6-vs2.1.1-rc13/fs/file_table.c 2006-01-04 21:59:59 +0100 5435--- linux-2.6.16.orig/fs/file_table.c
5436+++ linux-2.6.16/fs/file_table.c
5306@@ -18,6 +18,8 @@ 5437@@ -22,6 +22,8 @@
5307 #include <linux/mount.h>
5308 #include <linux/cdev.h>
5309 #include <linux/fsnotify.h> 5438 #include <linux/fsnotify.h>
5439 #include <linux/sysctl.h>
5440 #include <linux/percpu_counter.h>
5310+#include <linux/vs_limit.h> 5441+#include <linux/vs_limit.h>
5311+#include <linux/vs_context.h> 5442+#include <linux/vs_context.h>
5312 5443
5313 /* sysctl tunables... */ 5444 #include <asm/atomic.h>
5314 struct files_stat_struct files_stat = { 5445
5315@@ -96,6 +98,8 @@ struct file *get_empty_filp(void) 5446@@ -119,6 +121,8 @@ struct file *get_empty_filp(void)
5316 rwlock_init(&f->f_owner.lock); 5447 rwlock_init(&f->f_owner.lock);
5317 /* f->f_version: 0 */ 5448 /* f->f_version: 0 */
5318 INIT_LIST_HEAD(&f->f_u.fu_list); 5449 INIT_LIST_HEAD(&f->f_u.fu_list);
5319+ f->f_xid = vx_current_xid(); 5450+ f->f_xid = vx_current_xid();
5320+ vx_files_inc(f); 5451+ vx_files_inc(f);
5321 return f; 5452 return f;
5322 5453
5323 over: 5454 over:
5324@@ -150,6 +154,8 @@ void fastcall __fput(struct file *file) 5455@@ -173,6 +177,8 @@ void fastcall __fput(struct file *file)
5325 fops_put(file->f_op); 5456 fops_put(file->f_op);
5326 if (file->f_mode & FMODE_WRITE) 5457 if (file->f_mode & FMODE_WRITE)
5327 put_write_access(inode); 5458 put_write_access(inode);
5328+ vx_files_dec(file); 5459+ vx_files_dec(file);
5329+ file->f_xid = 0; 5460+ file->f_xid = 0;
5330 file_kill(file); 5461 file_kill(file);
5331 file->f_dentry = NULL; 5462 file->f_dentry = NULL;
5332 file->f_vfsmnt = NULL; 5463 file->f_vfsmnt = NULL;
5333@@ -215,6 +221,8 @@ void put_filp(struct file *file) 5464@@ -238,6 +244,8 @@ void put_filp(struct file *file)
5334 { 5465 {
5335 if (rcuref_dec_and_test(&file->f_count)) { 5466 if (atomic_dec_and_test(&file->f_count)) {
5336 security_file_free(file); 5467 security_file_free(file);
5337+ vx_files_dec(file); 5468+ vx_files_dec(file);
5338+ file->f_xid = 0; 5469+ file->f_xid = 0;
5339 file_kill(file); 5470 file_kill(file);
5340 file_free(file); 5471 file_free(file);
5341 } 5472 }
5342diff -NurpP --minimal linux-2.6.15.6/fs/hfsplus/ioctl.c linux-2.6.15.6-vs2.1.1-rc13/fs/hfsplus/ioctl.c 5473Index: linux-2.6.16/fs/hfsplus/ioctl.c
5343--- linux-2.6.15.6/fs/hfsplus/ioctl.c 2005-03-02 12:38:44 +0100 5474===================================================================
5344+++ linux-2.6.15.6-vs2.1.1-rc13/fs/hfsplus/ioctl.c 2006-02-14 12:35:23 +0100 5475--- linux-2.6.16.orig/fs/hfsplus/ioctl.c
5476+++ linux-2.6.16/fs/hfsplus/ioctl.c
5477@@ -16,6 +16,7 @@
5478 #include <linux/fs.h>
5479 #include <linux/sched.h>
5480 #include <linux/xattr.h>
5481+#include <linux/mount.h>
5482 #include <asm/uaccess.h>
5483 #include "hfsplus_fs.h"
5484
5345@@ -34,7 +34,8 @@ int hfsplus_ioctl(struct inode *inode, s 5485@@ -35,7 +36,8 @@ int hfsplus_ioctl(struct inode *inode, s
5346 flags |= EXT2_FLAG_NODUMP; /* EXT2_NODUMP_FL */ 5486 flags |= EXT2_FLAG_NODUMP; /* EXT2_NODUMP_FL */
5347 return put_user(flags, (int __user *)arg); 5487 return put_user(flags, (int __user *)arg);
5348 case HFSPLUS_IOC_EXT2_SETFLAGS: { 5488 case HFSPLUS_IOC_EXT2_SETFLAGS: {
5349- if (IS_RDONLY(inode)) 5489- if (IS_RDONLY(inode))
5350+ if (IS_RDONLY(inode) || 5490+ if (IS_RDONLY(inode) ||
5351+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt))) 5491+ (filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
5352 return -EROFS; 5492 return -EROFS;
5353 5493
5354 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER)) 5494 if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
5355diff -NurpP --minimal linux-2.6.15.6/fs/inode.c linux-2.6.15.6-vs2.1.1-rc13/fs/inode.c 5495Index: linux-2.6.16/fs/inode.c
5356--- linux-2.6.15.6/fs/inode.c 2006-01-03 17:29:56 +0100 5496===================================================================
5357+++ linux-2.6.15.6-vs2.1.1-rc13/fs/inode.c 2006-02-13 05:26:55 +0100 5497--- linux-2.6.16.orig/fs/inode.c
5498+++ linux-2.6.16/fs/inode.c
5358@@ -115,6 +115,9 @@ static struct inode *alloc_inode(struct 5499@@ -116,6 +116,9 @@ static struct inode *alloc_inode(struct
5359 struct address_space * const mapping = &inode->i_data; 5500 struct address_space * const mapping = &inode->i_data;
5360 5501
5361 inode->i_sb = sb; 5502 inode->i_sb = sb;
5362+ 5503+
5363+ /* essential because of inode slab reuse */ 5504+ /* essential because of inode slab reuse */
5364+ inode->i_tag = 0; 5505+ inode->i_tag = 0;
5365 inode->i_blkbits = sb->s_blocksize_bits; 5506 inode->i_blkbits = sb->s_blocksize_bits;
5366 inode->i_flags = 0; 5507 inode->i_flags = 0;
5367 atomic_set(&inode->i_count, 1); 5508 atomic_set(&inode->i_count, 1);
5368@@ -127,6 +130,7 @@ static struct inode *alloc_inode(struct 5509@@ -128,6 +131,7 @@ static struct inode *alloc_inode(struct
5369 inode->i_bytes = 0; 5510 inode->i_bytes = 0;
5370 inode->i_generation = 0; 5511 inode->i_generation = 0;
5371 #ifdef CONFIG_QUOTA 5512 #ifdef CONFIG_QUOTA
5372+ inode->i_dqh = dqhget(sb->s_dqh); 5513+ inode->i_dqh = dqhget(sb->s_dqh);
5373 memset(&inode->i_dquot, 0, sizeof(inode->i_dquot)); 5514 memset(&inode->i_dquot, 0, sizeof(inode->i_dquot));
5374 #endif 5515 #endif
5375 inode->i_pipe = NULL; 5516 inode->i_pipe = NULL;
5376@@ -174,6 +178,8 @@ void destroy_inode(struct inode *inode) 5517@@ -175,6 +179,8 @@ void destroy_inode(struct inode *inode)
5377 if (inode_has_buffers(inode)) 5518 if (inode_has_buffers(inode))
5378 BUG(); 5519 BUG();
5379 security_inode_free(inode); 5520 security_inode_free(inode);
5380+ if (dqhash_valid(inode->i_dqh)) 5521+ if (dqhash_valid(inode->i_dqh))
5381+ dqhput(inode->i_dqh); 5522+ dqhput(inode->i_dqh);
5382 if (inode->i_sb->s_op->destroy_inode) 5523 if (inode->i_sb->s_op->destroy_inode)
5383 inode->i_sb->s_op->destroy_inode(inode); 5524 inode->i_sb->s_op->destroy_inode(inode);
5384 else 5525 else
5385@@ -235,6 +241,8 @@ void __iget(struct inode * inode) 5526@@ -236,6 +242,8 @@ void __iget(struct inode * inode)
5386 inodes_stat.nr_unused--; 5527 inodes_stat.nr_unused--;
5387 } 5528 }
5388 5529
5389+EXPORT_SYMBOL_GPL(__iget); 5530+EXPORT_SYMBOL_GPL(__iget);
5390+ 5531+
5391 /** 5532 /**
5392 * clear_inode - clear an inode 5533 * clear_inode - clear an inode
5393 * @inode: inode to clear 5534 * @inode: inode to clear
5394@@ -1257,12 +1265,13 @@ EXPORT_SYMBOL(inode_needs_sync); 5535@@ -1272,12 +1280,13 @@ EXPORT_SYMBOL(inode_needs_sync);
5395 /* Function back in dquot.c */ 5536 /* Function back in dquot.c */
5396 int remove_inode_dquot_ref(struct inode *, int, struct list_head *); 5537 int remove_inode_dquot_ref(struct inode *, int, struct list_head *);
5397 5538
5398-void remove_dquot_ref(struct super_block *sb, int type, 5539-void remove_dquot_ref(struct super_block *sb, int type,
5399+void remove_dquot_ref(struct dqhash *hash, int type, 5540+void remove_dquot_ref(struct dqhash *hash, int type,
5405- if (!sb->dq_op) 5546- if (!sb->dq_op)
5406+ if (!hash->dqh_qop) 5547+ if (!hash->dqh_qop)
5407 return; /* nothing to do */ 5548 return; /* nothing to do */
5408 spin_lock(&inode_lock); /* This lock is for inodes code */ 5549 spin_lock(&inode_lock); /* This lock is for inodes code */
5409 5550
5410diff -NurpP --minimal linux-2.6.15.6/fs/ioctl.c linux-2.6.15.6-vs2.1.1-rc13/fs/ioctl.c 5551Index: linux-2.6.16/fs/ioctl.c
5411--- linux-2.6.15.6/fs/ioctl.c 2005-03-02 12:38:44 +0100 5552===================================================================
5412+++ linux-2.6.15.6-vs2.1.1-rc13/fs/ioctl.c 2006-02-13 05:26:55 +0100 5553--- linux-2.6.16.orig/fs/ioctl.c
5554+++ linux-2.6.16/fs/ioctl.c
5413@@ -12,10 +12,19 @@ 5555@@ -13,10 +13,19 @@
5414 #include <linux/fs.h> 5556 #include <linux/fs.h>
5415 #include <linux/security.h> 5557 #include <linux/security.h>
5416 #include <linux/module.h> 5558 #include <linux/module.h>
5417+#include <linux/proc_fs.h> 5559+#include <linux/proc_fs.h>
5418+#include <linux/vserver/inode.h> 5560+#include <linux/vserver/inode.h>
5428+#endif 5570+#endif
5429+ 5571+
5430 static long do_ioctl(struct file *filp, unsigned int cmd, 5572 static long do_ioctl(struct file *filp, unsigned int cmd,
5431 unsigned long arg) 5573 unsigned long arg)
5432 { 5574 {
5433@@ -146,6 +155,48 @@ int vfs_ioctl(struct file *filp, unsigne 5575@@ -147,6 +156,48 @@ int vfs_ioctl(struct file *filp, unsigne
5434 else 5576 else
5435 error = -ENOTTY; 5577 error = -ENOTTY;
5436 break; 5578 break;
5437+#ifdef CONFIG_VSERVER_LEGACY 5579+#ifdef CONFIG_VSERVER_LEGACY
5438+#ifndef CONFIG_TAGGING_NONE 5580+#ifndef CONFIG_TAGGING_NONE
5477+ break; 5619+ break;
5478+#endif 5620+#endif
5479 default: 5621 default:
5480 if (S_ISREG(filp->f_dentry->d_inode->i_mode)) 5622 if (S_ISREG(filp->f_dentry->d_inode->i_mode))
5481 error = file_ioctl(filp, cmd, arg); 5623 error = file_ioctl(filp, cmd, arg);
5482diff -NurpP --minimal linux-2.6.15.6/fs/ioprio.c linux-2.6.15.6-vs2.1.1-rc13/fs/ioprio.c 5624Index: linux-2.6.16/fs/ioprio.c
5483--- linux-2.6.15.6/fs/ioprio.c 2006-01-03 17:29:56 +0100 5625===================================================================
5484+++ linux-2.6.15.6-vs2.1.1-rc13/fs/ioprio.c 2006-02-13 16:25:38 +0100 5626--- linux-2.6.16.orig/fs/ioprio.c
5627+++ linux-2.6.16/fs/ioprio.c
5485@@ -23,6 +23,7 @@ 5628@@ -24,6 +24,7 @@
5486 #include <linux/ioprio.h>
5487 #include <linux/blkdev.h> 5629 #include <linux/blkdev.h>
5630 #include <linux/capability.h>
5488 #include <linux/syscalls.h> 5631 #include <linux/syscalls.h>
5489+#include <linux/vs_pid.h> 5632+#include <linux/vs_pid.h>
5490 5633
5491 static int set_task_ioprio(struct task_struct *task, int ioprio) 5634 static int set_task_ioprio(struct task_struct *task, int ioprio)
5492 { 5635 {
5493@@ -94,7 +95,7 @@ asmlinkage long sys_ioprio_set(int which 5636@@ -95,7 +96,7 @@ asmlinkage long sys_ioprio_set(int which
5494 if (!who) 5637 if (!who)
5495 user = current->user; 5638 user = current->user;
5496 else 5639 else
5497- user = find_user(who); 5640- user = find_user(who);
5498+ user = find_user(who, vx_current_xid()); 5641+ user = find_user(who, vx_current_xid());
5499 5642
5500 if (!user) 5643 if (!user)
5501 break; 5644 break;
5502@@ -148,7 +149,7 @@ asmlinkage long sys_ioprio_get(int which 5645@@ -149,7 +150,7 @@ asmlinkage long sys_ioprio_get(int which
5503 if (!who) 5646 if (!who)
5504 user = current->user; 5647 user = current->user;
5505 else 5648 else
5506- user = find_user(who); 5649- user = find_user(who);
5507+ user = find_user(who, vx_current_xid()); 5650+ user = find_user(who, vx_current_xid());
5508 5651
5509 if (!user) 5652 if (!user)
5510 break; 5653 break;
5511diff -NurpP --minimal linux-2.6.15.6/fs/jfs/Makefile linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/Makefile 5654Index: linux-2.6.16/fs/jfs/Makefile
5512--- linux-2.6.15.6/fs/jfs/Makefile 2004-08-14 12:56:09 +0200 5655===================================================================
5513+++ linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/Makefile 2006-02-12 14:06:50 +0100 5656--- linux-2.6.16.orig/fs/jfs/Makefile
5657+++ linux-2.6.16/fs/jfs/Makefile
5514@@ -8,7 +8,8 @@ jfs-y := super.o file.o inode.o namei 5658@@ -8,7 +8,8 @@ jfs-y := super.o file.o inode.o namei
5515 jfs_xtree.o jfs_imap.o jfs_debug.o jfs_dmap.o \ 5659 jfs_xtree.o jfs_imap.o jfs_debug.o jfs_dmap.o \
5516 jfs_unicode.o jfs_dtree.o jfs_inode.o \ 5660 jfs_unicode.o jfs_dtree.o jfs_inode.o \
5517 jfs_extent.o symlink.o jfs_metapage.o \ 5661 jfs_extent.o symlink.o jfs_metapage.o \
5518- jfs_logmgr.o jfs_txnmgr.o jfs_uniupr.o resize.o xattr.o 5662- jfs_logmgr.o jfs_txnmgr.o jfs_uniupr.o resize.o xattr.o
5519+ jfs_logmgr.o jfs_txnmgr.o jfs_uniupr.o \ 5663+ jfs_logmgr.o jfs_txnmgr.o jfs_uniupr.o \
5520+ resize.o xattr.o ioctl.o 5664+ resize.o xattr.o ioctl.o
5521 5665
5522 jfs-$(CONFIG_JFS_POSIX_ACL) += acl.o 5666 jfs-$(CONFIG_JFS_POSIX_ACL) += acl.o
5523 5667
5524diff -NurpP --minimal linux-2.6.15.6/fs/jfs/acl.c linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/acl.c 5668Index: linux-2.6.16/fs/jfs/acl.c
5525--- linux-2.6.15.6/fs/jfs/acl.c 2005-10-28 20:49:44 +0200 5669===================================================================
5526+++ linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/acl.c 2006-02-13 05:26:55 +0100 5670--- linux-2.6.16.orig/fs/jfs/acl.c
5671+++ linux-2.6.16/fs/jfs/acl.c
5527@@ -229,7 +229,8 @@ int jfs_setattr(struct dentry *dentry, s 5672@@ -229,7 +229,8 @@ int jfs_setattr(struct dentry *dentry, s
5528 return rc; 5673 return rc;
5529 5674
5530 if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) || 5675 if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
5531- (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) { 5676- (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
5532+ (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid) || 5677+ (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid) ||
5533+ (iattr->ia_valid & ATTR_TAG && iattr->ia_tag != inode->i_tag)) { 5678+ (iattr->ia_valid & ATTR_TAG && iattr->ia_tag != inode->i_tag)) {
5534 if (DQUOT_TRANSFER(inode, iattr)) 5679 if (DQUOT_TRANSFER(inode, iattr))
5535 return -EDQUOT; 5680 return -EDQUOT;
5536 } 5681 }
5537diff -NurpP --minimal linux-2.6.15.6/fs/jfs/file.c linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/file.c 5682Index: linux-2.6.16/fs/jfs/file.c
5538--- linux-2.6.15.6/fs/jfs/file.c 2005-08-29 22:25:31 +0200 5683===================================================================
5539+++ linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/file.c 2006-02-12 14:06:50 +0100 5684--- linux-2.6.16.orig/fs/jfs/file.c
5685+++ linux-2.6.16/fs/jfs/file.c
5540@@ -98,6 +98,7 @@ struct inode_operations jfs_file_inode_o 5686@@ -98,6 +98,7 @@ struct inode_operations jfs_file_inode_o
5541 .setattr = jfs_setattr, 5687 .setattr = jfs_setattr,
5542 .permission = jfs_permission, 5688 .permission = jfs_permission,
5543 #endif 5689 #endif
5544+ .sync_flags = jfs_sync_flags, 5690+ .sync_flags = jfs_sync_flags,
5552+ .sendpage = generic_file_sendpage, 5698+ .sendpage = generic_file_sendpage,
5553 .fsync = jfs_fsync, 5699 .fsync = jfs_fsync,
5554 .release = jfs_release, 5700 .release = jfs_release,
5555+ .ioctl = jfs_ioctl, 5701+ .ioctl = jfs_ioctl,
5556 }; 5702 };
5557diff -NurpP --minimal linux-2.6.15.6/fs/jfs/inode.c linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/inode.c 5703Index: linux-2.6.16/fs/jfs/inode.c
5558--- linux-2.6.15.6/fs/jfs/inode.c 2005-10-28 20:49:44 +0200 5704===================================================================
5559+++ linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/inode.c 2006-02-12 14:06:50 +0100 5705--- linux-2.6.16.orig/fs/jfs/inode.c
5706+++ linux-2.6.16/fs/jfs/inode.c
5560@@ -22,6 +22,7 @@ 5707@@ -22,6 +22,7 @@
5561 #include <linux/buffer_head.h> 5708 #include <linux/buffer_head.h>
5562 #include <linux/pagemap.h> 5709 #include <linux/pagemap.h>
5563 #include <linux/quotaops.h> 5710 #include <linux/quotaops.h>
5564+#include <linux/vs_dlimit.h> 5711+#include <linux/vs_dlimit.h>
5579 DQUOT_DROP(inode); 5726 DQUOT_DROP(inode);
5580+ DLIMIT_FREE_INODE(inode); 5727+ DLIMIT_FREE_INODE(inode);
5581 } 5728 }
5582 5729
5583 clear_inode(inode); 5730 clear_inode(inode);
5584diff -NurpP --minimal linux-2.6.15.6/fs/jfs/ioctl.c linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/ioctl.c 5731Index: linux-2.6.16/fs/jfs/ioctl.c
5585--- linux-2.6.15.6/fs/jfs/ioctl.c 1970-01-01 01:00:00 +0100 5732===================================================================
5586+++ linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/ioctl.c 2006-02-14 12:35:23 +0100 5733--- /dev/null
5734+++ linux-2.6.16/fs/jfs/ioctl.c
5587@@ -0,0 +1,110 @@ 5735@@ -0,0 +1,111 @@
5588+/* 5736+/*
5589+ * linux/fs/jfs/ioctl.c 5737+ * linux/fs/jfs/ioctl.c
5590+ * 5738+ *
5591+ * Copyright (C) 2006 Herbert Poetzl 5739+ * Copyright (C) 2006 Herbert Poetzl
5592+ * adapted from Remy Card's ext2/ioctl.c 5740+ * adapted from Remy Card's ext2/ioctl.c
5595+#include <linux/fs.h> 5743+#include <linux/fs.h>
5596+#include <linux/ext2_fs.h> 5744+#include <linux/ext2_fs.h>
5597+#include <linux/ctype.h> 5745+#include <linux/ctype.h>
5598+#include <linux/capability.h> 5746+#include <linux/capability.h>
5599+#include <linux/time.h> 5747+#include <linux/time.h>
5748+#include <linux/mount.h>
5600+#include <asm/current.h> 5749+#include <asm/current.h>
5601+#include <asm/uaccess.h> 5750+#include <asm/uaccess.h>
5602+ 5751+
5603+#include "jfs_incore.h" 5752+#include "jfs_incore.h"
5604+#include "jfs_dinode.h" 5753+#include "jfs_dinode.h"
5693+ default: 5842+ default:
5694+ return -ENOTTY; 5843+ return -ENOTTY;
5695+ } 5844+ }
5696+} 5845+}
5697+ 5846+
5698diff -NurpP --minimal linux-2.6.15.6/fs/jfs/jfs_dinode.h linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/jfs_dinode.h 5847Index: linux-2.6.16/fs/jfs/jfs_dinode.h
5699--- linux-2.6.15.6/fs/jfs/jfs_dinode.h 2004-12-25 01:55:20 +0100 5848===================================================================
5700+++ linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/jfs_dinode.h 2006-02-12 14:06:50 +0100 5849--- linux-2.6.16.orig/fs/jfs/jfs_dinode.h
5850+++ linux-2.6.16/fs/jfs/jfs_dinode.h
5701@@ -139,13 +139,39 @@ struct dinode { 5851@@ -139,13 +139,39 @@ struct dinode {
5702 5852
5703 /* more extended mode bits: attributes for OS/2 */ 5853 /* more extended mode bits: attributes for OS/2 */
5704 #define IREADONLY 0x02000000 /* no write access to file */ 5854 #define IREADONLY 0x02000000 /* no write access to file */
5705-#define IARCHIVE 0x40000000 /* file archive bit */ 5855-#define IARCHIVE 0x40000000 /* file archive bit */
5740+#define JFS_IOC_GETFLAGS _IOR('f', 1, long) 5890+#define JFS_IOC_GETFLAGS _IOR('f', 1, long)
5741+#define JFS_IOC_SETFLAGS _IOW('f', 2, long) 5891+#define JFS_IOC_SETFLAGS _IOW('f', 2, long)
5742+ 5892+
5743+ 5893+
5744 #endif /*_H_JFS_DINODE */ 5894 #endif /*_H_JFS_DINODE */
5745diff -NurpP --minimal linux-2.6.15.6/fs/jfs/jfs_dtree.c linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/jfs_dtree.c 5895Index: linux-2.6.16/fs/jfs/jfs_dtree.c
5746--- linux-2.6.15.6/fs/jfs/jfs_dtree.c 2005-08-29 22:25:31 +0200 5896===================================================================
5747+++ linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/jfs_dtree.c 2006-01-04 21:59:59 +0100 5897--- linux-2.6.16.orig/fs/jfs/jfs_dtree.c
5898+++ linux-2.6.16/fs/jfs/jfs_dtree.c
5748@@ -102,6 +102,7 @@ 5899@@ -102,6 +102,7 @@
5749 5900
5750 #include <linux/fs.h> 5901 #include <linux/fs.h>
5751 #include <linux/quotaops.h> 5902 #include <linux/quotaops.h>
5752+#include <linux/vs_dlimit.h> 5903+#include <linux/vs_dlimit.h>
5864+ /* Free dlimit allocation */ 6015+ /* Free dlimit allocation */
5865+ DLIMIT_FREE_BLOCK(ip, xlen); 6016+ DLIMIT_FREE_BLOCK(ip, xlen);
5866 /* Free quota allocation */ 6017 /* Free quota allocation */
5867 DQUOT_FREE_BLOCK(ip, xlen); 6018 DQUOT_FREE_BLOCK(ip, xlen);
5868 6019
5869diff -NurpP --minimal linux-2.6.15.6/fs/jfs/jfs_extent.c linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/jfs_extent.c 6020Index: linux-2.6.16/fs/jfs/jfs_extent.c
5870--- linux-2.6.15.6/fs/jfs/jfs_extent.c 2005-08-29 22:25:32 +0200 6021===================================================================
5871+++ linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/jfs_extent.c 2006-01-04 21:59:59 +0100 6022--- linux-2.6.16.orig/fs/jfs/jfs_extent.c
6023+++ linux-2.6.16/fs/jfs/jfs_extent.c
5872@@ -18,6 +18,7 @@ 6024@@ -18,6 +18,7 @@
5873 6025
5874 #include <linux/fs.h> 6026 #include <linux/fs.h>
5875 #include <linux/quotaops.h> 6027 #include <linux/quotaops.h>
5876+#include <linux/vs_dlimit.h> 6028+#include <linux/vs_dlimit.h>
5927 dbFree(ip, nxaddr, nxlen); 6079 dbFree(ip, nxaddr, nxlen);
5928+ DLIMIT_FREE_BLOCK(ip, nxlen); 6080+ DLIMIT_FREE_BLOCK(ip, nxlen);
5929 DQUOT_FREE_BLOCK(ip, nxlen); 6081 DQUOT_FREE_BLOCK(ip, nxlen);
5930 goto exit; 6082 goto exit;
5931 } 6083 }
5932diff -NurpP --minimal linux-2.6.15.6/fs/jfs/jfs_filsys.h linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/jfs_filsys.h 6084Index: linux-2.6.16/fs/jfs/jfs_filsys.h
5933--- linux-2.6.15.6/fs/jfs/jfs_filsys.h 2005-10-28 20:49:44 +0200 6085===================================================================
5934+++ linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/jfs_filsys.h 2006-02-13 05:26:55 +0100 6086--- linux-2.6.16.orig/fs/jfs/jfs_filsys.h
6087+++ linux-2.6.16/fs/jfs/jfs_filsys.h
5935@@ -84,6 +84,7 @@ 6088@@ -84,6 +84,7 @@
5936 #define JFS_DIR_INDEX 0x00200000 /* Persistant index for */ 6089 #define JFS_DIR_INDEX 0x00200000 /* Persistant index for */
5937 /* directory entries */ 6090 /* directory entries */
5938 6091
5939+#define JFS_TAGGED 0x00800000 /* Context Tagging */ 6092+#define JFS_TAGGED 0x00800000 /* Context Tagging */
5940 6093
5941 /* 6094 /*
5942 * buffer cache configuration 6095 * buffer cache configuration
5943diff -NurpP --minimal linux-2.6.15.6/fs/jfs/jfs_imap.c linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/jfs_imap.c 6096Index: linux-2.6.16/fs/jfs/jfs_imap.c
5944--- linux-2.6.15.6/fs/jfs/jfs_imap.c 2006-01-03 17:29:57 +0100 6097===================================================================
5945+++ linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/jfs_imap.c 2006-02-13 05:26:55 +0100 6098--- linux-2.6.16.orig/fs/jfs/jfs_imap.c
6099+++ linux-2.6.16/fs/jfs/jfs_imap.c
5946@@ -45,6 +45,7 @@ 6100@@ -45,6 +45,7 @@
5947 #include <linux/buffer_head.h> 6101 #include <linux/buffer_head.h>
5948 #include <linux/pagemap.h> 6102 #include <linux/pagemap.h>
5949 #include <linux/quotaops.h> 6103 #include <linux/quotaops.h>
5950+#include <linux/vserver/tag.h> 6104+#include <linux/vserver/tag.h>
5951 6105
5952 #include "jfs_incore.h" 6106 #include "jfs_incore.h"
5953 #include "jfs_inode.h" 6107 #include "jfs_inode.h"
5954@@ -3078,14 +3079,21 @@ static void duplicateIXtree(struct super 6108@@ -3074,14 +3075,21 @@ static void duplicateIXtree(struct super
5955 static int copy_from_dinode(struct dinode * dip, struct inode *ip) 6109 static int copy_from_dinode(struct dinode * dip, struct inode *ip)
5956 { 6110 {
5957 struct jfs_inode_info *jfs_ip = JFS_IP(ip); 6111 struct jfs_inode_info *jfs_ip = JFS_IP(ip);
5958+ uid_t uid; 6112+ uid_t uid;
5959+ gid_t gid; 6113+ gid_t gid;
5973+ ip->i_tag = INOTAG_TAG(DX_TAG(ip), uid, gid, 0); 6127+ ip->i_tag = INOTAG_TAG(DX_TAG(ip), uid, gid, 0);
5974+ 6128+
5975 ip->i_size = le64_to_cpu(dip->di_size); 6129 ip->i_size = le64_to_cpu(dip->di_size);
5976 ip->i_atime.tv_sec = le32_to_cpu(dip->di_atime.tv_sec); 6130 ip->i_atime.tv_sec = le32_to_cpu(dip->di_atime.tv_sec);
5977 ip->i_atime.tv_nsec = le32_to_cpu(dip->di_atime.tv_nsec); 6131 ip->i_atime.tv_nsec = le32_to_cpu(dip->di_atime.tv_nsec);
5978@@ -3136,6 +3144,8 @@ static int copy_from_dinode(struct dinod 6132@@ -3132,6 +3140,8 @@ static int copy_from_dinode(struct dinod
5979 static void copy_to_dinode(struct dinode * dip, struct inode *ip) 6133 static void copy_to_dinode(struct dinode * dip, struct inode *ip)
5980 { 6134 {
5981 struct jfs_inode_info *jfs_ip = JFS_IP(ip); 6135 struct jfs_inode_info *jfs_ip = JFS_IP(ip);
5982+ uid_t uid; 6136+ uid_t uid;
5983+ gid_t gid; 6137+ gid_t gid;
5984 6138
5985 dip->di_fileset = cpu_to_le32(jfs_ip->fileset); 6139 dip->di_fileset = cpu_to_le32(jfs_ip->fileset);
5986 dip->di_inostamp = cpu_to_le32(JFS_SBI(ip->i_sb)->inostamp); 6140 dip->di_inostamp = cpu_to_le32(JFS_SBI(ip->i_sb)->inostamp);
5987@@ -3144,8 +3154,11 @@ static void copy_to_dinode(struct dinode 6141@@ -3140,8 +3150,11 @@ static void copy_to_dinode(struct dinode
5988 dip->di_size = cpu_to_le64(ip->i_size); 6142 dip->di_size = cpu_to_le64(ip->i_size);
5989 dip->di_nblocks = cpu_to_le64(PBLK2LBLK(ip->i_sb, ip->i_blocks)); 6143 dip->di_nblocks = cpu_to_le64(PBLK2LBLK(ip->i_sb, ip->i_blocks));
5990 dip->di_nlink = cpu_to_le32(ip->i_nlink); 6144 dip->di_nlink = cpu_to_le32(ip->i_nlink);
5991- dip->di_uid = cpu_to_le32(ip->i_uid); 6145- dip->di_uid = cpu_to_le32(ip->i_uid);
5992- dip->di_gid = cpu_to_le32(ip->i_gid); 6146- dip->di_gid = cpu_to_le32(ip->i_gid);
5996+ dip->di_uid = cpu_to_le32(uid); 6150+ dip->di_uid = cpu_to_le32(uid);
5997+ dip->di_gid = cpu_to_le32(gid); 6151+ dip->di_gid = cpu_to_le32(gid);
5998 /* 6152 /*
5999 * mode2 is only needed for storing the higher order bits. 6153 * mode2 is only needed for storing the higher order bits.
6000 * Trust i_mode for the lower order ones 6154 * Trust i_mode for the lower order ones
6001diff -NurpP --minimal linux-2.6.15.6/fs/jfs/jfs_inode.c linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/jfs_inode.c 6155Index: linux-2.6.16/fs/jfs/jfs_inode.c
6002--- linux-2.6.15.6/fs/jfs/jfs_inode.c 2005-08-29 22:25:32 +0200 6156===================================================================
6003+++ linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/jfs_inode.c 2006-02-13 05:26:55 +0100 6157--- linux-2.6.16.orig/fs/jfs/jfs_inode.c
6158+++ linux-2.6.16/fs/jfs/jfs_inode.c
6004@@ -18,6 +18,8 @@ 6159@@ -18,6 +18,8 @@
6005 6160
6006 #include <linux/fs.h> 6161 #include <linux/fs.h>
6007 #include <linux/quotaops.h> 6162 #include <linux/quotaops.h>
6008+#include <linux/vs_dlimit.h> 6163+#include <linux/vs_dlimit.h>
6125 jfs_inode->xtlid = 0; 6280 jfs_inode->xtlid = 0;
6126+ jfs_set_inode_flags(inode); 6281+ jfs_set_inode_flags(inode);
6127 6282
6128 jfs_info("ialloc returns inode = 0x%p\n", inode); 6283 jfs_info("ialloc returns inode = 0x%p\n", inode);
6129 6284
6130diff -NurpP --minimal linux-2.6.15.6/fs/jfs/jfs_inode.h linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/jfs_inode.h 6285Index: linux-2.6.16/fs/jfs/jfs_inode.h
6131--- linux-2.6.15.6/fs/jfs/jfs_inode.h 2005-08-29 22:25:32 +0200 6286===================================================================
6132+++ linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/jfs_inode.h 2006-02-12 14:06:50 +0100 6287--- linux-2.6.16.orig/fs/jfs/jfs_inode.h
6288+++ linux-2.6.16/fs/jfs/jfs_inode.h
6133@@ -20,6 +20,8 @@ 6289@@ -20,6 +20,8 @@
6134 6290
6135 extern struct inode *ialloc(struct inode *, umode_t); 6291 extern struct inode *ialloc(struct inode *, umode_t);
6136 extern int jfs_fsync(struct file *, struct dentry *, int); 6292 extern int jfs_fsync(struct file *, struct dentry *, int);
6137+extern int jfs_ioctl(struct inode *, struct file *, 6293+extern int jfs_ioctl(struct inode *, struct file *,
6146+extern int jfs_sync_flags(struct inode *); 6302+extern int jfs_sync_flags(struct inode *);
6147+extern void jfs_set_inode_flags(struct inode *); 6303+extern void jfs_set_inode_flags(struct inode *);
6148 6304
6149 extern struct address_space_operations jfs_aops; 6305 extern struct address_space_operations jfs_aops;
6150 extern struct inode_operations jfs_dir_inode_operations; 6306 extern struct inode_operations jfs_dir_inode_operations;
6151diff -NurpP --minimal linux-2.6.15.6/fs/jfs/jfs_xtree.c linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/jfs_xtree.c 6307Index: linux-2.6.16/fs/jfs/jfs_xtree.c
6152--- linux-2.6.15.6/fs/jfs/jfs_xtree.c 2006-01-03 17:29:57 +0100 6308===================================================================
6153+++ linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/jfs_xtree.c 2006-01-04 21:59:59 +0100 6309--- linux-2.6.16.orig/fs/jfs/jfs_xtree.c
6310+++ linux-2.6.16/fs/jfs/jfs_xtree.c
6154@@ -21,6 +21,7 @@ 6311@@ -21,6 +21,7 @@
6155 6312
6156 #include <linux/fs.h> 6313 #include <linux/fs.h>
6157 #include <linux/quotaops.h> 6314 #include <linux/quotaops.h>
6158+#include <linux/vs_dlimit.h> 6315+#include <linux/vs_dlimit.h>
6240+ /* update dlimit allocation to reflect freed blocks */ 6397+ /* update dlimit allocation to reflect freed blocks */
6241+ DLIMIT_FREE_BLOCK(ip, nfreed); 6398+ DLIMIT_FREE_BLOCK(ip, nfreed);
6242 /* update quota allocation to reflect freed blocks */ 6399 /* update quota allocation to reflect freed blocks */
6243 DQUOT_FREE_BLOCK(ip, nfreed); 6400 DQUOT_FREE_BLOCK(ip, nfreed);
6244 6401
6245diff -NurpP --minimal linux-2.6.15.6/fs/jfs/namei.c linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/namei.c 6402Index: linux-2.6.16/fs/jfs/namei.c
6246--- linux-2.6.15.6/fs/jfs/namei.c 2006-01-03 17:29:57 +0100 6403===================================================================
6247+++ linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/namei.c 2006-02-13 05:26:55 +0100 6404--- linux-2.6.16.orig/fs/jfs/namei.c
6405+++ linux-2.6.16/fs/jfs/namei.c
6248@@ -20,6 +20,7 @@ 6406@@ -20,6 +20,7 @@
6249 #include <linux/fs.h> 6407 #include <linux/fs.h>
6250 #include <linux/ctype.h> 6408 #include <linux/ctype.h>
6251 #include <linux/quotaops.h> 6409 #include <linux/quotaops.h>
6252+#include <linux/vserver/tag.h> 6410+#include <linux/vserver/tag.h>
6274 .fsync = jfs_fsync, 6432 .fsync = jfs_fsync,
6275+ .ioctl = jfs_ioctl, 6433+ .ioctl = jfs_ioctl,
6276 }; 6434 };
6277 6435
6278 static int jfs_ci_hash(struct dentry *dir, struct qstr *this) 6436 static int jfs_ci_hash(struct dentry *dir, struct qstr *this)
6279diff -NurpP --minimal linux-2.6.15.6/fs/jfs/super.c linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/super.c 6437Index: linux-2.6.16/fs/jfs/super.c
6280--- linux-2.6.15.6/fs/jfs/super.c 2006-01-03 17:29:57 +0100 6438===================================================================
6281+++ linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/super.c 2006-02-13 05:26:55 +0100 6439--- linux-2.6.16.orig/fs/jfs/super.c
6440+++ linux-2.6.16/fs/jfs/super.c
6282@@ -195,7 +195,7 @@ static void jfs_put_super(struct super_b 6441@@ -195,7 +195,7 @@ static void jfs_put_super(struct super_b
6283 enum { 6442 enum {
6284 Opt_integrity, Opt_nointegrity, Opt_iocharset, Opt_resize, 6443 Opt_integrity, Opt_nointegrity, Opt_iocharset, Opt_resize,
6285 Opt_resize_nosize, Opt_errors, Opt_ignore, Opt_err, Opt_quota, 6444 Opt_resize_nosize, Opt_errors, Opt_ignore, Opt_err, Opt_quota,
6286- Opt_usrquota, Opt_grpquota 6445- Opt_usrquota, Opt_grpquota
6342+ if (sbi->flag & JFS_TAGGED) 6501+ if (sbi->flag & JFS_TAGGED)
6343+ sb->s_flags |= MS_TAGGED; 6502+ sb->s_flags |= MS_TAGGED;
6344 6503
6345 if (newLVSize) { 6504 if (newLVSize) {
6346 printk(KERN_ERR "resize option for remount only\n"); 6505 printk(KERN_ERR "resize option for remount only\n");
6347diff -NurpP --minimal linux-2.6.15.6/fs/jfs/xattr.c linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/xattr.c 6506Index: linux-2.6.16/fs/jfs/xattr.c
6348--- linux-2.6.15.6/fs/jfs/xattr.c 2005-10-28 20:49:44 +0200 6507===================================================================
6349+++ linux-2.6.15.6-vs2.1.1-rc13/fs/jfs/xattr.c 2006-01-04 21:59:59 +0100 6508--- linux-2.6.16.orig/fs/jfs/xattr.c
6509+++ linux-2.6.16/fs/jfs/xattr.c
6350@@ -22,6 +22,7 @@ 6510@@ -23,6 +23,7 @@
6351 #include <linux/posix_acl_xattr.h> 6511 #include <linux/posix_acl_xattr.h>
6352 #include <linux/quotaops.h> 6512 #include <linux/quotaops.h>
6353 #include <linux/security.h> 6513 #include <linux/security.h>
6354+#include <linux/vs_dlimit.h> 6514+#include <linux/vs_dlimit.h>
6355 #include "jfs_incore.h" 6515 #include "jfs_incore.h"
6356 #include "jfs_superblock.h" 6516 #include "jfs_superblock.h"
6357 #include "jfs_dmap.h" 6517 #include "jfs_dmap.h"
6358@@ -277,9 +278,16 @@ static int ea_write(struct inode *ip, st 6518@@ -263,9 +264,16 @@ static int ea_write(struct inode *ip, st
6359 if (DQUOT_ALLOC_BLOCK(ip, nblocks)) { 6519 if (DQUOT_ALLOC_BLOCK(ip, nblocks)) {
6360 return -EDQUOT; 6520 return -EDQUOT;
6361 } 6521 }
6362+ /* Allocate new blocks to dlimit. */ 6522+ /* Allocate new blocks to dlimit. */
6363+ if (DLIMIT_ALLOC_BLOCK(ip, nblocks)) { 6523+ if (DLIMIT_ALLOC_BLOCK(ip, nblocks)) {
6370+ /*Rollback dlimit allocation. */ 6530+ /*Rollback dlimit allocation. */
6371+ DLIMIT_FREE_BLOCK(ip, nblocks); 6531+ DLIMIT_FREE_BLOCK(ip, nblocks);
6372 /*Rollback quota allocation. */ 6532 /*Rollback quota allocation. */
6373 DQUOT_FREE_BLOCK(ip, nblocks); 6533 DQUOT_FREE_BLOCK(ip, nblocks);
6374 return rc; 6534 return rc;
6375@@ -346,6 +354,8 @@ static int ea_write(struct inode *ip, st 6535@@ -332,6 +340,8 @@ static int ea_write(struct inode *ip, st
6376 6536
6377 failed: 6537 failed:
6378 /* Rollback quota allocation. */ 6538 /* Rollback quota allocation. */
6379+ DLIMIT_FREE_BLOCK(ip, nblocks); 6539+ DLIMIT_FREE_BLOCK(ip, nblocks);
6380+ /* Rollback quota allocation. */ 6540+ /* Rollback quota allocation. */
6381 DQUOT_FREE_BLOCK(ip, nblocks); 6541 DQUOT_FREE_BLOCK(ip, nblocks);
6382 6542
6383 dbFree(ip, blkno, nblocks); 6543 dbFree(ip, blkno, nblocks);
6384@@ -482,6 +492,7 @@ static int ea_get(struct inode *inode, s 6544@@ -468,6 +478,7 @@ static int ea_get(struct inode *inode, s
6385 s64 blkno; 6545 s64 blkno;
6386 int rc; 6546 int rc;
6387 int quota_allocation = 0; 6547 int quota_allocation = 0;
6388+ int dlimit_allocation = 0; 6548+ int dlimit_allocation = 0;
6389 6549
6390 /* When fsck.jfs clears a bad ea, it doesn't clear the size */ 6550 /* When fsck.jfs clears a bad ea, it doesn't clear the size */
6391 if (ji->ea.flag == 0) 6551 if (ji->ea.flag == 0)
6392@@ -557,6 +568,12 @@ static int ea_get(struct inode *inode, s 6552@@ -543,6 +554,12 @@ static int ea_get(struct inode *inode, s
6393 6553
6394 quota_allocation = blocks_needed; 6554 quota_allocation = blocks_needed;
6395 6555
6396+ /* Allocate new blocks to dlimit. */ 6556+ /* Allocate new blocks to dlimit. */
6397+ rc = -ENOSPC; 6557+ rc = -ENOSPC;
6400+ dlimit_allocation = blocks_needed; 6560+ dlimit_allocation = blocks_needed;
6401+ 6561+
6402 rc = dbAlloc(inode, INOHINT(inode), (s64) blocks_needed, 6562 rc = dbAlloc(inode, INOHINT(inode), (s64) blocks_needed,
6403 &blkno); 6563 &blkno);
6404 if (rc) 6564 if (rc)
6405@@ -613,6 +630,9 @@ static int ea_get(struct inode *inode, s 6565@@ -599,6 +616,9 @@ static int ea_get(struct inode *inode, s
6406 return ea_size; 6566 return ea_size;
6407 6567
6408 clean_up: 6568 clean_up:
6409+ /* Rollback dlimit allocation */ 6569+ /* Rollback dlimit allocation */
6410+ if (dlimit_allocation) 6570+ if (dlimit_allocation)
6411+ DLIMIT_FREE_BLOCK(inode, dlimit_allocation); 6571+ DLIMIT_FREE_BLOCK(inode, dlimit_allocation);
6412 /* Rollback quota allocation */ 6572 /* Rollback quota allocation */
6413 if (quota_allocation) 6573 if (quota_allocation)
6414 DQUOT_FREE_BLOCK(inode, quota_allocation); 6574 DQUOT_FREE_BLOCK(inode, quota_allocation);
6415@@ -689,8 +709,10 @@ static int ea_put(tid_t tid, struct inod 6575@@ -675,8 +695,10 @@ static int ea_put(tid_t tid, struct inod
6416 } 6576 }
6417 6577
6418 /* If old blocks exist, they must be removed from quota allocation. */ 6578 /* If old blocks exist, they must be removed from quota allocation. */
6419- if (old_blocks) 6579- if (old_blocks)
6420+ if (old_blocks) { 6580+ if (old_blocks) {
6422 DQUOT_FREE_BLOCK(inode, old_blocks); 6582 DQUOT_FREE_BLOCK(inode, old_blocks);
6423+ } 6583+ }
6424 6584
6425 inode->i_ctime = CURRENT_TIME; 6585 inode->i_ctime = CURRENT_TIME;
6426 6586
6427diff -NurpP --minimal linux-2.6.15.6/fs/libfs.c linux-2.6.15.6-vs2.1.1-rc13/fs/libfs.c 6587Index: linux-2.6.16/fs/libfs.c
6428--- linux-2.6.15.6/fs/libfs.c 2005-08-29 22:25:32 +0200 6588===================================================================
6429+++ linux-2.6.15.6-vs2.1.1-rc13/fs/libfs.c 2006-01-04 21:59:59 +0100 6589--- linux-2.6.16.orig/fs/libfs.c
6590+++ linux-2.6.16/fs/libfs.c
6430@@ -122,7 +122,8 @@ static inline unsigned char dt_type(stru 6591@@ -122,7 +122,8 @@ static inline unsigned char dt_type(stru
6431 * both impossible due to the lock on directory. 6592 * both impossible due to the lock on directory.
6432 */ 6593 */
6433 6594
6434-int dcache_readdir(struct file * filp, void * dirent, filldir_t filldir) 6595-int dcache_readdir(struct file * filp, void * dirent, filldir_t filldir)
6436+ void * dirent, filldir_t filldir, int (*filter)(struct dentry *dentry)) 6597+ void * dirent, filldir_t filldir, int (*filter)(struct dentry *dentry))
6437 { 6598 {
6438 struct dentry *dentry = filp->f_dentry; 6599 struct dentry *dentry = filp->f_dentry;
6439 struct dentry *cursor = filp->private_data; 6600 struct dentry *cursor = filp->private_data;
6440@@ -156,6 +157,8 @@ int dcache_readdir(struct file * filp, v 6601@@ -156,6 +157,8 @@ int dcache_readdir(struct file * filp, v
6441 next = list_entry(p, struct dentry, d_child); 6602 next = list_entry(p, struct dentry, d_u.d_child);
6442 if (d_unhashed(next) || !next->d_inode) 6603 if (d_unhashed(next) || !next->d_inode)
6443 continue; 6604 continue;
6444+ if (filter && !filter(next)) 6605+ if (filter && !filter(next))
6445+ continue; 6606+ continue;
6446 6607
6463+ 6624+
6464+ 6625+
6465 ssize_t generic_read_dir(struct file *filp, char __user *buf, size_t siz, loff_t *ppos) 6626 ssize_t generic_read_dir(struct file *filp, char __user *buf, size_t siz, loff_t *ppos)
6466 { 6627 {
6467 return -EISDIR; 6628 return -EISDIR;
6468@@ -620,6 +635,7 @@ EXPORT_SYMBOL(dcache_dir_close); 6629@@ -621,6 +636,7 @@ EXPORT_SYMBOL(dcache_dir_close);
6469 EXPORT_SYMBOL(dcache_dir_lseek); 6630 EXPORT_SYMBOL(dcache_dir_lseek);
6470 EXPORT_SYMBOL(dcache_dir_open); 6631 EXPORT_SYMBOL(dcache_dir_open);
6471 EXPORT_SYMBOL(dcache_readdir); 6632 EXPORT_SYMBOL(dcache_readdir);
6472+EXPORT_SYMBOL(dcache_readdir_filter); 6633+EXPORT_SYMBOL(dcache_readdir_filter);
6473 EXPORT_SYMBOL(generic_read_dir); 6634 EXPORT_SYMBOL(generic_read_dir);
6474 EXPORT_SYMBOL(get_sb_pseudo); 6635 EXPORT_SYMBOL(get_sb_pseudo);
6475 EXPORT_SYMBOL(simple_commit_write); 6636 EXPORT_SYMBOL(simple_commit_write);
6476diff -NurpP --minimal linux-2.6.15.6/fs/locks.c linux-2.6.15.6-vs2.1.1-rc13/fs/locks.c 6637Index: linux-2.6.16/fs/locks.c
6477--- linux-2.6.15.6/fs/locks.c 2006-01-03 17:29:57 +0100 6638===================================================================
6478+++ linux-2.6.15.6-vs2.1.1-rc13/fs/locks.c 2006-01-04 21:59:59 +0100 6639--- linux-2.6.16.orig/fs/locks.c
6640+++ linux-2.6.16/fs/locks.c
6479@@ -125,6 +125,7 @@ 6641@@ -125,6 +125,7 @@
6480 #include <linux/syscalls.h> 6642 #include <linux/syscalls.h>
6481 #include <linux/time.h> 6643 #include <linux/time.h>
6482 #include <linux/rcupdate.h> 6644 #include <linux/rcupdate.h>
6483+#include <linux/vs_limit.h> 6645+#include <linux/vs_limit.h>
6492+ return NULL; 6654+ return NULL;
6493 return kmem_cache_alloc(filelock_cache, SLAB_KERNEL); 6655 return kmem_cache_alloc(filelock_cache, SLAB_KERNEL);
6494 } 6656 }
6495 6657
6496 /* Free a lock which is not in use. */ 6658 /* Free a lock which is not in use. */
6497 static inline void locks_free_lock(struct file_lock *fl) 6659 static void locks_free_lock(struct file_lock *fl)
6498 { 6660 {
6499+ vx_locks_dec(fl); 6661+ vx_locks_dec(fl);
6500+ 6662+
6501 if (fl == NULL) { 6663 if (fl == NULL) {
6502 BUG(); 6664 BUG();
6540+ "f_xid(%d) == fl_xid(%d)", filp->f_xid, fl->fl_xid); 6702+ "f_xid(%d) == fl_xid(%d)", filp->f_xid, fl->fl_xid);
6541+ vx_locks_inc(fl); 6703+ vx_locks_inc(fl);
6542 error = lease_init(filp, type, fl); 6704 error = lease_init(filp, type, fl);
6543 if (error) 6705 if (error)
6544 return error; 6706 return error;
6545@@ -772,7 +790,7 @@ out: 6707@@ -771,7 +789,7 @@ out:
6546 6708
6547 EXPORT_SYMBOL(posix_lock_file); 6709 EXPORT_SYMBOL(posix_lock_file);
6548 6710
6549-static int __posix_lock_file(struct inode *inode, struct file_lock *request) 6711-static int __posix_lock_file(struct inode *inode, struct file_lock *request)
6550+static int __posix_lock_file(struct inode *inode, struct file_lock *request, xid_t xid) 6712+static int __posix_lock_file(struct inode *inode, struct file_lock *request, xid_t xid)
6551 { 6713 {
6552 struct file_lock *fl; 6714 struct file_lock *fl;
6553 struct file_lock *new_fl, *new_fl2; 6715 struct file_lock *new_fl, *new_fl2;
6554@@ -781,12 +799,18 @@ static int __posix_lock_file(struct inod 6716@@ -780,12 +798,18 @@ static int __posix_lock_file(struct inod
6555 struct file_lock **before; 6717 struct file_lock **before;
6556 int error, added = 0; 6718 int error, added = 0;
6557 6719
6558+ vxd_assert(xid == vx_current_xid(), 6720+ vxd_assert(xid == vx_current_xid(),
6559+ "xid(%d) == current(%d)", xid, vx_current_xid()); 6721+ "xid(%d) == current(%d)", xid, vx_current_xid());
6568+ new_fl2->fl_xid = xid; 6730+ new_fl2->fl_xid = xid;
6569+ vx_locks_inc(new_fl2); 6731+ vx_locks_inc(new_fl2);
6570 6732
6571 lock_kernel(); 6733 lock_kernel();
6572 if (request->fl_type != F_UNLCK) { 6734 if (request->fl_type != F_UNLCK) {
6573@@ -964,7 +988,7 @@ static int __posix_lock_file(struct inod 6735@@ -963,7 +987,7 @@ static int __posix_lock_file(struct inod
6574 */ 6736 */
6575 int posix_lock_file(struct file *filp, struct file_lock *fl) 6737 int posix_lock_file(struct file *filp, struct file_lock *fl)
6576 { 6738 {
6577- return __posix_lock_file(filp->f_dentry->d_inode, fl); 6739- return __posix_lock_file(filp->f_dentry->d_inode, fl);
6578+ return __posix_lock_file(filp->f_dentry->d_inode, fl, filp->f_xid); 6740+ return __posix_lock_file(filp->f_dentry->d_inode, fl, filp->f_xid);
6579 } 6741 }
6580 6742
6581 /** 6743 /**
6582@@ -981,7 +1005,8 @@ int posix_lock_file_wait(struct file *fi 6744@@ -980,7 +1004,8 @@ int posix_lock_file_wait(struct file *fi
6583 int error; 6745 int error;
6584 might_sleep (); 6746 might_sleep ();
6585 for (;;) { 6747 for (;;) {
6586- error = __posix_lock_file(filp->f_dentry->d_inode, fl); 6748- error = __posix_lock_file(filp->f_dentry->d_inode, fl);
6587+ error = __posix_lock_file(filp->f_dentry->d_inode, 6749+ error = __posix_lock_file(filp->f_dentry->d_inode,
6588+ fl, filp->f_xid); 6750+ fl, filp->f_xid);
6589 if ((error != -EAGAIN) || !(fl->fl_flags & FL_SLEEP)) 6751 if ((error != -EAGAIN) || !(fl->fl_flags & FL_SLEEP))
6590 break; 6752 break;
6591 error = wait_event_interruptible(fl->fl_wait, !fl->fl_next); 6753 error = wait_event_interruptible(fl->fl_wait, !fl->fl_next);
6592@@ -1053,7 +1078,7 @@ int locks_mandatory_area(int read_write, 6754@@ -1052,7 +1077,7 @@ int locks_mandatory_area(int read_write,
6593 fl.fl_end = offset + count - 1; 6755 fl.fl_end = offset + count - 1;
6594 6756
6595 for (;;) { 6757 for (;;) {
6596- error = __posix_lock_file(inode, &fl); 6758- error = __posix_lock_file(inode, &fl);
6597+ error = __posix_lock_file(inode, &fl, filp->f_xid); 6759+ error = __posix_lock_file(inode, &fl, filp->f_xid);
6598 if (error != -EAGAIN) 6760 if (error != -EAGAIN)
6599 break; 6761 break;
6600 if (!(fl.fl_flags & FL_SLEEP)) 6762 if (!(fl.fl_flags & FL_SLEEP))
6601@@ -1614,6 +1639,11 @@ int fcntl_setlk(unsigned int fd, struct 6763@@ -1613,6 +1638,11 @@ int fcntl_setlk(unsigned int fd, struct
6602 if (file_lock == NULL) 6764 if (file_lock == NULL)
6603 return -ENOLCK; 6765 return -ENOLCK;
6604 6766
6605+ vxd_assert(filp->f_xid == vx_current_xid(), 6767+ vxd_assert(filp->f_xid == vx_current_xid(),
6606+ "f_xid(%d) == current(%d)", filp->f_xid, vx_current_xid()); 6768+ "f_xid(%d) == current(%d)", filp->f_xid, vx_current_xid());
6608+ vx_locks_inc(file_lock); 6770+ vx_locks_inc(file_lock);
6609+ 6771+
6610 /* 6772 /*
6611 * This might block, so we do it before checking the inode. 6773 * This might block, so we do it before checking the inode.
6612 */ 6774 */
6613@@ -1666,7 +1696,8 @@ again: 6775@@ -1665,7 +1695,8 @@ again:
6614 error = filp->f_op->lock(filp, cmd, file_lock); 6776 error = filp->f_op->lock(filp, cmd, file_lock);
6615 else { 6777 else {
6616 for (;;) { 6778 for (;;) {
6617- error = __posix_lock_file(inode, file_lock); 6779- error = __posix_lock_file(inode, file_lock);
6618+ error = __posix_lock_file(inode, file_lock, 6780+ error = __posix_lock_file(inode, file_lock,
6619+ filp->f_xid); 6781+ filp->f_xid);
6620 if ((error != -EAGAIN) || (cmd == F_SETLK)) 6782 if ((error != -EAGAIN) || (cmd == F_SETLK))
6621 break; 6783 break;
6622 error = wait_event_interruptible(file_lock->fl_wait, 6784 error = wait_event_interruptible(file_lock->fl_wait,
6623@@ -1757,6 +1788,11 @@ int fcntl_setlk64(unsigned int fd, struc 6785@@ -1756,6 +1787,11 @@ int fcntl_setlk64(unsigned int fd, struc
6624 if (file_lock == NULL) 6786 if (file_lock == NULL)
6625 return -ENOLCK; 6787 return -ENOLCK;
6626 6788
6627+ vxd_assert(filp->f_xid == vx_current_xid(), 6789+ vxd_assert(filp->f_xid == vx_current_xid(),
6628+ "f_xid(%d) == current(%d)", filp->f_xid, vx_current_xid()); 6790+ "f_xid(%d) == current(%d)", filp->f_xid, vx_current_xid());
6630+ vx_locks_inc(file_lock); 6792+ vx_locks_inc(file_lock);
6631+ 6793+
6632 /* 6794 /*
6633 * This might block, so we do it before checking the inode. 6795 * This might block, so we do it before checking the inode.
6634 */ 6796 */
6635@@ -1809,7 +1845,8 @@ again: 6797@@ -1808,7 +1844,8 @@ again:
6636 error = filp->f_op->lock(filp, cmd, file_lock); 6798 error = filp->f_op->lock(filp, cmd, file_lock);
6637 else { 6799 else {
6638 for (;;) { 6800 for (;;) {
6639- error = __posix_lock_file(inode, file_lock); 6801- error = __posix_lock_file(inode, file_lock);
6640+ error = __posix_lock_file(inode, file_lock, 6802+ error = __posix_lock_file(inode, file_lock,
6641+ filp->f_xid); 6803+ filp->f_xid);
6642 if ((error != -EAGAIN) || (cmd == F_SETLK64)) 6804 if ((error != -EAGAIN) || (cmd == F_SETLK64))
6643 break; 6805 break;
6644 error = wait_event_interruptible(file_lock->fl_wait, 6806 error = wait_event_interruptible(file_lock->fl_wait,
6645@@ -2086,6 +2123,10 @@ int get_locks_status(char *buffer, char 6807@@ -2081,6 +2118,10 @@ int get_locks_status(char *buffer, char
6646 list_for_each(tmp, &file_lock_list) { 6808 list_for_each(tmp, &file_lock_list) {
6647 struct list_head *btmp; 6809 struct list_head *btmp;
6648 struct file_lock *fl = list_entry(tmp, struct file_lock, fl_link); 6810 struct file_lock *fl = list_entry(tmp, struct file_lock, fl_link);
6649+ 6811+
6650+ if (!vx_check(fl->fl_xid, VX_IDENT|VX_WATCH)) 6812+ if (!vx_check(fl->fl_xid, VX_IDENT|VX_WATCH))
6651+ continue; 6813+ continue;
6652+ 6814+
6653 lock_get_status(q, fl, ++i, ""); 6815 lock_get_status(q, fl, ++i, "");
6654 move_lock_status(&q, &pos, offset); 6816 move_lock_status(&q, &pos, offset);
6655 6817
6656diff -NurpP --minimal linux-2.6.15.6/fs/namei.c linux-2.6.15.6-vs2.1.1-rc13/fs/namei.c 6818Index: linux-2.6.16/fs/namei.c
6657--- linux-2.6.15.6/fs/namei.c 2006-01-03 17:29:57 +0100 6819===================================================================
6658+++ linux-2.6.15.6-vs2.1.1-rc13/fs/namei.c 2006-02-13 05:26:55 +0100 6820--- linux-2.6.16.orig/fs/namei.c
6821+++ linux-2.6.16/fs/namei.c
6659@@ -29,6 +29,10 @@ 6822@@ -32,6 +32,10 @@
6660 #include <linux/mount.h>
6661 #include <linux/audit.h>
6662 #include <linux/file.h> 6823 #include <linux/file.h>
6824 #include <linux/fcntl.h>
6825 #include <linux/namei.h>
6663+#include <linux/proc_fs.h> 6826+#include <linux/proc_fs.h>
6664+#include <linux/vserver/inode.h> 6827+#include <linux/vserver/inode.h>
6665+#include <linux/vs_tag.h> 6828+#include <linux/vs_tag.h>
6666+#include <linux/vserver/debug.h> 6829+#include <linux/vserver/debug.h>
6667 #include <asm/namei.h> 6830 #include <asm/namei.h>
6668 #include <asm/uaccess.h> 6831 #include <asm/uaccess.h>
6669 6832
6670@@ -222,6 +226,24 @@ int generic_permission(struct inode *ino 6833@@ -225,6 +229,24 @@ int generic_permission(struct inode *ino
6671 return -EACCES; 6834 return -EACCES;
6672 } 6835 }
6673 6836
6674+static inline int dx_permission(struct inode *inode, int mask, struct nameidata *nd) 6837+static inline int dx_permission(struct inode *inode, int mask, struct nameidata *nd)
6675+{ 6838+{
6690+} 6853+}
6691+ 6854+
6692 int permission(struct inode *inode, int mask, struct nameidata *nd) 6855 int permission(struct inode *inode, int mask, struct nameidata *nd)
6693 { 6856 {
6694 int retval, submask; 6857 int retval, submask;
6695@@ -232,7 +254,7 @@ int permission(struct inode *inode, int 6858@@ -235,7 +257,7 @@ int permission(struct inode *inode, int
6696 /* 6859 /*
6697 * Nobody gets write access to a read-only fs. 6860 * Nobody gets write access to a read-only fs.
6698 */ 6861 */
6699- if (IS_RDONLY(inode) && 6862- if (IS_RDONLY(inode) &&
6700+ if ((IS_RDONLY(inode) || (nd && MNT_IS_RDONLY(nd->mnt))) && 6863+ if ((IS_RDONLY(inode) || (nd && MNT_IS_RDONLY(nd->mnt))) &&
6701 (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode))) 6864 (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)))
6702 return -EROFS; 6865 return -EROFS;
6703 6866
6704@@ -246,6 +268,8 @@ int permission(struct inode *inode, int 6867@@ -249,6 +271,8 @@ int permission(struct inode *inode, int
6705 6868
6706 /* Ordinary permission routines do not understand MAY_APPEND. */ 6869 /* Ordinary permission routines do not understand MAY_APPEND. */
6707 submask = mask & ~MAY_APPEND; 6870 submask = mask & ~MAY_APPEND;
6708+ if ((retval = dx_permission(inode, mask, nd))) 6871+ if ((retval = dx_permission(inode, mask, nd)))
6709+ return retval; 6872+ return retval;
6710 if (inode->i_op && inode->i_op->permission) 6873 if (inode->i_op && inode->i_op->permission)
6711 retval = inode->i_op->permission(inode, submask, nd); 6874 retval = inode->i_op->permission(inode, submask, nd);
6712 else 6875 else
6713@@ -699,7 +723,8 @@ static inline void follow_dotdot(struct 6876@@ -702,7 +726,8 @@ static __always_inline void follow_dotdo
6714 if (nd->dentry == current->fs->root && 6877 if (nd->dentry == current->fs->root &&
6715 nd->mnt == current->fs->rootmnt) { 6878 nd->mnt == current->fs->rootmnt) {
6716 read_unlock(&current->fs->lock); 6879 read_unlock(&current->fs->lock);
6717- break; 6880- break;
6718+ /* for sane '/' avoid follow_mount() */ 6881+ /* for sane '/' avoid follow_mount() */
6719+ return; 6882+ return;
6720 } 6883 }
6721 read_unlock(&current->fs->lock); 6884 read_unlock(&current->fs->lock);
6722 spin_lock(&dcache_lock); 6885 spin_lock(&dcache_lock);
6723@@ -736,16 +761,34 @@ static int do_lookup(struct nameidata *n 6886@@ -739,16 +764,34 @@ static int do_lookup(struct nameidata *n
6724 { 6887 {
6725 struct vfsmount *mnt = nd->mnt; 6888 struct vfsmount *mnt = nd->mnt;
6726 struct dentry *dentry = __d_lookup(nd->dentry, name); 6889 struct dentry *dentry = __d_lookup(nd->dentry, name);
6727+ struct inode *inode; 6890+ struct inode *inode;
6728 6891
6753+ dput(dentry); 6916+ dput(dentry);
6754+ return -ENOENT; 6917+ return -ENOENT;
6755 6918
6756 need_lookup: 6919 need_lookup:
6757 dentry = real_lookup(nd->dentry, name, nd); 6920 dentry = real_lookup(nd->dentry, name, nd);
6758@@ -1293,7 +1336,8 @@ static inline int check_sticky(struct in 6921@@ -1345,7 +1388,8 @@ static inline int check_sticky(struct in
6759 * 10. We don't allow removal of NFS sillyrenamed files; it's handled by 6922 * 10. We don't allow removal of NFS sillyrenamed files; it's handled by
6760 * nfs_async_unlink(). 6923 * nfs_async_unlink().
6761 */ 6924 */
6762-static inline int may_delete(struct inode *dir,struct dentry *victim,int isdir) 6925-static int may_delete(struct inode *dir,struct dentry *victim,int isdir)
6763+static inline int may_delete(struct inode *dir, struct dentry *victim, 6926+static int may_delete(struct inode *dir, struct dentry *victim,
6764+ int isdir, struct nameidata *nd) 6927+ int isdir, struct nameidata *nd)
6765 { 6928 {
6766 int error; 6929 int error;
6767 6930
6768@@ -1302,13 +1346,13 @@ static inline int may_delete(struct inod 6931@@ -1354,13 +1398,13 @@ static int may_delete(struct inode *dir,
6769 6932
6770 BUG_ON(victim->d_parent->d_inode != dir); 6933 BUG_ON(victim->d_parent->d_inode != dir);
6771 6934
6772- error = permission(dir,MAY_WRITE | MAY_EXEC, NULL); 6935- error = permission(dir,MAY_WRITE | MAY_EXEC, NULL);
6773+ error = permission(dir,MAY_WRITE | MAY_EXEC, nd); 6936+ error = permission(dir,MAY_WRITE | MAY_EXEC, nd);
6779- IS_IMMUTABLE(victim->d_inode)) 6942- IS_IMMUTABLE(victim->d_inode))
6780+ IS_IXORUNLINK(victim->d_inode)) 6943+ IS_IXORUNLINK(victim->d_inode))
6781 return -EPERM; 6944 return -EPERM;
6782 if (isdir) { 6945 if (isdir) {
6783 if (!S_ISDIR(victim->d_inode->i_mode)) 6946 if (!S_ISDIR(victim->d_inode->i_mode))
6784@@ -1439,6 +1483,10 @@ int may_open(struct nameidata *nd, int a 6947@@ -1491,6 +1535,10 @@ int may_open(struct nameidata *nd, int a
6785 if (S_ISDIR(inode->i_mode) && (flag & FMODE_WRITE)) 6948 if (S_ISDIR(inode->i_mode) && (flag & FMODE_WRITE))
6786 return -EISDIR; 6949 return -EISDIR;
6787 6950
6788+#ifdef CONFIG_VSERVER_COWBL 6951+#ifdef CONFIG_VSERVER_COWBL
6789+ if (IS_COW_LINK(inode) && (flag & FMODE_WRITE)) 6952+ if (IS_COW_LINK(inode) && (flag & FMODE_WRITE))
6790+ return -EMLINK; 6953+ return -EMLINK;
6791+#endif 6954+#endif
6792 error = vfs_permission(nd, acc_mode); 6955 error = vfs_permission(nd, acc_mode);
6793 if (error) 6956 if (error)
6794 return error; 6957 return error;
6795@@ -1455,7 +1503,8 @@ int may_open(struct nameidata *nd, int a 6958@@ -1507,7 +1555,8 @@ int may_open(struct nameidata *nd, int a
6796 return -EACCES; 6959 return -EACCES;
6797 6960
6798 flag &= ~O_TRUNC; 6961 flag &= ~O_TRUNC;
6799- } else if (IS_RDONLY(inode) && (flag & FMODE_WRITE)) 6962- } else if (IS_RDONLY(inode) && (flag & FMODE_WRITE))
6800+ } else if ((IS_RDONLY(inode) || MNT_IS_RDONLY(nd->mnt)) 6963+ } else if ((IS_RDONLY(inode) || MNT_IS_RDONLY(nd->mnt))
6801+ && (flag & FMODE_WRITE)) 6964+ && (flag & FMODE_WRITE))
6802 return -EROFS; 6965 return -EROFS;
6803 /* 6966 /*
6804 * An append-only file must be opened in append mode for writing. 6967 * An append-only file must be opened in append mode for writing.
6805@@ -1503,6 +1552,8 @@ int may_open(struct nameidata *nd, int a 6968@@ -1555,6 +1604,8 @@ int may_open(struct nameidata *nd, int a
6806 return 0; 6969 return 0;
6807 } 6970 }
6808 6971
6809+int cow_break_link(struct dentry *dentry, const char *pathname); 6972+int cow_break_link(struct dentry *dentry, const char *pathname);
6810+ 6973+
6811 /* 6974 /*
6812 * open_namei() 6975 * open_namei()
6813 * 6976 *
6814@@ -1524,6 +1575,11 @@ int open_namei(const char * pathname, in 6977@@ -1577,6 +1628,11 @@ int open_namei(int dfd, const char *path
6815 struct dentry *dir; 6978 struct dentry *dir;
6816 int count = 0; 6979 int count = 0;
6817 6980
6818+#ifdef CONFIG_VSERVER_COWBL 6981+#ifdef CONFIG_VSERVER_COWBL
6819+ int rflag = flag; 6982+ int rflag = flag;
6821+restart: 6984+restart:
6822+#endif 6985+#endif
6823 acc_mode = ACC_MODE(flag); 6986 acc_mode = ACC_MODE(flag);
6824 6987
6825 /* O_TRUNC implies we need access checks for write permissions */ 6988 /* O_TRUNC implies we need access checks for write permissions */
6826@@ -1616,6 +1672,18 @@ do_last: 6989@@ -1670,6 +1726,18 @@ do_last:
6827 goto exit; 6990 goto exit;
6828 ok: 6991 ok:
6829 error = may_open(nd, acc_mode, flag); 6992 error = may_open(nd, acc_mode, flag);
6830+#ifdef CONFIG_VSERVER_COWBL 6993+#ifdef CONFIG_VSERVER_COWBL
6831+ if (error == -EMLINK) { 6994+ if (error == -EMLINK) {
6840+ } 7003+ }
6841+#endif 7004+#endif
6842 if (error) 7005 if (error)
6843 goto exit; 7006 goto exit;
6844 return 0; 7007 return 0;
6845@@ -1719,9 +1787,10 @@ fail: 7008@@ -1773,9 +1841,10 @@ fail:
6846 } 7009 }
6847 EXPORT_SYMBOL_GPL(lookup_create); 7010 EXPORT_SYMBOL_GPL(lookup_create);
6848 7011
6849-int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) 7012-int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
6850+int vfs_mknod(struct inode *dir, struct dentry *dentry, 7013+int vfs_mknod(struct inode *dir, struct dentry *dentry,
6853- int error = may_create(dir, dentry, NULL); 7016- int error = may_create(dir, dentry, NULL);
6854+ int error = may_create(dir, dentry, nd); 7017+ int error = may_create(dir, dentry, nd);
6855 7018
6856 if (error) 7019 if (error)
6857 return error; 7020 return error;
6858@@ -1770,11 +1839,12 @@ asmlinkage long sys_mknod(const char __u 7021@@ -1825,11 +1894,12 @@ asmlinkage long sys_mknodat(int dfd, con
6859 error = vfs_create(nd.dentry->d_inode,dentry,mode,&nd); 7022 error = vfs_create(nd.dentry->d_inode,dentry,mode,&nd);
6860 break; 7023 break;
6861 case S_IFCHR: case S_IFBLK: 7024 case S_IFCHR: case S_IFBLK:
6862- error = vfs_mknod(nd.dentry->d_inode,dentry,mode, 7025- error = vfs_mknod(nd.dentry->d_inode,dentry,mode,
6863- new_decode_dev(dev)); 7026- new_decode_dev(dev));
6869+ error = vfs_mknod(nd.dentry->d_inode, dentry, mode, 7032+ error = vfs_mknod(nd.dentry->d_inode, dentry, mode,
6870+ 0, &nd); 7033+ 0, &nd);
6871 break; 7034 break;
6872 case S_IFDIR: 7035 case S_IFDIR:
6873 error = -EPERM; 7036 error = -EPERM;
6874@@ -1792,9 +1862,10 @@ out: 7037@@ -1852,9 +1922,10 @@ asmlinkage long sys_mknod(const char __u
6875 return error; 7038 return sys_mknodat(AT_FDCWD, filename, mode, dev);
6876 } 7039 }
6877 7040
6878-int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) 7041-int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
6879+int vfs_mkdir(struct inode *dir, struct dentry *dentry, 7042+int vfs_mkdir(struct inode *dir, struct dentry *dentry,
6880+ int mode, struct nameidata *nd) 7043+ int mode, struct nameidata *nd)
6882- int error = may_create(dir, dentry, NULL); 7045- int error = may_create(dir, dentry, NULL);
6883+ int error = may_create(dir, dentry, nd); 7046+ int error = may_create(dir, dentry, nd);
6884 7047
6885 if (error) 7048 if (error)
6886 return error; 7049 return error;
6887@@ -1833,7 +1904,8 @@ asmlinkage long sys_mkdir(const char __u 7050@@ -1893,7 +1964,8 @@ asmlinkage long sys_mkdirat(int dfd, con
6888 if (!IS_ERR(dentry)) { 7051 if (!IS_ERR(dentry)) {
6889 if (!IS_POSIXACL(nd.dentry->d_inode)) 7052 if (!IS_POSIXACL(nd.dentry->d_inode))
6890 mode &= ~current->fs->umask; 7053 mode &= ~current->fs->umask;
6891- error = vfs_mkdir(nd.dentry->d_inode, dentry, mode); 7054- error = vfs_mkdir(nd.dentry->d_inode, dentry, mode);
6892+ error = vfs_mkdir(nd.dentry->d_inode, dentry, 7055+ error = vfs_mkdir(nd.dentry->d_inode, dentry,
6893+ mode, &nd); 7056+ mode, &nd);
6894 dput(dentry); 7057 dput(dentry);
6895 } 7058 }
6896 up(&nd.dentry->d_inode->i_sem); 7059 mutex_unlock(&nd.dentry->d_inode->i_mutex);
6897@@ -1873,9 +1945,10 @@ void dentry_unhash(struct dentry *dentry 7060@@ -1938,9 +2010,10 @@ void dentry_unhash(struct dentry *dentry
6898 spin_unlock(&dcache_lock); 7061 spin_unlock(&dcache_lock);
6899 } 7062 }
6900 7063
6901-int vfs_rmdir(struct inode *dir, struct dentry *dentry) 7064-int vfs_rmdir(struct inode *dir, struct dentry *dentry)
6902+int vfs_rmdir(struct inode *dir, struct dentry *dentry, 7065+int vfs_rmdir(struct inode *dir, struct dentry *dentry,
6905- int error = may_delete(dir, dentry, 1); 7068- int error = may_delete(dir, dentry, 1);
6906+ int error = may_delete(dir, dentry, 1, nd); 7069+ int error = may_delete(dir, dentry, 1, nd);
6907 7070
6908 if (error) 7071 if (error)
6909 return error; 7072 return error;
6910@@ -1936,7 +2009,7 @@ asmlinkage long sys_rmdir(const char __u 7073@@ -2001,7 +2074,7 @@ static long do_rmdir(int dfd, const char
6911 dentry = lookup_hash(&nd); 7074 dentry = lookup_hash(&nd);
6912 error = PTR_ERR(dentry); 7075 error = PTR_ERR(dentry);
6913 if (!IS_ERR(dentry)) { 7076 if (!IS_ERR(dentry)) {
6914- error = vfs_rmdir(nd.dentry->d_inode, dentry); 7077- error = vfs_rmdir(nd.dentry->d_inode, dentry);
6915+ error = vfs_rmdir(nd.dentry->d_inode, dentry, &nd); 7078+ error = vfs_rmdir(nd.dentry->d_inode, dentry, &nd);
6916 dput(dentry); 7079 dput(dentry);
6917 } 7080 }
6918 up(&nd.dentry->d_inode->i_sem); 7081 mutex_unlock(&nd.dentry->d_inode->i_mutex);
6919@@ -1947,9 +2020,10 @@ exit: 7082@@ -2017,9 +2090,10 @@ asmlinkage long sys_rmdir(const char __u
6920 return error; 7083 return do_rmdir(AT_FDCWD, pathname);
6921 } 7084 }
6922 7085
6923-int vfs_unlink(struct inode *dir, struct dentry *dentry) 7086-int vfs_unlink(struct inode *dir, struct dentry *dentry)
6924+int vfs_unlink(struct inode *dir, struct dentry *dentry, 7087+int vfs_unlink(struct inode *dir, struct dentry *dentry,
6925+ struct nameidata *nd) 7088+ struct nameidata *nd)
6927- int error = may_delete(dir, dentry, 0); 7090- int error = may_delete(dir, dentry, 0);
6928+ int error = may_delete(dir, dentry, 0, nd); 7091+ int error = may_delete(dir, dentry, 0, nd);
6929 7092
6930 if (error) 7093 if (error)
6931 return error; 7094 return error;
6932@@ -2011,7 +2085,7 @@ asmlinkage long sys_unlink(const char __ 7095@@ -2081,7 +2155,7 @@ static long do_unlinkat(int dfd, const c
6933 inode = dentry->d_inode; 7096 inode = dentry->d_inode;
6934 if (inode) 7097 if (inode)
6935 atomic_inc(&inode->i_count); 7098 atomic_inc(&inode->i_count);
6936- error = vfs_unlink(nd.dentry->d_inode, dentry); 7099- error = vfs_unlink(nd.dentry->d_inode, dentry);
6937+ error = vfs_unlink(nd.dentry->d_inode, dentry, &nd); 7100+ error = vfs_unlink(nd.dentry->d_inode, dentry, &nd);
6938 exit2: 7101 exit2:
6939 dput(dentry); 7102 dput(dentry);
6940 } 7103 }
6941@@ -2030,9 +2104,10 @@ slashes: 7104@@ -2116,9 +2190,10 @@ asmlinkage long sys_unlink(const char __
6942 goto exit2; 7105 return do_unlinkat(AT_FDCWD, pathname);
6943 } 7106 }
6944 7107
6945-int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname, int mode) 7108-int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname, int mode)
6946+int vfs_symlink(struct inode *dir, struct dentry *dentry, 7109+int vfs_symlink(struct inode *dir, struct dentry *dentry,
6947+ const char *oldname, int mode, struct nameidata *nd) 7110+ const char *oldname, int mode, struct nameidata *nd)
6949- int error = may_create(dir, dentry, NULL); 7112- int error = may_create(dir, dentry, NULL);
6950+ int error = may_create(dir, dentry, nd); 7113+ int error = may_create(dir, dentry, nd);
6951 7114
6952 if (error) 7115 if (error)
6953 return error; 7116 return error;
6954@@ -2072,7 +2147,8 @@ asmlinkage long sys_symlink(const char _ 7117@@ -2159,7 +2234,8 @@ asmlinkage long sys_symlinkat(const char
6955 dentry = lookup_create(&nd, 0); 7118 dentry = lookup_create(&nd, 0);
6956 error = PTR_ERR(dentry); 7119 error = PTR_ERR(dentry);
6957 if (!IS_ERR(dentry)) { 7120 if (!IS_ERR(dentry)) {
6958- error = vfs_symlink(nd.dentry->d_inode, dentry, from, S_IALLUGO); 7121- error = vfs_symlink(nd.dentry->d_inode, dentry, from, S_IALLUGO);
6959+ error = vfs_symlink(nd.dentry->d_inode, dentry, 7122+ error = vfs_symlink(nd.dentry->d_inode, dentry,
6960+ from, S_IALLUGO, &nd); 7123+ from, S_IALLUGO, &nd);
6961 dput(dentry); 7124 dput(dentry);
6962 } 7125 }
6963 up(&nd.dentry->d_inode->i_sem); 7126 mutex_unlock(&nd.dentry->d_inode->i_mutex);
6964@@ -2084,7 +2160,8 @@ out: 7127@@ -2176,7 +2252,8 @@ asmlinkage long sys_symlink(const char _
6965 return error; 7128 return sys_symlinkat(oldname, AT_FDCWD, newname);
6966 } 7129 }
6967 7130
6968-int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry) 7131-int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry)
6969+int vfs_link(struct dentry *old_dentry, struct inode *dir, 7132+int vfs_link(struct dentry *old_dentry, struct inode *dir,
6970+ struct dentry *new_dentry, struct nameidata *nd) 7133+ struct dentry *new_dentry, struct nameidata *nd)
6971 { 7134 {
6972 struct inode *inode = old_dentry->d_inode; 7135 struct inode *inode = old_dentry->d_inode;
6973 int error; 7136 int error;
6974@@ -2092,7 +2169,7 @@ int vfs_link(struct dentry *old_dentry, 7137@@ -2184,7 +2261,7 @@ int vfs_link(struct dentry *old_dentry,
6975 if (!inode) 7138 if (!inode)
6976 return -ENOENT; 7139 return -ENOENT;
6977 7140
6978- error = may_create(dir, new_dentry, NULL); 7141- error = may_create(dir, new_dentry, NULL);
6979+ error = may_create(dir, new_dentry, nd); 7142+ error = may_create(dir, new_dentry, nd);
6980 if (error) 7143 if (error)
6981 return error; 7144 return error;
6982 7145
6983@@ -2102,7 +2179,7 @@ int vfs_link(struct dentry *old_dentry, 7146@@ -2194,7 +2271,7 @@ int vfs_link(struct dentry *old_dentry,
6984 /* 7147 /*
6985 * A link to an append-only or immutable file cannot be created. 7148 * A link to an append-only or immutable file cannot be created.
6986 */ 7149 */
6987- if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) 7150- if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
6988+ if (IS_APPEND(inode) || IS_IXORUNLINK(inode)) 7151+ if (IS_APPEND(inode) || IS_IXORUNLINK(inode))
6989 return -EPERM; 7152 return -EPERM;
6990 if (!dir->i_op || !dir->i_op->link) 7153 if (!dir->i_op || !dir->i_op->link)
6991 return -EPERM; 7154 return -EPERM;
6992@@ -2154,7 +2231,8 @@ asmlinkage long sys_link(const char __us 7155@@ -2251,7 +2328,8 @@ asmlinkage long sys_linkat(int olddfd, c
6993 new_dentry = lookup_create(&nd, 0); 7156 new_dentry = lookup_create(&nd, 0);
6994 error = PTR_ERR(new_dentry); 7157 error = PTR_ERR(new_dentry);
6995 if (!IS_ERR(new_dentry)) { 7158 if (!IS_ERR(new_dentry)) {
6996- error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry); 7159- error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry);
6997+ error = vfs_link(old_nd.dentry, nd.dentry->d_inode, 7160+ error = vfs_link(old_nd.dentry, nd.dentry->d_inode,
6998+ new_dentry, &nd); 7161+ new_dentry, &nd);
6999 dput(new_dentry); 7162 dput(new_dentry);
7000 } 7163 }
7001 up(&nd.dentry->d_inode->i_sem); 7164 mutex_unlock(&nd.dentry->d_inode->i_mutex);
7002@@ -2281,14 +2359,14 @@ int vfs_rename(struct inode *old_dir, st 7165@@ -2383,14 +2461,14 @@ int vfs_rename(struct inode *old_dir, st
7003 if (old_dentry->d_inode == new_dentry->d_inode) 7166 if (old_dentry->d_inode == new_dentry->d_inode)
7004 return 0; 7167 return 0;
7005 7168
7006- error = may_delete(old_dir, old_dentry, is_dir); 7169- error = may_delete(old_dir, old_dentry, is_dir);
7007+ error = may_delete(old_dir, old_dentry, is_dir, NULL); 7170+ error = may_delete(old_dir, old_dentry, is_dir, NULL);
7014- error = may_delete(new_dir, new_dentry, is_dir); 7177- error = may_delete(new_dir, new_dentry, is_dir);
7015+ error = may_delete(new_dir, new_dentry, is_dir, NULL); 7178+ error = may_delete(new_dir, new_dentry, is_dir, NULL);
7016 if (error) 7179 if (error)
7017 return error; 7180 return error;
7018 7181
7019@@ -2365,6 +2443,9 @@ static inline int do_rename(const char * 7182@@ -2468,6 +2546,9 @@ static int do_rename(int olddfd, const c
7020 error = -EINVAL; 7183 error = -EINVAL;
7021 if (old_dentry == trap) 7184 if (old_dentry == trap)
7022 goto exit4; 7185 goto exit4;
7023+ error = -EROFS; 7186+ error = -EROFS;
7024+ if (MNT_IS_RDONLY(newnd.mnt)) 7187+ if (MNT_IS_RDONLY(newnd.mnt))
7025+ goto exit4; 7188+ goto exit4;
7026 new_dentry = lookup_hash(&newnd); 7189 new_dentry = lookup_hash(&newnd);
7027 error = PTR_ERR(new_dentry); 7190 error = PTR_ERR(new_dentry);
7028 if (IS_ERR(new_dentry)) 7191 if (IS_ERR(new_dentry))
7029@@ -2452,6 +2533,124 @@ int vfs_follow_link(struct nameidata *nd 7192@@ -2561,6 +2642,125 @@ int vfs_follow_link(struct nameidata *nd
7030 return __vfs_follow_link(nd, link); 7193 return __vfs_follow_link(nd, link);
7031 } 7194 }
7032 7195
7033+ 7196+
7034+#ifdef CONFIG_VSERVER_COWBL 7197+#ifdef CONFIG_VSERVER_COWBL
7082+ 7245+
7083+ ret = vfs_create(dir_nd.dentry->d_inode, new_dentry, mode, &dir_nd); 7246+ ret = vfs_create(dir_nd.dentry->d_inode, new_dentry, mode, &dir_nd);
7084+ vxdprintk(VXD_CBIT(misc, 2), 7247+ vxdprintk(VXD_CBIT(misc, 2),
7085+ "vfs_create(new): %d", ret); 7248+ "vfs_create(new): %d", ret);
7086+ if (ret == -EEXIST) { 7249+ if (ret == -EEXIST) {
7250+
7087+ up(&dir_nd.dentry->d_inode->i_sem); 7251+ mutex_unlock(&dir_nd.dentry->d_inode->i_mutex);
7088+ dput(new_dentry); 7252+ dput(new_dentry);
7089+ path_release(&dir_nd); 7253+ path_release(&dir_nd);
7090+ goto retry; 7254+ goto retry;
7091+ } 7255+ }
7092+ 7256+
7134+ "fput(old_file=%p[#%d])", old_file, 7298+ "fput(old_file=%p[#%d])", old_file,
7135+ atomic_read(&old_file->f_count)); 7299+ atomic_read(&old_file->f_count));
7136+ fput(old_file); 7300+ fput(old_file);
7137+ 7301+
7138+out_rel_both: 7302+out_rel_both:
7139+ up(&dir_nd.dentry->d_inode->i_sem); 7303+ mutex_unlock(&dir_nd.dentry->d_inode->i_mutex);
7140+ dput(new_dentry); 7304+ dput(new_dentry);
7141+ 7305+
7142+ path_release(&dir_nd); 7306+ path_release(&dir_nd);
7143+out_rel_old: 7307+out_rel_old:
7144+ path_release(&old_nd); 7308+ path_release(&old_nd);
7149+#endif 7313+#endif
7150+ 7314+
7151 /* get the link contents into pagecache */ 7315 /* get the link contents into pagecache */
7152 static char *page_getlink(struct dentry * dentry, struct page **ppage) 7316 static char *page_getlink(struct dentry * dentry, struct page **ppage)
7153 { 7317 {
7154diff -NurpP --minimal linux-2.6.15.6/fs/namespace.c linux-2.6.15.6-vs2.1.1-rc13/fs/namespace.c 7318Index: linux-2.6.16/fs/namespace.c
7155--- linux-2.6.15.6/fs/namespace.c 2006-01-03 17:29:57 +0100 7319===================================================================
7156+++ linux-2.6.15.6-vs2.1.1-rc13/fs/namespace.c 2006-02-13 05:26:55 +0100 7320--- linux-2.6.16.orig/fs/namespace.c
7321+++ linux-2.6.16/fs/namespace.c
7157@@ -22,6 +22,8 @@ 7322@@ -23,6 +23,8 @@
7158 #include <linux/namei.h> 7323 #include <linux/namei.h>
7159 #include <linux/security.h> 7324 #include <linux/security.h>
7160 #include <linux/mount.h> 7325 #include <linux/mount.h>
7161+#include <linux/vserver/namespace.h> 7326+#include <linux/vserver/namespace.h>
7162+#include <linux/vserver/tag.h> 7327+#include <linux/vserver/tag.h>
7163 #include <asm/uaccess.h> 7328 #include <asm/uaccess.h>
7164 #include <asm/unistd.h> 7329 #include <asm/unistd.h>
7165 #include "pnode.h" 7330 #include "pnode.h"
7166@@ -236,6 +238,7 @@ static struct vfsmount *clone_mnt(struct 7331@@ -241,6 +243,7 @@ static struct vfsmount *clone_mnt(struct
7167 mnt->mnt_root = dget(root); 7332 mnt->mnt_root = dget(root);
7168 mnt->mnt_mountpoint = mnt->mnt_root; 7333 mnt->mnt_mountpoint = mnt->mnt_root;
7169 mnt->mnt_parent = mnt; 7334 mnt->mnt_parent = mnt;
7170+ mnt->mnt_tag = old->mnt_tag; 7335+ mnt->mnt_tag = old->mnt_tag;
7171 7336
7172 if (flag & CL_SLAVE) { 7337 if (flag & CL_SLAVE) {
7173 list_add(&mnt->mnt_slave, &old->mnt_slave_list); 7338 list_add(&mnt->mnt_slave, &old->mnt_slave_list);
7174@@ -344,43 +347,85 @@ static inline void mangle(struct seq_fil 7339@@ -349,43 +352,85 @@ static inline void mangle(struct seq_fil
7175 seq_escape(m, s, " \t\n\\"); 7340 seq_escape(m, s, " \t\n\\");
7176 } 7341 }
7177 7342
7178+static int mnt_is_reachable(struct vfsmount *mnt) 7343+static int mnt_is_reachable(struct vfsmount *mnt)
7179+{ 7344+{
7214+ char *unset_str; 7379+ char *unset_str;
7215 } fs_info[] = { 7380 } fs_info[] = {
7216- { MS_SYNCHRONOUS, ",sync" }, 7381- { MS_SYNCHRONOUS, ",sync" },
7217- { MS_DIRSYNC, ",dirsync" }, 7382- { MS_DIRSYNC, ",dirsync" },
7218- { MS_MANDLOCK, ",mand" }, 7383- { MS_MANDLOCK, ",mand" },
7219- { MS_NOATIME, ",noatime" },
7220- { MS_NODIRATIME, ",nodiratime" },
7221- { 0, NULL } 7384- { 0, NULL }
7222- }; 7385- };
7223- static struct proc_fs_info mnt_info[] = { 7386- static struct proc_fs_info mnt_info[] = {
7224- { MNT_NOSUID, ",nosuid" }, 7387- { MNT_NOSUID, ",nosuid" },
7225- { MNT_NODEV, ",nodev" }, 7388- { MNT_NODEV, ",nodev" },
7226- { MNT_NOEXEC, ",noexec" }, 7389- { MNT_NOEXEC, ",noexec" },
7390- { MNT_NOATIME, ",noatime" },
7391- { MNT_NODIRATIME, ",nodiratime" },
7227- { 0, NULL } 7392- { 0, NULL }
7228+ { MS_RDONLY, MNT_RDONLY, "ro", "rw" }, 7393+ { MS_RDONLY, MNT_RDONLY, "ro", "rw" },
7229+ { MS_SYNCHRONOUS, 0, ",sync", NULL }, 7394+ { MS_SYNCHRONOUS, 0, ",sync", NULL },
7230+ { MS_DIRSYNC, 0, ",dirsync", NULL }, 7395+ { MS_DIRSYNC, 0, ",dirsync", NULL },
7231+ { MS_MANDLOCK, 0, ",mand", NULL }, 7396+ { MS_MANDLOCK, 0, ",mand", NULL },
7244 7409
7245- mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none"); 7410- mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none");
7246- seq_putc(m, ' '); 7411- seq_putc(m, ' ');
7247- seq_path(m, mnt, mnt->mnt_root, " \t\n\\"); 7412- seq_path(m, mnt, mnt->mnt_root, " \t\n\\");
7248- seq_putc(m, ' '); 7413- seq_putc(m, ' ');
7249- mangle(m, mnt->mnt_sb->s_type->name);
7250- seq_puts(m, mnt->mnt_sb->s_flags & MS_RDONLY ? " ro" : " rw");
7251- for (fs_infop = fs_info; fs_infop->flag; fs_infop++) {
7252- if (mnt->mnt_sb->s_flags & fs_infop->flag)
7253- seq_puts(m, fs_infop->str);
7254+ if (vx_flags(VXF_HIDE_MOUNT, 0)) 7414+ if (vx_flags(VXF_HIDE_MOUNT, 0))
7255+ return 0; 7415+ return 0;
7256+ if (!mnt_is_reachable(mnt)) 7416+ if (!mnt_is_reachable(mnt))
7257+ return 0; 7417+ return 0;
7258+ 7418+
7262+ } else { 7422+ } else {
7263+ mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none"); 7423+ mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none");
7264+ seq_putc(m, ' '); 7424+ seq_putc(m, ' ');
7265+ seq_path(m, mnt, mnt->mnt_root, " \t\n\\"); 7425+ seq_path(m, mnt, mnt->mnt_root, " \t\n\\");
7266+ seq_putc(m, ' '); 7426+ seq_putc(m, ' ');
7267 } 7427+ }
7428 mangle(m, mnt->mnt_sb->s_type->name);
7429- seq_puts(m, mnt->mnt_sb->s_flags & MS_RDONLY ? " ro" : " rw");
7430- for (fs_infop = fs_info; fs_infop->flag; fs_infop++) {
7431- if (mnt->mnt_sb->s_flags & fs_infop->flag)
7432- seq_puts(m, fs_infop->str);
7433- }
7268- for (fs_infop = mnt_info; fs_infop->flag; fs_infop++) { 7434- for (fs_infop = mnt_info; fs_infop->flag; fs_infop++) {
7269- if (mnt->mnt_flags & fs_infop->flag) 7435- if (mnt->mnt_flags & fs_infop->flag)
7270- seq_puts(m, fs_infop->str); 7436- seq_puts(m, fs_infop->str);
7271+ mangle(m, mnt->mnt_sb->s_type->name);
7272+ seq_putc(m, ' '); 7437+ seq_putc(m, ' ');
7273+ for (p = fs_info; (p->s_flag | p->mnt_flag) ; p++) { 7438+ for (p = fs_info; (p->s_flag | p->mnt_flag) ; p++) {
7274+ if ((s_flags & p->s_flag) || (mnt_flags & p->mnt_flag)) { 7439+ if ((s_flags & p->s_flag) || (mnt_flags & p->mnt_flag)) {
7275+ if (p->set_str) 7440+ if (p->set_str)
7276+ seq_puts(m, p->set_str); 7441+ seq_puts(m, p->set_str);
7282+ if (mnt->mnt_flags & MNT_TAGID) 7447+ if (mnt->mnt_flags & MNT_TAGID)
7283+ seq_printf(m, ",tag=%d", mnt->mnt_tag); 7448+ seq_printf(m, ",tag=%d", mnt->mnt_tag);
7284 if (mnt->mnt_sb->s_op->show_options) 7449 if (mnt->mnt_sb->s_op->show_options)
7285 err = mnt->mnt_sb->s_op->show_options(m, mnt); 7450 err = mnt->mnt_sb->s_op->show_options(m, mnt);
7286 seq_puts(m, " 0 0\n"); 7451 seq_puts(m, " 0 0\n");
7287@@ -470,15 +515,11 @@ void release_mounts(struct list_head *he 7452@@ -475,15 +520,11 @@ void release_mounts(struct list_head *he
7288 } 7453 }
7289 } 7454 }
7290 7455
7291-void umount_tree(struct vfsmount *mnt, int propagate, struct list_head *kill) 7456-void umount_tree(struct vfsmount *mnt, int propagate, struct list_head *kill)
7292+static inline void __umount_list(struct vfsmount *mnt, 7457+static inline void __umount_list(struct vfsmount *mnt,
7300- } 7465- }
7301- 7466-
7302 if (propagate) 7467 if (propagate)
7303 propagate_umount(kill); 7468 propagate_umount(kill);
7304 7469
7305@@ -494,6 +535,33 @@ void umount_tree(struct vfsmount *mnt, i 7470@@ -499,6 +540,33 @@ void umount_tree(struct vfsmount *mnt, i
7306 } 7471 }
7307 } 7472 }
7308 7473
7309+void umount_tree(struct vfsmount *mnt, int propagate, struct list_head *kill) 7474+void umount_tree(struct vfsmount *mnt, int propagate, struct list_head *kill)
7310+{ 7475+{
7334+} 7499+}
7335+ 7500+
7336 static int do_umount(struct vfsmount *mnt, int flags) 7501 static int do_umount(struct vfsmount *mnt, int flags)
7337 { 7502 {
7338 struct super_block *sb = mnt->mnt_sb; 7503 struct super_block *sb = mnt->mnt_sb;
7339@@ -554,7 +622,7 @@ static int do_umount(struct vfsmount *mn 7504@@ -559,7 +627,7 @@ static int do_umount(struct vfsmount *mn
7340 down_write(&sb->s_umount); 7505 down_write(&sb->s_umount);
7341 if (!(sb->s_flags & MS_RDONLY)) { 7506 if (!(sb->s_flags & MS_RDONLY)) {
7342 lock_kernel(); 7507 lock_kernel();
7343- DQUOT_OFF(sb); 7508- DQUOT_OFF(sb);
7344+ DQUOT_OFF(sb->s_dqh); 7509+ DQUOT_OFF(sb->s_dqh);
7345 retval = do_remount_sb(sb, MS_RDONLY, NULL, 0); 7510 retval = do_remount_sb(sb, MS_RDONLY, NULL, 0);
7346 unlock_kernel(); 7511 unlock_kernel();
7347 } 7512 }
7348@@ -603,7 +671,7 @@ asmlinkage long sys_umount(char __user * 7513@@ -608,7 +676,7 @@ asmlinkage long sys_umount(char __user *
7349 goto dput_and_out; 7514 goto dput_and_out;
7350 7515
7351 retval = -EPERM; 7516 retval = -EPERM;
7352- if (!capable(CAP_SYS_ADMIN)) 7517- if (!capable(CAP_SYS_ADMIN))
7353+ if (!capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_SECURE_MOUNT)) 7518+ if (!capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_SECURE_MOUNT))
7354 goto dput_and_out; 7519 goto dput_and_out;
7355 7520
7356 retval = do_umount(nd.mnt, flags); 7521 retval = do_umount(nd.mnt, flags);
7357@@ -629,6 +697,8 @@ static int mount_is_safe(struct nameidat 7522@@ -634,6 +702,8 @@ static int mount_is_safe(struct nameidat
7358 { 7523 {
7359 if (capable(CAP_SYS_ADMIN)) 7524 if (capable(CAP_SYS_ADMIN))
7360 return 0; 7525 return 0;
7361+ if (vx_ccaps(VXC_SECURE_MOUNT)) 7526+ if (vx_ccaps(VXC_SECURE_MOUNT))
7362+ return 0; 7527+ return 0;
7363 return -EPERM; 7528 return -EPERM;
7364 #ifdef notyet 7529 #ifdef notyet
7365 if (S_ISLNK(nd->dentry->d_inode->i_mode)) 7530 if (S_ISLNK(nd->dentry->d_inode->i_mode))
7366@@ -856,11 +926,13 @@ static int do_change_type(struct nameida 7531@@ -861,11 +931,13 @@ static int do_change_type(struct nameida
7367 /* 7532 /*
7368 * do loopback mount. 7533 * do loopback mount.
7369 */ 7534 */
7370-static int do_loopback(struct nameidata *nd, char *old_name, int recurse) 7535-static int do_loopback(struct nameidata *nd, char *old_name, int recurse)
7371+static int do_loopback(struct nameidata *nd, char *old_name, tag_t tag, 7536+static int do_loopback(struct nameidata *nd, char *old_name, tag_t tag,
7376 int err = mount_is_safe(nd); 7541 int err = mount_is_safe(nd);
7377+ int recurse = flags & MS_REC; 7542+ int recurse = flags & MS_REC;
7378 if (err) 7543 if (err)
7379 return err; 7544 return err;
7380 if (!old_name || !*old_name) 7545 if (!old_name || !*old_name)
7381@@ -886,6 +958,12 @@ static int do_loopback(struct nameidata 7546@@ -891,6 +963,12 @@ static int do_loopback(struct nameidata
7382 if (!mnt) 7547 if (!mnt)
7383 goto out; 7548 goto out;
7384 7549
7385+ mnt->mnt_flags = mnt_flags; 7550+ mnt->mnt_flags = mnt_flags;
7386+ if (flags & MS_TAGID) { 7551+ if (flags & MS_TAGID) {
7389+ } 7554+ }
7390+ 7555+
7391 err = graft_tree(mnt, nd); 7556 err = graft_tree(mnt, nd);
7392 if (err) { 7557 if (err) {
7393 LIST_HEAD(umount_list); 7558 LIST_HEAD(umount_list);
7559@@ -899,6 +977,7 @@ static int do_loopback(struct nameidata
7560 spin_unlock(&vfsmount_lock);
7561 release_mounts(&umount_list);
7562 }
7563+ mnt->mnt_flags = mnt_flags;
7564
7565 out:
7566 up_write(&namespace_sem);
7394@@ -907,12 +985,12 @@ out: 7567@@ -912,12 +991,12 @@ out:
7395 * on it - tough luck. 7568 * on it - tough luck.
7396 */ 7569 */
7397 static int do_remount(struct nameidata *nd, int flags, int mnt_flags, 7570 static int do_remount(struct nameidata *nd, int flags, int mnt_flags,
7398- void *data) 7571- void *data)
7399+ void *data, xid_t xid) 7572+ void *data, xid_t xid)
7404- if (!capable(CAP_SYS_ADMIN)) 7577- if (!capable(CAP_SYS_ADMIN))
7405+ if (!capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_SECURE_REMOUNT)) 7578+ if (!capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_SECURE_REMOUNT))
7406 return -EPERM; 7579 return -EPERM;
7407 7580
7408 if (!check_mnt(nd->mnt)) 7581 if (!check_mnt(nd->mnt))
7409@@ -946,7 +1024,7 @@ static int do_move_mount(struct nameidat 7582@@ -951,7 +1030,7 @@ static int do_move_mount(struct nameidat
7410 struct nameidata old_nd, parent_nd; 7583 struct nameidata old_nd, parent_nd;
7411 struct vfsmount *p; 7584 struct vfsmount *p;
7412 int err = 0; 7585 int err = 0;
7413- if (!capable(CAP_SYS_ADMIN)) 7586- if (!capable(CAP_SYS_ADMIN))
7414+ if (!capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_SECURE_MOUNT)) 7587+ if (!capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_SECURE_MOUNT))
7415 return -EPERM; 7588 return -EPERM;
7416 if (!old_name || !*old_name) 7589 if (!old_name || !*old_name)
7417 return -EINVAL; 7590 return -EINVAL;
7418@@ -1026,7 +1104,7 @@ static int do_new_mount(struct nameidata 7591@@ -1031,7 +1110,7 @@ static int do_new_mount(struct nameidata
7419 return -EINVAL; 7592 return -EINVAL;
7420 7593
7421 /* we need capabilities... */ 7594 /* we need capabilities... */
7422- if (!capable(CAP_SYS_ADMIN)) 7595- if (!capable(CAP_SYS_ADMIN))
7423+ if (!capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_SECURE_MOUNT)) 7596+ if (!capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_SECURE_MOUNT))
7424 return -EPERM; 7597 return -EPERM;
7425 7598
7426 mnt = do_kern_mount(type, flags, name, data); 7599 mnt = do_kern_mount(type, flags, name, data);
7427@@ -1264,6 +1342,7 @@ long do_mount(char *dev_name, char *dir_ 7600@@ -1269,6 +1348,7 @@ long do_mount(char *dev_name, char *dir_
7428 struct nameidata nd; 7601 struct nameidata nd;
7429 int retval = 0; 7602 int retval = 0;
7430 int mnt_flags = 0; 7603 int mnt_flags = 0;
7431+ tag_t tag = 0; 7604+ tag_t tag = 0;
7432 7605
7433 /* Discard magic */ 7606 /* Discard magic */
7434 if ((flags & MS_MGC_MSK) == MS_MGC_VAL) 7607 if ((flags & MS_MGC_MSK) == MS_MGC_VAL)
7435@@ -1279,15 +1358,34 @@ long do_mount(char *dev_name, char *dir_ 7608@@ -1284,7 +1364,19 @@ long do_mount(char *dev_name, char *dir_
7436 if (data_page) 7609 if (data_page)
7437 ((char *)data_page)[PAGE_SIZE - 1] = 0; 7610 ((char *)data_page)[PAGE_SIZE - 1] = 0;
7438 7611
7439+#ifdef CONFIG_PROPAGATE 7612+#ifdef CONFIG_PROPAGATE
7440+ retval = dx_parse_tag(data_page, &tag, 1); 7613+ retval = dx_parse_tag(data_page, &tag, 1);
7450+ if (flags & MS_RDONLY) 7623+ if (flags & MS_RDONLY)
7451+ mnt_flags |= MNT_RDONLY; 7624+ mnt_flags |= MNT_RDONLY;
7452 if (flags & MS_NOSUID) 7625 if (flags & MS_NOSUID)
7453 mnt_flags |= MNT_NOSUID; 7626 mnt_flags |= MNT_NOSUID;
7454 if (flags & MS_NODEV) 7627 if (flags & MS_NODEV)
7455 mnt_flags |= MNT_NODEV; 7628@@ -1296,6 +1388,8 @@ long do_mount(char *dev_name, char *dir_
7456 if (flags & MS_NOEXEC)
7457 mnt_flags |= MNT_NOEXEC;
7458+ if (flags & MS_NOATIME)
7459+ mnt_flags |= MNT_NOATIME;
7460+ if (flags & MS_NODIRATIME) 7629 if (flags & MS_NODIRATIME)
7461+ mnt_flags |= MNT_NODIRATIME; 7630 mnt_flags |= MNT_NODIRATIME;
7462 flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE);
7463 7631
7464+ if (vx_ccaps(VXC_SECURE_MOUNT)) 7632+ if (vx_ccaps(VXC_SECURE_MOUNT))
7465+ mnt_flags |= MNT_NODEV; 7633+ mnt_flags |= MNT_NODEV;
7466+ 7634 flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE |
7467 /* ... and get the mountpoint */ 7635 MS_NOATIME | MS_NODIRATIME);
7468 retval = path_lookup(dir_name, LOOKUP_FOLLOW, &nd); 7636
7469 if (retval)
7470@@ -1299,9 +1397,9 @@ long do_mount(char *dev_name, char *dir_ 7637@@ -1310,9 +1404,9 @@ long do_mount(char *dev_name, char *dir_
7471 7638
7472 if (flags & MS_REMOUNT) 7639 if (flags & MS_REMOUNT)
7473 retval = do_remount(&nd, flags & ~MS_REMOUNT, mnt_flags, 7640 retval = do_remount(&nd, flags & ~MS_REMOUNT, mnt_flags,
7474- data_page); 7641- data_page);
7475+ data_page, tag); 7642+ data_page, tag);
7477- retval = do_loopback(&nd, dev_name, flags & MS_REC); 7644- retval = do_loopback(&nd, dev_name, flags & MS_REC);
7478+ retval = do_loopback(&nd, dev_name, tag, flags, mnt_flags); 7645+ retval = do_loopback(&nd, dev_name, tag, flags, mnt_flags);
7479 else if (flags & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE)) 7646 else if (flags & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE))
7480 retval = do_change_type(&nd, flags); 7647 retval = do_change_type(&nd, flags);
7481 else if (flags & MS_MOVE) 7648 else if (flags & MS_MOVE)
7482@@ -1330,7 +1428,7 @@ int copy_namespace(int flags, struct tas 7649@@ -1410,7 +1504,7 @@ int copy_namespace(int flags, struct tas
7483 if (!(flags & CLONE_NEWNS)) 7650 if (!(flags & CLONE_NEWNS))
7484 return 0; 7651 return 0;
7485 7652
7486- if (!capable(CAP_SYS_ADMIN)) { 7653- if (!capable(CAP_SYS_ADMIN)) {
7487+ if (!capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_SECURE_MOUNT)) { 7654+ if (!capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_SECURE_MOUNT)) {
7488 put_namespace(namespace);
7489 return -EPERM; 7655 err = -EPERM;
7656 goto out;
7490 } 7657 }
7491diff -NurpP --minimal linux-2.6.15.6/fs/nfs/dir.c linux-2.6.15.6-vs2.1.1-rc13/fs/nfs/dir.c 7658Index: linux-2.6.16/fs/nfs/dir.c
7492--- linux-2.6.15.6/fs/nfs/dir.c 2006-01-03 17:29:57 +0100 7659===================================================================
7493+++ linux-2.6.15.6-vs2.1.1-rc13/fs/nfs/dir.c 2006-02-14 11:37:05 +0100 7660--- linux-2.6.16.orig/fs/nfs/dir.c
7661+++ linux-2.6.16/fs/nfs/dir.c
7494@@ -28,9 +28,11 @@ 7662@@ -28,9 +28,11 @@
7495 #include <linux/sunrpc/clnt.h> 7663 #include <linux/sunrpc/clnt.h>
7496 #include <linux/nfs_fs.h> 7664 #include <linux/nfs_fs.h>
7497 #include <linux/nfs_mount.h> 7665 #include <linux/nfs_mount.h>
7498+#include <linux/mount.h> 7666+#include <linux/mount.h>
7519+ if ((IS_RDONLY(dir) || MNT_IS_RDONLY(nd->mnt)) && 7687+ if ((IS_RDONLY(dir) || MNT_IS_RDONLY(nd->mnt)) &&
7520+ (nd->intent.open.flags & (O_CREAT|O_TRUNC|FMODE_WRITE))) 7688+ (nd->intent.open.flags & (O_CREAT|O_TRUNC|FMODE_WRITE)))
7521 return 0; 7689 return 0;
7522 return 1; 7690 return 1;
7523 } 7691 }
7524diff -NurpP --minimal linux-2.6.15.6/fs/nfs/inode.c linux-2.6.15.6-vs2.1.1-rc13/fs/nfs/inode.c 7692Index: linux-2.6.16/fs/nfs/inode.c
7525--- linux-2.6.15.6/fs/nfs/inode.c 2006-01-03 17:29:57 +0100 7693===================================================================
7526+++ linux-2.6.15.6-vs2.1.1-rc13/fs/nfs/inode.c 2006-02-13 05:42:02 +0100 7694--- linux-2.6.16.orig/fs/nfs/inode.c
7695+++ linux-2.6.16/fs/nfs/inode.c
7527@@ -35,6 +35,7 @@ 7696@@ -35,6 +35,7 @@
7528 #include <linux/mount.h> 7697 #include <linux/mount.h>
7529 #include <linux/nfs_idmap.h> 7698 #include <linux/nfs_idmap.h>
7530 #include <linux/vfs.h> 7699 #include <linux/vfs.h>
7531+#include <linux/vserver/tag.h> 7700+#include <linux/vserver/tag.h>
7532 7701
7533 #include <asm/system.h> 7702 #include <asm/system.h>
7534 #include <asm/uaccess.h> 7703 #include <asm/uaccess.h>
7535@@ -340,12 +341,16 @@ nfs_sb_init(struct super_block *sb, rpc_ 7704@@ -336,12 +337,16 @@ nfs_sb_init(struct super_block *sb, rpc_
7536 } 7705 }
7537 server->backing_dev_info.ra_pages = server->rpages * NFS_MAX_READAHEAD; 7706 server->backing_dev_info.ra_pages = server->rpages * NFS_MAX_READAHEAD;
7538 7707
7539+ if (server->flags & NFS_MOUNT_TAGGED) 7708+ if (server->flags & NFS_MOUNT_TAGGED)
7540+ sb->s_flags |= MS_TAGGED; 7709+ sb->s_flags |= MS_TAGGED;
7547 server->client->cl_softrtry = (server->flags & NFS_MOUNT_SOFT) ? 1 : 0; 7716 server->client->cl_softrtry = (server->flags & NFS_MOUNT_SOFT) ? 1 : 0;
7548+ server->client->cl_tag = (server->flags & NFS_MOUNT_TAGGED) ? 1 : 0; 7717+ server->client->cl_tag = (server->flags & NFS_MOUNT_TAGGED) ? 1 : 0;
7549 7718
7550 /* We're airborne Set socket buffersize */ 7719 /* We're airborne Set socket buffersize */
7551 rpc_setbufsize(server->client, server->wsize + 100, server->rsize + 100); 7720 rpc_setbufsize(server->client, server->wsize + 100, server->rsize + 100);
7552@@ -417,6 +422,7 @@ nfs_create_client(struct nfs_server *ser 7721@@ -413,6 +418,7 @@ nfs_create_client(struct nfs_server *ser
7553 7722
7554 clnt->cl_intr = 1; 7723 clnt->cl_intr = 1;
7555 clnt->cl_softrtry = 1; 7724 clnt->cl_softrtry = 1;
7556+ clnt->cl_tag = 1; 7725+ clnt->cl_tag = 1;
7557 clnt->cl_chatty = 1;
7558 7726
7559 return clnt; 7727 return clnt;
7728
7560@@ -599,6 +605,7 @@ static int nfs_show_options(struct seq_f 7729@@ -593,6 +599,7 @@ static int nfs_show_options(struct seq_f
7561 { NFS_MOUNT_NOAC, ",noac", "" }, 7730 { NFS_MOUNT_NOAC, ",noac", "" },
7562 { NFS_MOUNT_NONLM, ",nolock", ",lock" }, 7731 { NFS_MOUNT_NONLM, ",nolock", ",lock" },
7563 { NFS_MOUNT_NOACL, ",noacl", "" }, 7732 { NFS_MOUNT_NOACL, ",noacl", "" },
7564+ { NFS_MOUNT_TAGGED, ",tag", "" }, 7733+ { NFS_MOUNT_TAGGED, ",tag", "" },
7565 { 0, NULL, NULL } 7734 { 0, NULL, NULL }
7566 }; 7735 };
7567 struct proc_nfs_info *nfs_infop; 7736 struct proc_nfs_info *nfs_infop;
7568@@ -814,8 +821,10 @@ nfs_fhget(struct super_block *sb, struct 7737@@ -805,8 +812,10 @@ nfs_fhget(struct super_block *sb, struct
7569 nfsi->change_attr = fattr->change_attr; 7738 nfsi->change_attr = fattr->change_attr;
7570 inode->i_size = nfs_size_to_loff_t(fattr->size); 7739 inode->i_size = nfs_size_to_loff_t(fattr->size);
7571 inode->i_nlink = fattr->nlink; 7740 inode->i_nlink = fattr->nlink;
7572- inode->i_uid = fattr->uid; 7741- inode->i_uid = fattr->uid;
7573- inode->i_gid = fattr->gid; 7742- inode->i_gid = fattr->gid;
7576+ inode->i_tag = INOTAG_TAG(DX_TAG(inode), fattr->uid, fattr->gid, 0); 7745+ inode->i_tag = INOTAG_TAG(DX_TAG(inode), fattr->uid, fattr->gid, 0);
7577+ /* maybe fattr->xid someday */ 7746+ /* maybe fattr->xid someday */
7578 if (fattr->valid & (NFS_ATTR_FATTR_V3 | NFS_ATTR_FATTR_V4)) { 7747 if (fattr->valid & (NFS_ATTR_FATTR_V3 | NFS_ATTR_FATTR_V4)) {
7579 /* 7748 /*
7580 * report the blocks in 512byte units 7749 * report the blocks in 512byte units
7581@@ -907,6 +916,8 @@ void nfs_setattr_update_inode(struct ino 7750@@ -897,6 +906,8 @@ void nfs_setattr_update_inode(struct ino
7582 inode->i_uid = attr->ia_uid; 7751 inode->i_uid = attr->ia_uid;
7583 if ((attr->ia_valid & ATTR_GID) != 0) 7752 if ((attr->ia_valid & ATTR_GID) != 0)
7584 inode->i_gid = attr->ia_gid; 7753 inode->i_gid = attr->ia_gid;
7585+ if ((attr->ia_valid & ATTR_TAG) && IS_TAGGED(inode)) 7754+ if ((attr->ia_valid & ATTR_TAG) && IS_TAGGED(inode))
7586+ inode->i_tag = attr->ia_tag; 7755+ inode->i_tag = attr->ia_tag;
7587 spin_lock(&inode->i_lock); 7756 spin_lock(&inode->i_lock);
7588 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL; 7757 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL;
7589 spin_unlock(&inode->i_lock); 7758 spin_unlock(&inode->i_lock);
7590@@ -1266,6 +1277,9 @@ static int nfs_check_inode_attributes(st 7759@@ -1294,6 +1305,9 @@ static int nfs_check_inode_attributes(st
7591 struct nfs_inode *nfsi = NFS_I(inode); 7760 struct nfs_inode *nfsi = NFS_I(inode);
7592 loff_t cur_size, new_isize; 7761 loff_t cur_size, new_isize;
7593 int data_unstable; 7762 int data_unstable;
7594+ uid_t uid; 7763+ uid_t uid;
7595+ gid_t gid; 7764+ gid_t gid;
7596+ tag_t tag; 7765+ tag_t tag;
7597 7766
7598 7767
7599 /* Are we in the process of updating data on the server? */ 7768 if ((fattr->valid & NFS_ATTR_FATTR) == 0)
7600@@ -1315,10 +1329,15 @@ static int nfs_check_inode_attributes(st 7769@@ -1333,10 +1347,15 @@ static int nfs_check_inode_attributes(st
7601 nfsi->cache_validity |= NFS_INO_REVAL_PAGECACHE; 7770 nfsi->cache_validity |= NFS_INO_REVAL_PAGECACHE;
7602 } 7771 }
7603 7772
7604+ uid = INOTAG_UID(DX_TAG(inode), fattr->uid, fattr->gid); 7773+ uid = INOTAG_UID(DX_TAG(inode), fattr->uid, fattr->gid);
7605+ gid = INOTAG_GID(DX_TAG(inode), fattr->uid, fattr->gid); 7774+ gid = INOTAG_GID(DX_TAG(inode), fattr->uid, fattr->gid);
7613+ || inode->i_gid != gid 7782+ || inode->i_gid != gid
7614+ || inode->i_tag != tag) 7783+ || inode->i_tag != tag)
7615 nfsi->cache_validity |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL; 7784 nfsi->cache_validity |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL;
7616 7785
7617 /* Has the link count changed? */ 7786 /* Has the link count changed? */
7618@@ -1402,6 +1421,9 @@ static int nfs_update_inode(struct inode 7787@@ -1420,6 +1439,9 @@ static int nfs_update_inode(struct inode
7619 loff_t cur_isize, new_isize; 7788 loff_t cur_isize, new_isize;
7620 unsigned int invalid = 0; 7789 unsigned int invalid = 0;
7621 int data_stable; 7790 int data_stable;
7622+ uid_t uid; 7791+ uid_t uid;
7623+ gid_t gid; 7792+ gid_t gid;
7624+ tag_t tag; 7793+ tag_t tag;
7625 7794
7626 dfprintk(VFS, "NFS: %s(%s/%ld ct=%d info=0x%x)\n", 7795 dfprintk(VFS, "NFS: %s(%s/%ld ct=%d info=0x%x)\n",
7627 __FUNCTION__, inode->i_sb->s_id, inode->i_ino, 7796 __FUNCTION__, inode->i_sb->s_id, inode->i_ino,
7628@@ -1483,15 +1505,21 @@ static int nfs_update_inode(struct inode 7797@@ -1498,15 +1520,21 @@ static int nfs_update_inode(struct inode
7629 } 7798 }
7630 memcpy(&inode->i_atime, &fattr->atime, sizeof(inode->i_atime)); 7799 memcpy(&inode->i_atime, &fattr->atime, sizeof(inode->i_atime));
7631 7800
7632+ uid = INOTAG_UID(DX_TAG(inode), fattr->uid, fattr->gid); 7801+ uid = INOTAG_UID(DX_TAG(inode), fattr->uid, fattr->gid);
7633+ gid = INOTAG_GID(DX_TAG(inode), fattr->uid, fattr->gid); 7802+ gid = INOTAG_GID(DX_TAG(inode), fattr->uid, fattr->gid);
7649+ inode->i_gid = gid; 7818+ inode->i_gid = gid;
7650+ inode->i_tag = tag; 7819+ inode->i_tag = tag;
7651 7820
7652 if (fattr->valid & (NFS_ATTR_FATTR_V3 | NFS_ATTR_FATTR_V4)) { 7821 if (fattr->valid & (NFS_ATTR_FATTR_V3 | NFS_ATTR_FATTR_V4)) {
7653 /* 7822 /*
7654diff -NurpP --minimal linux-2.6.15.6/fs/nfs/nfs3xdr.c linux-2.6.15.6-vs2.1.1-rc13/fs/nfs/nfs3xdr.c 7823Index: linux-2.6.16/fs/nfs/nfs3xdr.c
7655--- linux-2.6.15.6/fs/nfs/nfs3xdr.c 2006-01-03 17:29:57 +0100 7824===================================================================
7656+++ linux-2.6.15.6-vs2.1.1-rc13/fs/nfs/nfs3xdr.c 2006-02-13 05:26:55 +0100 7825--- linux-2.6.16.orig/fs/nfs/nfs3xdr.c
7826+++ linux-2.6.16/fs/nfs/nfs3xdr.c
7657@@ -22,6 +22,7 @@ 7827@@ -22,6 +22,7 @@
7658 #include <linux/nfs3.h> 7828 #include <linux/nfs3.h>
7659 #include <linux/nfs_fs.h> 7829 #include <linux/nfs_fs.h>
7660 #include <linux/nfsacl.h> 7830 #include <linux/nfsacl.h>
7661+#include <linux/vserver/tag.h> 7831+#include <linux/vserver/tag.h>
7741+ p = xdr_encode_sattr(p, args->sattr, 7911+ p = xdr_encode_sattr(p, args->sattr,
7742+ req->rq_task->tk_client->cl_tag); 7912+ req->rq_task->tk_client->cl_tag);
7743 if (args->type == NF3CHR || args->type == NF3BLK) { 7913 if (args->type == NF3CHR || args->type == NF3BLK) {
7744 *p++ = htonl(MAJOR(args->rdev)); 7914 *p++ = htonl(MAJOR(args->rdev));
7745 *p++ = htonl(MINOR(args->rdev)); 7915 *p++ = htonl(MINOR(args->rdev));
7746diff -NurpP --minimal linux-2.6.15.6/fs/nfs/nfsroot.c linux-2.6.15.6-vs2.1.1-rc13/fs/nfs/nfsroot.c 7916Index: linux-2.6.16/fs/nfs/nfsroot.c
7747--- linux-2.6.15.6/fs/nfs/nfsroot.c 2005-08-29 22:25:32 +0200 7917===================================================================
7748+++ linux-2.6.15.6-vs2.1.1-rc13/fs/nfs/nfsroot.c 2006-02-13 05:26:55 +0100 7918--- linux-2.6.16.orig/fs/nfs/nfsroot.c
7919+++ linux-2.6.16/fs/nfs/nfsroot.c
7749@@ -87,6 +87,7 @@ 7920@@ -87,6 +87,7 @@
7750 #include <linux/root_dev.h> 7921 #include <linux/root_dev.h>
7751 #include <net/ipconfig.h> 7922 #include <net/ipconfig.h>
7752 #include <linux/parser.h> 7923 #include <linux/parser.h>
7753+#include <linux/vs_cvirt.h> 7924+#include <linux/vs_cvirt.h>
7796+ case Opt_tagid: 7967+ case Opt_tagid:
7797+ /* use args[0] */ 7968+ /* use args[0] */
7798+ nfs_data.flags |= NFS_MOUNT_TAGGED; 7969+ nfs_data.flags |= NFS_MOUNT_TAGGED;
7799+ break; 7970+ break;
7800+#endif 7971+#endif
7801 default : 7972 default:
7802 return 0; 7973 printk(KERN_WARNING "Root-NFS: unknown "
7803 } 7974 "option: %s\n", p);
7804@@ -310,7 +329,7 @@ static int __init root_nfs_name(char *na 7975@@ -312,7 +331,7 @@ static int __init root_nfs_name(char *na
7805 /* Override them by options set on kernel command-line */ 7976 /* Override them by options set on kernel command-line */
7806 root_nfs_parse(name, buf); 7977 root_nfs_parse(name, buf);
7807 7978
7808- cp = system_utsname.nodename; 7979- cp = system_utsname.nodename;
7809+ cp = vx_new_uts(nodename); 7980+ cp = vx_new_uts(nodename);
7810 if (strlen(buf) + strlen(cp) > NFS_MAXPATHLEN) { 7981 if (strlen(buf) + strlen(cp) > NFS_MAXPATHLEN) {
7811 printk(KERN_ERR "Root-NFS: Pathname for remote directory too long.\n"); 7982 printk(KERN_ERR "Root-NFS: Pathname for remote directory too long.\n");
7812 return -1; 7983 return -1;
7813diff -NurpP --minimal linux-2.6.15.6/fs/nfsd/auth.c linux-2.6.15.6-vs2.1.1-rc13/fs/nfsd/auth.c 7984Index: linux-2.6.16/fs/nfsd/auth.c
7814--- linux-2.6.15.6/fs/nfsd/auth.c 2004-08-14 12:56:14 +0200 7985===================================================================
7815+++ linux-2.6.15.6-vs2.1.1-rc13/fs/nfsd/auth.c 2006-02-13 05:42:02 +0100 7986--- linux-2.6.16.orig/fs/nfsd/auth.c
7987+++ linux-2.6.16/fs/nfsd/auth.c
7816@@ -9,6 +9,7 @@ 7988@@ -9,6 +9,7 @@
7817 #include <linux/sunrpc/svc.h> 7989 #include <linux/sunrpc/svc.h>
7818 #include <linux/sunrpc/svcauth.h> 7990 #include <linux/sunrpc/svcauth.h>
7819 #include <linux/nfsd/nfsd.h> 7991 #include <linux/nfsd/nfsd.h>
7820+#include <linux/vserver/tag.h> 7992+#include <linux/vserver/tag.h>
7844- if ((cred->cr_uid)) { 8016- if ((cred->cr_uid)) {
7845+ if (INOTAG_UID(DX_TAG_NFSD, cred->cr_uid, cred->cr_gid)) { 8017+ if (INOTAG_UID(DX_TAG_NFSD, cred->cr_uid, cred->cr_gid)) {
7846 cap_t(current->cap_effective) &= ~CAP_NFSD_MASK; 8018 cap_t(current->cap_effective) &= ~CAP_NFSD_MASK;
7847 } else { 8019 } else {
7848 cap_t(current->cap_effective) |= (CAP_NFSD_MASK & 8020 cap_t(current->cap_effective) |= (CAP_NFSD_MASK &
7849diff -NurpP --minimal linux-2.6.15.6/fs/nfsd/nfs3xdr.c linux-2.6.15.6-vs2.1.1-rc13/fs/nfsd/nfs3xdr.c 8021Index: linux-2.6.16/fs/nfsd/nfs3xdr.c
7850--- linux-2.6.15.6/fs/nfsd/nfs3xdr.c 2006-01-03 17:29:58 +0100 8022===================================================================
7851+++ linux-2.6.15.6-vs2.1.1-rc13/fs/nfsd/nfs3xdr.c 2006-02-13 05:43:10 +0100 8023--- linux-2.6.16.orig/fs/nfsd/nfs3xdr.c
8024+++ linux-2.6.16/fs/nfsd/nfs3xdr.c
7852@@ -21,6 +21,7 @@ 8025@@ -21,6 +21,7 @@
7853 #include <linux/sunrpc/svc.h> 8026 #include <linux/sunrpc/svc.h>
7854 #include <linux/nfsd/nfsd.h> 8027 #include <linux/nfsd/nfsd.h>
7855 #include <linux/nfsd/xdr3.h> 8028 #include <linux/nfsd/xdr3.h>
7856+#include <linux/vserver/tag.h> 8029+#include <linux/vserver/tag.h>
7882+ iap->ia_gid = INOTAG_GID(DX_TAG_NFSD, uid, gid); 8055+ iap->ia_gid = INOTAG_GID(DX_TAG_NFSD, uid, gid);
7883+ iap->ia_tag = INOTAG_TAG(DX_TAG_NFSD, uid, gid, 0); 8056+ iap->ia_tag = INOTAG_TAG(DX_TAG_NFSD, uid, gid, 0);
7884 if (*p++) { 8057 if (*p++) {
7885 u64 newsize; 8058 u64 newsize;
7886 8059
7887@@ -166,8 +172,10 @@ encode_fattr3(struct svc_rqst *rqstp, u3 8060@@ -163,8 +169,10 @@ encode_fattr3(struct svc_rqst *rqstp, u3
7888 *p++ = htonl(nfs3_ftypes[(stat.mode & S_IFMT) >> 12]); 8061 *p++ = htonl(nfs3_ftypes[(stat->mode & S_IFMT) >> 12]);
7889 *p++ = htonl((u32) stat.mode); 8062 *p++ = htonl((u32) stat->mode);
7890 *p++ = htonl((u32) stat.nlink); 8063 *p++ = htonl((u32) stat->nlink);
7891- *p++ = htonl((u32) nfsd_ruid(rqstp, stat.uid)); 8064- *p++ = htonl((u32) nfsd_ruid(rqstp, stat->uid));
7892- *p++ = htonl((u32) nfsd_rgid(rqstp, stat.gid)); 8065- *p++ = htonl((u32) nfsd_rgid(rqstp, stat->gid));
7893+ *p++ = htonl((u32) nfsd_ruid(rqstp, 8066+ *p++ = htonl((u32) nfsd_ruid(rqstp,
7894+ TAGINO_UID(DX_TAG(dentry->d_inode), stat.uid, stat.tag))); 8067+ TAGINO_UID(DX_TAG(dentry->d_inode), stat->uid, stat->tag)));
7895+ *p++ = htonl((u32) nfsd_rgid(rqstp, 8068+ *p++ = htonl((u32) nfsd_rgid(rqstp,
7896+ TAGINO_GID(DX_TAG(dentry->d_inode), stat.gid, stat.tag))); 8069+ TAGINO_GID(DX_TAG(dentry->d_inode), stat->gid, stat->tag)));
7897 if (S_ISLNK(stat.mode) && stat.size > NFS3_MAXPATHLEN) { 8070 if (S_ISLNK(stat->mode) && stat->size > NFS3_MAXPATHLEN) {
7898 p = xdr_encode_hyper(p, (u64) NFS3_MAXPATHLEN); 8071 p = xdr_encode_hyper(p, (u64) NFS3_MAXPATHLEN);
7899 } else { 8072 } else {
7900diff -NurpP --minimal linux-2.6.15.6/fs/nfsd/nfs4recover.c linux-2.6.15.6-vs2.1.1-rc13/fs/nfsd/nfs4recover.c 8073Index: linux-2.6.16/fs/nfsd/nfs4recover.c
7901--- linux-2.6.15.6/fs/nfsd/nfs4recover.c 2005-10-28 20:49:44 +0200 8074===================================================================
7902+++ linux-2.6.15.6-vs2.1.1-rc13/fs/nfsd/nfs4recover.c 2006-02-13 07:30:05 +0100 8075--- linux-2.6.16.orig/fs/nfsd/nfs4recover.c
8076+++ linux-2.6.16/fs/nfsd/nfs4recover.c
7903@@ -155,7 +155,7 @@ nfsd4_create_clid_dir(struct nfs4_client 8077@@ -155,7 +155,7 @@ nfsd4_create_clid_dir(struct nfs4_client
7904 dprintk("NFSD: nfsd4_create_clid_dir: DIRECTORY EXISTS\n"); 8078 dprintk("NFSD: nfsd4_create_clid_dir: DIRECTORY EXISTS\n");
7905 goto out_put; 8079 goto out_put;
7906 } 8080 }
7907- status = vfs_mkdir(rec_dir.dentry->d_inode, dentry, S_IRWXU); 8081- status = vfs_mkdir(rec_dir.dentry->d_inode, dentry, S_IRWXU);
7908+ status = vfs_mkdir(rec_dir.dentry->d_inode, dentry, S_IRWXU, NULL); 8082+ status = vfs_mkdir(rec_dir.dentry->d_inode, dentry, S_IRWXU, NULL);
7909 out_put: 8083 out_put:
7910 dput(dentry); 8084 dput(dentry);
7911 out_unlock: 8085 out_unlock:
7912@@ -260,7 +260,7 @@ nfsd4_remove_clid_file(struct dentry *di 8086@@ -259,7 +259,7 @@ nfsd4_remove_clid_file(struct dentry *di
7913 return -EINVAL; 8087 return -EINVAL;
7914 } 8088 }
7915 down(&dir->d_inode->i_sem); 8089 mutex_lock(&dir->d_inode->i_mutex);
7916- status = vfs_unlink(dir->d_inode, dentry); 8090- status = vfs_unlink(dir->d_inode, dentry);
7917+ status = vfs_unlink(dir->d_inode, dentry, NULL); 8091+ status = vfs_unlink(dir->d_inode, dentry, NULL);
7918 up(&dir->d_inode->i_sem); 8092 mutex_unlock(&dir->d_inode->i_mutex);
7919 return status; 8093 return status;
7920 } 8094 }
7921@@ -275,7 +275,7 @@ nfsd4_clear_clid_dir(struct dentry *dir, 8095@@ -274,7 +274,7 @@ nfsd4_clear_clid_dir(struct dentry *dir,
7922 * a kernel from the future.... */ 8096 * a kernel from the future.... */
7923 nfsd4_list_rec_dir(dentry, nfsd4_remove_clid_file); 8097 nfsd4_list_rec_dir(dentry, nfsd4_remove_clid_file);
7924 down(&dir->d_inode->i_sem); 8098 mutex_lock(&dir->d_inode->i_mutex);
7925- status = vfs_rmdir(dir->d_inode, dentry); 8099- status = vfs_rmdir(dir->d_inode, dentry);
7926+ status = vfs_rmdir(dir->d_inode, dentry, NULL); 8100+ status = vfs_rmdir(dir->d_inode, dentry, NULL);
7927 up(&dir->d_inode->i_sem); 8101 mutex_unlock(&dir->d_inode->i_mutex);
7928 return status; 8102 return status;
7929 } 8103 }
7930diff -NurpP --minimal linux-2.6.15.6/fs/nfsd/nfs4xdr.c linux-2.6.15.6-vs2.1.1-rc13/fs/nfsd/nfs4xdr.c 8104Index: linux-2.6.16/fs/nfsd/nfs4xdr.c
7931--- linux-2.6.15.6/fs/nfsd/nfs4xdr.c 2006-01-03 17:29:58 +0100 8105===================================================================
7932+++ linux-2.6.15.6-vs2.1.1-rc13/fs/nfsd/nfs4xdr.c 2006-02-13 05:42:02 +0100 8106--- linux-2.6.16.orig/fs/nfsd/nfs4xdr.c
8107+++ linux-2.6.16/fs/nfsd/nfs4xdr.c
7933@@ -57,6 +57,7 @@ 8108@@ -57,6 +57,7 @@
7934 #include <linux/nfsd_idmap.h> 8109 #include <linux/nfsd_idmap.h>
7935 #include <linux/nfs4.h> 8110 #include <linux/nfs4.h>
7936 #include <linux/nfs4_acl.h> 8111 #include <linux/nfs4_acl.h>
7937+#include <linux/vserver/tag.h> 8112+#include <linux/vserver/tag.h>
7957+ TAGINO_GID(DX_TAG(dentry->d_inode), 8132+ TAGINO_GID(DX_TAG(dentry->d_inode),
7958+ stat.gid, stat.tag), &p, &buflen); 8133+ stat.gid, stat.tag), &p, &buflen);
7959 if (status == nfserr_resource) 8134 if (status == nfserr_resource)
7960 goto out_resource; 8135 goto out_resource;
7961 if (status) 8136 if (status)
7962diff -NurpP --minimal linux-2.6.15.6/fs/nfsd/nfsxdr.c linux-2.6.15.6-vs2.1.1-rc13/fs/nfsd/nfsxdr.c 8137Index: linux-2.6.16/fs/nfsd/nfsxdr.c
7963--- linux-2.6.15.6/fs/nfsd/nfsxdr.c 2005-08-29 22:25:32 +0200 8138===================================================================
7964+++ linux-2.6.15.6-vs2.1.1-rc13/fs/nfsd/nfsxdr.c 2006-02-13 05:44:11 +0100 8139--- linux-2.6.16.orig/fs/nfsd/nfsxdr.c
8140+++ linux-2.6.16/fs/nfsd/nfsxdr.c
7965@@ -15,6 +15,7 @@ 8141@@ -15,6 +15,7 @@
7966 #include <linux/nfsd/nfsd.h> 8142 #include <linux/nfsd/nfsd.h>
7967 #include <linux/nfsd/xdr.h> 8143 #include <linux/nfsd/xdr.h>
7968 #include <linux/mm.h> 8144 #include <linux/mm.h>
7969+#include <linux/vserver/tag.h> 8145+#include <linux/vserver/tag.h>
7995+ iap->ia_gid = INOTAG_GID(DX_TAG_NFSD, uid, gid); 8171+ iap->ia_gid = INOTAG_GID(DX_TAG_NFSD, uid, gid);
7996+ iap->ia_tag = INOTAG_TAG(DX_TAG_NFSD, uid, gid, 0); 8172+ iap->ia_tag = INOTAG_TAG(DX_TAG_NFSD, uid, gid, 0);
7997 if ((tmp = ntohl(*p++)) != (u32)-1) { 8173 if ((tmp = ntohl(*p++)) != (u32)-1) {
7998 iap->ia_valid |= ATTR_SIZE; 8174 iap->ia_valid |= ATTR_SIZE;
7999 iap->ia_size = tmp; 8175 iap->ia_size = tmp;
8000@@ -166,8 +172,10 @@ encode_fattr(struct svc_rqst *rqstp, u32 8176@@ -164,8 +170,10 @@ encode_fattr(struct svc_rqst *rqstp, u32
8001 *p++ = htonl(nfs_ftypes[type >> 12]); 8177 *p++ = htonl(nfs_ftypes[type >> 12]);
8002 *p++ = htonl((u32) stat.mode); 8178 *p++ = htonl((u32) stat->mode);
8003 *p++ = htonl((u32) stat.nlink); 8179 *p++ = htonl((u32) stat->nlink);
8004- *p++ = htonl((u32) nfsd_ruid(rqstp, stat.uid)); 8180- *p++ = htonl((u32) nfsd_ruid(rqstp, stat->uid));
8005- *p++ = htonl((u32) nfsd_rgid(rqstp, stat.gid)); 8181- *p++ = htonl((u32) nfsd_rgid(rqstp, stat->gid));
8006+ *p++ = htonl((u32) nfsd_ruid(rqstp, 8182+ *p++ = htonl((u32) nfsd_ruid(rqstp,
8007+ TAGINO_UID(DX_TAG(dentry->d_inode), stat.uid, stat.tag))); 8183+ TAGINO_UID(DX_TAG(dentry->d_inode), stat->uid, stat->tag)));
8008+ *p++ = htonl((u32) nfsd_rgid(rqstp, 8184+ *p++ = htonl((u32) nfsd_rgid(rqstp,
8009+ TAGINO_GID(DX_TAG(dentry->d_inode), stat.gid, stat.tag))); 8185+ TAGINO_GID(DX_TAG(dentry->d_inode), stat->gid, stat->tag)));
8010 8186
8011 if (S_ISLNK(type) && stat.size > NFS_MAXPATHLEN) { 8187 if (S_ISLNK(type) && stat->size > NFS_MAXPATHLEN) {
8012 *p++ = htonl(NFS_MAXPATHLEN); 8188 *p++ = htonl(NFS_MAXPATHLEN);
8013diff -NurpP --minimal linux-2.6.15.6/fs/nfsd/vfs.c linux-2.6.15.6-vs2.1.1-rc13/fs/nfsd/vfs.c 8189Index: linux-2.6.16/fs/nfsd/vfs.c
8014--- linux-2.6.15.6/fs/nfsd/vfs.c 2006-01-03 17:29:58 +0100 8190===================================================================
8015+++ linux-2.6.15.6-vs2.1.1-rc13/fs/nfsd/vfs.c 2006-01-04 21:59:59 +0100 8191--- linux-2.6.16.orig/fs/nfsd/vfs.c
8192+++ linux-2.6.16/fs/nfsd/vfs.c
8016@@ -1161,13 +1161,13 @@ nfsd_create(struct svc_rqst *rqstp, stru 8193@@ -1160,13 +1160,13 @@ nfsd_create(struct svc_rqst *rqstp, stru
8017 err = vfs_create(dirp, dchild, iap->ia_mode, NULL); 8194 err = vfs_create(dirp, dchild, iap->ia_mode, NULL);
8018 break; 8195 break;
8019 case S_IFDIR: 8196 case S_IFDIR:
8020- err = vfs_mkdir(dirp, dchild, iap->ia_mode); 8197- err = vfs_mkdir(dirp, dchild, iap->ia_mode);
8021+ err = vfs_mkdir(dirp, dchild, iap->ia_mode, NULL); 8198+ err = vfs_mkdir(dirp, dchild, iap->ia_mode, NULL);
8027- err = vfs_mknod(dirp, dchild, iap->ia_mode, rdev); 8204- err = vfs_mknod(dirp, dchild, iap->ia_mode, rdev);
8028+ err = vfs_mknod(dirp, dchild, iap->ia_mode, rdev, NULL); 8205+ err = vfs_mknod(dirp, dchild, iap->ia_mode, rdev, NULL);
8029 break; 8206 break;
8030 default: 8207 default:
8031 printk("nfsd: bad file type %o in nfsd_create\n", type); 8208 printk("nfsd: bad file type %o in nfsd_create\n", type);
8032@@ -1443,11 +1443,13 @@ nfsd_symlink(struct svc_rqst *rqstp, str 8209@@ -1446,11 +1446,13 @@ nfsd_symlink(struct svc_rqst *rqstp, str
8033 else { 8210 else {
8034 strncpy(path_alloced, path, plen); 8211 strncpy(path_alloced, path, plen);
8035 path_alloced[plen] = 0; 8212 path_alloced[plen] = 0;
8036- err = vfs_symlink(dentry->d_inode, dnew, path_alloced, mode); 8213- err = vfs_symlink(dentry->d_inode, dnew, path_alloced, mode);
8037+ err = vfs_symlink(dentry->d_inode, dnew, 8214+ err = vfs_symlink(dentry->d_inode, dnew,
8041 } else 8218 } else
8042- err = vfs_symlink(dentry->d_inode, dnew, path, mode); 8219- err = vfs_symlink(dentry->d_inode, dnew, path, mode);
8043+ err = vfs_symlink(dentry->d_inode, dnew, 8220+ err = vfs_symlink(dentry->d_inode, dnew,
8044+ path, mode, NULL); 8221+ path, mode, NULL);
8045 8222
8046 if (!err) { 8223 if (!err)
8047 if (EX_ISSYNC(fhp->fh_export)) 8224 if (EX_ISSYNC(fhp->fh_export))
8048@@ -1505,7 +1507,7 @@ nfsd_link(struct svc_rqst *rqstp, struct 8225@@ -1508,7 +1510,7 @@ nfsd_link(struct svc_rqst *rqstp, struct
8049 dold = tfhp->fh_dentry; 8226 dold = tfhp->fh_dentry;
8050 dest = dold->d_inode; 8227 dest = dold->d_inode;
8051 8228
8052- err = vfs_link(dold, dirp, dnew); 8229- err = vfs_link(dold, dirp, dnew);
8053+ err = vfs_link(dold, dirp, dnew, NULL); 8230+ err = vfs_link(dold, dirp, dnew, NULL);
8054 if (!err) { 8231 if (!err) {
8055 if (EX_ISSYNC(ffhp->fh_export)) { 8232 if (EX_ISSYNC(ffhp->fh_export)) {
8056 nfsd_sync_dir(ddir); 8233 err = nfserrno(nfsd_sync_dir(ddir));
8057@@ -1666,9 +1668,9 @@ nfsd_unlink(struct svc_rqst *rqstp, stru 8234@@ -1670,9 +1672,9 @@ nfsd_unlink(struct svc_rqst *rqstp, stru
8058 err = nfserr_perm; 8235 err = -EPERM;
8059 } else 8236 } else
8060 #endif 8237 #endif
8061- err = vfs_unlink(dirp, rdentry); 8238- err = vfs_unlink(dirp, rdentry);
8062+ err = vfs_unlink(dirp, rdentry, NULL); 8239+ err = vfs_unlink(dirp, rdentry, NULL);
8063 } else { /* It's RMDIR */ 8240 } else { /* It's RMDIR */
8064- err = vfs_rmdir(dirp, rdentry); 8241- err = vfs_rmdir(dirp, rdentry);
8065+ err = vfs_rmdir(dirp, rdentry, NULL); 8242+ err = vfs_rmdir(dirp, rdentry, NULL);
8066 } 8243 }
8067 8244
8068 dput(rdentry); 8245 dput(rdentry);
8069@@ -1780,7 +1782,8 @@ nfsd_permission(struct svc_export *exp, 8246@@ -1781,7 +1783,8 @@ nfsd_permission(struct svc_export *exp,
8070 */ 8247 */
8071 if (!(acc & MAY_LOCAL_ACCESS)) 8248 if (!(acc & MAY_LOCAL_ACCESS))
8072 if (acc & (MAY_WRITE | MAY_SATTR | MAY_TRUNC)) { 8249 if (acc & (MAY_WRITE | MAY_SATTR | MAY_TRUNC)) {
8073- if (EX_RDONLY(exp) || IS_RDONLY(inode)) 8250- if (EX_RDONLY(exp) || IS_RDONLY(inode))
8074+ if (EX_RDONLY(exp) || IS_RDONLY(inode) 8251+ if (EX_RDONLY(exp) || IS_RDONLY(inode)
8075+ || MNT_IS_RDONLY(exp->ex_mnt)) 8252+ || MNT_IS_RDONLY(exp->ex_mnt))
8076 return nfserr_rofs; 8253 return nfserr_rofs;
8077 if (/* (acc & MAY_WRITE) && */ IS_IMMUTABLE(inode)) 8254 if (/* (acc & MAY_WRITE) && */ IS_IMMUTABLE(inode))
8078 return nfserr_perm; 8255 return nfserr_perm;
8079diff -NurpP --minimal linux-2.6.15.6/fs/open.c linux-2.6.15.6-vs2.1.1-rc13/fs/open.c 8256Index: linux-2.6.16/fs/open.c
8080--- linux-2.6.15.6/fs/open.c 2006-01-03 17:29:59 +0100 8257===================================================================
8081+++ linux-2.6.15.6-vs2.1.1-rc13/fs/open.c 2006-02-13 05:26:55 +0100 8258--- linux-2.6.16.orig/fs/open.c
8259+++ linux-2.6.16/fs/open.c
8082@@ -25,6 +25,9 @@ 8260@@ -27,6 +27,9 @@
8083 #include <linux/pagemap.h> 8261 #include <linux/pagemap.h>
8084 #include <linux/syscalls.h> 8262 #include <linux/syscalls.h>
8085 #include <linux/rcupdate.h> 8263 #include <linux/rcupdate.h>
8086+#include <linux/vs_limit.h> 8264+#include <linux/vs_limit.h>
8087+#include <linux/vs_dlimit.h> 8265+#include <linux/vs_dlimit.h>
8088+#include <linux/vserver/tag.h> 8266+#include <linux/vserver/tag.h>
8089 8267
8090 #include <asm/unistd.h> 8268 #include <asm/unistd.h>
8091 8269
8092@@ -43,6 +46,8 @@ int vfs_statfs(struct super_block *sb, s 8270@@ -45,6 +48,8 @@ int vfs_statfs(struct super_block *sb, s
8093 if (retval == 0 && buf->f_frsize == 0) 8271 if (retval == 0 && buf->f_frsize == 0)
8094 buf->f_frsize = buf->f_bsize; 8272 buf->f_frsize = buf->f_bsize;
8095 } 8273 }
8096+ if (!vx_check(0, VX_ADMIN|VX_WATCH)) 8274+ if (!vx_check(0, VX_ADMIN|VX_WATCH))
8097+ vx_vsi_statfs(sb, buf); 8275+ vx_vsi_statfs(sb, buf);
8098 } 8276 }
8099 return retval; 8277 return retval;
8100 } 8278 }
8101@@ -245,7 +250,7 @@ static inline long do_sys_truncate(const 8279@@ -248,7 +253,7 @@ static long do_sys_truncate(const char _
8102 goto dput_and_out; 8280 goto dput_and_out;
8103 8281
8104 error = -EROFS; 8282 error = -EROFS;
8105- if (IS_RDONLY(inode)) 8283- if (IS_RDONLY(inode))
8106+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(nd.mnt)) 8284+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(nd.mnt))
8107 goto dput_and_out; 8285 goto dput_and_out;
8108 8286
8109 error = -EPERM; 8287 error = -EPERM;
8110@@ -369,7 +374,7 @@ asmlinkage long sys_utime(char __user * 8288@@ -372,7 +377,7 @@ asmlinkage long sys_utime(char __user *
8111 inode = nd.dentry->d_inode; 8289 inode = nd.dentry->d_inode;
8112 8290
8113 error = -EROFS; 8291 error = -EROFS;
8114- if (IS_RDONLY(inode)) 8292- if (IS_RDONLY(inode))
8115+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(nd.mnt)) 8293+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(nd.mnt))
8116 goto dput_and_out; 8294 goto dput_and_out;
8117 8295
8118 /* Don't worry, the checks are done in inode_change_ok() */ 8296 /* Don't worry, the checks are done in inode_change_ok() */
8119@@ -426,7 +431,7 @@ long do_utimes(char __user * filename, s 8297@@ -429,7 +434,7 @@ long do_utimes(int dfd, char __user *fil
8120 inode = nd.dentry->d_inode; 8298 inode = nd.dentry->d_inode;
8121 8299
8122 error = -EROFS; 8300 error = -EROFS;
8123- if (IS_RDONLY(inode)) 8301- if (IS_RDONLY(inode))
8124+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(nd.mnt)) 8302+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(nd.mnt))
8125 goto dput_and_out; 8303 goto dput_and_out;
8126 8304
8127 /* Don't worry, the checks are done in inode_change_ok() */ 8305 /* Don't worry, the checks are done in inode_change_ok() */
8128@@ -508,7 +513,8 @@ asmlinkage long sys_access(const char __ 8306@@ -516,7 +521,8 @@ asmlinkage long sys_faccessat(int dfd, c
8129 if (!res) { 8307 if (!res) {
8130 res = vfs_permission(&nd, mode); 8308 res = vfs_permission(&nd, mode);
8131 /* SuS v2 requires we report a read only fs too */ 8309 /* SuS v2 requires we report a read only fs too */
8132- if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode) 8310- if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode)
8133+ if(!res && (mode & S_IWOTH) 8311+ if(!res && (mode & S_IWOTH)
8134+ && (IS_RDONLY(nd.dentry->d_inode) || MNT_IS_RDONLY(nd.mnt)) 8312+ && (IS_RDONLY(nd.dentry->d_inode) || MNT_IS_RDONLY(nd.mnt))
8135 && !special_file(nd.dentry->d_inode->i_mode)) 8313 && !special_file(nd.dentry->d_inode->i_mode))
8136 res = -EROFS; 8314 res = -EROFS;
8137 path_release(&nd); 8315 path_release(&nd);
8138@@ -614,7 +620,7 @@ asmlinkage long sys_fchmod(unsigned int 8316@@ -627,7 +633,7 @@ asmlinkage long sys_fchmod(unsigned int
8139 inode = dentry->d_inode; 8317 inode = dentry->d_inode;
8140 8318
8141 err = -EROFS; 8319 err = -EROFS;
8142- if (IS_RDONLY(inode)) 8320- if (IS_RDONLY(inode))
8143+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(file->f_vfsmnt)) 8321+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(file->f_vfsmnt))
8144 goto out_putf; 8322 goto out_putf;
8145 err = -EPERM; 8323 err = -EPERM;
8146 if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) 8324 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
8147@@ -646,7 +652,7 @@ asmlinkage long sys_chmod(const char __u 8325@@ -660,7 +666,7 @@ asmlinkage long sys_fchmodat(int dfd, co
8148 inode = nd.dentry->d_inode; 8326 inode = nd.dentry->d_inode;
8149 8327
8150 error = -EROFS; 8328 error = -EROFS;
8151- if (IS_RDONLY(inode)) 8329- if (IS_RDONLY(inode))
8152+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(nd.mnt)) 8330+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(nd.mnt))
8153 goto dput_and_out; 8331 goto dput_and_out;
8154 8332
8155 error = -EPERM; 8333 error = -EPERM;
8156@@ -667,7 +673,8 @@ out: 8334@@ -686,7 +692,8 @@ asmlinkage long sys_chmod(const char __u
8157 return error; 8335 return sys_fchmodat(AT_FDCWD, filename, mode);
8158 } 8336 }
8159 8337
8160-static int chown_common(struct dentry * dentry, uid_t user, gid_t group) 8338-static int chown_common(struct dentry * dentry, uid_t user, gid_t group)
8161+static int chown_common(struct dentry *dentry, struct vfsmount *mnt, 8339+static int chown_common(struct dentry *dentry, struct vfsmount *mnt,
8162+ uid_t user, gid_t group) 8340+ uid_t user, gid_t group)
8163 { 8341 {
8164 struct inode * inode; 8342 struct inode * inode;
8165 int error; 8343 int error;
8166@@ -679,7 +686,7 @@ static int chown_common(struct dentry * 8344@@ -698,7 +705,7 @@ static int chown_common(struct dentry *
8167 goto out; 8345 goto out;
8168 } 8346 }
8169 error = -EROFS; 8347 error = -EROFS;
8170- if (IS_RDONLY(inode)) 8348- if (IS_RDONLY(inode))
8171+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(mnt)) 8349+ if (IS_RDONLY(inode) || MNT_IS_RDONLY(mnt))
8172 goto out; 8350 goto out;
8173 error = -EPERM; 8351 error = -EPERM;
8174 if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) 8352 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
8175@@ -687,11 +694,11 @@ static int chown_common(struct dentry * 8353@@ -706,11 +713,11 @@ static int chown_common(struct dentry *
8176 newattrs.ia_valid = ATTR_CTIME; 8354 newattrs.ia_valid = ATTR_CTIME;
8177 if (user != (uid_t) -1) { 8355 if (user != (uid_t) -1) {
8178 newattrs.ia_valid |= ATTR_UID; 8356 newattrs.ia_valid |= ATTR_UID;
8179- newattrs.ia_uid = user; 8357- newattrs.ia_uid = user;
8180+ newattrs.ia_uid = dx_map_uid(user); 8358+ newattrs.ia_uid = dx_map_uid(user);
8184- newattrs.ia_gid = group; 8362- newattrs.ia_gid = group;
8185+ newattrs.ia_gid = dx_map_gid(group); 8363+ newattrs.ia_gid = dx_map_gid(group);
8186 } 8364 }
8187 if (!S_ISDIR(inode->i_mode)) 8365 if (!S_ISDIR(inode->i_mode))
8188 newattrs.ia_valid |= ATTR_KILL_SUID|ATTR_KILL_SGID; 8366 newattrs.ia_valid |= ATTR_KILL_SUID|ATTR_KILL_SGID;
8189@@ -709,7 +716,7 @@ asmlinkage long sys_chown(const char __u 8367@@ -728,7 +735,7 @@ asmlinkage long sys_chown(const char __u
8190 8368
8191 error = user_path_walk(filename, &nd); 8369 error = user_path_walk(filename, &nd);
8192 if (!error) { 8370 if (!error) {
8193- error = chown_common(nd.dentry, user, group); 8371- error = chown_common(nd.dentry, user, group);
8194+ error = chown_common(nd.dentry, nd.mnt, user, group); 8372+ error = chown_common(nd.dentry, nd.mnt, user, group);
8195 path_release(&nd); 8373 path_release(&nd);
8196 } 8374 }
8197 return error; 8375 return error;
8376@@ -747,7 +754,7 @@ asmlinkage long sys_fchownat(int dfd, co
8377 follow = (flag & AT_SYMLINK_NOFOLLOW) ? 0 : LOOKUP_FOLLOW;
8378 error = __user_walk_fd(dfd, filename, follow, &nd);
8379 if (!error) {
8380- error = chown_common(nd.dentry, user, group);
8381+ error = chown_common(nd.dentry, nd.mnt, user, group);
8382 path_release(&nd);
8383 }
8384 out:
8198@@ -722,7 +729,7 @@ asmlinkage long sys_lchown(const char __ 8385@@ -761,7 +768,7 @@ asmlinkage long sys_lchown(const char __
8199 8386
8200 error = user_path_walk_link(filename, &nd); 8387 error = user_path_walk_link(filename, &nd);
8201 if (!error) { 8388 if (!error) {
8202- error = chown_common(nd.dentry, user, group); 8389- error = chown_common(nd.dentry, user, group);
8203+ error = chown_common(nd.dentry, nd.mnt, user, group); 8390+ error = chown_common(nd.dentry, nd.mnt, user, group);
8204 path_release(&nd); 8391 path_release(&nd);
8205 } 8392 }
8206 return error; 8393 return error;
8207@@ -736,7 +743,7 @@ asmlinkage long sys_fchown(unsigned int 8394@@ -775,7 +782,7 @@ asmlinkage long sys_fchown(unsigned int
8208 8395
8209 file = fget(fd); 8396 file = fget(fd);
8210 if (file) { 8397 if (file) {
8211- error = chown_common(file->f_dentry, user, group); 8398- error = chown_common(file->f_dentry, user, group);
8212+ error = chown_common(file->f_dentry, file->f_vfsmnt, user, group); 8399+ error = chown_common(file->f_dentry, file->f_vfsmnt, user, group);
8213 fput(file); 8400 fput(file);
8214 } 8401 }
8215 return error; 8402 return error;
8216@@ -954,6 +961,7 @@ repeat: 8403@@ -999,6 +1006,7 @@ repeat:
8217 FD_SET(fd, fdt->open_fds); 8404 FD_SET(fd, fdt->open_fds);
8218 FD_CLR(fd, fdt->close_on_exec); 8405 FD_CLR(fd, fdt->close_on_exec);
8219 fdt->next_fd = fd + 1; 8406 fdt->next_fd = fd + 1;
8220+ vx_openfd_inc(fd); 8407+ vx_openfd_inc(fd);
8221 #if 1 8408 #if 1
8222 /* Sanity check */ 8409 /* Sanity check */
8223 if (fdt->fd[fd] != NULL) { 8410 if (fdt->fd[fd] != NULL) {
8224@@ -976,6 +984,7 @@ static inline void __put_unused_fd(struc 8411@@ -1021,6 +1029,7 @@ static void __put_unused_fd(struct files
8225 __FD_CLR(fd, fdt->open_fds); 8412 __FD_CLR(fd, fdt->open_fds);
8226 if (fd < fdt->next_fd) 8413 if (fd < fdt->next_fd)
8227 fdt->next_fd = fd; 8414 fdt->next_fd = fd;
8228+ vx_openfd_dec(fd); 8415+ vx_openfd_dec(fd);
8229 } 8416 }
8230 8417
8231 void fastcall put_unused_fd(unsigned int fd) 8418 void fastcall put_unused_fd(unsigned int fd)
8232diff -NurpP --minimal linux-2.6.15.6/fs/proc/array.c linux-2.6.15.6-vs2.1.1-rc13/fs/proc/array.c 8419Index: linux-2.6.16/fs/proc/array.c
8233--- linux-2.6.15.6/fs/proc/array.c 2006-01-03 17:29:59 +0100 8420===================================================================
8234+++ linux-2.6.15.6-vs2.1.1-rc13/fs/proc/array.c 2006-02-13 16:25:38 +0100 8421--- linux-2.6.16.orig/fs/proc/array.c
8422+++ linux-2.6.16/fs/proc/array.c
8235@@ -75,6 +75,9 @@ 8423@@ -75,6 +75,9 @@
8236 #include <linux/times.h> 8424 #include <linux/times.h>
8237 #include <linux/cpuset.h> 8425 #include <linux/cpuset.h>
8238 #include <linux/rcupdate.h> 8426 #include <linux/rcupdate.h>
8239+#include <linux/vs_context.h> 8427+#include <linux/vs_context.h>
8344+ buffer += sprintf (buffer,"ipv4root_bcast: 0\n"); 8532+ buffer += sprintf (buffer,"ipv4root_bcast: 0\n");
8345+ } 8533+ }
8346+ put_nx_info(nxi); 8534+ put_nx_info(nxi);
8347+#endif 8535+#endif
8348+skip: 8536+skip:
8349 #if defined(CONFIG_ARCH_S390) 8537 #if defined(CONFIG_S390)
8350 buffer = task_show_regs(task, buffer); 8538 buffer = task_show_regs(task, buffer);
8351 #endif 8539 #endif
8352@@ -322,7 +378,7 @@ static int do_task_stat(struct task_stru 8540@@ -322,7 +378,7 @@ static int do_task_stat(struct task_stru
8353 sigset_t sigign, sigcatch; 8541 sigset_t sigign, sigcatch;
8354 char state; 8542 char state;
8358 int num_threads = 0; 8546 int num_threads = 0;
8359 struct mm_struct *mm; 8547 struct mm_struct *mm;
8360 unsigned long long start_time; 8548 unsigned long long start_time;
8361@@ -388,7 +444,11 @@ static int do_task_stat(struct task_stru 8549@@ -388,7 +444,11 @@ static int do_task_stat(struct task_stru
8362 } 8550 }
8363 it_real_value = task->signal->it_real_value; 8551 it_real_value = task->signal->real_timer.expires;
8364 } 8552 }
8365- ppid = pid_alive(task) ? task->group_leader->real_parent->tgid : 0; 8553- ppid = pid_alive(task) ? task->group_leader->real_parent->tgid : 0;
8366+ pid = vx_info_map_pid(task->vx_info, pid_alive(task) ? task->pid : 0); 8554+ pid = vx_info_map_pid(task->vx_info, pid_alive(task) ? task->pid : 0);
8367+ ppid = (!(pid > 1)) ? 0 : vx_info_map_tgid(task->vx_info, 8555+ ppid = (!(pid > 1)) ? 0 : vx_info_map_tgid(task->vx_info,
8368+ task->group_leader->real_parent->tgid); 8556+ task->group_leader->real_parent->tgid);
8392- task->pid, 8580- task->pid,
8393+ pid, 8581+ pid,
8394 tcomm, 8582 tcomm,
8395 state, 8583 state,
8396 ppid, 8584 ppid,
8397diff -NurpP --minimal linux-2.6.15.6/fs/proc/base.c linux-2.6.15.6-vs2.1.1-rc13/fs/proc/base.c 8585Index: linux-2.6.16/fs/proc/base.c
8398--- linux-2.6.15.6/fs/proc/base.c 2006-01-03 17:29:59 +0100 8586===================================================================
8399+++ linux-2.6.15.6-vs2.1.1-rc13/fs/proc/base.c 2006-02-13 16:25:38 +0100 8587--- linux-2.6.16.orig/fs/proc/base.c
8588+++ linux-2.6.16/fs/proc/base.c
8400@@ -71,6 +71,8 @@ 8589@@ -72,6 +72,8 @@
8401 #include <linux/cpuset.h> 8590 #include <linux/cpuset.h>
8402 #include <linux/audit.h> 8591 #include <linux/audit.h>
8403 #include <linux/poll.h> 8592 #include <linux/poll.h>
8404+#include <linux/vs_network.h> 8593+#include <linux/vs_network.h>
8405+#include <linux/vs_pid.h> 8594+#include <linux/vs_pid.h>
8406 #include "internal.h" 8595 #include "internal.h"
8407 8596
8408 /* 8597 /*
8409@@ -120,6 +122,8 @@ enum pid_directory_inos { 8598@@ -121,6 +123,8 @@ enum pid_directory_inos {
8410 PROC_TGID_ATTR_EXEC, 8599 PROC_TGID_ATTR_EXEC,
8411 PROC_TGID_ATTR_FSCREATE, 8600 PROC_TGID_ATTR_FSCREATE,
8412 #endif 8601 #endif
8413+ PROC_TGID_VX_INFO, 8602+ PROC_TGID_VX_INFO,
8414+ PROC_TGID_IP_INFO, 8603+ PROC_TGID_IP_INFO,
8415 #ifdef CONFIG_AUDITSYSCALL 8604 #ifdef CONFIG_AUDITSYSCALL
8416 PROC_TGID_LOGINUID, 8605 PROC_TGID_LOGINUID,
8417 #endif 8606 #endif
8418@@ -160,6 +164,8 @@ enum pid_directory_inos { 8607@@ -161,6 +165,8 @@ enum pid_directory_inos {
8419 PROC_TID_ATTR_EXEC, 8608 PROC_TID_ATTR_EXEC,
8420 PROC_TID_ATTR_FSCREATE, 8609 PROC_TID_ATTR_FSCREATE,
8421 #endif 8610 #endif
8422+ PROC_TID_VX_INFO, 8611+ PROC_TID_VX_INFO,
8423+ PROC_TID_IP_INFO, 8612+ PROC_TID_IP_INFO,
8424 #ifdef CONFIG_AUDITSYSCALL 8613 #ifdef CONFIG_AUDITSYSCALL
8425 PROC_TID_LOGINUID, 8614 PROC_TID_LOGINUID,
8426 #endif 8615 #endif
8427@@ -215,6 +221,8 @@ static struct pid_entry tgid_base_stuff[ 8616@@ -216,6 +222,8 @@ static struct pid_entry tgid_base_stuff[
8428 #ifdef CONFIG_CPUSETS 8617 #ifdef CONFIG_CPUSETS
8429 E(PROC_TGID_CPUSET, "cpuset", S_IFREG|S_IRUGO), 8618 E(PROC_TGID_CPUSET, "cpuset", S_IFREG|S_IRUGO),
8430 #endif 8619 #endif
8431+ E(PROC_TGID_VX_INFO, "vinfo", S_IFREG|S_IRUGO), 8620+ E(PROC_TGID_VX_INFO, "vinfo", S_IFREG|S_IRUGO),
8432+ E(PROC_TGID_IP_INFO, "ninfo", S_IFREG|S_IRUGO), 8621+ E(PROC_TGID_IP_INFO, "ninfo", S_IFREG|S_IRUGO),
8433 E(PROC_TGID_OOM_SCORE, "oom_score",S_IFREG|S_IRUGO), 8622 E(PROC_TGID_OOM_SCORE, "oom_score",S_IFREG|S_IRUGO),
8434 E(PROC_TGID_OOM_ADJUST,"oom_adj", S_IFREG|S_IRUGO|S_IWUSR), 8623 E(PROC_TGID_OOM_ADJUST,"oom_adj", S_IFREG|S_IRUGO|S_IWUSR),
8435 #ifdef CONFIG_AUDITSYSCALL 8624 #ifdef CONFIG_AUDITSYSCALL
8436@@ -257,6 +265,8 @@ static struct pid_entry tid_base_stuff[] 8625@@ -258,6 +266,8 @@ static struct pid_entry tid_base_stuff[]
8437 #ifdef CONFIG_CPUSETS 8626 #ifdef CONFIG_CPUSETS
8438 E(PROC_TID_CPUSET, "cpuset", S_IFREG|S_IRUGO), 8627 E(PROC_TID_CPUSET, "cpuset", S_IFREG|S_IRUGO),
8439 #endif 8628 #endif
8440+ E(PROC_TID_VX_INFO, "vinfo", S_IFREG|S_IRUGO), 8629+ E(PROC_TID_VX_INFO, "vinfo", S_IFREG|S_IRUGO),
8441+ E(PROC_TID_IP_INFO, "ninfo", S_IFREG|S_IRUGO), 8630+ E(PROC_TID_IP_INFO, "ninfo", S_IFREG|S_IRUGO),
8442 E(PROC_TID_OOM_SCORE, "oom_score",S_IFREG|S_IRUGO), 8631 E(PROC_TID_OOM_SCORE, "oom_score",S_IFREG|S_IRUGO),
8443 E(PROC_TID_OOM_ADJUST, "oom_adj", S_IFREG|S_IRUGO|S_IWUSR), 8632 E(PROC_TID_OOM_ADJUST, "oom_adj", S_IFREG|S_IRUGO|S_IWUSR),
8444 #ifdef CONFIG_AUDITSYSCALL 8633 #ifdef CONFIG_AUDITSYSCALL
8445@@ -530,12 +540,19 @@ static int proc_oom_score(struct task_st 8634@@ -537,6 +547,11 @@ static int proc_check_chroot(struct dent
8446
8447 /* If the process being read is separated by chroot from the reading process,
8448 * don't let the reader access the threads.
8449+ *
8450+ * note: this does dput(root) and mntput(vfsmnt) on exit.
8451 */
8452 static int proc_check_chroot(struct dentry *root, struct vfsmount *vfsmnt)
8453 {
8454 struct dentry *de, *base; 8635 struct dentry *de, *base;
8455 struct vfsmount *our_vfsmnt, *mnt; 8636 struct vfsmount *our_vfsmnt, *mnt;
8456 int res = 0; 8637 int res = 0;
8457+ 8638+
8458+ /* context admin override */ 8639+ /* context admin override */
8460+ goto override; 8641+ goto override;
8461+ 8642+
8462 read_lock(&current->fs->lock); 8643 read_lock(&current->fs->lock);
8463 our_vfsmnt = mntget(current->fs->rootmnt); 8644 our_vfsmnt = mntget(current->fs->rootmnt);
8464 base = dget(current->fs->root); 8645 base = dget(current->fs->root);
8465@@ -545,11 +562,11 @@ static int proc_check_chroot(struct dent 8646@@ -546,11 +561,11 @@ static int proc_check_chroot(struct dent
8466 de = root; 8647 de = root;
8467 mnt = vfsmnt; 8648 mnt = vfsmnt;
8468 8649
8469- while (vfsmnt != our_vfsmnt) { 8650- while (vfsmnt != our_vfsmnt) {
8470- if (vfsmnt == vfsmnt->mnt_parent) 8651- if (vfsmnt == vfsmnt->mnt_parent)
8476+ de = mnt->mnt_mountpoint; 8657+ de = mnt->mnt_mountpoint;
8477+ mnt = mnt->mnt_parent; 8658+ mnt = mnt->mnt_parent;
8478 } 8659 }
8479 8660
8480 if (!is_subdir(de, base)) 8661 if (!is_subdir(de, base))
8481@@ -559,8 +576,9 @@ static int proc_check_chroot(struct dent 8662@@ -560,8 +575,9 @@ static int proc_check_chroot(struct dent
8482 exit: 8663 exit:
8483 dput(base); 8664 dput(base);
8484 mntput(our_vfsmnt); 8665 mntput(our_vfsmnt);
8485+override: 8666+override:
8486 dput(root); 8667 dput(root);
8487- mntput(mnt); 8668- mntput(mnt);
8488+ mntput(vfsmnt); 8669+ mntput(vfsmnt);
8489 return res; 8670 return res;
8490 out: 8671 out:
8491 spin_unlock(&vfsmount_lock); 8672 spin_unlock(&vfsmount_lock);
8492@@ -1220,7 +1238,7 @@ static int proc_pident_readdir(struct fi 8673@@ -1221,7 +1237,7 @@ static int proc_pident_readdir(struct fi
8493 struct inode *inode = dentry->d_inode; 8674 struct inode *inode = dentry->d_inode;
8494 struct pid_entry *p; 8675 struct pid_entry *p;
8495 ino_t ino; 8676 ino_t ino;
8496- int ret; 8677- int ret;
8497+ int ret, hide; 8678+ int ret, hide;
8498 8679
8499 ret = -ENOENT; 8680 ret = -ENOENT;
8500 if (!pid_alive(proc_task(inode))) 8681 if (!pid_alive(proc_task(inode)))
8501@@ -1251,11 +1269,20 @@ static int proc_pident_readdir(struct fi 8682@@ -1252,11 +1268,20 @@ static int proc_pident_readdir(struct fi
8502 goto out; 8683 goto out;
8503 } 8684 }
8504 p = ents + i; 8685 p = ents + i;
8505+ hide = vx_flags(VXF_INFO_HIDE, 0); 8686+ hide = vx_flags(VXF_INFO_HIDE, 0);
8506 while (p->name) { 8687 while (p->name) {
8517 filp->f_pos++; 8698 filp->f_pos++;
8518+ skip: 8699+ skip:
8519 p++; 8700 p++;
8520 } 8701 }
8521 } 8702 }
8522@@ -1329,6 +1356,8 @@ static struct inode *proc_pid_make_inode 8703@@ -1330,6 +1355,8 @@ static struct inode *proc_pid_make_inode
8523 inode->i_uid = task->euid; 8704 inode->i_uid = task->euid;
8524 inode->i_gid = task->egid; 8705 inode->i_gid = task->egid;
8525 } 8706 }
8526+ /* procfs is xid tagged */ 8707+ /* procfs is xid tagged */
8527+ inode->i_tag = (tag_t)vx_task_xid(task); 8708+ inode->i_tag = (tag_t)vx_task_xid(task);
8528 security_task_to_inode(task, inode); 8709 security_task_to_inode(task, inode);
8529 8710
8530 out: 8711 out:
8531@@ -1354,6 +1383,11 @@ static int pid_revalidate(struct dentry 8712@@ -1355,6 +1382,11 @@ static int pid_revalidate(struct dentry
8532 { 8713 {
8533 struct inode *inode = dentry->d_inode; 8714 struct inode *inode = dentry->d_inode;
8534 struct task_struct *task = proc_task(inode); 8715 struct task_struct *task = proc_task(inode);
8535+ 8716+
8536+ if (!vx_check(vx_task_xid(task), VX_IDENT)) 8717+ if (!vx_check(vx_task_xid(task), VX_IDENT))
8538+ /* discard wrong fakeinit */ 8719+ /* discard wrong fakeinit */
8539+ 8720+
8540 if (pid_alive(task)) { 8721 if (pid_alive(task)) {
8541 if (proc_type(inode) == PROC_TGID_INO || proc_type(inode) == PROC_TID_INO || task_dumpable(task)) { 8722 if (proc_type(inode) == PROC_TGID_INO || proc_type(inode) == PROC_TID_INO || task_dumpable(task)) {
8542 inode->i_uid = task->euid; 8723 inode->i_uid = task->euid;
8543@@ -1365,6 +1399,7 @@ static int pid_revalidate(struct dentry 8724@@ -1366,6 +1398,7 @@ static int pid_revalidate(struct dentry
8544 security_task_to_inode(task, inode); 8725 security_task_to_inode(task, inode);
8545 return 1; 8726 return 1;
8546 } 8727 }
8547+out_drop: 8728+out_drop:
8548 d_drop(dentry); 8729 d_drop(dentry);
8549 return 0; 8730 return 0;
8550 } 8731 }
8551@@ -1599,6 +1634,9 @@ static struct file_operations proc_tgid_ 8732@@ -1600,6 +1633,9 @@ static struct file_operations proc_tgid_
8552 static struct inode_operations proc_tgid_attr_inode_operations; 8733 static struct inode_operations proc_tgid_attr_inode_operations;
8553 #endif 8734 #endif
8554 8735
8555+extern int proc_pid_vx_info(struct task_struct *, char *); 8736+extern int proc_pid_vx_info(struct task_struct *, char *);
8556+extern int proc_pid_nx_info(struct task_struct *, char *); 8737+extern int proc_pid_nx_info(struct task_struct *, char *);
8557+ 8738+
8558 static int get_tid_list(int index, unsigned int *tids, struct inode *dir); 8739 static int get_tid_list(int index, unsigned int *tids, struct inode *dir);
8559 8740
8560 /* SMP-safe */ 8741 /* SMP-safe */
8561@@ -1786,15 +1824,33 @@ static struct dentry *proc_pident_lookup 8742@@ -1787,15 +1823,33 @@ static struct dentry *proc_pident_lookup
8562 inode->i_fop = &proc_loginuid_operations; 8743 inode->i_fop = &proc_loginuid_operations;
8563 break; 8744 break;
8564 #endif 8745 #endif
8565+ case PROC_TID_VX_INFO: 8746+ case PROC_TID_VX_INFO:
8566+ case PROC_TGID_VX_INFO: 8747+ case PROC_TGID_VX_INFO:
8592+out_put: 8773+out_put:
8593+ iput(inode); 8774+ iput(inode);
8594 out: 8775 out:
8595 return ERR_PTR(error); 8776 return ERR_PTR(error);
8596 } 8777 }
8597@@ -1878,14 +1934,14 @@ static int proc_self_readlink(struct den 8778@@ -1879,14 +1933,14 @@ static int proc_self_readlink(struct den
8598 int buflen) 8779 int buflen)
8599 { 8780 {
8600 char tmp[30]; 8781 char tmp[30];
8601- sprintf(tmp, "%d", current->tgid); 8782- sprintf(tmp, "%d", current->tgid);
8602+ sprintf(tmp, "%d", vx_map_tgid(current->tgid)); 8783+ sprintf(tmp, "%d", vx_map_tgid(current->tgid));
8609- sprintf(tmp, "%d", current->tgid); 8790- sprintf(tmp, "%d", current->tgid);
8610+ sprintf(tmp, "%d", vx_map_tgid(current->tgid)); 8791+ sprintf(tmp, "%d", vx_map_tgid(current->tgid));
8611 return ERR_PTR(vfs_follow_link(nd,tmp)); 8792 return ERR_PTR(vfs_follow_link(nd,tmp));
8612 } 8793 }
8613 8794
8614@@ -1948,6 +2004,20 @@ void proc_pid_flush(struct dentry *proc_ 8795@@ -1949,6 +2003,20 @@ void proc_pid_flush(struct dentry *proc_
8615 } 8796 }
8616 } 8797 }
8617 8798
8618+#define VXF_FAKE_INIT (VXF_INFO_INIT|VXF_STATE_INIT) 8799+#define VXF_FAKE_INIT (VXF_INFO_INIT|VXF_STATE_INIT)
8619+ 8800+
8630+} 8811+}
8631+ 8812+
8632 /* SMP-safe */ 8813 /* SMP-safe */
8633 struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd) 8814 struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd)
8634 { 8815 {
8635@@ -1984,13 +2054,14 @@ struct dentry *proc_pid_lookup(struct in 8816@@ -1985,13 +2053,14 @@ struct dentry *proc_pid_lookup(struct in
8636 if (!task) 8817 if (!task)
8637 goto out; 8818 goto out;
8638 8819
8639- inode = proc_pid_make_inode(dir->i_sb, task, PROC_TGID_INO); 8820- inode = proc_pid_make_inode(dir->i_sb, task, PROC_TGID_INO);
8640+ /* check for context visibility */ 8821+ /* check for context visibility */
8650- goto out; 8831- goto out;
8651- } 8832- }
8652 inode->i_mode = S_IFDIR|S_IRUGO|S_IXUGO; 8833 inode->i_mode = S_IFDIR|S_IRUGO|S_IXUGO;
8653 inode->i_op = &proc_tgid_base_inode_operations; 8834 inode->i_op = &proc_tgid_base_inode_operations;
8654 inode->i_fop = &proc_tgid_base_operations; 8835 inode->i_fop = &proc_tgid_base_operations;
8655@@ -2019,6 +2090,8 @@ struct dentry *proc_pid_lookup(struct in 8836@@ -2020,6 +2089,8 @@ struct dentry *proc_pid_lookup(struct in
8656 goto out; 8837 goto out;
8657 } 8838 }
8658 return NULL; 8839 return NULL;
8659+out_drop_task: 8840+out_drop_task:
8660+ put_task_struct(task); 8841+ put_task_struct(task);
8661 out: 8842 out:
8662 return ERR_PTR(-ENOENT); 8843 return ERR_PTR(-ENOENT);
8663 } 8844 }
8664@@ -2034,6 +2107,8 @@ static struct dentry *proc_task_lookup(s 8845@@ -2035,6 +2106,8 @@ static struct dentry *proc_task_lookup(s
8665 tid = name_to_int(dentry); 8846 tid = name_to_int(dentry);
8666 if (tid == ~0U) 8847 if (tid == ~0U)
8667 goto out; 8848 goto out;
8668+ if (vx_current_initpid(tid)) 8849+ if (vx_current_initpid(tid))
8669+ goto out; 8850+ goto out;
8670 8851
8671 read_lock(&tasklist_lock); 8852 read_lock(&tasklist_lock);
8672 task = find_task_by_pid(tid); 8853 task = find_task_by_pid(tid);
8673@@ -2045,11 +2120,14 @@ static struct dentry *proc_task_lookup(s 8854@@ -2046,11 +2119,14 @@ static struct dentry *proc_task_lookup(s
8674 if (leader->tgid != task->tgid) 8855 if (leader->tgid != task->tgid)
8675 goto out_drop_task; 8856 goto out_drop_task;
8676 8857
8677- inode = proc_pid_make_inode(dir->i_sb, task, PROC_TID_INO); 8858- inode = proc_pid_make_inode(dir->i_sb, task, PROC_TID_INO);
8678- 8859-
8685 goto out_drop_task; 8866 goto out_drop_task;
8686+ 8867+
8687 inode->i_mode = S_IFDIR|S_IRUGO|S_IXUGO; 8868 inode->i_mode = S_IFDIR|S_IRUGO|S_IXUGO;
8688 inode->i_op = &proc_tid_base_inode_operations; 8869 inode->i_op = &proc_tid_base_inode_operations;
8689 inode->i_fop = &proc_tid_base_operations; 8870 inode->i_fop = &proc_tid_base_operations;
8690@@ -2089,7 +2167,7 @@ static int get_tgid_list(int index, unsi 8871@@ -2090,7 +2166,7 @@ static int get_tgid_list(int index, unsi
8691 read_lock(&tasklist_lock); 8872 read_lock(&tasklist_lock);
8692 p = NULL; 8873 p = NULL;
8693 if (version) { 8874 if (version) {
8694- p = find_task_by_pid(version); 8875- p = find_task_by_pid(version);
8695+ p = find_task_by_real_pid(version); 8876+ p = find_task_by_real_pid(version);
8696 if (p && !thread_group_leader(p)) 8877 if (p && !thread_group_leader(p))
8697 p = NULL; 8878 p = NULL;
8698 } 8879 }
8699@@ -2101,11 +2179,15 @@ static int get_tgid_list(int index, unsi 8880@@ -2102,11 +2178,15 @@ static int get_tgid_list(int index, unsi
8700 8881
8701 for ( ; p != &init_task; p = next_task(p)) { 8882 for ( ; p != &init_task; p = next_task(p)) {
8702 int tgid = p->pid; 8883 int tgid = p->pid;
8703+ 8884+
8704 if (!pid_alive(p)) 8885 if (!pid_alive(p))
8711- tgids[nr_tgids] = tgid; 8892- tgids[nr_tgids] = tgid;
8712+ tgids[nr_tgids] = vx_map_tgid(tgid); 8893+ tgids[nr_tgids] = vx_map_tgid(tgid);
8713 nr_tgids++; 8894 nr_tgids++;
8714 if (nr_tgids >= PROC_MAXPIDS) 8895 if (nr_tgids >= PROC_MAXPIDS)
8715 break; 8896 break;
8716@@ -2135,10 +2217,13 @@ static int get_tid_list(int index, unsig 8897@@ -2136,10 +2216,13 @@ static int get_tid_list(int index, unsig
8717 if (pid_alive(task)) do { 8898 if (pid_alive(task)) do {
8718 int tid = task->pid; 8899 int tid = task->pid;
8719 8900
8720+ /* check for context visibility */ 8901+ /* check for context visibility */
8721+ if (!proc_pid_visible(task, tid)) 8902+ if (!proc_pid_visible(task, tid))
8726- tids[nr_tids] = tid; 8907- tids[nr_tids] = tid;
8727+ tids[nr_tids] = vx_map_pid(tid); 8908+ tids[nr_tids] = vx_map_pid(tid);
8728 nr_tids++; 8909 nr_tids++;
8729 if (nr_tids >= PROC_MAXPIDS) 8910 if (nr_tids >= PROC_MAXPIDS)
8730 break; 8911 break;
8731@@ -2214,11 +2299,14 @@ static int proc_task_readdir(struct file 8912@@ -2215,11 +2298,14 @@ static int proc_task_readdir(struct file
8732 unsigned int nr_tids, i; 8913 unsigned int nr_tids, i;
8733 struct dentry *dentry = filp->f_dentry; 8914 struct dentry *dentry = filp->f_dentry;
8734 struct inode *inode = dentry->d_inode; 8915 struct inode *inode = dentry->d_inode;
8735+ struct task_struct *task = proc_task(inode); 8916+ struct task_struct *task = proc_task(inode);
8736 int retval = -ENOENT; 8917 int retval = -ENOENT;
8742+ goto out; 8923+ goto out;
8743+ if (!pid_alive(task)) 8924+ if (!pid_alive(task))
8744 goto out; 8925 goto out;
8745 retval = 0; 8926 retval = 0;
8746 8927
8747diff -NurpP --minimal linux-2.6.15.6/fs/proc/generic.c linux-2.6.15.6-vs2.1.1-rc13/fs/proc/generic.c 8928Index: linux-2.6.16/fs/proc/generic.c
8748--- linux-2.6.15.6/fs/proc/generic.c 2006-01-03 17:29:59 +0100 8929===================================================================
8749+++ linux-2.6.15.6-vs2.1.1-rc13/fs/proc/generic.c 2006-02-13 05:26:55 +0100 8930--- linux-2.6.16.orig/fs/proc/generic.c
8931+++ linux-2.6.16/fs/proc/generic.c
8750@@ -19,6 +19,7 @@ 8932@@ -19,6 +19,7 @@
8751 #include <linux/idr.h> 8933 #include <linux/idr.h>
8752 #include <linux/namei.h> 8934 #include <linux/namei.h>
8753 #include <linux/bitops.h> 8935 #include <linux/bitops.h>
8754+#include <linux/vserver/inode.h> 8936+#include <linux/vserver/inode.h>
8755 #include <asm/uaccess.h> 8937 #include <asm/uaccess.h>
8756 8938
8757 static ssize_t proc_file_read(struct file *file, char __user *buf, 8939 #include "internal.h"
8758@@ -383,11 +384,15 @@ struct dentry *proc_lookup(struct inode 8940@@ -385,11 +386,15 @@ struct dentry *proc_lookup(struct inode
8759 for (de = de->subdir; de ; de = de->next) { 8941 for (de = de->subdir; de ; de = de->next) {
8760 if (de->namelen != dentry->d_name.len) 8942 if (de->namelen != dentry->d_name.len)
8761 continue; 8943 continue;
8762+ if (!vx_hide_check(0, de->vx_flags)) 8944+ if (!vx_hide_check(0, de->vx_flags))
8763+ continue; 8945+ continue;
8769+ /* generic proc entries belong to the host */ 8951+ /* generic proc entries belong to the host */
8770+ inode->i_tag = 0; 8952+ inode->i_tag = 0;
8771 break; 8953 break;
8772 } 8954 }
8773 } 8955 }
8774@@ -459,9 +464,12 @@ int proc_readdir(struct file * filp, 8956@@ -461,9 +466,12 @@ int proc_readdir(struct file * filp,
8775 } 8957 }
8776 8958
8777 do { 8959 do {
8778+ if (!vx_hide_check(0, de->vx_flags)) 8960+ if (!vx_hide_check(0, de->vx_flags))
8779+ goto skip; 8961+ goto skip;
8782 goto out; 8964 goto out;
8783+ skip: 8965+ skip:
8784 filp->f_pos++; 8966 filp->f_pos++;
8785 de = de->next; 8967 de = de->next;
8786 } while (de); 8968 } while (de);
8787@@ -579,6 +587,7 @@ static struct proc_dir_entry *proc_creat 8969@@ -581,6 +589,7 @@ static struct proc_dir_entry *proc_creat
8788 ent->namelen = len; 8970 ent->namelen = len;
8789 ent->mode = mode; 8971 ent->mode = mode;
8790 ent->nlink = nlink; 8972 ent->nlink = nlink;
8791+ ent->vx_flags = IATTR_PROC_DEFAULT; 8973+ ent->vx_flags = IATTR_PROC_DEFAULT;
8792 out: 8974 out:
8793 return ent; 8975 return ent;
8794 } 8976 }
8795@@ -599,7 +608,8 @@ struct proc_dir_entry *proc_symlink(cons 8977@@ -601,7 +610,8 @@ struct proc_dir_entry *proc_symlink(cons
8796 kfree(ent->data); 8978 kfree(ent->data);
8797 kfree(ent); 8979 kfree(ent);
8798 ent = NULL; 8980 ent = NULL;
8799- } 8981- }
8800+ } else 8982+ } else
8801+ ent->vx_flags = IATTR_PROC_SYMLINK; 8983+ ent->vx_flags = IATTR_PROC_SYMLINK;
8802 } else { 8984 } else {
8803 kfree(ent); 8985 kfree(ent);
8804 ent = NULL; 8986 ent = NULL;
8805diff -NurpP --minimal linux-2.6.15.6/fs/proc/inode.c linux-2.6.15.6-vs2.1.1-rc13/fs/proc/inode.c 8987Index: linux-2.6.16/fs/proc/inode.c
8806--- linux-2.6.15.6/fs/proc/inode.c 2006-01-03 17:29:59 +0100 8988===================================================================
8807+++ linux-2.6.15.6-vs2.1.1-rc13/fs/proc/inode.c 2006-01-04 21:59:59 +0100 8989--- linux-2.6.16.orig/fs/proc/inode.c
8990+++ linux-2.6.16/fs/proc/inode.c
8808@@ -170,6 +170,8 @@ struct inode *proc_get_inode(struct supe 8991@@ -170,6 +170,8 @@ struct inode *proc_get_inode(struct supe
8809 inode->i_uid = de->uid; 8992 inode->i_uid = de->uid;
8810 inode->i_gid = de->gid; 8993 inode->i_gid = de->gid;
8811 } 8994 }
8812+ if (de->vx_flags) 8995+ if (de->vx_flags)
8813+ PROC_I(inode)->vx_flags = de->vx_flags; 8996+ PROC_I(inode)->vx_flags = de->vx_flags;
8814 if (de->size) 8997 if (de->size)
8815 inode->i_size = de->size; 8998 inode->i_size = de->size;
8816 if (de->nlink) 8999 if (de->nlink)
8817diff -NurpP --minimal linux-2.6.15.6/fs/proc/proc_misc.c linux-2.6.15.6-vs2.1.1-rc13/fs/proc/proc_misc.c 9000Index: linux-2.6.16/fs/proc/proc_misc.c
8818--- linux-2.6.15.6/fs/proc/proc_misc.c 2006-01-03 17:29:59 +0100 9001===================================================================
8819+++ linux-2.6.15.6-vs2.1.1-rc13/fs/proc/proc_misc.c 2006-02-13 03:06:48 +0100 9002--- linux-2.6.16.orig/fs/proc/proc_misc.c
9003+++ linux-2.6.16/fs/proc/proc_misc.c
8820@@ -52,6 +52,8 @@ 9004@@ -53,6 +53,8 @@
8821 #include <asm/div64.h> 9005 #include <asm/div64.h>
8822 #include "internal.h" 9006 #include "internal.h"
8823 9007
8824+#include <linux/vs_cvirt.h> 9008+#include <linux/vs_cvirt.h>
8825+ 9009+
8893+ vx_new_uts(release), 9077+ vx_new_uts(release),
8894+ vx_new_uts(version)); 9078+ vx_new_uts(version));
8895 return proc_calc_metrics(page, start, off, count, eof, len); 9079 return proc_calc_metrics(page, start, off, count, eof, len);
8896 } 9080 }
8897 9081
8898diff -NurpP --minimal linux-2.6.15.6/fs/proc/root.c linux-2.6.15.6-vs2.1.1-rc13/fs/proc/root.c 9082Index: linux-2.6.16/fs/proc/root.c
8899--- linux-2.6.15.6/fs/proc/root.c 2004-12-25 01:55:21 +0100 9083===================================================================
8900+++ linux-2.6.15.6-vs2.1.1-rc13/fs/proc/root.c 2006-01-04 21:59:59 +0100 9084--- linux-2.6.16.orig/fs/proc/root.c
9085+++ linux-2.6.16/fs/proc/root.c
8901@@ -23,6 +23,9 @@ struct proc_dir_entry *proc_net, *proc_n 9086@@ -25,6 +25,9 @@ struct proc_dir_entry *proc_net, *proc_n
8902 #ifdef CONFIG_SYSCTL 9087 #ifdef CONFIG_SYSCTL
8903 struct proc_dir_entry *proc_sys_root; 9088 struct proc_dir_entry *proc_sys_root;
8904 #endif 9089 #endif
8905+struct proc_dir_entry *proc_virtual; 9090+struct proc_dir_entry *proc_virtual;
8906+ 9091+
8907+extern void proc_vx_init(void); 9092+extern void proc_vx_init(void);
8908 9093
8909 static struct super_block *proc_get_sb(struct file_system_type *fs_type, 9094 static struct super_block *proc_get_sb(struct file_system_type *fs_type,
8910 int flags, const char *dev_name, void *data) 9095 int flags, const char *dev_name, void *data)
8911@@ -77,6 +80,7 @@ void __init proc_root_init(void) 9096@@ -78,6 +81,7 @@ void __init proc_root_init(void)
8912 proc_device_tree_init(); 9097 proc_device_tree_init();
8913 #endif 9098 #endif
8914 proc_bus = proc_mkdir("bus", NULL); 9099 proc_bus = proc_mkdir("bus", NULL);
8915+ proc_vx_init(); 9100+ proc_vx_init();
8916 } 9101 }
8917 9102
8918 static struct dentry *proc_root_lookup(struct inode * dir, struct dentry * dentry, struct nameidata *nd) 9103 static int proc_root_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat
8919diff -NurpP --minimal linux-2.6.15.6/fs/quota.c linux-2.6.15.6-vs2.1.1-rc13/fs/quota.c 9104Index: linux-2.6.16/fs/quota.c
8920--- linux-2.6.15.6/fs/quota.c 2006-01-03 17:29:59 +0100 9105===================================================================
8921+++ linux-2.6.15.6-vs2.1.1-rc13/fs/quota.c 2006-01-04 21:59:59 +0100 9106--- linux-2.6.16.orig/fs/quota.c
9107+++ linux-2.6.16/fs/quota.c
8922@@ -16,47 +16,50 @@ 9108@@ -17,47 +17,50 @@
8923 #include <linux/syscalls.h>
8924 #include <linux/buffer_head.h> 9109 #include <linux/buffer_head.h>
9110 #include <linux/capability.h>
8925 #include <linux/quotaops.h> 9111 #include <linux/quotaops.h>
8926+#include <linux/major.h> 9112+#include <linux/major.h>
8927+#include <linux/blkdev.h> 9113+#include <linux/blkdev.h>
8928+#include <linux/vserver/debug.h> 9114+#include <linux/vserver/debug.h>
8929 9115
8978- if (sb && !sb->s_qcop->quota_sync) 9164- if (sb && !sb->s_qcop->quota_sync)
8979+ if (hash && !hash->dqh_qcop->quota_sync) 9165+ if (hash && !hash->dqh_qcop->quota_sync)
8980 return -ENOSYS; 9166 return -ENOSYS;
8981 break; 9167 break;
8982 default: 9168 default:
8983@@ -72,7 +75,7 @@ static int generic_quotactl_valid(struct 9169@@ -73,7 +76,7 @@ static int generic_quotactl_valid(struct
8984 case Q_SETQUOTA: 9170 case Q_SETQUOTA:
8985 case Q_GETQUOTA: 9171 case Q_GETQUOTA:
8986 /* This is just informative test so we are satisfied without a lock */ 9172 /* This is just informative test so we are satisfied without a lock */
8987- if (!sb_has_quota_enabled(sb, type)) 9173- if (!sb_has_quota_enabled(sb, type))
8988+ if (!dqh_has_quota_enabled(hash, type)) 9174+ if (!dqh_has_quota_enabled(hash, type))
8989 return -ESRCH; 9175 return -ESRCH;
8990 } 9176 }
8991 9177
8992@@ -80,47 +83,47 @@ static int generic_quotactl_valid(struct 9178@@ -81,47 +84,47 @@ static int generic_quotactl_valid(struct
8993 if (cmd == Q_GETQUOTA) { 9179 if (cmd == Q_GETQUOTA) {
8994 if (((type == USRQUOTA && current->euid != id) || 9180 if (((type == USRQUOTA && current->euid != id) ||
8995 (type == GRPQUOTA && !in_egroup_p(id))) && 9181 (type == GRPQUOTA && !in_egroup_p(id))) &&
8996- !capable(CAP_SYS_ADMIN)) 9182- !capable(CAP_SYS_ADMIN))
8997+ !capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_QUOTA_CTL)) 9183+ !capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_QUOTA_CTL))
9045- if (!sb->s_qcop->quota_sync) 9231- if (!sb->s_qcop->quota_sync)
9046+ if (!hash->dqh_qcop->quota_sync) 9232+ if (!hash->dqh_qcop->quota_sync)
9047 return -ENOSYS; 9233 return -ENOSYS;
9048 break; 9234 break;
9049 default: 9235 default:
9050@@ -131,57 +134,68 @@ static int xqm_quotactl_valid(struct sup 9236@@ -132,57 +135,68 @@ static int xqm_quotactl_valid(struct sup
9051 if (cmd == Q_XGETQUOTA) { 9237 if (cmd == Q_XGETQUOTA) {
9052 if (((type == XQM_USRQUOTA && current->euid != id) || 9238 if (((type == XQM_USRQUOTA && current->euid != id) ||
9053 (type == XQM_GRPQUOTA && !in_egroup_p(id))) && 9239 (type == XQM_GRPQUOTA && !in_egroup_p(id))) &&
9054- !capable(CAP_SYS_ADMIN)) 9240- !capable(CAP_SYS_ADMIN))
9055+ !capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_QUOTA_CTL)) 9241+ !capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_QUOTA_CTL))
9105+ hash->dqh_qcop->quota_sync(hash, type); 9291+ hash->dqh_qcop->quota_sync(hash, type);
9106+ 9292+
9107+ quota_sync_sb(hash->dqh_sb); 9293+ quota_sync_sb(hash->dqh_sb);
9108 9294
9109 /* Now when everything is written we can discard the pagecache so 9295 /* Now when everything is written we can discard the pagecache so
9110 * that userspace sees the changes. We need i_sem and so we could 9296 * that userspace sees the changes. We need i_mutex and so we could
9111 * not do it inside dqonoff_sem. Moreover we need to be carefull 9297 * not do it inside dqonoff_sem. Moreover we need to be carefull
9112 * about races with quotaoff() (that is the reason why we have own 9298 * about races with quotaoff() (that is the reason why we have own
9113 * reference to inode). */ 9299 * reference to inode). */
9114- down(&sb_dqopt(sb)->dqonoff_sem); 9300- down(&sb_dqopt(sb)->dqonoff_sem);
9115+ down(&dqh_dqopt(hash)->dqonoff_sem); 9301+ down(&dqh_dqopt(hash)->dqonoff_sem);
9128 } 9314 }
9129- up(&sb_dqopt(sb)->dqonoff_sem); 9315- up(&sb_dqopt(sb)->dqonoff_sem);
9130+ up(&dqh_dqopt(hash)->dqonoff_sem); 9316+ up(&dqh_dqopt(hash)->dqonoff_sem);
9131 for (cnt = 0; cnt < MAXQUOTAS; cnt++) { 9317 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
9132 if (discard[cnt]) { 9318 if (discard[cnt]) {
9133 down(&discard[cnt]->i_sem); 9319 mutex_lock(&discard[cnt]->i_mutex);
9134@@ -192,67 +206,59 @@ static void quota_sync_sb(struct super_b 9320@@ -193,67 +207,59 @@ static void quota_sync_sb(struct super_b
9135 } 9321 }
9136 } 9322 }
9137 9323
9138-void sync_dquots(struct super_block *sb, int type) 9324-void sync_dquots(struct super_block *sb, int type)
9139+void sync_dquots_dqh(struct dqhash *hash, int type) 9325+void sync_dquots_dqh(struct dqhash *hash, int type)
9224+ fmt = dqh_dqopt(hash)->info[type].dqi_format->qf_fmt_id; 9410+ fmt = dqh_dqopt(hash)->info[type].dqi_format->qf_fmt_id;
9225+ up_read(&dqh_dqopt(hash)->dqptr_sem); 9411+ up_read(&dqh_dqopt(hash)->dqptr_sem);
9226 if (copy_to_user(addr, &fmt, sizeof(fmt))) 9412 if (copy_to_user(addr, &fmt, sizeof(fmt)))
9227 return -EFAULT; 9413 return -EFAULT;
9228 return 0; 9414 return 0;
9229@@ -260,7 +266,7 @@ static int do_quotactl(struct super_bloc 9415@@ -261,7 +267,7 @@ static int do_quotactl(struct super_bloc
9230 case Q_GETINFO: { 9416 case Q_GETINFO: {
9231 struct if_dqinfo info; 9417 struct if_dqinfo info;
9232 9418
9233- if ((ret = sb->s_qcop->get_info(sb, type, &info))) 9419- if ((ret = sb->s_qcop->get_info(sb, type, &info)))
9234+ if ((ret = hash->dqh_qcop->get_info(hash, type, &info))) 9420+ if ((ret = hash->dqh_qcop->get_info(hash, type, &info)))
9235 return ret; 9421 return ret;
9236 if (copy_to_user(addr, &info, sizeof(info))) 9422 if (copy_to_user(addr, &info, sizeof(info)))
9237 return -EFAULT; 9423 return -EFAULT;
9238@@ -271,12 +277,12 @@ static int do_quotactl(struct super_bloc 9424@@ -272,12 +278,12 @@ static int do_quotactl(struct super_bloc
9239 9425
9240 if (copy_from_user(&info, addr, sizeof(info))) 9426 if (copy_from_user(&info, addr, sizeof(info)))
9241 return -EFAULT; 9427 return -EFAULT;
9242- return sb->s_qcop->set_info(sb, type, &info); 9428- return sb->s_qcop->set_info(sb, type, &info);
9243+ return hash->dqh_qcop->set_info(hash, type, &info); 9429+ return hash->dqh_qcop->set_info(hash, type, &info);
9248- if ((ret = sb->s_qcop->get_dqblk(sb, type, id, &idq))) 9434- if ((ret = sb->s_qcop->get_dqblk(sb, type, id, &idq)))
9249+ if ((ret = hash->dqh_qcop->get_dqblk(hash, type, id, &idq))) 9435+ if ((ret = hash->dqh_qcop->get_dqblk(hash, type, id, &idq)))
9250 return ret; 9436 return ret;
9251 if (copy_to_user(addr, &idq, sizeof(idq))) 9437 if (copy_to_user(addr, &idq, sizeof(idq)))
9252 return -EFAULT; 9438 return -EFAULT;
9253@@ -287,10 +293,10 @@ static int do_quotactl(struct super_bloc 9439@@ -288,10 +294,10 @@ static int do_quotactl(struct super_bloc
9254 9440
9255 if (copy_from_user(&idq, addr, sizeof(idq))) 9441 if (copy_from_user(&idq, addr, sizeof(idq)))
9256 return -EFAULT; 9442 return -EFAULT;
9257- return sb->s_qcop->set_dqblk(sb, type, id, &idq); 9443- return sb->s_qcop->set_dqblk(sb, type, id, &idq);
9258+ return hash->dqh_qcop->set_dqblk(hash, type, id, &idq); 9444+ return hash->dqh_qcop->set_dqblk(hash, type, id, &idq);
9261- sync_dquots(sb, type); 9447- sync_dquots(sb, type);
9262+ sync_dquots_dqh(hash, type); 9448+ sync_dquots_dqh(hash, type);
9263 return 0; 9449 return 0;
9264 9450
9265 case Q_XQUOTAON: 9451 case Q_XQUOTAON:
9266@@ -300,12 +306,12 @@ static int do_quotactl(struct super_bloc 9452@@ -301,12 +307,12 @@ static int do_quotactl(struct super_bloc
9267 9453
9268 if (copy_from_user(&flags, addr, sizeof(flags))) 9454 if (copy_from_user(&flags, addr, sizeof(flags)))
9269 return -EFAULT; 9455 return -EFAULT;
9270- return sb->s_qcop->set_xstate(sb, flags, cmd); 9456- return sb->s_qcop->set_xstate(sb, flags, cmd);
9271+ return hash->dqh_qcop->set_xstate(hash, flags, cmd); 9457+ return hash->dqh_qcop->set_xstate(hash, flags, cmd);
9276- if ((ret = sb->s_qcop->get_xstate(sb, &fqs))) 9462- if ((ret = sb->s_qcop->get_xstate(sb, &fqs)))
9277+ if ((ret = hash->dqh_qcop->get_xstate(hash, &fqs))) 9463+ if ((ret = hash->dqh_qcop->get_xstate(hash, &fqs)))
9278 return ret; 9464 return ret;
9279 if (copy_to_user(addr, &fqs, sizeof(fqs))) 9465 if (copy_to_user(addr, &fqs, sizeof(fqs)))
9280 return -EFAULT; 9466 return -EFAULT;
9281@@ -316,19 +322,19 @@ static int do_quotactl(struct super_bloc 9467@@ -317,19 +323,19 @@ static int do_quotactl(struct super_bloc
9282 9468
9283 if (copy_from_user(&fdq, addr, sizeof(fdq))) 9469 if (copy_from_user(&fdq, addr, sizeof(fdq)))
9284 return -EFAULT; 9470 return -EFAULT;
9285- return sb->s_qcop->set_xquota(sb, type, id, &fdq); 9471- return sb->s_qcop->set_xquota(sb, type, id, &fdq);
9286+ return hash->dqh_qcop->set_xquota(hash, type, id, &fdq); 9472+ return hash->dqh_qcop->set_xquota(hash, type, id, &fdq);
9299- return sb->s_qcop->quota_sync(sb, type); 9485- return sb->s_qcop->quota_sync(sb, type);
9300+ return hash->dqh_qcop->quota_sync(hash, type); 9486+ return hash->dqh_qcop->quota_sync(hash, type);
9301 /* We never reach here unless validity check is broken */ 9487 /* We never reach here unless validity check is broken */
9302 default: 9488 default:
9303 BUG(); 9489 BUG();
9304@@ -336,6 +342,43 @@ static int do_quotactl(struct super_bloc 9490@@ -337,6 +343,43 @@ static int do_quotactl(struct super_bloc
9305 return 0; 9491 return 0;
9306 } 9492 }
9307 9493
9308+#if defined(CONFIG_BLK_DEV_VROOT) || defined(CONFIG_BLK_DEV_VROOT_MODULE) 9494+#if defined(CONFIG_BLK_DEV_VROOT) || defined(CONFIG_BLK_DEV_VROOT_MODULE)
9309+ 9495+
9343+#endif 9529+#endif
9344+ 9530+
9345 /* 9531 /*
9346 * This is the system call interface. This communicates with 9532 * This is the system call interface. This communicates with
9347 * the user-level programs. Currently this only supports diskquota 9533 * the user-level programs. Currently this only supports diskquota
9348@@ -346,6 +389,7 @@ asmlinkage long sys_quotactl(unsigned in 9534@@ -347,6 +390,7 @@ asmlinkage long sys_quotactl(unsigned in
9349 { 9535 {
9350 uint cmds, type; 9536 uint cmds, type;
9351 struct super_block *sb = NULL; 9537 struct super_block *sb = NULL;
9352+ struct dqhash *dqh = NULL; 9538+ struct dqhash *dqh = NULL;
9353 struct block_device *bdev; 9539 struct block_device *bdev;
9354 char *tmp; 9540 char *tmp;
9355 int ret; 9541 int ret;
9356@@ -361,15 +405,33 @@ asmlinkage long sys_quotactl(unsigned in 9542@@ -362,15 +406,33 @@ asmlinkage long sys_quotactl(unsigned in
9357 putname(tmp); 9543 putname(tmp);
9358 if (IS_ERR(bdev)) 9544 if (IS_ERR(bdev))
9359 return PTR_ERR(bdev); 9545 return PTR_ERR(bdev);
9360+#if defined(CONFIG_BLK_DEV_VROOT) || defined(CONFIG_BLK_DEV_VROOT_MODULE) 9546+#if defined(CONFIG_BLK_DEV_VROOT) || defined(CONFIG_BLK_DEV_VROOT_MODULE)
9361+ if (bdev && bdev->bd_inode && 9547+ if (bdev && bdev->bd_inode &&
9388- ret = do_quotactl(sb, type, cmds, id, addr); 9574- ret = do_quotactl(sb, type, cmds, id, addr);
9389+ ret = do_quotactl(dqh, type, cmds, id, addr); 9575+ ret = do_quotactl(dqh, type, cmds, id, addr);
9390 if (sb) 9576 if (sb)
9391 drop_super(sb); 9577 drop_super(sb);
9392 9578
9393diff -NurpP --minimal linux-2.6.15.6/fs/quota_v1.c linux-2.6.15.6-vs2.1.1-rc13/fs/quota_v1.c 9579Index: linux-2.6.16/fs/quota_v1.c
9394--- linux-2.6.15.6/fs/quota_v1.c 2005-03-02 12:38:45 +0100 9580===================================================================
9395+++ linux-2.6.15.6-vs2.1.1-rc13/fs/quota_v1.c 2006-01-04 21:59:59 +0100 9581--- linux-2.6.16.orig/fs/quota_v1.c
9582+++ linux-2.6.16/fs/quota_v1.c
9396@@ -42,12 +42,13 @@ static int v1_read_dqblk(struct dquot *d 9583@@ -42,12 +42,13 @@ static int v1_read_dqblk(struct dquot *d
9397 int type = dquot->dq_type; 9584 int type = dquot->dq_type;
9398 struct v1_disk_dqblk dqblk; 9585 struct v1_disk_dqblk dqblk;
9399 9586
9400- if (!sb_dqopt(dquot->dq_sb)->files[type]) 9587- if (!sb_dqopt(dquot->dq_sb)->files[type])
9501- ret = sb->s_op->quota_write(sb, type, (char *)&dqblk, 9688- ret = sb->s_op->quota_write(sb, type, (char *)&dqblk,
9502+ ret = hash->dqh_sb->s_op->quota_write(hash, type, (char *)&dqblk, 9689+ ret = hash->dqh_sb->s_op->quota_write(hash, type, (char *)&dqblk,
9503 sizeof(struct v1_disk_dqblk), v1_dqoff(0)); 9690 sizeof(struct v1_disk_dqblk), v1_dqoff(0));
9504 if (ret == sizeof(struct v1_disk_dqblk)) 9691 if (ret == sizeof(struct v1_disk_dqblk))
9505 ret = 0; 9692 ret = 0;
9506diff -NurpP --minimal linux-2.6.15.6/fs/quota_v2.c linux-2.6.15.6-vs2.1.1-rc13/fs/quota_v2.c 9693Index: linux-2.6.16/fs/quota_v2.c
9507--- linux-2.6.15.6/fs/quota_v2.c 2005-06-22 02:38:37 +0200 9694===================================================================
9508+++ linux-2.6.15.6-vs2.1.1-rc13/fs/quota_v2.c 2006-01-04 21:59:59 +0100 9695--- linux-2.6.16.orig/fs/quota_v2.c
9696+++ linux-2.6.16/fs/quota_v2.c
9509@@ -26,14 +26,15 @@ typedef char *dqbuf_t; 9697@@ -26,14 +26,15 @@ typedef char *dqbuf_t;
9510 #define GETENTRIES(buf) ((struct v2_disk_dqblk *)(((char *)buf)+sizeof(struct v2_disk_dqdbheader))) 9698 #define GETENTRIES(buf) ((struct v2_disk_dqblk *)(((char *)buf)+sizeof(struct v2_disk_dqdbheader)))
9511 9699
9512 /* Check whether given file is really vfsv0 quotafile */ 9700 /* Check whether given file is really vfsv0 quotafile */
9513-static int v2_check_quota_file(struct super_block *sb, int type) 9701-static int v2_check_quota_file(struct super_block *sb, int type)
9520 9708
9521- size = sb->s_op->quota_read(sb, type, (char *)&dqhead, sizeof(struct v2_disk_dqheader), 0); 9709- size = sb->s_op->quota_read(sb, type, (char *)&dqhead, sizeof(struct v2_disk_dqheader), 0);
9522+ size = hash->dqh_sb->s_op->quota_read(hash, type, 9710+ size = hash->dqh_sb->s_op->quota_read(hash, type,
9523+ (char *)&dqhead, sizeof(struct v2_disk_dqheader), 0); 9711+ (char *)&dqhead, sizeof(struct v2_disk_dqheader), 0);
9524 if (size != sizeof(struct v2_disk_dqheader)) { 9712 if (size != sizeof(struct v2_disk_dqheader)) {
9525 printk("failed read\n"); 9713 printk("quota_v2: failed read expected=%zd got=%zd\n",
9526 return 0; 9714 sizeof(struct v2_disk_dqheader), size);
9527@@ -45,17 +46,17 @@ static int v2_check_quota_file(struct su 9715@@ -46,17 +47,17 @@ static int v2_check_quota_file(struct su
9528 } 9716 }
9529 9717
9530 /* Read information header from quota file */ 9718 /* Read information header from quota file */
9531-static int v2_read_file_info(struct super_block *sb, int type) 9719-static int v2_read_file_info(struct super_block *sb, int type)
9532+static int v2_read_file_info(struct dqhash *hash, int type) 9720+static int v2_read_file_info(struct dqhash *hash, int type)
9545- sb->s_id); 9733- sb->s_id);
9546+ hash->dqh_sb->s_id); 9734+ hash->dqh_sb->s_id);
9547 return -1; 9735 return -1;
9548 } 9736 }
9549 info->dqi_bgrace = le32_to_cpu(dinfo.dqi_bgrace); 9737 info->dqi_bgrace = le32_to_cpu(dinfo.dqi_bgrace);
9550@@ -68,10 +69,10 @@ static int v2_read_file_info(struct supe 9738@@ -69,10 +70,10 @@ static int v2_read_file_info(struct supe
9551 } 9739 }
9552 9740
9553 /* Write information header to quota file */ 9741 /* Write information header to quota file */
9554-static int v2_write_file_info(struct super_block *sb, int type) 9742-static int v2_write_file_info(struct super_block *sb, int type)
9555+static int v2_write_file_info(struct dqhash *hash, int type) 9743+static int v2_write_file_info(struct dqhash *hash, int type)
9558- struct mem_dqinfo *info = sb_dqopt(sb)->info+type; 9746- struct mem_dqinfo *info = sb_dqopt(sb)->info+type;
9559+ struct mem_dqinfo *info = dqh_dqopt(hash)->info+type; 9747+ struct mem_dqinfo *info = dqh_dqopt(hash)->info+type;
9560 ssize_t size; 9748 ssize_t size;
9561 9749
9562 spin_lock(&dq_data_lock); 9750 spin_lock(&dq_data_lock);
9563@@ -83,11 +84,11 @@ static int v2_write_file_info(struct sup 9751@@ -84,11 +85,11 @@ static int v2_write_file_info(struct sup
9564 dinfo.dqi_blocks = cpu_to_le32(info->u.v2_i.dqi_blocks); 9752 dinfo.dqi_blocks = cpu_to_le32(info->u.v2_i.dqi_blocks);
9565 dinfo.dqi_free_blk = cpu_to_le32(info->u.v2_i.dqi_free_blk); 9753 dinfo.dqi_free_blk = cpu_to_le32(info->u.v2_i.dqi_free_blk);
9566 dinfo.dqi_free_entry = cpu_to_le32(info->u.v2_i.dqi_free_entry); 9754 dinfo.dqi_free_entry = cpu_to_le32(info->u.v2_i.dqi_free_entry);
9567- size = sb->s_op->quota_write(sb, type, (char *)&dinfo, 9755- size = sb->s_op->quota_write(sb, type, (char *)&dinfo,
9568+ size = hash->dqh_sb->s_op->quota_write(hash, type, (char *)&dinfo, 9756+ size = hash->dqh_sb->s_op->quota_write(hash, type, (char *)&dinfo,
9572- sb->s_id); 9760- sb->s_id);
9573+ hash->dqh_sb->s_id); 9761+ hash->dqh_sb->s_id);
9574 return -1; 9762 return -1;
9575 } 9763 }
9576 return 0; 9764 return 0;
9577@@ -131,24 +132,24 @@ static inline void freedqbuf(dqbuf_t buf 9765@@ -132,24 +133,24 @@ static inline void freedqbuf(dqbuf_t buf
9578 kfree(buf); 9766 kfree(buf);
9579 } 9767 }
9580 9768
9581-static inline ssize_t read_blk(struct super_block *sb, int type, uint blk, dqbuf_t buf) 9769-static inline ssize_t read_blk(struct super_block *sb, int type, uint blk, dqbuf_t buf)
9582+static inline ssize_t read_blk(struct dqhash *hash, int type, uint blk, dqbuf_t buf) 9770+static inline ssize_t read_blk(struct dqhash *hash, int type, uint blk, dqbuf_t buf)
9605- struct mem_dqinfo *info = sb_dqinfo(sb, type); 9793- struct mem_dqinfo *info = sb_dqinfo(sb, type);
9606+ struct mem_dqinfo *info = dqh_dqinfo(hash, type); 9794+ struct mem_dqinfo *info = dqh_dqinfo(hash, type);
9607 struct v2_disk_dqdbheader *dh = (struct v2_disk_dqdbheader *)buf; 9795 struct v2_disk_dqdbheader *dh = (struct v2_disk_dqdbheader *)buf;
9608 int ret, blk; 9796 int ret, blk;
9609 9797
9610@@ -156,18 +157,18 @@ static int get_free_dqblk(struct super_b 9798@@ -157,18 +158,18 @@ static int get_free_dqblk(struct super_b
9611 return -ENOMEM; 9799 return -ENOMEM;
9612 if (info->u.v2_i.dqi_free_blk) { 9800 if (info->u.v2_i.dqi_free_blk) {
9613 blk = info->u.v2_i.dqi_free_blk; 9801 blk = info->u.v2_i.dqi_free_blk;
9614- if ((ret = read_blk(sb, type, blk, buf)) < 0) 9802- if ((ret = read_blk(sb, type, blk, buf)) < 0)
9615+ if ((ret = read_blk(hash, type, blk, buf)) < 0) 9803+ if ((ret = read_blk(hash, type, blk, buf)) < 0)
9627- mark_info_dirty(sb, type); 9815- mark_info_dirty(sb, type);
9628+ mark_info_dirty(hash, type); 9816+ mark_info_dirty(hash, type);
9629 ret = blk; 9817 ret = blk;
9630 out_buf: 9818 out_buf:
9631 freedqbuf(buf); 9819 freedqbuf(buf);
9632@@ -175,9 +176,9 @@ out_buf: 9820@@ -176,9 +177,9 @@ out_buf:
9633 } 9821 }
9634 9822
9635 /* Insert empty block to the list */ 9823 /* Insert empty block to the list */
9636-static int put_free_dqblk(struct super_block *sb, int type, dqbuf_t buf, uint blk) 9824-static int put_free_dqblk(struct super_block *sb, int type, dqbuf_t buf, uint blk)
9637+static int put_free_dqblk(struct dqhash *hash, int type, dqbuf_t buf, uint blk) 9825+static int put_free_dqblk(struct dqhash *hash, int type, dqbuf_t buf, uint blk)
9639- struct mem_dqinfo *info = sb_dqinfo(sb, type); 9827- struct mem_dqinfo *info = sb_dqinfo(sb, type);
9640+ struct mem_dqinfo *info = dqh_dqinfo(hash, type); 9828+ struct mem_dqinfo *info = dqh_dqinfo(hash, type);
9641 struct v2_disk_dqdbheader *dh = (struct v2_disk_dqdbheader *)buf; 9829 struct v2_disk_dqdbheader *dh = (struct v2_disk_dqdbheader *)buf;
9642 int err; 9830 int err;
9643 9831
9644@@ -185,18 +186,18 @@ static int put_free_dqblk(struct super_b 9832@@ -186,18 +187,18 @@ static int put_free_dqblk(struct super_b
9645 dh->dqdh_prev_free = cpu_to_le32(0); 9833 dh->dqdh_prev_free = cpu_to_le32(0);
9646 dh->dqdh_entries = cpu_to_le16(0); 9834 dh->dqdh_entries = cpu_to_le16(0);
9647 info->u.v2_i.dqi_free_blk = blk; 9835 info->u.v2_i.dqi_free_blk = blk;
9648- mark_info_dirty(sb, type); 9836- mark_info_dirty(sb, type);
9649+ mark_info_dirty(hash, type); 9837+ mark_info_dirty(hash, type);
9662- struct mem_dqinfo *info = sb_dqinfo(sb, type); 9850- struct mem_dqinfo *info = sb_dqinfo(sb, type);
9663+ struct mem_dqinfo *info = dqh_dqinfo(hash, type); 9851+ struct mem_dqinfo *info = dqh_dqinfo(hash, type);
9664 struct v2_disk_dqdbheader *dh = (struct v2_disk_dqdbheader *)buf; 9852 struct v2_disk_dqdbheader *dh = (struct v2_disk_dqdbheader *)buf;
9665 uint nextblk = le32_to_cpu(dh->dqdh_next_free), prevblk = le32_to_cpu(dh->dqdh_prev_free); 9853 uint nextblk = le32_to_cpu(dh->dqdh_next_free), prevblk = le32_to_cpu(dh->dqdh_prev_free);
9666 int err; 9854 int err;
9667@@ -204,27 +205,27 @@ static int remove_free_dqentry(struct su 9855@@ -205,27 +206,27 @@ static int remove_free_dqentry(struct su
9668 if (!tmpbuf) 9856 if (!tmpbuf)
9669 return -ENOMEM; 9857 return -ENOMEM;
9670 if (nextblk) { 9858 if (nextblk) {
9671- if ((err = read_blk(sb, type, nextblk, tmpbuf)) < 0) 9859- if ((err = read_blk(sb, type, nextblk, tmpbuf)) < 0)
9672+ if ((err = read_blk(hash, type, nextblk, tmpbuf)) < 0) 9860+ if ((err = read_blk(hash, type, nextblk, tmpbuf)) < 0)
9696- if (write_blk(sb, type, blk, buf) < 0) 9884- if (write_blk(sb, type, blk, buf) < 0)
9697+ if (write_blk(hash, type, blk, buf) < 0) 9885+ if (write_blk(hash, type, blk, buf) < 0)
9698 printk(KERN_ERR "VFS: Can't write block (%u) with free entries.\n", blk); 9886 printk(KERN_ERR "VFS: Can't write block (%u) with free entries.\n", blk);
9699 return 0; 9887 return 0;
9700 out_buf: 9888 out_buf:
9701@@ -233,10 +234,10 @@ out_buf: 9889@@ -234,10 +235,10 @@ out_buf:
9702 } 9890 }
9703 9891
9704 /* Insert given block to the beginning of list with free entries */ 9892 /* Insert given block to the beginning of list with free entries */
9705-static int insert_free_dqentry(struct super_block *sb, int type, dqbuf_t buf, uint blk) 9893-static int insert_free_dqentry(struct super_block *sb, int type, dqbuf_t buf, uint blk)
9706+static int insert_free_dqentry(struct dqhash *hash, int type, dqbuf_t buf, uint blk) 9894+static int insert_free_dqentry(struct dqhash *hash, int type, dqbuf_t buf, uint blk)
9709- struct mem_dqinfo *info = sb_dqinfo(sb, type); 9897- struct mem_dqinfo *info = sb_dqinfo(sb, type);
9710+ struct mem_dqinfo *info = dqh_dqinfo(hash, type); 9898+ struct mem_dqinfo *info = dqh_dqinfo(hash, type);
9711 struct v2_disk_dqdbheader *dh = (struct v2_disk_dqdbheader *)buf; 9899 struct v2_disk_dqdbheader *dh = (struct v2_disk_dqdbheader *)buf;
9712 int err; 9900 int err;
9713 9901
9714@@ -244,18 +245,18 @@ static int insert_free_dqentry(struct su 9902@@ -245,18 +246,18 @@ static int insert_free_dqentry(struct su
9715 return -ENOMEM; 9903 return -ENOMEM;
9716 dh->dqdh_next_free = cpu_to_le32(info->u.v2_i.dqi_free_entry); 9904 dh->dqdh_next_free = cpu_to_le32(info->u.v2_i.dqi_free_entry);
9717 dh->dqdh_prev_free = cpu_to_le32(0); 9905 dh->dqdh_prev_free = cpu_to_le32(0);
9718- if ((err = write_blk(sb, type, blk, buf)) < 0) 9906- if ((err = write_blk(sb, type, blk, buf)) < 0)
9719+ if ((err = write_blk(hash, type, blk, buf)) < 0) 9907+ if ((err = write_blk(hash, type, blk, buf)) < 0)
9732- mark_info_dirty(sb, type); 9920- mark_info_dirty(sb, type);
9733+ mark_info_dirty(hash, type); 9921+ mark_info_dirty(hash, type);
9734 return 0; 9922 return 0;
9735 out_buf: 9923 out_buf:
9736 freedqbuf(tmpbuf); 9924 freedqbuf(tmpbuf);
9737@@ -265,8 +266,9 @@ out_buf: 9925@@ -266,8 +267,9 @@ out_buf:
9738 /* Find space for dquot */ 9926 /* Find space for dquot */
9739 static uint find_free_dqentry(struct dquot *dquot, int *err) 9927 static uint find_free_dqentry(struct dquot *dquot, int *err)
9740 { 9928 {
9741- struct super_block *sb = dquot->dq_sb; 9929- struct super_block *sb = dquot->dq_sb;
9742- struct mem_dqinfo *info = sb_dqopt(sb)->info+dquot->dq_type; 9930- struct mem_dqinfo *info = sb_dqopt(sb)->info+dquot->dq_type;
9744+ struct dqhash *dqh = dquot->dq_dqh; 9932+ struct dqhash *dqh = dquot->dq_dqh;
9745+ struct mem_dqinfo *info = dqh_dqopt(dqh)->info+dquot->dq_type; 9933+ struct mem_dqinfo *info = dqh_dqopt(dqh)->info+dquot->dq_type;
9746 uint blk, i; 9934 uint blk, i;
9747 struct v2_disk_dqdbheader *dh; 9935 struct v2_disk_dqdbheader *dh;
9748 struct v2_disk_dqblk *ddquot; 9936 struct v2_disk_dqblk *ddquot;
9749@@ -282,11 +284,11 @@ static uint find_free_dqentry(struct dqu 9937@@ -283,11 +285,11 @@ static uint find_free_dqentry(struct dqu
9750 ddquot = GETENTRIES(buf); 9938 ddquot = GETENTRIES(buf);
9751 if (info->u.v2_i.dqi_free_entry) { 9939 if (info->u.v2_i.dqi_free_entry) {
9752 blk = info->u.v2_i.dqi_free_entry; 9940 blk = info->u.v2_i.dqi_free_entry;
9753- if ((*err = read_blk(sb, dquot->dq_type, blk, buf)) < 0) 9941- if ((*err = read_blk(sb, dquot->dq_type, blk, buf)) < 0)
9754+ if ((*err = read_blk(dqh, dquot->dq_type, blk, buf)) < 0) 9942+ if ((*err = read_blk(dqh, dquot->dq_type, blk, buf)) < 0)
9758- blk = get_free_dqblk(sb, dquot->dq_type); 9946- blk = get_free_dqblk(sb, dquot->dq_type);
9759+ blk = get_free_dqblk(dqh, dquot->dq_type); 9947+ blk = get_free_dqblk(dqh, dquot->dq_type);
9760 if ((int)blk < 0) { 9948 if ((int)blk < 0) {
9761 *err = blk; 9949 *err = blk;
9762 freedqbuf(buf); 9950 freedqbuf(buf);
9763@@ -295,10 +297,10 @@ static uint find_free_dqentry(struct dqu 9951@@ -296,10 +298,10 @@ static uint find_free_dqentry(struct dqu
9764 memset(buf, 0, V2_DQBLKSIZE); 9952 memset(buf, 0, V2_DQBLKSIZE);
9765 /* This is enough as block is already zeroed and entry list is empty... */ 9953 /* This is enough as block is already zeroed and entry list is empty... */
9766 info->u.v2_i.dqi_free_entry = blk; 9954 info->u.v2_i.dqi_free_entry = blk;
9767- mark_info_dirty(sb, dquot->dq_type); 9955- mark_info_dirty(sb, dquot->dq_type);
9768+ mark_info_dirty(dqh, dquot->dq_type); 9956+ mark_info_dirty(dqh, dquot->dq_type);
9771- if ((*err = remove_free_dqentry(sb, dquot->dq_type, buf, blk)) < 0) { 9959- if ((*err = remove_free_dqentry(sb, dquot->dq_type, buf, blk)) < 0) {
9772+ if ((*err = remove_free_dqentry(dqh, dquot->dq_type, buf, blk)) < 0) { 9960+ if ((*err = remove_free_dqentry(dqh, dquot->dq_type, buf, blk)) < 0) {
9773 printk(KERN_ERR "VFS: find_free_dqentry(): Can't remove block (%u) from entry free list.\n", blk); 9961 printk(KERN_ERR "VFS: find_free_dqentry(): Can't remove block (%u) from entry free list.\n", blk);
9774 goto out_buf; 9962 goto out_buf;
9775 } 9963 }
9776@@ -313,7 +315,7 @@ static uint find_free_dqentry(struct dqu 9964@@ -314,7 +316,7 @@ static uint find_free_dqentry(struct dqu
9777 goto out_buf; 9965 goto out_buf;
9778 } 9966 }
9779 #endif 9967 #endif
9780- if ((*err = write_blk(sb, dquot->dq_type, blk, buf)) < 0) { 9968- if ((*err = write_blk(sb, dquot->dq_type, blk, buf)) < 0) {
9781+ if ((*err = write_blk(dqh, dquot->dq_type, blk, buf)) < 0) { 9969+ if ((*err = write_blk(dqh, dquot->dq_type, blk, buf)) < 0) {
9782 printk(KERN_ERR "VFS: find_free_dqentry(): Can't write quota data block %u.\n", blk); 9970 printk(KERN_ERR "VFS: find_free_dqentry(): Can't write quota data block %u.\n", blk);
9783 goto out_buf; 9971 goto out_buf;
9784 } 9972 }
9785@@ -328,7 +330,7 @@ out_buf: 9973@@ -329,7 +331,7 @@ out_buf:
9786 /* Insert reference to structure into the trie */ 9974 /* Insert reference to structure into the trie */
9787 static int do_insert_tree(struct dquot *dquot, uint *treeblk, int depth) 9975 static int do_insert_tree(struct dquot *dquot, uint *treeblk, int depth)
9788 { 9976 {
9789- struct super_block *sb = dquot->dq_sb; 9977- struct super_block *sb = dquot->dq_sb;
9790+ struct dqhash *dqh = dquot->dq_dqh; 9978+ struct dqhash *dqh = dquot->dq_dqh;
9791 dqbuf_t buf; 9979 dqbuf_t buf;
9792 int ret = 0, newson = 0, newact = 0; 9980 int ret = 0, newson = 0, newact = 0;
9793 __le32 *ref; 9981 __le32 *ref;
9794@@ -337,7 +339,7 @@ static int do_insert_tree(struct dquot * 9982@@ -338,7 +340,7 @@ static int do_insert_tree(struct dquot *
9795 if (!(buf = getdqbuf())) 9983 if (!(buf = getdqbuf()))
9796 return -ENOMEM; 9984 return -ENOMEM;
9797 if (!*treeblk) { 9985 if (!*treeblk) {
9798- ret = get_free_dqblk(sb, dquot->dq_type); 9986- ret = get_free_dqblk(sb, dquot->dq_type);
9799+ ret = get_free_dqblk(dqh, dquot->dq_type); 9987+ ret = get_free_dqblk(dqh, dquot->dq_type);
9800 if (ret < 0) 9988 if (ret < 0)
9801 goto out_buf; 9989 goto out_buf;
9802 *treeblk = ret; 9990 *treeblk = ret;
9803@@ -345,7 +347,7 @@ static int do_insert_tree(struct dquot * 9991@@ -346,7 +348,7 @@ static int do_insert_tree(struct dquot *
9804 newact = 1; 9992 newact = 1;
9805 } 9993 }
9806 else { 9994 else {
9807- if ((ret = read_blk(sb, dquot->dq_type, *treeblk, buf)) < 0) { 9995- if ((ret = read_blk(sb, dquot->dq_type, *treeblk, buf)) < 0) {
9808+ if ((ret = read_blk(dqh, dquot->dq_type, *treeblk, buf)) < 0) { 9996+ if ((ret = read_blk(dqh, dquot->dq_type, *treeblk, buf)) < 0) {
9809 printk(KERN_ERR "VFS: Can't read tree quota block %u.\n", *treeblk); 9997 printk(KERN_ERR "VFS: Can't read tree quota block %u.\n", *treeblk);
9810 goto out_buf; 9998 goto out_buf;
9811 } 9999 }
9812@@ -368,10 +370,10 @@ static int do_insert_tree(struct dquot * 10000@@ -369,10 +371,10 @@ static int do_insert_tree(struct dquot *
9813 ret = do_insert_tree(dquot, &newblk, depth+1); 10001 ret = do_insert_tree(dquot, &newblk, depth+1);
9814 if (newson && ret >= 0) { 10002 if (newson && ret >= 0) {
9815 ref[GETIDINDEX(dquot->dq_id, depth)] = cpu_to_le32(newblk); 10003 ref[GETIDINDEX(dquot->dq_id, depth)] = cpu_to_le32(newblk);
9816- ret = write_blk(sb, dquot->dq_type, *treeblk, buf); 10004- ret = write_blk(sb, dquot->dq_type, *treeblk, buf);
9817+ ret = write_blk(dqh, dquot->dq_type, *treeblk, buf); 10005+ ret = write_blk(dqh, dquot->dq_type, *treeblk, buf);
9820- put_free_dqblk(sb, dquot->dq_type, buf, *treeblk); 10008- put_free_dqblk(sb, dquot->dq_type, buf, *treeblk);
9821+ put_free_dqblk(dqh, dquot->dq_type, buf, *treeblk); 10009+ put_free_dqblk(dqh, dquot->dq_type, buf, *treeblk);
9822 out_buf: 10010 out_buf:
9823 freedqbuf(buf); 10011 freedqbuf(buf);
9824 return ret; 10012 return ret;
9825@@ -408,10 +410,11 @@ static int v2_write_dquot(struct dquot * 10013@@ -409,10 +411,11 @@ static int v2_write_dquot(struct dquot *
9826 if (!memcmp(&empty, &ddquot, sizeof(struct v2_disk_dqblk))) 10014 if (!memcmp(&empty, &ddquot, sizeof(struct v2_disk_dqblk)))
9827 ddquot.dqb_itime = cpu_to_le64(1); 10015 ddquot.dqb_itime = cpu_to_le64(1);
9828 spin_unlock(&dq_data_lock); 10016 spin_unlock(&dq_data_lock);
9829- ret = dquot->dq_sb->s_op->quota_write(dquot->dq_sb, type, 10017- ret = dquot->dq_sb->s_op->quota_write(dquot->dq_sb, type,
9830+ ret = dquot->dq_dqh->dqh_sb->s_op->quota_write(dquot->dq_dqh, type, 10018+ ret = dquot->dq_dqh->dqh_sb->s_op->quota_write(dquot->dq_dqh, type,
9834+ printk(KERN_WARNING "VFS: dquota write failed on dev %s\n", 10022+ printk(KERN_WARNING "VFS: dquota write failed on dev %s\n",
9835+ dquot->dq_dqh->dqh_sb->s_id); 10023+ dquot->dq_dqh->dqh_sb->s_id);
9836 if (ret >= 0) 10024 if (ret >= 0)
9837 ret = -ENOSPC; 10025 ret = -ENOSPC;
9838 } 10026 }
9839@@ -425,7 +428,8 @@ static int v2_write_dquot(struct dquot * 10027@@ -426,7 +429,8 @@ static int v2_write_dquot(struct dquot *
9840 /* Free dquot entry in data block */ 10028 /* Free dquot entry in data block */
9841 static int free_dqentry(struct dquot *dquot, uint blk) 10029 static int free_dqentry(struct dquot *dquot, uint blk)
9842 { 10030 {
9843- struct super_block *sb = dquot->dq_sb; 10031- struct super_block *sb = dquot->dq_sb;
9844+ // struct super_block *sb = dquot->dq_sb; 10032+ // struct super_block *sb = dquot->dq_sb;
9845+ struct dqhash *dqh = dquot->dq_dqh; 10033+ struct dqhash *dqh = dquot->dq_dqh;
9846 int type = dquot->dq_type; 10034 int type = dquot->dq_type;
9847 struct v2_disk_dqdbheader *dh; 10035 struct v2_disk_dqdbheader *dh;
9848 dqbuf_t buf = getdqbuf(); 10036 dqbuf_t buf = getdqbuf();
9849@@ -439,15 +443,15 @@ static int free_dqentry(struct dquot *dq 10037@@ -440,15 +444,15 @@ static int free_dqentry(struct dquot *dq
9850 (uint)(dquot->dq_off >> V2_DQBLKSIZE_BITS)); 10038 (uint)(dquot->dq_off >> V2_DQBLKSIZE_BITS));
9851 goto out_buf; 10039 goto out_buf;
9852 } 10040 }
9853- if ((ret = read_blk(sb, type, blk, buf)) < 0) { 10041- if ((ret = read_blk(sb, type, blk, buf)) < 0) {
9854+ if ((ret = read_blk(dqh, type, blk, buf)) < 0) { 10042+ if ((ret = read_blk(dqh, type, blk, buf)) < 0) {
9863+ if ((ret = remove_free_dqentry(dqh, type, buf, blk)) < 0 || 10051+ if ((ret = remove_free_dqentry(dqh, type, buf, blk)) < 0 ||
9864+ (ret = put_free_dqblk(dqh, type, buf, blk)) < 0) { 10052+ (ret = put_free_dqblk(dqh, type, buf, blk)) < 0) {
9865 printk(KERN_ERR "VFS: Can't move quota data block (%u) " 10053 printk(KERN_ERR "VFS: Can't move quota data block (%u) "
9866 "to free list.\n", blk); 10054 "to free list.\n", blk);
9867 goto out_buf; 10055 goto out_buf;
9868@@ -458,13 +462,13 @@ static int free_dqentry(struct dquot *dq 10056@@ -459,13 +463,13 @@ static int free_dqentry(struct dquot *dq
9869 sizeof(struct v2_disk_dqblk)); 10057 sizeof(struct v2_disk_dqblk));
9870 if (le16_to_cpu(dh->dqdh_entries) == V2_DQSTRINBLK-1) { 10058 if (le16_to_cpu(dh->dqdh_entries) == V2_DQSTRINBLK-1) {
9871 /* Insert will write block itself */ 10059 /* Insert will write block itself */
9872- if ((ret = insert_free_dqentry(sb, type, buf, blk)) < 0) { 10060- if ((ret = insert_free_dqentry(sb, type, buf, blk)) < 0) {
9873+ if ((ret = insert_free_dqentry(dqh, type, buf, blk)) < 0) { 10061+ if ((ret = insert_free_dqentry(dqh, type, buf, blk)) < 0) {
9879- if ((ret = write_blk(sb, type, blk, buf)) < 0) { 10067- if ((ret = write_blk(sb, type, blk, buf)) < 0) {
9880+ if ((ret = write_blk(dqh, type, blk, buf)) < 0) { 10068+ if ((ret = write_blk(dqh, type, blk, buf)) < 0) {
9881 printk(KERN_ERR "VFS: Can't write quota data " 10069 printk(KERN_ERR "VFS: Can't write quota data "
9882 "block %u\n", blk); 10070 "block %u\n", blk);
9883 goto out_buf; 10071 goto out_buf;
9884@@ -479,7 +483,7 @@ out_buf: 10072@@ -480,7 +484,7 @@ out_buf:
9885 /* Remove reference to dquot from tree */ 10073 /* Remove reference to dquot from tree */
9886 static int remove_tree(struct dquot *dquot, uint *blk, int depth) 10074 static int remove_tree(struct dquot *dquot, uint *blk, int depth)
9887 { 10075 {
9888- struct super_block *sb = dquot->dq_sb; 10076- struct super_block *sb = dquot->dq_sb;
9889+ struct dqhash *dqh = dquot->dq_dqh; 10077+ struct dqhash *dqh = dquot->dq_dqh;
9890 int type = dquot->dq_type; 10078 int type = dquot->dq_type;
9891 dqbuf_t buf = getdqbuf(); 10079 dqbuf_t buf = getdqbuf();
9892 int ret = 0; 10080 int ret = 0;
9893@@ -488,7 +492,7 @@ static int remove_tree(struct dquot *dqu 10081@@ -489,7 +493,7 @@ static int remove_tree(struct dquot *dqu
9894 10082
9895 if (!buf) 10083 if (!buf)
9896 return -ENOMEM; 10084 return -ENOMEM;
9897- if ((ret = read_blk(sb, type, *blk, buf)) < 0) { 10085- if ((ret = read_blk(sb, type, *blk, buf)) < 0) {
9898+ if ((ret = read_blk(dqh, type, *blk, buf)) < 0) { 10086+ if ((ret = read_blk(dqh, type, *blk, buf)) < 0) {
9899 printk(KERN_ERR "VFS: Can't read quota data block %u\n", *blk); 10087 printk(KERN_ERR "VFS: Can't read quota data block %u\n", *blk);
9900 goto out_buf; 10088 goto out_buf;
9901 } 10089 }
9902@@ -505,11 +509,11 @@ static int remove_tree(struct dquot *dqu 10090@@ -506,11 +510,11 @@ static int remove_tree(struct dquot *dqu
9903 for (i = 0; i < V2_DQBLKSIZE && !buf[i]; i++); /* Block got empty? */ 10091 for (i = 0; i < V2_DQBLKSIZE && !buf[i]; i++); /* Block got empty? */
9904 /* Don't put the root block into the free block list */ 10092 /* Don't put the root block into the free block list */
9905 if (i == V2_DQBLKSIZE && *blk != V2_DQTREEOFF) { 10093 if (i == V2_DQBLKSIZE && *blk != V2_DQTREEOFF) {
9906- put_free_dqblk(sb, type, buf, *blk); 10094- put_free_dqblk(sb, type, buf, *blk);
9907+ put_free_dqblk(dqh, type, buf, *blk); 10095+ put_free_dqblk(dqh, type, buf, *blk);
9911- if ((ret = write_blk(sb, type, *blk, buf)) < 0) 10099- if ((ret = write_blk(sb, type, *blk, buf)) < 0)
9912+ if ((ret = write_blk(dqh, type, *blk, buf)) < 0) 10100+ if ((ret = write_blk(dqh, type, *blk, buf)) < 0)
9913 printk(KERN_ERR "VFS: Can't write quota tree " 10101 printk(KERN_ERR "VFS: Can't write quota tree "
9914 "block %u.\n", *blk); 10102 "block %u.\n", *blk);
9915 } 10103 }
9916@@ -538,7 +542,7 @@ static loff_t find_block_dqentry(struct 10104@@ -539,7 +543,7 @@ static loff_t find_block_dqentry(struct
9917 10105
9918 if (!buf) 10106 if (!buf)
9919 return -ENOMEM; 10107 return -ENOMEM;
9920- if ((ret = read_blk(dquot->dq_sb, dquot->dq_type, blk, buf)) < 0) { 10108- if ((ret = read_blk(dquot->dq_sb, dquot->dq_type, blk, buf)) < 0) {
9921+ if ((ret = read_blk(dquot->dq_dqh, dquot->dq_type, blk, buf)) < 0) { 10109+ if ((ret = read_blk(dquot->dq_dqh, dquot->dq_type, blk, buf)) < 0) {
9922 printk(KERN_ERR "VFS: Can't read quota tree block %u.\n", blk); 10110 printk(KERN_ERR "VFS: Can't read quota tree block %u.\n", blk);
9923 goto out_buf; 10111 goto out_buf;
9924 } 10112 }
9925@@ -577,7 +581,7 @@ static loff_t find_tree_dqentry(struct d 10113@@ -578,7 +582,7 @@ static loff_t find_tree_dqentry(struct d
9926 10114
9927 if (!buf) 10115 if (!buf)
9928 return -ENOMEM; 10116 return -ENOMEM;
9929- if ((ret = read_blk(dquot->dq_sb, dquot->dq_type, blk, buf)) < 0) { 10117- if ((ret = read_blk(dquot->dq_sb, dquot->dq_type, blk, buf)) < 0) {
9930+ if ((ret = read_blk(dquot->dq_dqh, dquot->dq_type, blk, buf)) < 0) { 10118+ if ((ret = read_blk(dquot->dq_dqh, dquot->dq_type, blk, buf)) < 0) {
9931 printk(KERN_ERR "VFS: Can't read quota tree block %u.\n", blk); 10119 printk(KERN_ERR "VFS: Can't read quota tree block %u.\n", blk);
9932 goto out_buf; 10120 goto out_buf;
9933 } 10121 }
9934@@ -609,7 +613,7 @@ static int v2_read_dquot(struct dquot *d 10122@@ -610,7 +614,7 @@ static int v2_read_dquot(struct dquot *d
9935 10123
9936 #ifdef __QUOTA_V2_PARANOIA 10124 #ifdef __QUOTA_V2_PARANOIA
9937 /* Invalidated quota? */ 10125 /* Invalidated quota? */
9938- if (!dquot->dq_sb || !sb_dqopt(dquot->dq_sb)->files[type]) { 10126- if (!dquot->dq_sb || !sb_dqopt(dquot->dq_sb)->files[type]) {
9939+ if (!dquot->dq_dqh || !dqh_dqopt(dquot->dq_dqh)->files[type]) { 10127+ if (!dquot->dq_dqh || !dqh_dqopt(dquot->dq_dqh)->files[type]) {
9940 printk(KERN_ERR "VFS: Quota invalidated while reading!\n"); 10128 printk(KERN_ERR "VFS: Quota invalidated while reading!\n");
9941 return -EIO; 10129 return -EIO;
9942 } 10130 }
9943@@ -626,7 +630,7 @@ static int v2_read_dquot(struct dquot *d 10131@@ -627,7 +631,7 @@ static int v2_read_dquot(struct dquot *d
9944 } 10132 }
9945 else { 10133 else {
9946 dquot->dq_off = offset; 10134 dquot->dq_off = offset;
9947- if ((ret = dquot->dq_sb->s_op->quota_read(dquot->dq_sb, type, 10135- if ((ret = dquot->dq_sb->s_op->quota_read(dquot->dq_sb, type,
9948+ if ((ret = dquot->dq_dqh->dqh_sb->s_op->quota_read(dquot->dq_dqh, type, 10136+ if ((ret = dquot->dq_dqh->dqh_sb->s_op->quota_read(dquot->dq_dqh, type,
9949 (char *)&ddquot, sizeof(struct v2_disk_dqblk), offset)) 10137 (char *)&ddquot, sizeof(struct v2_disk_dqblk), offset))
9950 != sizeof(struct v2_disk_dqblk)) { 10138 != sizeof(struct v2_disk_dqblk)) {
9951 if (ret >= 0) 10139 if (ret >= 0)
9952diff -NurpP --minimal linux-2.6.15.6/fs/read_write.c linux-2.6.15.6-vs2.1.1-rc13/fs/read_write.c 10140Index: linux-2.6.16/fs/read_write.c
9953--- linux-2.6.15.6/fs/read_write.c 2005-10-28 20:49:45 +0200 10141===================================================================
9954+++ linux-2.6.15.6-vs2.1.1-rc13/fs/read_write.c 2006-03-11 20:22:42 +0100 10142--- linux-2.6.16.orig/fs/read_write.c
10143+++ linux-2.6.16/fs/read_write.c
9955@@ -622,12 +622,75 @@ sys_writev(unsigned long fd, const struc 10144@@ -636,12 +636,77 @@ sys_writev(unsigned long fd, const struc
9956 return ret; 10145 return ret;
9957 } 10146 }
9958 10147
9959+ssize_t vfs_sendfile(struct file *out_file, struct file *in_file, loff_t *ppos, 10148+ssize_t vfs_sendfile(struct file *out_file, struct file *in_file, loff_t *ppos,
9960+ size_t count, loff_t max) 10149+ size_t count, loff_t max)
9975+ else 10164+ else
9976+ if (!(in_file->f_mode & FMODE_PREAD)) 10165+ if (!(in_file->f_mode & FMODE_PREAD))
9977+ return -ESPIPE; 10166+ return -ESPIPE;
9978+ 10167+
9979+ ret = rw_verify_area(READ, in_file, ppos, count); 10168+ ret = rw_verify_area(READ, in_file, ppos, count);
9980+ if (ret) 10169+ if (ret < 0)
9981+ return ret; 10170+ return ret;
10171+ count = ret;
9982+ 10172+
9983+ /* verify out_file */ 10173+ /* verify out_file */
9984+ out_inode = out_file->f_dentry->d_inode; 10174+ out_inode = out_file->f_dentry->d_inode;
9985+ if (!out_inode) 10175+ if (!out_inode)
9986+ return -EINVAL; 10176+ return -EINVAL;
9987+ if (!out_file->f_op || !out_file->f_op->sendpage) 10177+ if (!out_file->f_op || !out_file->f_op->sendpage)
9988+ return -EINVAL; 10178+ return -EINVAL;
9989+ 10179+
9990+ ret = rw_verify_area(WRITE, out_file, &out_file->f_pos, count); 10180+ ret = rw_verify_area(WRITE, out_file, &out_file->f_pos, count);
9991+ if (ret) 10181+ if (ret < 0)
9992+ return ret; 10182+ return ret;
10183+ count = ret;
9993+ 10184+
9994+ ret = security_file_permission (out_file, MAY_WRITE); 10185+ ret = security_file_permission (out_file, MAY_WRITE);
9995+ if (ret) 10186+ if (ret)
9996+ return ret; 10187+ return ret;
9997+ 10188+
10028- struct inode * in_inode, * out_inode; 10219- struct inode * in_inode, * out_inode;
10029- loff_t pos; 10220- loff_t pos;
10030 ssize_t retval; 10221 ssize_t retval;
10031 int fput_needed_in, fput_needed_out; 10222 int fput_needed_in, fput_needed_out;
10032 10223
10033@@ -640,21 +703,6 @@ static ssize_t do_sendfile(int out_fd, i 10224@@ -654,22 +719,6 @@ static ssize_t do_sendfile(int out_fd, i
10034 goto out; 10225 goto out;
10035 if (!(in_file->f_mode & FMODE_READ)) 10226 if (!(in_file->f_mode & FMODE_READ))
10036 goto fput_in; 10227 goto fput_in;
10037- retval = -EINVAL; 10228- retval = -EINVAL;
10038- in_inode = in_file->f_dentry->d_inode; 10229- in_inode = in_file->f_dentry->d_inode;
10045- ppos = &in_file->f_pos; 10236- ppos = &in_file->f_pos;
10046- else 10237- else
10047- if (!(in_file->f_mode & FMODE_PREAD)) 10238- if (!(in_file->f_mode & FMODE_PREAD))
10048- goto fput_in; 10239- goto fput_in;