From patchwork Sat May 11 17:44:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2554451 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id A314E3FC5A for ; Sat, 11 May 2013 17:44:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754331Ab3EKRoG (ORCPT ); Sat, 11 May 2013 13:44:06 -0400 Received: from mail-ie0-f172.google.com ([209.85.223.172]:60879 "EHLO mail-ie0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754227Ab3EKRoD (ORCPT ); Sat, 11 May 2013 13:44:03 -0400 Received: by mail-ie0-f172.google.com with SMTP id 16so10176342iea.3 for ; Sat, 11 May 2013 10:44:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=+Q3wI5pP1k0JYDD3xnpGu76tDzeDN6FWIm2ZmBB6VYI=; b=X/2PxyQ8jrNZqnByhYs6LZrBhewIjffKFK0WkdixLlFdFfsfzVf9vGspF7NZWPHPg/ YJP7cNsBtjXV8LJ0UFvmmwQ8HwGczcX4Ky6VuZ3w6CFygRP08tY7v+yzHXz8i1HMPS+C tvMlJpUEuJ8Mw7s26hKptm+QIJobWmEeVTi61zfkcXpx79mRyC9m/NJl3A92vE516JZx DQ/rJ0tIxJhW1Kzo/pp60cc5tEa+bxwYuLh68i3cFQayHg4odEHt82cZlHdoBwhezo5u wYpU9Uge+b26q5PliTOR2NqMqGZFWrW01aPwqF1azvlahSgyXDGHFp9j/ulxHcd6m0XC T3CA== X-Received: by 10.50.16.39 with SMTP id c7mr5364859igd.32.1368294242881; Sat, 11 May 2013 10:44:02 -0700 (PDT) Received: from [172.22.22.4] (c-71-195-31-37.hsd1.mn.comcast.net. [71.195.31.37]) by mx.google.com with ESMTPSA id ve9sm6126444igb.3.2013.05.11.10.44.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 11 May 2013 10:44:02 -0700 (PDT) Message-ID: <518E8362.30906@inktank.com> Date: Sat, 11 May 2013 12:44:02 -0500 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: ceph-devel@vger.kernel.org Subject: [PATCH 2/5] rbd: don't release write request until necessary References: <518E831E.6000206@inktank.com> In-Reply-To: <518E831E.6000206@inktank.com> X-Gm-Message-State: ALoCoQkGNOFfbdMChLhrP+CVtAG0gX6yI6ndDbx2VHHZuneWUy2tSNY/lH8M3zCrmF92YZ9iFIrh Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Previously when a layered write was going to involve a copyup request, the original osd request was released before submitting the parent full-object read. The osd request for the copyup would then be allocated in rbd_img_obj_parent_read_full_callback(). Shortly we will be handling the event of mapped layered images getting flattened, and when that occurs we need to resubmit the original request. We therefore don't want to release the osd request until we really konw we're going to replace it--in the callback function. Signed-off-by: Alex Elder --- drivers/block/rbd.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) @@ -2269,15 +2273,6 @@ static int rbd_img_obj_parent_read_full(struct rbd_obj_request *obj_request) rbd_assert(rbd_dev->parent != NULL); /* - * First things first. The original osd request is of no - * use to use any more, we'll need a new one that can hold - * the two ops in a copyup request. We'll get that later, - * but for now we can release the old one. - */ - rbd_osd_req_destroy(obj_request->osd_req); - obj_request->osd_req = NULL; - - /* * Determine the byte range covered by the object in the * child image to which the original request was to be sent. */ diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 06d49b5..ac3f4e7 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -2187,13 +2187,17 @@ rbd_img_obj_parent_read_full_callback(struct rbd_img_request *img_request) if (result) goto out_err; - /* Allocate the new copyup osd request for the original request */ - + /* + * The original osd request is of no use to use any more. + * We need a new one that can hold the two ops in a copyup + * request. Allocate the new copyup osd request for the + * original request, and release the old one. + */ result = -ENOMEM; - rbd_assert(!orig_request->osd_req); osd_req = rbd_osd_req_create_copyup(orig_request); if (!osd_req) goto out_err; + rbd_osd_req_destroy(orig_request->osd_req); orig_request->osd_req = osd_req; orig_request->copyup_pages = pages;