From patchwork Sat May 11 17:47:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2554531 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 4F5B8DF230 for ; Sat, 11 May 2013 17:47:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751524Ab3EKRrr (ORCPT ); Sat, 11 May 2013 13:47:47 -0400 Received: from mail-ie0-f172.google.com ([209.85.223.172]:56766 "EHLO mail-ie0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751038Ab3EKRrr (ORCPT ); Sat, 11 May 2013 13:47:47 -0400 Received: by mail-ie0-f172.google.com with SMTP id 16so10109908iea.31 for ; Sat, 11 May 2013 10:47:47 -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=HwhhJyIGjK384OgIrV0T6VwSl61Kpx7o4GFrzFTuzps=; b=VkmpOa1oAMVKKmD76wvqYJ/YVuG5higGH26CtCClrDLSM+nQTYwM82mLJcqtVk+lXI v0d9DP1b2owxMBXLbZYa9tXpueSu6+bsVcd6t34pPNig3+B9nDuuj+F2xNH6Vw6yZKGE Wqot2XaijkpVIJfWak4RkBWDCCE6g2aHIFgP707KFXGquqQbnffcmQTQiZQ0f7AWEb5o uGsBUQ1YUwE11nD+hAUsLh41Dng8LTTwnJ7tw1Edcluca8siIutaVokbysHbO5QsZuAu jQ4KD8rxudwi0QZHz9iwnlC1NRjZcSOS4uUTN9qgkMbCwnLwFjBSYWb/vJ9+cEkLJmrf PhtA== X-Received: by 10.42.145.137 with SMTP id f9mr10436685icv.52.1368294466887; Sat, 11 May 2013 10:47:46 -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 wx2sm6117415igb.4.2013.05.11.10.47.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 11 May 2013 10:47:46 -0700 (PDT) Message-ID: <518E8442.9020305@inktank.com> Date: Sat, 11 May 2013 12:47:46 -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 4/4] rbd: re-submit flattened write request (part 2) References: <518E83D3.4050709@inktank.com> In-Reply-To: <518E83D3.4050709@inktank.com> X-Gm-Message-State: ALoCoQmP78Qv1uN4R1mFMeV8bdxOL7Ca5mn7DOdi6qzR/oFRIp/pxLMF7Mt3kJIMev2fOGxWq63S Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Add code to rbd_img_obj_exists_callback() to detect when a clone's parent image has disappeared, and re-submit the original write request in that case. Kill off some redundant assertions. This completes the resolution for: http://tracker.ceph.com/issues/3763 Signed-off-by: Alex Elder --- drivers/block/rbd.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) rbd_assert(!obj_request_img_data_test(obj_request)); @@ -2530,8 +2531,20 @@ static void rbd_img_obj_exists_callback(struct rbd_obj_request *obj_request) obj_request->xferred, obj_request->length); rbd_obj_request_put(obj_request); - rbd_assert(orig_request); - rbd_assert(orig_request->img_request); + /* + * If the overlap has become 0 (most likely because the + * image has been flattened) we need to free the pages + * and re-submit the original write request. + */ + rbd_dev = orig_request->img_request->rbd_dev; + if (!rbd_dev->parent_overlap) { + struct ceph_osd_client *osdc; + + osdc = &rbd_dev->rbd_client->client->osdc; + result = rbd_obj_request_submit(osdc, orig_request); + if (!result) + return; + } /* * Our only purpose here is to determine whether the object diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index dfa6bfc..59bf75a 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -2508,6 +2508,7 @@ out_err: static void rbd_img_obj_exists_callback(struct rbd_obj_request *obj_request) { struct rbd_obj_request *orig_request; + struct rbd_device *rbd_dev; int result;