From patchwork Tue Jan 20 12:41:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 5669041 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8A9E99F333 for ; Tue, 20 Jan 2015 12:42:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AF8B120306 for ; Tue, 20 Jan 2015 12:42:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CD62C20131 for ; Tue, 20 Jan 2015 12:41:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753844AbbATMly (ORCPT ); Tue, 20 Jan 2015 07:41:54 -0500 Received: from mail-we0-f178.google.com ([74.125.82.178]:60649 "EHLO mail-we0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753742AbbATMls (ORCPT ); Tue, 20 Jan 2015 07:41:48 -0500 Received: by mail-we0-f178.google.com with SMTP id p10so36887885wes.9 for ; Tue, 20 Jan 2015 04:41:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8DGBY/7UwgEQqtWUQZ27M6lXbzXudeFS6N8ed4+wfXQ=; b=NJWRp6pE01x9B1MI917KJTDAvcumRZHAQtGNfYavQdNobiV0cUYKaFz7XLdsMYKuUY lQBP/DgdZMgU89ktsuq6aFRTKWlYfZ9PUrUozAKDAvaDvwLSnzSCKDcIimpXxChP9MYG 1c7Ds6OnXzoqnWXGw0h9/SZvmFXVYz7RcUNUg+ppWhetfnJ/1grbYZd1VPozHGkON8pf b2P9NRo4inkiJK6QmyMc+npxPaOioBgw2XVUv6J+pO/RwIAXXXH3tnOSUt4p11a4QutR /EjZMyWBmNlRmpeKM5ZvNYZW/JxnoO3tHoq+uA2q38IA9ggasnetHC06hQSzrFm9SCt8 0JuQ== X-Gm-Message-State: ALoCoQnJ621n8crYlmQZJumGUy6fwaRABbELTEX7w7RsY8ZfZ9rq6PepqWsx0OjxGf1FNSlbqY61 X-Received: by 10.194.81.136 with SMTP id a8mr69878884wjy.104.1421757707577; Tue, 20 Jan 2015 04:41:47 -0800 (PST) Received: from localhost.localdomain ([109.110.67.201]) by mx.google.com with ESMTPSA id ck7sm21136704wjb.13.2015.01.20.04.41.46 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Jan 2015 04:41:46 -0800 (PST) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Cc: Alex Elder Subject: [PATCH 2/3] rbd: drop parent_ref in rbd_dev_unprobe() unconditionally Date: Tue, 20 Jan 2015 15:41:08 +0300 Message-Id: <1421757669-38796-3-git-send-email-idryomov@redhat.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1421757669-38796-1-git-send-email-idryomov@redhat.com> References: <1421757669-38796-1-git-send-email-idryomov@redhat.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This effectively reverts the last hunk of 392a9dad7e77 ("rbd: detect when clone image is flattened"). The problem with parent_overlap != 0 condition is that it's possible and completely valid to have an image with parent_overlap == 0 whose parent state needs to be cleaned up on unmap. The next commit, which drops the "clone image now standalone" logic, opens up another window of opportunity to hit this, but even without it # cat parent-ref.sh #!/bin/bash rbd create --image-format 2 --size 1 foo rbd snap create foo@snap rbd snap protect foo@snap rbd clone foo@snap bar rbd resize --allow-shrink --size 0 bar rbd resize --size 1 bar DEV=$(rbd map bar) rbd unmap $DEV leaves rbd_device/rbd_spec/etc and rbd_client along with ceph_client hanging around. My thinking behind calling rbd_dev_parent_put() unconditionally is that there shouldn't be any requests in flight at that point in time as we are deep into unmap sequence. Hence, even if rbd_dev_unparent() caused by flatten is delayed by in-flight requests, it will have finished by the time we reach rbd_dev_unprobe() caused by unmap, thus turning unconditional rbd_dev_parent_put() into a no-op. Fixes: http://tracker.ceph.com/issues/10352 Cc: stable@vger.kernel.org # 3.11+ Signed-off-by: Ilya Dryomov Reviewed-by: Josh Durgin Reviewed-by: Alex Elder --- drivers/block/rbd.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 2990a1c75159..b85d52005a21 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -5075,10 +5075,7 @@ static void rbd_dev_unprobe(struct rbd_device *rbd_dev) { struct rbd_image_header *header; - /* Drop parent reference unless it's already been done (or none) */ - - if (rbd_dev->parent_overlap) - rbd_dev_parent_put(rbd_dev); + rbd_dev_parent_put(rbd_dev); /* Free dynamic fields from the header, then zero it out */