From patchwork Sat May 11 17:38:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2554251 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 9D7843FC5A for ; Sat, 11 May 2013 17:38:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753971Ab3EKRiN (ORCPT ); Sat, 11 May 2013 13:38:13 -0400 Received: from mail-ia0-f176.google.com ([209.85.210.176]:45846 "EHLO mail-ia0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753777Ab3EKRiM (ORCPT ); Sat, 11 May 2013 13:38:12 -0400 Received: by mail-ia0-f176.google.com with SMTP id j38so5571928iad.7 for ; Sat, 11 May 2013 10:38:12 -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 :content-type:content-transfer-encoding:x-gm-message-state; bh=oCNYw8f9qgGVZxmK3rlQVcFMtfS4O34kPGS5+QG3dSg=; b=IxcKPbSoflt4txpsvLkipLOEz1yO0RzGQiMyDgYkcS880dnck4WnzeOcrIs2Aophfm dqQqQyKrKER6cirbOvs+3iQKFWR0Ia2Gss6QhiyUXpbvlVtEAlpzDO/Zf0ndbmmCY+Ft fXp+rHGcJypd/AOTY13XhE8ZTFkjTWoEaqtxFgJGRgJMCaJ1tT93EpKnHrcjQYrX7t8k CJvE2ZJuSWITCgtJpCpZb79ZMwk07j/lsYlrWvndzyEWGDZfTbNLdVHdXIrSirH7KMLr SMETIDydGm3ZnNkLzh9AvZCnEmR8buoYa4UMrMTBXu8iQPPB/0iDz8Uo3KJNO7qOrg8s fyAg== X-Received: by 10.50.78.232 with SMTP id e8mr5359468igx.72.1368293892085; Sat, 11 May 2013 10:38:12 -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 d9sm5614097igr.4.2013.05.11.10.38.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 11 May 2013 10:38:11 -0700 (PDT) Message-ID: <518E8203.6050308@inktank.com> Date: Sat, 11 May 2013 12:38:11 -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] rbd: ignore zero-overlap parent X-Gm-Message-State: ALoCoQlAR1AkgelkOVu4ZYg+K1W3KwyQsH2d0VtklYqNogFTJ77BnFXYrzSsmDXfSfiD+XT6SNDV Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org An rbd clone image that has an overlap with its parent of 0 is effectively not a layered image at all. Detect this case and treat such an image as non-layered. Issue a warning to be sure the user knows what's going on. This resolves: http://tracker.ceph.com/issues/5028 Signed-off-by: Alex Elder Reviewed-by: Josh Durgin --- drivers/block/rbd.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) out_err: diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index b9221a0..3a8135f 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -3655,9 +3655,13 @@ static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev) ceph_decode_64_safe(&p, end, parent_spec->snap_id, out_err); ceph_decode_64_safe(&p, end, overlap, out_err); - rbd_dev->parent_overlap = overlap; - rbd_dev->parent_spec = parent_spec; - parent_spec = NULL; /* rbd_dev now owns this */ + if (overlap) { + rbd_dev->parent_spec = parent_spec; + parent_spec = NULL; /* rbd_dev now owns this */ + rbd_dev->parent_overlap = overlap; + } else { + rbd_warn(rbd_dev, "ignoring parent of clone with overlap 0\n"); + } out: ret = 0;