From patchwork Tue Apr 30 12:23:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2504361 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 A97683FD85 for ; Tue, 30 Apr 2013 12:23:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760547Ab3D3MXh (ORCPT ); Tue, 30 Apr 2013 08:23:37 -0400 Received: from mail-ia0-f181.google.com ([209.85.210.181]:42899 "EHLO mail-ia0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760543Ab3D3MXh (ORCPT ); Tue, 30 Apr 2013 08:23:37 -0400 Received: by mail-ia0-f181.google.com with SMTP id k38so372756iah.40 for ; Tue, 30 Apr 2013 05:23:36 -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=4WQGU3+uG+LL2cYIiHawelQOlPsXWULbQ4H8jRdT00I=; b=GyXhcnbtNcu+O2XHd/IjlQHmB5MAVAtfadqQUyd1TsYxOaKt1p3nFjSXzZ8ELK0aO4 kfxM4gvAfefoIjib9W2SLUW8eYJRA2M+oJ7RAj3t+j5uz0o8iFGvuAX2mqVDzaTn5xDO b5Z3Y+qsbdCRCPWiooBfZ/rQ8DkY2+w9me7pAtUM9DAD7ZqyxOoBAIjDhuoo9C5XVNT1 28QtxQP4bSQMlbZreV+GG7qCQqIlXEGzvHUN2413VIbrmQWSwdXJ4ka0hmnlri57Qt7n 8wxzleicyLVW57kXIhYF7LHeCimP8EFfU9lYb1X+xR7hLoAHW9oS9zihEhIjc9qAkV1l bd/g== X-Received: by 10.50.212.3 with SMTP id ng3mr3821502igc.43.1367324616837; Tue, 30 Apr 2013 05:23:36 -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 m4sm10515631igd.0.2013.04.30.05.23.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 30 Apr 2013 05:23:35 -0700 (PDT) Message-ID: <517FB7C7.90900@inktank.com> Date: Tue, 30 Apr 2013 07:23:35 -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/3] rbd: don't revalidate so much References: <517FB770.1070500@inktank.com> In-Reply-To: <517FB770.1070500@inktank.com> X-Gm-Message-State: ALoCoQkUMcPAS0ThC5vAprK3LZCC1CmUB/ugXuMPAwz9M5SfkKIIgXWiR03GNWJ7ni/pCmekvfxT Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Whenever a header object event causes a mapped rbd image to refresh its header information, revalidate_disk() is being called. This was done in rbd_dev_refresh() outside the control mutex in order to avoid a lock inversion. Although a an event like this *might* indicate the image has changed size, most of the time it does not. Record the image size before and after the refresh, and only call revalidate_disk() if it changes. This resolves: http://tracker.ceph.com/issues/4867 Signed-off-by: Alex Elder --- drivers/block/rbd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) } diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 176a3d7..dbc61e3 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -3065,19 +3065,22 @@ static int rbd_dev_v1_refresh(struct rbd_device *rbd_dev, u64 *hver) static int rbd_dev_refresh(struct rbd_device *rbd_dev, u64 *hver) { + u64 image_size; int ret; rbd_assert(rbd_image_format_valid(rbd_dev->image_format)); + image_size = rbd_dev->header.image_size; mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); if (rbd_dev->image_format == 1) ret = rbd_dev_v1_refresh(rbd_dev, hver); else ret = rbd_dev_v2_refresh(rbd_dev, hver); mutex_unlock(&ctl_mutex); - revalidate_disk(rbd_dev->disk); if (ret) rbd_warn(rbd_dev, "got notification but failed to " " update snaps: %d\n", ret); + if (image_size != rbd_dev->header.image_size) + revalidate_disk(rbd_dev->disk); return ret;