From patchwork Wed Jan 17 19:48:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10170637 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1BEFB603B5 for ; Wed, 17 Jan 2018 19:48:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C1A31FFE4 for ; Wed, 17 Jan 2018 19:48:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0067B205AD; Wed, 17 Jan 2018 19:48:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B8BE1FFE4 for ; Wed, 17 Jan 2018 19:48:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752888AbeAQTsP (ORCPT ); Wed, 17 Jan 2018 14:48:15 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:7918 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752854AbeAQTsL (ORCPT ); Wed, 17 Jan 2018 14:48:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1516219033; x=1547755033; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=ObyRhJ4yXYdH4urEdyKgdOK9FoM56+Az7POncrodC7A=; b=PrXdP5Ivxj1T+whKUxagLY0wqKIqFSbdXu/yqSjgErDClUoPbJFzZW1u kOkK4THKDrSelTRiVNelzKpyviYKxldFHrUfep9vjwjEGAJFg4cV82mhh Q3x4I9VwfIc5CsK2RqAvYjMQlabL+MCl3NmR9gfp1IcStDdSQeqwDnNJD 2UIYRD2mU895IyckHpUKPyaktnIMdMuQJCFYYG+KdYTFwGeSKH8xzkCWF QCt4tI85PIoDxmbrqicUMTaQVmN04fSjJOelna0peMSuridqShWqHgTvK LucGa9tDcSsjtjP6dgmdrZz5X1qNMe8GtZY2gFiACDxQ/Qpw6z2qeBkJ/ A==; X-IronPort-AV: E=Sophos;i="5.46,374,1511798400"; d="scan'208";a="165617195" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 18 Jan 2018 03:57:12 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 17 Jan 2018 11:43:51 -0800 Received: from thinkpad-bart.sdcorp.global.sandisk.com (HELO thinkpad-bart.int.fusionio.com) ([10.11.171.236]) by uls-op-cesaip02.wdc.com with ESMTP; 17 Jan 2018 11:48:11 -0800 From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche Subject: [PATCH v2 2/3] block: Document scheduler modification locking requirements Date: Wed, 17 Jan 2018 11:48:09 -0800 Message-Id: <20180117194810.26583-3-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180117194810.26583-1-bart.vanassche@wdc.com> References: <20180117194810.26583-1-bart.vanassche@wdc.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch does not change any functionality. Signed-off-by: Bart Van Assche Reviewed-by: Christoph Hellwig --- block/elevator.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/block/elevator.c b/block/elevator.c index 4f00b53cd5fd..e87e9b43aba0 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -869,6 +869,8 @@ int elv_register_queue(struct request_queue *q) struct elevator_queue *e = q->elevator; int error; + lockdep_assert_held(&q->sysfs_lock); + error = kobject_add(&e->kobj, &q->kobj, "%s", "iosched"); if (!error) { struct elv_fs_entry *attr = e->type->elevator_attrs; @@ -889,6 +891,8 @@ int elv_register_queue(struct request_queue *q) void elv_unregister_queue(struct request_queue *q) { + lockdep_assert_held(&q->sysfs_lock); + if (q) { struct elevator_queue *e = q->elevator; @@ -965,6 +969,8 @@ static int elevator_switch_mq(struct request_queue *q, { int ret; + lockdep_assert_held(&q->sysfs_lock); + blk_mq_freeze_queue(q); blk_mq_quiesce_queue(q); @@ -1010,6 +1016,8 @@ static int elevator_switch(struct request_queue *q, struct elevator_type *new_e) bool old_registered = false; int err; + lockdep_assert_held(&q->sysfs_lock); + if (q->mq_ops) return elevator_switch_mq(q, new_e);