From: "Jan Beulich" Subject: Re: xen3.3.x on modern kernel / fs/aio.c / SUSE patches.xen/xen3-auto-common.diff Date: Mon, 21 May 2012 10:38:01 +0100 Message-ID: <4FBA29190200007800084BA7@nat28.tlf.novell.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Alex Bligh Cc: Xen Devel List-Id: xen-devel@lists.xenproject.org >>> On 17.05.12 at 23:05, Alex Bligh wrote: > I am busy trying to forward-port xen3.3.x onto an Ubuntu Precise kernel. > My route of attack is to apply all the patches.xen/ files that were > in the SUSE 3.3.2 kernel release. > > I appear to have been reasonably successful with this bar one change > I don't understand. > > In fs/aio.c, patches.xen/xen3-autocommon.diff has the following patch hunk > listed at the end of this email. The first hunk applies fine. The later > hunk does not. This is because the ioctx handling appears to have changed. > I am not sure how this works or what it is trying to do. > > The Ubuntu version had: > ioctx = ioctx_alloc(nr_events); > ret = PTR_ERR(ioctx); > if (!IS_ERR(ioctx)) { > ret = put_user(ioctx->user_id, ctxp); > if (!ret) { > put_ioctx(ioctx); > return 0; > } > io_destroy(ioctx); > } > > out: > return ret; > > Note the put_ioctx, ioctx_alloc, and lack of get_ioctx. > > I /think/ the right solution here is as follows. Any ideas? > > ioctx = ioctx_alloc(nr_events); > ret = PTR_ERR(ioctx); > if (!IS_ERR(ioctx)) { > ret = put_user(ioctx->user_id, ctxp); > #ifdef CONFIG_EPOLL > if (make_fd && ret >= 0) > ret = make_aio_fd(ioctx); > #endif > if (!ret) { > put_ioctx(ioctx); > return 0; > } > io_destroy(ioctx); > } > > out: > return ret; Our code (3.4-rc6) looks like this if (!IS_ERR(ioctx)) { ret = put_user(ioctx->user_id, ctxp); #ifdef CONFIG_EPOLL if (make_fd && !ret) ret = make_aio_fd(ioctx); #endif if (ret < 0) io_destroy(ioctx); put_ioctx(ioctx); } The patch apply failure and other confusion are presumably due to a backport of a first attempt to address the issue someone spotted in the AIO code - I would assume/hope that the full 3.4 solution got/will get backported to a later 3.3.x. Jan