|
|
9827a32 |
|
|
|
9827a32 |
Delivered-To: jwboyer@gmail.com
|
|
|
9827a32 |
Received: by 10.76.168.104 with SMTP id zv8csp55623oab;
|
|
|
9827a32 |
Fri, 30 Aug 2013 15:51:42 -0700 (PDT)
|
|
|
9827a32 |
X-Received: by 10.67.30.70 with SMTP id kc6mr13149193pad.32.1377903101609;
|
|
|
9827a32 |
Fri, 30 Aug 2013 15:51:41 -0700 (PDT)
|
|
|
9827a32 |
Return-Path: <linux-kernel-owner@vger.kernel.org>
|
|
|
9827a32 |
Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67])
|
|
|
9827a32 |
by mx.google.com with ESMTP id gg2si304840pac.217.1969.12.31.16.00.00;
|
|
|
9827a32 |
Fri, 30 Aug 2013 15:51:41 -0700 (PDT)
|
|
|
9827a32 |
Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67;
|
|
|
9827a32 |
Authentication-Results: mx.google.com;
|
|
|
9827a32 |
spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mail=linux-kernel-owner@vger.kernel.org;
|
|
|
9827a32 |
dkim=neutral (bad format) header.i=@hds.com
|
|
|
9827a32 |
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
|
|
|
9827a32 |
id S1756106Ab3H3WrX (ORCPT <rfc822;georgezhim@gmail.com>
|
|
|
9827a32 |
+ 99 others); Fri, 30 Aug 2013 18:47:23 -0400
|
|
|
9827a32 |
Received: from usindpps04.hds.com ([207.126.252.17]:35640 "EHLO
|
|
|
9827a32 |
usindpps04.hds.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
|
|
|
9827a32 |
with ESMTP id S1752650Ab3H3WrW (ORCPT
|
|
|
9827a32 |
<rfc822;linux-kernel@vger.kernel.org>);
|
|
|
9827a32 |
Fri, 30 Aug 2013 18:47:22 -0400
|
|
|
9827a32 |
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=hds.com; h=subject : to : from : cc
|
|
|
9827a32 |
: date : message-id : in-reply-to : references : mime-version :
|
|
|
9827a32 |
content-type : content-transfer-encoding; s=mail1;
|
|
|
9827a32 |
bh=xbQuWVaSJrPfWG5E7bXFAbOFjf/sBaRZsPmpVgy0CYk=;
|
|
|
9827a32 |
b=NW/A8Imu32MXoBi5FLrQ0FsK66RTWMQo1bFRtgQplVEQQIAXyf1XhCaAZyTkTplc0iEx
|
|
|
9827a32 |
ovyGZHvLbmGL6w3I3pxkCFz1BPJCqoZtvQITir/WvfzyadYOK1cz+vuBUQSCmfkacvS/
|
|
|
9827a32 |
w37h1jLAjsvWXkl0GY7pxB9HJMXdeLnhhuWxtNU8m8rKZ7t3LSByMeQi5/3OTkNojDEe
|
|
|
9827a32 |
70cKeZXCPQ/UIDJAF4cpSVXia5FwoJISjXvQIrvqkYhFelzq3OHMcC482PdpqNB475h3
|
|
|
9827a32 |
yHHJ83HFOLRulUQdOG5ZVTB9qRg0zxRx/oedeXwzturFke68noRRa4f4izQ8sCwsWOCI Dw==
|
|
|
9827a32 |
Received: from usindmail01.hds.com (usindmail03 [207.126.252.22])
|
|
|
9827a32 |
by usindpps04.hds.com (8.14.5/8.14.5) with ESMTP id r7UMlHIc025543;
|
|
|
9827a32 |
Fri, 30 Aug 2013 18:47:17 -0400
|
|
|
9827a32 |
Received: from hds.com (usindnetf5d-vlan47float.corp.hds.com [10.74.73.11])
|
|
|
9827a32 |
by usindmail01.hds.com (8.14.1/8.14.1) with ESMTP id r7UMlGiC058545;
|
|
|
9827a32 |
Fri, 30 Aug 2013 18:47:17 -0400 (EDT)
|
|
|
9827a32 |
Subject: [PATCH v2 2/2] elevator: acquire q->sysfs_lock in elevator_change()
|
|
|
9827a32 |
To: linux-kernel@vger.kernel.org
|
|
|
9827a32 |
From: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
|
|
|
9827a32 |
Cc: axboe@kernel.dk, tj@kernel.org, seiji.aguchi@hds.com,
|
|
|
9827a32 |
vgoyal@redhat.com, majianpeng@gmail.com
|
|
|
9827a32 |
Date: Fri, 30 Aug 2013 18:47:16 -0400
|
|
|
9827a32 |
Message-ID: <20130830224716.21812.99333.stgit@hds.com>
|
|
|
9827a32 |
In-Reply-To: <20130830224707.21812.63516.stgit@hds.com>
|
|
|
9827a32 |
References: <20130830224707.21812.63516.stgit@hds.com>
|
|
|
9827a32 |
User-Agent: StGit/0.16
|
|
|
9827a32 |
MIME-Version: 1.0
|
|
|
9827a32 |
Content-Type: text/plain; charset="utf-8"
|
|
|
9827a32 |
Content-Transfer-Encoding: 7bit
|
|
|
9827a32 |
X-Proofpoint-SPF-Result: pass
|
|
|
9827a32 |
X-Proofpoint-SPF-Record: v=spf1 mx ip4:207.126.244.0/26 ip4:207.126.252.0/25 include:mktomail.com
|
|
|
9827a32 |
include:cloud.hds.com ~all
|
|
|
9827a32 |
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.10.8794,1.0.431,0.0.0000
|
|
|
9827a32 |
definitions=2013-08-30_09:2013-08-30,2013-08-30,1970-01-01 signatures=0
|
|
|
9827a32 |
X-Proofpoint-Spam-Details: rule=notspam policy=outbound_policy score=0 spamscore=0 suspectscore=1
|
|
|
9827a32 |
phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx
|
|
|
9827a32 |
scancount=1 engine=7.0.1-1305240000 definitions=main-1308300162
|
|
|
9827a32 |
Sender: linux-kernel-owner@vger.kernel.org
|
|
|
9827a32 |
Precedence: bulk
|
|
|
9827a32 |
List-ID: <linux-kernel.vger.kernel.org>
|
|
|
9827a32 |
X-Mailing-List: linux-kernel@vger.kernel.org
|
|
|
9827a32 |
|
|
|
9827a32 |
Add locking of q->sysfs_lock into elevator_change() (an exported function)
|
|
|
9827a32 |
to ensure it is held to protect q->elevator from elevator_init(), even if
|
|
|
9827a32 |
elevator_change() is called from non-sysfs paths.
|
|
|
9827a32 |
sysfs path (elv_iosched_store) uses __elevator_change(), non-locking
|
|
|
9827a32 |
version, as the lock is already taken by elv_iosched_store().
|
|
|
9827a32 |
|
|
|
9827a32 |
Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
|
|
|
9827a32 |
---
|
|
|
9827a32 |
block/elevator.c | 16 ++++++++++++++--
|
|
|
9827a32 |
1 file changed, 14 insertions(+), 2 deletions(-)
|
|
|
9827a32 |
|
|
|
9827a32 |
diff --git a/block/elevator.c b/block/elevator.c
|
|
|
9827a32 |
index 02d4390..6d765f7 100644
|
|
|
9827a32 |
--- a/block/elevator.c
|
|
|
9827a32 |
+++ b/block/elevator.c
|
|
|
9827a32 |
@@ -965,7 +965,7 @@ fail_init:
|
|
|
9827a32 |
/*
|
|
|
9827a32 |
* Switch this queue to the given IO scheduler.
|
|
|
9827a32 |
*/
|
|
|
9827a32 |
-int elevator_change(struct request_queue *q, const char *name)
|
|
|
9827a32 |
+static int __elevator_change(struct request_queue *q, const char *name)
|
|
|
9827a32 |
{
|
|
|
9827a32 |
char elevator_name[ELV_NAME_MAX];
|
|
|
9827a32 |
struct elevator_type *e;
|
|
|
9827a32 |
@@ -987,6 +987,18 @@ int elevator_change(struct request_queue *q, const char *name)
|
|
|
9827a32 |
|
|
|
9827a32 |
return elevator_switch(q, e);
|
|
|
9827a32 |
}
|
|
|
9827a32 |
+
|
|
|
9827a32 |
+int elevator_change(struct request_queue *q, const char *name)
|
|
|
9827a32 |
+{
|
|
|
9827a32 |
+ int ret;
|
|
|
9827a32 |
+
|
|
|
9827a32 |
+ /* Protect q->elevator from elevator_init() */
|
|
|
9827a32 |
+ mutex_lock(&q->sysfs_lock);
|
|
|
9827a32 |
+ ret = __elevator_change(q, name);
|
|
|
9827a32 |
+ mutex_unlock(&q->sysfs_lock);
|
|
|
9827a32 |
+
|
|
|
9827a32 |
+ return ret;
|
|
|
9827a32 |
+}
|
|
|
9827a32 |
EXPORT_SYMBOL(elevator_change);
|
|
|
9827a32 |
|
|
|
9827a32 |
ssize_t elv_iosched_store(struct request_queue *q, const char *name,
|
|
|
9827a32 |
@@ -997,7 +1009,7 @@ ssize_t elv_iosched_store(struct request_queue *q, const char *name,
|
|
|
9827a32 |
if (!q->elevator)
|
|
|
9827a32 |
return count;
|
|
|
9827a32 |
|
|
|
9827a32 |
- ret = elevator_change(q, name);
|
|
|
9827a32 |
+ ret = __elevator_change(q, name);
|
|
|
9827a32 |
if (!ret)
|
|
|
9827a32 |
return count;
|
|
|
9827a32 |
|
|
|
9827a32 |
|
|
|
9827a32 |
--
|
|
|
9827a32 |
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
|
|
|
9827a32 |
the body of a message to majordomo@vger.kernel.org
|
|
|
9827a32 |
More majordomo info at http://vger.kernel.org/majordomo-info.html
|
|
|
9827a32 |
Please read the FAQ at http://www.tux.org/lkml/
|