From patchwork Tue Jan 16 18:17:51 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: 10167847 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 CB8D5603B5 for ; Tue, 16 Jan 2018 18:17:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CEE59212D6 for ; Tue, 16 Jan 2018 18:17:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C38A924BFE; Tue, 16 Jan 2018 18:17:55 +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 7E3EC265B9 for ; Tue, 16 Jan 2018 18:17:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751187AbeAPSRy (ORCPT ); Tue, 16 Jan 2018 13:17:54 -0500 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:18046 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751142AbeAPSRx (ORCPT ); Tue, 16 Jan 2018 13:17:53 -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=1516126674; x=1547662674; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=ObyRhJ4yXYdH4urEdyKgdOK9FoM56+Az7POncrodC7A=; b=Z4ruOItFFojp2x0e5GQh9NzfTkeU77rprRC0sS7Nsr1p4osUzleI/3dc DBwk49oPav65G0e1TvacP8EtdNY5aMGQ4wgQaO3PH9PRGY0GiJvDfDngo U1GeTzLNFpr+5N6KyBHsiX1mze5MhPL/87DNaf+0sGOXa826ltmdcGhWn H/IGvBx8BT+qmjoZ50S+YlybsWgc6/GF07WYzsCVbIGI7u5vAlwHPAY8Z 6IYebtkS3R6+Nv+aYU4EgKsMkuTT4nGyRe7cKJ5dIDt1Mw6F8sRxRCcKd o5D8xYLHn1JVBM2PH2d3E+WSSxKD8h4CY8eupzPDwwKge4dzhaebDYJr6 g==; X-IronPort-AV: E=Sophos;i="5.46,369,1511798400"; d="scan'208";a="69652910" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 17 Jan 2018 02:17:53 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 16 Jan 2018 10:13:08 -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; 16 Jan 2018 10:17:52 -0800 From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Mike Snitzer , Bart Van Assche Subject: [PATCH 2/3] block: Document scheduler change code locking requirements Date: Tue, 16 Jan 2018 10:17:51 -0800 Message-Id: <20180116181752.25847-3-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180116181752.25847-1-bart.vanassche@wdc.com> References: <20180116181752.25847-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 --- 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);