diff -NurpP --minimal linux-2.6.31.6-vs2.3.0.36.26/include/linux/vserver/context.h linux-2.6.31.6-vs2.3.0.36.26.1/include/linux/vserver/context.h --- linux-2.6.31.6-vs2.3.0.36.26/include/linux/vserver/context.h 2009-11-24 08:41:50.000000000 +0100 +++ linux-2.6.31.6-vs2.3.0.36.26.1/include/linux/vserver/context.h 2009-12-01 22:24:54.000000000 +0100 @@ -131,7 +131,9 @@ struct vx_info { #else struct _vx_info_pc *ptr_pc; /* per cpu array */ #endif - +#ifdef CONFIG_BSD_PROCESS_ACCT + struct bsd_acct_struct *bacct; /* bsd process accounting */ +#endif wait_queue_head_t vx_wait; /* context exit waitqueue */ int reboot_cmd; /* last sys_reboot() cmd */ int exit_code; /* last process exit code */ diff -NurpP --minimal linux-2.6.31.6-vs2.3.0.36.26/kernel/acct.c linux-2.6.31.6-vs2.3.0.36.26.1/kernel/acct.c --- linux-2.6.31.6-vs2.3.0.36.26/kernel/acct.c 2009-10-23 15:03:46.000000000 +0200 +++ linux-2.6.31.6-vs2.3.0.36.26.1/kernel/acct.c 2009-12-01 23:05:46.000000000 +0100 @@ -60,6 +60,27 @@ #include /* sector_div */ #include + +static inline +struct bsd_acct_struct *vx_current_bacct(struct pid_namespace *ns) +{ + struct vx_info *vxi = current_vx_info(); + + return vxi ? vxi->bacct : ns->bacct; +} + +static inline +void vx_set_current_bacct(struct pid_namespace *ns, struct bsd_acct_struct *acct) +{ + struct vx_info *vxi = current_vx_info(); + + if (vxi) + vxi->bacct = acct; + else + ns->bacct = acct; +} + + /* * These constants control the amount of freespace that suspend and * resume the process accounting system, and the time delay between @@ -236,7 +257,7 @@ static int acct_on(char *name) } ns = task_active_pid_ns(current); - if (ns->bacct == NULL) { + if (vx_current_bacct(ns) == NULL) { acct = kzalloc(sizeof(struct bsd_acct_struct), GFP_KERNEL); if (acct == NULL) { filp_close(file, NULL); @@ -252,14 +273,14 @@ static int acct_on(char *name) } spin_lock(&acct_lock); - if (ns->bacct == NULL) { - ns->bacct = acct; + if (vx_current_bacct(ns) == NULL) { + vx_set_current_bacct(ns, acct); acct = NULL; } mnt = file->f_path.mnt; mnt_pin(mnt); - acct_file_reopen(ns->bacct, file, ns); + acct_file_reopen(vx_current_bacct(ns), file, ns); spin_unlock(&acct_lock); mntput(mnt); /* it's pinned, now give up active reference */ @@ -356,7 +377,7 @@ void acct_exit_ns(struct pid_namespace * struct bsd_acct_struct *acct; spin_lock(&acct_lock); - acct = ns->bacct; + acct = vx_current_bacct(ns); if (acct != NULL) { if (acct->file != NULL) acct_file_reopen(acct, NULL, NULL); @@ -643,7 +664,7 @@ static void acct_process_in_ns(struct pi struct file *file = NULL; struct bsd_acct_struct *acct; - acct = ns->bacct; + acct = vx_current_bacct(ns); /* * accelerate the common fastpath: */