From patchwork Tue Feb 5 20:52:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2099371 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 A8216DF24C for ; Tue, 5 Feb 2013 20:52:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756488Ab3BEUw2 (ORCPT ); Tue, 5 Feb 2013 15:52:28 -0500 Received: from mail-ie0-f178.google.com ([209.85.223.178]:35206 "EHLO mail-ie0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756300Ab3BEUw2 (ORCPT ); Tue, 5 Feb 2013 15:52:28 -0500 Received: by mail-ie0-f178.google.com with SMTP id c13so881765ieb.9 for ; Tue, 05 Feb 2013 12:52:26 -0800 (PST) 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=fWqlMsxomCbLen9ETftjkavAz0gyCvDpiGc41cGhnrg=; b=aOzGtybtNcETxsDOcV/kOwzXZzIEre3f9TkxNjD/Z6iA0+s54MVe006dHPm+y9PJgQ Bzy0DZq2gZpv8flTNasISLgzyQyqAZBlbDGgyBK08RrcI77CBubTL9yQKBRireVip78I 0UMsvkcsnitxBXlBj1dTwhku/xlTfPnWSvoxW86aw4WSNug/tu2SXzLerkUQj72Lb4ZM 0RhW8fOyIcNwcNh8JDRleirE2xgPad19E6ZOEMFdJzucKi707SH9Fw4Q39V4w5k6vSRy q5e8QVHN33AJ7i/3Y+c61NI/xaQfpOpG+uOusk/HPMkQMVgnV8ZTHt0suLbwWD2Jgaj4 41pw== X-Received: by 10.50.187.169 with SMTP id ft9mr966806igc.25.1360097546616; Tue, 05 Feb 2013 12:52:26 -0800 (PST) Received: from [172.22.22.4] (c-71-195-31-37.hsd1.mn.comcast.net. [71.195.31.37]) by mx.google.com with ESMTPS id kf2sm24408215igc.0.2013.02.05.12.52.24 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 05 Feb 2013 12:52:25 -0800 (PST) Message-ID: <51117109.6000504@inktank.com> Date: Tue, 05 Feb 2013 14:52:25 -0600 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-Version: 1.0 To: ceph-devel@vger.kernel.org Subject: [PATCH] rbd: turn off interrupts for open/remove locking X-Gm-Message-State: ALoCoQmONmHbHdvvjWQGmu4FNrNpfTUz6SKMNdWxIY0HWMl00gzCpzIvII9OvsH9ijC1PG3Gy0Eg Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org This commit: bc7a62ee5 rbd: prevent open for image being removed added checking for removing rbd before allowing an open, and used the same request spinlock for protecting that and updating the open count as is used for the request queue. However it used the non-irq protected version of the spinlocks. Fix that. Signed-off-by: Alex Elder Reviewed-by: Josh Durgin --- drivers/block/rbd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) @@ -416,9 +416,9 @@ static int rbd_release(struct gendisk *disk, fmode_t mode) struct rbd_device *rbd_dev = disk->private_data; unsigned long open_count_before; - spin_lock(&rbd_dev->lock); + spin_lock_irq(&rbd_dev->lock); open_count_before = rbd_dev->open_count--; - spin_unlock(&rbd_dev->lock); + spin_unlock_irq(&rbd_dev->lock); rbd_assert(open_count_before > 0); mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); @@ -4099,12 +4099,12 @@ static ssize_t rbd_remove(struct bus_type *bus, goto done; } - spin_lock(&rbd_dev->lock); + spin_lock_irq(&rbd_dev->lock); if (rbd_dev->open_count) ret = -EBUSY; else set_bit(RBD_DEV_FLAG_REMOVING, &rbd_dev->flags); - spin_unlock(&rbd_dev->lock); + spin_unlock_irq(&rbd_dev->lock); if (ret < 0) goto done; diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 14a6967..91983a60 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -394,12 +394,12 @@ static int rbd_open(struct block_device *bdev, fmode_t mode) if ((mode & FMODE_WRITE) && rbd_dev->mapping.read_only) return -EROFS; - spin_lock(&rbd_dev->lock); + spin_lock_irq(&rbd_dev->lock); if (test_bit(RBD_DEV_FLAG_REMOVING, &rbd_dev->flags)) removing = true; else rbd_dev->open_count++; - spin_unlock(&rbd_dev->lock); + spin_unlock_irq(&rbd_dev->lock); if (removing) return -ENOENT;