Subject: Re: [vserver] patch-3.10.9-vs2.3.6.6.diff fails on 3.10.17
From: Corey Wright <undefined@pobox.com>
Date: Sat, 19 Oct 2013 08:22:40 -0500
Sat, 19 Oct 2013 08:22:40 -0500
On Sat, 19 Oct 2013 13:26:48 +0200
Herbert Poetzl <herbert@13thfloor.at> wrote:

> On Sat, Oct 19, 2013 at 11:42:51AM +0200, Christian Recktenwald wrote:
> > todays autobuild failed with 4 hunks rejected in 
> > init/main.c, ipc/sem.c and ipc/shm.c 
> 
> How about 3.10.15-vs2.3.6.6 ?

3.10.15-vs2.3.6.6 has the same failures (or 4 failures in the same 3 files).

the failures are due to the following 3.10.16 patches:

 * http://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/?h=linux-3.10.y&id=e84ca333752636c70cf85711aeef2b2abaac816e
 * http://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/?h=linux-3.10.y&id=34b2092419a3f73bb69c55247fe71ca4941faad2

(the introduction of the random.h include in init/main.c is so trivial to
account/adjust for that i didn't look up the original 3.10.16 patch.)

the attached patch is my attempt to fix-up the rejects based on the affected
functions (as i won't claim i took the time to understand the entirety of
sem.c and shm.c).

the patch works, at least well enough to boot the resulting kernel in
virtualbox and run testme.sh and testfs.sh.

i'm still running 3.0.y, but plan to migrate to 3.10.y within the next week,
so i won't be able to provide any immediate feedback on my patch (besides
test*.sh in virtualbox)

corey
--
undefined@pobox.com

> thanks,
> Herbert
> 
> > -- 
> > LiHAS - Adrian Reyer - Hessenwiesenstraße 10 - D-70565 Stuttgart
> > Fon: +49 (7 11) 78 28 50 90 - Fax:  +49 (7 11) 78 28 50 91
> > Mail: lihas@lihas.de - Web: http://lihas.de
> > Linux, Netzwerke, Consulting & Support - USt-ID: DE 227 816 626 Stuttgart


diff -urNpd linux-3.10.17-vs2.3.6.6/init/main.c linux-3.10.17-vs2.3.6.6-fixed/init/main.c
--- linux-3.10.17-vs2.3.6.6/init/main.c	2013-10-18 22:45:21.000000000 -0500
+++ linux-3.10.17-vs2.3.6.6-fixed/init/main.c	2013-10-18 23:34:43.000000000 -0500
@@ -75,6 +75,7 @@
 #include <linux/blkdev.h>
 #include <linux/elevator.h>
 #include <linux/random.h>
+#include <linux/vserver/percpu.h>
 
 #include <asm/io.h>
 #include <asm/bugs.h>
diff -urNpd linux-3.10.17-vs2.3.6.6/ipc/sem.c linux-3.10.17-vs2.3.6.6-fixed/ipc/sem.c
--- linux-3.10.17-vs2.3.6.6/ipc/sem.c	2013-10-19 00:12:10.000000000 -0500
+++ linux-3.10.17-vs2.3.6.6-fixed/ipc/sem.c	2013-10-18 23:54:15.000000000 -0500
@@ -1109,6 +1109,9 @@ static void freeary(struct ipc_namespace
 
 	wake_up_sem_queue_do(&tasks);
 	ns->used_sems -= sma->sem_nsems;
+	/* FIXME: obsoleted? */
+	vx_nsems_sub(sma, sma->sem_nsems);
+	vx_semary_dec(sma);
 	ipc_rcu_putref(sma, sem_rcu_free);
 }
 
diff -urNpd linux-3.10.17-vs2.3.6.6/ipc/shm.c linux-3.10.17-vs2.3.6.6-fixed/ipc/shm.c
--- linux-3.10.17-vs2.3.6.6/ipc/shm.c	2013-10-19 00:12:10.000000000 -0500
+++ linux-3.10.17-vs2.3.6.6-fixed/ipc/shm.c	2013-10-19 00:07:50.000000000 -0500
@@ -224,6 +224,7 @@ static void shm_destroy(struct ipc_names
 		user_shm_unlock(file_inode(shp->shm_file)->i_size,
 						shp->mlock_user);
 	fput (shp->shm_file);
+	put_vx_info(vxi);
 	ipc_rcu_putref(shp, shm_rcu_free);
 }
 
@@ -578,6 +579,7 @@ static int newseg(struct ipc_namespace *
 
 	ipc_unlock_object(&shp->shm_perm);
 	rcu_read_unlock();
+	vx_ipcshm_add(current_vx_info(), key, numpages);
 	return error;
 
 no_id: