Subject: Re: [vserver] linux 3.10.21 and patch-3.10.19-vs2.3.6.8.diff
From: Herbert Poetzl <herbert@13thfloor.at>
Date: Sat, 30 Nov 2013 09:42:32 +0100

On Fri, Nov 29, 2013 at 07:28:27PM -0600, Corey Wright wrote:
> applying patch-3.10.19-vs2.3.6.8.diff to linux-3.10.21 fails:

> patching file ipc/shm.c
> Hunk #2 FAILED at 210.
> Hunk #3 FAILED at 219.
> Hunk #4 succeeded at 499 (offset 3 lines).
> Hunk #5 succeeded at 576 (offset 3 lines).
> 2 out of 5 hunks FAILED -- saving rejects to file ipc/shm.c.rej

> the failure is due to this commit in 3.10.21:

> http://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/?h=linux-3.10.y&id=b444df2f5791fb1ddf7d6b771ee32e30cc29dad9

> the attached patch fixes the failure (and Makefile's EXTRAVERSION, too).

> instructions:
> 1. download linux-3.10.21 (or patch linux-3.10.20, etc)
> 2. apply patch-3.10.19-vs2.3.6.8.diff
> 3. apply the attached patch-3.10.19-21-vs2.3.6.8.diff

> i've built and tested the resulting kernel against testme.sh
> and testfs.sh in virtualbox (and will put into production in 24
> hours if no bugs are reported in linux-3.10.21).

Thanks! Appreciated!

I've uploaded an updated patch for 3.10.21, please
compare it to your results and let me know if there
are any differences.

Thanks again,
Herbert

> corey
> --
> undefined@pobox.com

> diff -urNpd a/linux-3.10.21-vs2.3.6.8/ipc/shm.c b/linux-3.10.21-vs2.3.6.8/ipc/shm.c
> --- a/linux-3.10.21-vs2.3.6.8/ipc/shm.c	2013-11-29 15:47:58.000000000 -0600
> +++ b/linux-3.10.21-vs2.3.6.8/ipc/shm.c	2013-11-29 16:21:32.000000000 -0600
> @@ -214,7 +214,13 @@ static void shm_destroy(struct ipc_names

>  	shm_file = shp->shm_file;
>  	shp->shm_file = NULL;
> -	ns->shm_tot -= (shp->shm_segsz + PAGE_SIZE - 1) >> PAGE_SHIFT;
> +
> +	struct vx_info *vxi = lookup_vx_info(shp->shm_perm.xid);
> +	int numpages = (shp->shm_segsz + PAGE_SIZE - 1) >> PAGE_SHIFT;
> +
> +	vx_ipcshm_sub(vxi, shp, numpages);
> +	ns->shm_tot -= numpages;
> +
>  	shm_rmid(ns, shp);
>  	shm_unlock(shp);
>  	if (!is_file_hugepages(shm_file))
> @@ -222,6 +228,7 @@ static void shm_destroy(struct ipc_names
>  	else if (shp->mlock_user)
>  		user_shm_unlock(file_inode(shm_file)->i_size, shp->mlock_user);
>  	fput(shm_file);
> +	put_vx_info(vxi);
>  	ipc_rcu_putref(shp, shm_rcu_free);
>  }

> diff -urNpd a/linux-3.10.21-vs2.3.6.8/Makefile b/linux-3.10.21-vs2.3.6.8/Makefile
> --- a/linux-3.10.21-vs2.3.6.8/Makefile	2013-11-29 15:38:14.000000000 -0600
> +++ b/linux-3.10.21-vs2.3.6.8/Makefile	2013-11-29 15:50:03.000000000 -0600
> @@ -1,7 +1,7 @@
>  VERSION = 3
>  PATCHLEVEL = 10
>  SUBLEVEL = 21
> -EXTRAVERSION =
> +EXTRAVERSION = -vs2.3.6.8
>  NAME = TOSSUG Baby Fish

>  # *DOCUMENTATION*